New to Forum With a Few Questions

NoSmoke

Member
Greetings, am investigating use of PicAxe for wind power generation load control (increase load on generator as wind speed increases and decrease as speed drops to maximize output). I would like to meter rotation speed and wind speed simultaneously using the Count instruction and the multitasking capabilities of the M2 chips but am wondering if it will just complete the Count in one task before going on to the Count in the other (sequential vs simultaneous). I was quite excited to see the M2s support "multitasking" but it would appear the capability is quite rudimentart insofar at least as real time processing is concerned(?).

I would also like to meter the two speeds continuously all the while responding to IR input and transmitting data over the serial output. Since both those functions apparently stop other processing whilst running and, as I understand it, even disable interrupts, I cannot see how continuous counting can be accomplished with a single chip. So, then I looked at the possibility of using multiple chips communicating via 12c but cannot determine whether or not 12c communication has the same limitations as serial communication.

I have also noted, using the programmer, that The M2 chips do not seem to support acting in 1c2 slave mode (master mode only) although this seems to contradict the documentation on the h12csetup command. Is that actually the case?

One other question if I could. If I use pwm to control power going to the wind mill load(s), will the IR or serial instructions interfere (alter timing) with the pwm output(s)?

Thanks for any help and suggestions on how I can accomplish this.
 

hippy

Ex-Staff (retired)
Welcome to the PICAXE forums.

You are correct that M2's can only be I2C masters and not I2C slaves, also that COUNT will block other tasks while executing. One way round that can be to measure a pulse with PULSIN and determine an RPM from that. PULSIN will block but only for one revolution.

It's also possible to do a COUNT on one thing and a subsequent COUNT on another; not truly simultaneous but often perfectly acceptable and usable. As you have surmised, putting two COUNT's in two separate task won't alleviate the blocking and they will still run sequentially.

While PICAXE multitasking has it's limitations being a single core CPU it does still have advantages for coding designs and algorithms. It's only when dealing with blocking commands that things will jam up and become notably sequential rather than tending towards simultaneous. PICAXE multi-tasking interleaves commands of each task rather than running them simultaneously. It's how long those commands take and whether they block which gives an illusion of simultaneous operation, or not.

On PWM, while PWMOUT is a background command and runs regardless of what else is happening, it can be affected by changes in PICAXE operating speeds. The duty rate remains the same and may mean there is no problem. If the frequency change is a problem then either PWM control or the IR receiver handling could be moved to another PICAXE so each can operate as required without inadvertently interfering with each other's operations.
 

SAborn

Senior Member
Hi, think you should have added "YET" to your forum name.:D

I have designed several windmill data loggers that record Voltage, Amps, Rpm, and wind speed that sends the data to a computer running a VB logging program to record the data every 1-10 second, the design is being used by a commercial windmill manufacture for their testing and supplied with their windmills, its all based around a 08m picaxe, so yes it can be done.

My current project is to design a dynamic braking system for their mills, to control the rpm during high winds.

Much of what you are asking about doing i have already done, but there is some limitations to what should be done with windmills and the effect that can be introduced to their operations.

Why the IR and for what function?

The main word of warning here would be if you rely solely on a micro processor to control the mill it is flaunt with danger, micros can get glitches in a noisy enviroment and then you have a runaway mill situation, i recommend the use of a simple analog circuit as a backup with a micro doing the main control just under (lower than)the settings of the analog circuit, so in the case of a micro fault then the analog circuit will take over and control the mill.

What is the wattage rating of your mill and what voltage.
 

SAborn

Senior Member
Do you rectifie on the mill or bring the 3 phase AC down from the mill and rectifie at the battery, as i generate the RPM count from 1 or 2 of the AC phases, its much simpler and less junk up the mill to deal with.

The period to count the rpm is all dependant of the number of magnets and poles in the generator.
On average it will read rpm from @20 rpm upwards, and considering the average cutin speed is around 100rpm than this is more than suitable.
 

NoSmoke

Member
Thanks for the welcome Hippy and for the comments. Using the PULSIN command may be the way to do it - perhaps not as accurate as COUNT but good enough. Sequential COUNTs would also work in my application but I was also interested in exploring the device capability so wondering if simultaneous could also be somehow accomplished.

Using multiple chips seems attractive and a good way of getting better multitasking capability but I'm not clear if 1c2 would be the best communication mode and, if ic2 blocks like serial and IR - any further comments appreciated.

Another question if I could - what's the advantage of program slots (at first I thought it was also multitasking but it doesn't seem to do that)?
 

NoSmoke

Member
Thanks for the help SAborn. Does your data logger run on a PC and is it available to others?

The IR was just a means of manual input to the program (and more usable now that a timeout has been added).

As far as runaways, I have active mechanical pitch control on the rotor which limits RPMs at high speeds (and presents a better blade angle to the wind at low speeds) so the mill will run happily even unloaded in high wind conditions. Wattage is about 1KW and voltage about 120, 3ph. I rectify on the ground and would count RPM, as you suggest, from frequency measurment on one of the phases. I have a rudimantary form of load control now which requires only a pot and SCR per phase but am interested now in trying something more adjustable to maximize power output (hence a PicAxe controller). I would also plan on adding data logging to the device.
 

hippy

Ex-Staff (retired)
@ NoSmoke : All commands block but most only for a very short time so they can be perceived as not blocking in reality; things which wait for something and may never continue if they don't get something ( like SERIN, IRIN ) are what we'd normally consider blocking commands.

I2C doesn't block indefinitely, nor does high-speed background receive. It's also possible to arrange for serial to become effectively non-blocking; only waits when there is data so will continue quickly after data transfer so it's perhaps not as much an obstacle as you are imagining. In this application I think you could have a multiple PICAXE solution; two read the generator RPM and wind speed and then pass that on to a master to generate PWM using serial. I'd go that route.

That would also let you use COUNT which is often easier than PULSIN and the maths needed. In fact the code in the RPM reading PICAXE would be just a few lines.

Program slots ( not available on M2 ) are areas for 'alternative programs' for the PICAXE with the RUN mechanism to decide which to execute.
 

SAborn

Senior Member
The data logger sends the raw data to a PC via a serial port, all logging and calibration of the data is done by the PC, this reduces the time the picaxe needs to process data.

Yes the logging program is available and there is several versions the logger will work with, they are all free to use for personal use.

What is your alternator, AXFX or iron core.

In most cases it is best to control extra loading (dump load) to the mill by a second rectifier, this eliminates the need for blocking diodes, then its just 1 device to control on the DC side compared to 3 on the AC side.

My advice would be keep the data logging as 1 project and a controller as a second project, this allows for greater processing speed of logged data, and eliminates time delay loops in mill control.

For example my mill can go from 100 to 400 rpm in a fraction of a second so to have any form of active control you need to keep the controlling program as tight and as fast as able, with the least amount of instructions as able.

I am interested in your pitch control, but for a smallish mill it would seem a lot of work, and as many have tried it with varying degree of success.
 

NoSmoke

Member
My alternator is a 3ph motor conversion (first with ceramic mags and later with neos). May be a good idea to keep logging and control separate but with the backup pitch control no great harm would result if any control time delays occur.

The pitch control mechanism did take some time to build as I made it pretty much from scratch and not referring to any existing designs (I hadn't realized it had been done before). For a smallish wind mill it would probably not be worth it but it was a hobby project more than anthing else so the extra required effort was not a penalty. In any case it works well and is not all that complex - shafts at the blade roots running in pillow blocks, a fly weight on each shaft with a torsion return spring and a "spider" mechanism to keep the shafts rotation synced with each other. It was all made with only a welder, metal chop saw and drill press. If I ever build another mill, I would definately do it that way again.
 

NoSmoke

Member
My alternator is a 3ph motor conversion (first with ceramic mags and later with neos). May be a good idea to keep logging and control separate but with the backup pitch control no great harm would result if any control time delays occur.

The pitch control mechanism did take some time to build as I made it pretty much from scratch and not referring to any existing designs (I hadn't realized it had been done before). For a smallish wind mill it would probably not be worth it but it was a hobby project more than anthing else so the extra required effort was not a penalty. In any case it works well and is not all that complex - shafts at the blade roots running in pillow blocks, a fly weight on each shaft with a torsion return spring and a "spider" mechanism to keep the shafts rotation synced with each other. It was all made with only a welder, metal chop saw and drill press. If I ever build another mill, I would definately do it that way again.
 

SAborn

Senior Member
A forum you might like to have a look at and even post some pictures of your pitch control is here.

http://www.thebackshed.com/forum/home.asp

It has a large pool of data and a lot of people very much into wind energy.

You will also find logging software (Piclog) on the forum, i use a slightly different set of software, but piclog will get you started and i can give you better software later, also some of the early logger designs i done is posted on the forum too.

It sounds very impressive what you have done for blade pitch.

3 phase motor conversion might be a very low pulse count for the rpm, as i am guessing 6 or 8 magnets per rev, where i have either 12 or 56 magnets per rev.
It will still work but it makes the count time longer like 1 to 2 seconds, where i can get away with 250 - 500ms
 

NoSmoke

Member
I've already posted pics on the following forum if you would like to have a look. The pics are for an earlier 2 blade mill, which I have now converted to 3 blade, but the principle remains the same.

http://www.greenpowertalk.org/showthread.php?t=1372&highlight=forbes

I'll certainly take a look at thebackshed Piclog and your stuff.

Yes, the low pulse count (esp from a 900 RPM motor conversion) requires longer count time, as you say 1 or 2 seconds which is another reason I'm interested in looking at using Pulsin which should be a lot faster and probably sufficiently accurate.

BTW, anyone know why the 08M2s won't act in slave mode - it seems to me slave mode for a small chip would be more useful than master?

Also, how much gate voltage is typically required to drive a power mosfet (ie. will 5Vs from a picaxe be sufficient)? I suppose one might also want an optocoupler or Darlington in between(?).
 

SAborn

Senior Member
A lot of work has gone into that, i dont agree with the gear drive, as efficiency is reduced quickly, but if that is whats needed to get the RPM for the motor than you have little choice with the design.

You will more than likely run into some trouble using pulsin and require some good coding to get around the glitches that will occure from the wide range of rpm, i and others have tried it with mills and you can get some strange readings at times that need code to handle.

If you are intending to use PWM to control the mill through a mosfet, then its best to use a dedicated mosfet driver or with the current you will need to handle, the mosfet will run very hot switching at high frequency, as it will suffer badly from the miller effect.

You will also need to select your mosfet correctly for the application.

Im sure others will comment on this more.
 

NoSmoke

Member
Gearing (roller chain) up would involve maybe 10-15% loss(?). My approach to that would be to just make the blades 3 or 4% longer to make up the loss. Still, it's energy lost bit it seems to me it is justified by the relative ease of constructing a motor conversion/roller chain drive vs an equivalent direct drive alternator.

I'll experiment with the pulsin - it will be interesting to try even if not successful.

I'm aware that insufficient gate drive will cause heating of the junction but was unaware of dedicated mosfwet drivers so thanks for that suggestion.

BTW, how do you measure power, amperage specifically? Just place a v low resistance in the circuit and measure voltage drop? If so, what do you use for the resistor?

I've also discovered none of the M2 chips will act as i2c slave - anyone know why? I have i2c going with a 14M2 as master and 28X2 as slave but cannot get a reading on the signal with my old cheapie oscope. It only goes to about 500 KHz sweep which maybe isn't fast enough(?).
 

Goeytex

Senior Member
BTW, anyone know why the 08M2s won't act in slave mode - it seems to me slave mode for a small chip would be more useful than master?
The more common uses or IC2 are adding a real time clock, an EEPROM, Display, sensor, etc ... which are slaves thus the master capability. As to why slave mode is not implemented, that will have to be answered by Rev-ED or someone more knowledgeable than myself.

Also, how much gate voltage is typically required to drive a power mosfet (ie. will 5Vs from a picaxe be sufficient)? I suppose one might also want an optocoupler or Darlington in between(?).
Every MOSFET is different. The Datasheet will give the Gate Threshold Voltage. This is the voltage at which the MOSFET begins to conduct and NOT the ideal operating voltage. A logic level MOSFET will have a Gate Threshold voltage from between 1 volt and about 3.5 volts. A Power MOSFET will have a GTV from between 3.5 and 6 volts but are typically driven at 10 to 12 volts for maximum efficiency. A good power MOSFET will need a DRIVER.

A Picaxe can drive a Logic Level MOSFET, however it is not very efficient due to the low current < 25ma that has to overcome the Gate capacitance of a FET. It is almost always a good idea to use a MOSFET DRIVER rather than drive directly from a Picaxe, especially in high speed high duty cycle applications. Opto coupling is generally not necessary but can be useful in some applications.
 
Last edited:

Goeytex

Senior Member
BTW, how do you measure power, amperage specifically? Just place a v low resistance in the circuit and measure voltage drop? If so, what do you use for the resistor?
A common method is to use a .1 ohm or even a .01 ohm "current sense" resistor. These are special tight tolerance resistors specifically designed for this.
 

NoSmoke

Member
Goeytex, I looked in DigiKey and found a 15A, 200V device that should do it (alternator max is 120 VAC and about 10A total).

http://search.digikey.com/ca/en/products/2SK2401(TE24L,Q)/2SK2401TE24LQCT-ND/1531593

I note however your comment that although this device is a "logic level gate" type, a Picaxe will not supply sufficient current to drive it properly (if I understand you correctly). So then, would a Darlington chip, as supplied on certain Picaxe project boards, do it?

Also found a 0.1 Ohm resistor @ 10W which I think will work for the amps measurement.

Thanks for the assistance!
 

SAborn

Senior Member
I have tried many different sensors for reading the current (originally i used CT's), and the only 2 i would recommend is a good shunt and a shunt monitor chip or a Allegro sensor, the Allegro being the best choice, and by the time you stuff around with other methods with lesser results then the Allegro is a cheap option that will work perfectly with the picaxe, there is 2 styles in them Bi-directional and Uni-directional
in the part number for the chip there will be a "B" or a "U" to indicate which one they are, the Uni-directional is the better one for your application as it only reads a supply current where the Bi-directional reads current in and out of the battery and has zero amps at 2.5 volt on the sensor output to the picaxe, so you only have 2.5 volts to work with, where as the Uni-directional is from 0-5 volts and gives a better resolution, although either will work and i have used both.

Link here to a supplier.

http://www.ebay.com/itm/ws/eBayISAPI.dll?ViewItem&item=230596304590&ssPageName=STRK:MEWNX:IT

A good mosfet driver will drive the gate of the fet at around 6 amp compared to the 25ma the picaxe will.
By the time you burn up several mosfets trying to cut corners with not using a fet driver, it will cost you more than doing it the right way in the first place.

Personally i think using PWM is not required and you are better just hitting the brakes and loading the mill down to reduce rpm then letting it speed up and repeating the process, this solves all the problems with high speed switching and the need for super fast rpm readings, then you can use a solid state relay and no need for drivers.

You also need to look at the effects of PWM into a wire wound resistor load bank and the RF problems that will be generated there too.

On surface it seems to be a good idea using PWM, but it can be a bigger can of worms you are trying to create then the benefits gained. (then that is up to you to work out)
 

Goeytex

Senior Member
So then, would a Darlington chip, as supplied on certain Picaxe project boards, do it?
Not really. A Darlington only drives in one direction. A MOSFET Driver is Push-Pull so you get both rapid turn on
and rapid turn off. Use a Driver. Short cutting here will lead to disappointment and poor performance.
 

NoSmoke

Member
SAborn, I notice your Piclog circuit has a mosfet driven directly by the 08M so am wondering why a driver is not used in that case - is it because it is a low power mosfet (used only to power the relay)? Another thing I'm curious about is you mention a good driver will drive the gate at 6 or so amps - that seems like a lot of current (30W at 5V)?

I'm not too partial to banging the load full on and full off as you suggest, especially at higher output levels, due to the mechanical shock it would impose on the mill.

Thanks again for the assistance. The Allegro current sensor is a cool solution which I think I will try if I don't get good results with a shunt.

Goeytex, thanks for the advice on the mosfet driver, I will certainly use it.
 

SAborn

Senior Member
Just to clear things up... Piclog was designed by Glenn (Gizmo) not by me, i did do a different logger circuit however, its buried in the forum there somewhere.

If you follow all the threads on the Piclog use of a shunt you will find there was several problems with the way Glenn had done it.
The main problem is having the shunt in the negative lead to the battery, it should always be in the positive lead or you will get ground loop problems, but then you have the problem of monitoring the high side.

Yes you can drive a fet direct off a picaxe, but the point you are missing is what happens when switched at high speed and with lots of current across it.

Here is a link to just one of the many fet drivers on the market, it would be worth you having a read.

http://www.datasheetcatalog.org/datasheet/texasinstruments/ucc27322.pdf

Also look up "Miller plateau" to better understand the down side of using Mosfets and why drivers help to overcome the problem.

I'm not too partial to banging the load full on and full off
That makes me wonder what you think to how PWM works, its full on and full off at a fast rate.
What many people do is bring the dump load on in 2 or 3 stages of resistance to limit the shock or stress you referred to.

Dont get me wrong with thinking PWM is a bad thing to control the load with, but it do have its own problems when used on a windmill, that i am trying to draw your attention to before you find out the hard way.
 

NoSmoke

Member
I am aware of how PWM works. The point you are missing is that a very rapid series of off/on pulses will dampen the mechanical shock by virtue of the mill's rotational inertia and the inductance of the circuit (such that the control will approach analog smoothness as the pulse frequency is further increased). PWM also allows the implementation of MPPT.

I appreciate your drawing attention to the problems associated with power mosfets and PWM and, have also found in another related thread a couple of circuit diagrams showing not only how to connect a driver but to add circuit protection components (which I suspect may be extra necessary due to switching of an inductive source).

In any case, it should be easy to compare the effects of PWM vs gross on/off using the same circuitry and similar code.
 
Top