Anotherpower.com Forum

Renewable Energy Questions/Discussion => Automation, Controls, Inverters, MPPT, etc => Topic started by: frackers on September 26, 2012, 04:27:55 am

Title: My New Controller
Post by: frackers on September 26, 2012, 04:27:55 am
Get ready for the all new Mk 3 Wind Turbine Controller :)

Based on an Arduino Mega 2560, a 20x4 LCD display and a couple of 1-wire chips is has a total of 7 screens - 3 for monitoring and 4 for setup.

This is the first screen that gets displayed - all the important stuff immediately visible.
The 2 icons on the top right indicate the charge mode (F)loat (B)ulk (A)bsorb and whether an SD card is plugged in.

[attach=1]

The next screen contains lesser stuff - % shunt load, RPMs of the mill, temperature and date/time.

[attach=2]

The final monitoring screen has the totals - minimum and maximum for the last hour and last day as well as the total that the controller has seen in its lifetime.

[attach=3]

The first setup screen is the overall system stuff. The nominal battery volts, an option to calibrate the internal voltmeter and zero the ammeter and the date and time.

[attach=4]

The next screen allows the minimum and maximum voltages to be defined. These are the values between which you'll want the inverter to operate. Its shut off if below the minimum and the maximum shunt is applied if over the max.

[attach=5]

The third setup screen allows the battery bank size to be defined. This is used to determine whether the controller is in bulk charge mode (less than 90% full), absorb mode (90-100% full) or float mode (100% full). It also has an option to set the current charge level as the controller can't check the SG of the batteries!! The minimum change level is used on the next screen's inverter auto mode to decide when to switch off the inverter.

[attach=6]

The final setup screen defines whether there is an inverter attached and whether it uses only manual control (along with an extra field to allow it to be turned on and off) or automatic where the inverter is turned on at a charge level of bank size (i.e. 100%) and then turned off at minimum charge level.

[attach=7]

The controller has a serial interface via the USB connection that reports logging information and also accepts commands - more later!!

Title: Re: My New Controller
Post by: bj on September 26, 2012, 05:27:23 am
Very,Very nice.
Title: Re: My New Controller
Post by: Wolvenar on September 26, 2012, 05:30:20 am
Im going to have to look into the details of your little masterpiece :-)

I'm currently working on the getting serious about wind power part of my RE system, and this looks really intriguing.
Title: Re: My New Controller
Post by: ghurd on September 26, 2012, 06:00:44 am
Very Nice!
G-
Title: Re: My New Controller
Post by: frackers on September 26, 2012, 06:48:13 am
The next instalment is the serial interface. I run this via a wireless router (a TPLink 1043ND) that runs OpenWRT software and has the ACM driver loaded. I can ssh into the router and run picocom to get log info back from the controller or I can even reprogram it using the following command line on the router:
  socat tcp-l:54321,reuseaddr,fork file:/dev/ttyACM0,raw,echo=0,nonblock,waitlock=/var/run/tty0.lock,b115200
and the following line on my server/development box
  avrdude -p atmega2560 -c stk500v2 -P net:tplink:54321  -U flash:w:images/ardmega-turbine.hex

Here is the (very basic) help output

>> ?

>>del dir type disk dcs inv log date time find config<<


The first few commands are associated with the storage of data on the SD card. I've used command name familiar with DOS/Windows users rather than my preferred Linux (Unix) names!!

del - delete a file
dir - directory listing
type - display a file (end early with ESC)
disk - disk info, such as SD card manufacturer, free space, space used
dcs - this initialises the dis/charge registers to allow the total charge going in and out of the battery bank to be tracked. The ratio of these values is also used to determine the charge cycle efficiency.
inv - toggle the invert on or off
log - toggle the logging on/off. Handy if you don't want a display messed up with a log line in the middle of it
date - set the date as dd/mm/yy
time - set the time as hh:mm:ss. The date & time get lost on a restart as the Arduino has no real time clock. The values do get saved to EEPROM once per hour so at least any adjustments aren't too onerous!
find - like type but it only outputs lines that contain the string defined (cf. Unix grep). The number of days to look back by can be defined with a minus sign. eg. "find -3 F:10" will look over the past 3 days to find log entries where a new hourly maximum power was logged (the flag value of 10 means that!!).
config - displays some of the config.

The log info is stored in a FAT32 file system, one file per day.

Some examples:
>> dir

log-120909.txt      83953
log-120910.txt     166269
log-120911.txt     152866
log-120912.txt     161104
log-120913.txt     169106
log-120914.txt     161370
log-120915.txt     161857
log-120916.txt     159198
log-120917.txt     157831
log-120918.txt     187603
log-120919.txt     159092
log-120920.txt     161236
log-120921.txt     166901
log-120922.txt     167691
log-120923.txt     175498
log-120924.txt     184436
log-120925.txt     164924
log-120926.txt     187281


>> find -2 F:10

24-09-12 04:49:39 E:0 L:0 S:0 F:10 D:0 T:2.89 C:928 V:27.98 A:10.22 P:285 R:0 H:34 Y:497 h:20 y:-13 I:437 O:359
24-09-12 04:54:23 E:0 L:0 S:0 F:10 D:0 T:2.95 C:928 V:27.99 A:11.05 P:309 R:0 H:2609 Y:2609 h:20 y:-13 I:437 O:359
26-09-12 17:11:15 E:0 L:0 S:0 F:10 D:0 T:15.83 C:923 V:26.20 A:0.22 P:5 R:0 H:12 Y:12 h:-51 y:-51 I:453 O:374


>> config

System voltage 24, inverter control Yes
Voltage limits    22.00 - 29.00
Float Absorb     27.40 - 28.00
Charge limits     800 - 1000


>> disk

manuf:  1d
oem:    AD
prod:   SD   
rev:    10
serial: 4b3
date:   2/12
size:   3747MB
copy:   0
wr.pr.: 0/0
format: 0
free:   3915522048/0


You'll find a lot of the generic stuff at https://github.com/g8ecj/bertos (https://github.com/g8ecj/bertos), I'll be putting up another repository for the turbine specific bits.
Title: Re: My New Controller
Post by: tomw on September 26, 2012, 07:34:07 am
Great stuff!

Thanks for the share.

Tom
Title: Re: My New Controller
Post by: frackers on September 26, 2012, 06:02:10 pm
The software allows the logging of the following items:

   Date
   Time
   Temperature
   Battery charge
   Battery volts
   Charge/discharge current
   Shunt % load
   Power
   Turbine RPM
   Maximum and minimum power in the last hour and day
   Event flags (inverter on/off etc)

The record generated looks like this:

27-09-12 09:47:00 E:0 L:0 S:0 F:9 D:0 T:17.08 C:918 V:26.11 A:-0.50 P:-13 R:0 H:-6 Y:-6 h:-19 y:-19 I:453 O:390

   Date & Time
   E:         - error ON/OFF
   L:         - load ON/OFF
   S:         - shunt ON/OFF
   F:         - event flags

         DISPLAY     0         - manual request for display
         OVERVOLT    1         - volts greater than Max
         UNDERVOLT   2         - volts less than Min
         MANUALON    3         - inverter turned on manually
         MANUALOFF   4         - inverter turned off manually
         CHARGED     5         - inverter turned on in auto mode when at 100%
         DISCHARGED  6         - inverter turned on in auto mode when at Min Charge
         SHUNTON     7         - shunt load threshold exceeded
         SHUNTOFF    8         - dropped below shunt load threshold
         MARKTIME    9         - regular 1 minute interval report
         NEWHOURMAX  10        - new hour maximum recorded
         NEWDAYMAX   11        - new day maximum recorded
         NEWHOURMIN  12        - new hour minimum recorded
         NEWDAYMIN   13        - new day minimum recorded
         LEAKADJUST  14        - charge level adjusted by 1% to allow for leakage

   D:         - dump % load
   T:         - temperature
   C:         - charge in amp-hrs
   V:         - volts
   A:         - amps
   P:         - power
   R:         - rpm
   H:         - hour max
   Y:         - day max
   h:         - hour min
   y:         - day min
   I:         - incoming charge total
   O:         - outgoing charge total


Title: Re: My New Controller
Post by: frackers on September 26, 2012, 06:15:54 pm
A few general notes:

The controller relies on charge counting to see what the level of charge is in the batteries. This requires that the user manually synchronises the controller with the batteries from time to time. A couple of methods are used to try and keep the charge tracking accurate.

The charging control is based on a 3 stage charge such that

The shunt load is a PWM output at about 900Hz with opto isolators which in my case drives 4 automotive 160amp MOSFETS in parallel, although the load itself is only 40amps so far!!

The SD card operations all try and minimise the chance of data corruption. Generally the card is written to once a minute so if the card is popped out then hopefully its not in the middle of a data write!! When its put back in then the sense line is used to re-open the current log file (or a new one is created if there isn't one).


Title: Re: My New Controller
Post by: Wolvenar on September 26, 2012, 07:55:36 pm
Any info on the hardware involved?
Title: Re: My New Controller
Post by: frackers on September 26, 2012, 09:23:23 pm
Any info on the hardware involved?

Most of the hardware is the same as the Mk2 controller which was based on the AVR Butterfly demo board. The PCB Eagle files can be found here http://gilks.ath.cx/~g8ecj/New_Turbine/pcb-turbine-1.00.tar.bz2 (http://gilks.ath.cx/~g8ecj/New_Turbine/pcb-turbine-1.00.tar.bz2).

The Arduino Mega 2560 'shield' has the interface to the SD card, a 3.3v supply for the SD card, the connectors for the LCD and other parts and a schmidt trigger to clean up the raw AC from the turbine for getting the RPMs stable. I haven't got that stashed away anywhere yet as I still want to test the 'final' iteration of it ;) Should have it in a few days as I only have to drill the PCB and assemble it.

I've tried to keep it modular - its worked in that a major change to the CPU platform has allowed most of the hardware to be reused. I've also only used 1/4 of the code space of the Mega so I'm sure I'll think of other things to go into it!!


Title: Re: My New Controller
Post by: frackers on September 26, 2012, 09:40:42 pm
I forgot the push buttons!!

The User Interface.

There are 5 buttons. Up, Down, Left, Right and Centre

At startup, the monitor screens are displayed in a carousel with an interval of about 5 seconds.

Press Centre to cancel the carousel or press Up/Down to move between monitor screens.

Press Left/Right to move between setup screens.

When on a setup screen, press Centre to enter screen edit mode. This allows the Up/Down/Left/Right keys to move between the fields on the screen as indicated by the cursor being turned on.

When in screen edit mode, press both Left and Right together to get back to moving between screens or press Centre to get to field edit mode which is indicated by the field flashing.

When in field edit mode, Up/Down change the value. Some values have intellegent increments (eg. if over 100 then move in 10's, if over 1000 then 100's).

When in field edit mode, Left aborts any changes, Right sets the default for this field and Centre saves the value.

Some fields also have extra facilities, such as calibrate - this not only changes the scaling factor to allow the voltage measurement to track, it also runs the 1-wire auto zero algorithm on the current sensor. For this reason the calibration must be done with no load or charging occurring. Another 'special' is the Control->Override field which only requires Centre to be pressed to toggle the inverter on and off.

Title: Re: My New Controller
Post by: frackers on September 27, 2012, 05:15:34 am
Right - the code is now on github and it builds OK by following the README file :D

Take at look at https://github.com/g8ecj/turbine (https://github.com/g8ecj/turbine)

You'll need avr-gcc installed, note that although it uses an Arduino, it doesn't use the Arduino IDE or environment.
Title: Re: My New Controller
Post by: ghurd on September 27, 2012, 08:50:29 pm
24-09-12 04:49:39 E:0 L:0 S:0 F:10 D:0 T:2.89 C:928 V:27.98 A:10.22 P:285 R:0 H:34 Y:497 h:20 y:-13 I:437 O:359
24-09-12 04:54:23 E:0 L:0 S:0 F:10 D:0 T:2.95 C:928 V:27.99 A:11.05 P:309 R:0 H:2609 Y:2609 h:20 y:-13 I:437 O:359
26-09-12 17:11:15 E:0 L:0 S:0 F:10 D:0 T:15.83 C:923 V:26.20 A:0.22 P:5 R:0 H:12 Y:12 h:-51 y:-51 I:453 O:374
[/tt]

Yup...  That's what I thought it would be.  ???

Really though, I am glad people like you are doing things like this, and sharing it so freely.
G-
Title: Re: My New Controller
Post by: tomw on September 27, 2012, 10:13:09 pm
G;

Maybe its time to start Ghurd Heavy Industries, Digital Controls Research and Development Division and get Frackers on staff to drive the development.

I bet he is expensive, tho.

I know you secretly love digital and computer stuff.;)

Tom
Title: Re: My New Controller
Post by: frackers on September 28, 2012, 04:50:23 am

The leakage (self discharge) is assumed to be 1% per week. This will get a setup option in due course!


This has now been implemented with yet another setup screen (now got 5!!) that gets the number of days for 1% self discharge from the user. Also a new value that defines the idle current that the system takes - this will look after the power my wireless router and the controller itself takes and included in the state of charge of the battery.
Title: Re: My New Controller
Post by: Burnit0017 on September 28, 2012, 08:00:11 am
Hi, nice work, are you using a MPPT algorithm to control the power from the turbine?
Title: Re: My New Controller
Post by: frackers on September 28, 2012, 04:50:08 pm
Hi, nice work, are you using a MPPT algorithm to control the power from the turbine?

Nope - just using a straight dump load as a shunt regulator. The load is PWM controlled but  I don't fancy trying to wind inductors and building other components to handle 100 amps.

Even designing the MOSFET drivers for a dump load is a challenge - circulating currents, earth currents, flyback voltages, gate charge dumping, staying out of the linear region of the MOSFETs, parasitic  oscillation, snubbers and commutating diodes!! The first load I made was inductive which introduced a whole load of problems - capacitors exploding, MOSFETS catching on fire, two wire stumps where a diode used to be :-\

Maybe one day...

Title: Re: My New Controller
Post by: frackers on September 29, 2012, 10:51:28 pm
So what does all the heavy lifting in this controller? Its got to be the Dallas I-wire chip. The DS2438 Smart Battery Monitor. Designed for portable applications with rechargeable batteries, it scales very well to stationary huge installations  ;)

To quote from the spec sheet...


It does a lot more than this - like the current measurement as well as charge accumulation, saving the total life charge in and out. Pretty much the whole interface to the battery bank is through this chip.

The other interfaces are a 1-wire GPIO chip that simulates a push button remote control on the inverter, an interrupt input to the Arduino to measure RPM, a PWM output from the Arduino to control the shunt load and general I/O lines for scanning the push buttons and outputting to the LCD.


Title: Re: My New Controller
Post by: frackers on January 31, 2013, 02:40:25 pm
Well, I've debugged the first version and now built a copy of the original and am happy with the result!!

Here is a story in pictures and text showing the building of that second controller: http://gilks.ath.cx/~g8ecj/Mk3_Turbine/Mk3_controller.html (http://gilks.ath.cx/~g8ecj/Mk3_Turbine/Mk3_controller.html)

This should be up to date with Eagle PCB and schematic files, binary and code sources as well as an extensive README file that is based somewhat on this thread ;)

Enjoy...
Title: Re: My New Controller
Post by: Wolvenar on January 31, 2013, 06:04:37 pm
Impressive as always.
Title: Re: My New Controller
Post by: frackers on February 02, 2013, 08:26:32 pm
Having done the write-up , I've at last got round to fixing up the last couple of configuration items to allow a user to set everything without having to re-compile it!! Updated firmware etc on my web site.

The conductance (inverse of resistance) of the current shunt can now be set as can the number of magnet poles in the generator to read RPM. This means that selecting a couple of resistors and fitting a zener diode if going over 30 volts, the controller is good for 12, 24, 36 or 48 volt operation. The SD Card is a real boon for holding the logs which rarely go over 1/4 of a meg per day and the smallest card I can buy now is 4 gigs so 4000 days or call it 10 years!! The live monitoring is still there as well so I can still check out the mill from work!!

Title: Re: My New Controller
Post by: Watt on February 02, 2013, 11:11:39 pm
Very nice Frackers!
Title: Re: My New Controller
Post by: niall on February 03, 2013, 07:11:47 pm
great update ....those boards look commercial quality ..... 8)...

mppt ...i wonder if it is really worth it for homemade mills ...if the stator can be wound "matched" relatively close to the load ...is mppt really worth the extra expense ?





Title: Re: My New Controller
Post by: shawn on February 04, 2013, 01:04:40 am
As the proud owner of the copy controller I can say it works exactly as Robin says and it seems easy enough to workout even for the electronically challenged  ::)
Its also controlling my pv  ;D
   
        A big thanks Robin

     shawn
Title: Re: My New Controller
Post by: frackers on February 04, 2013, 04:33:26 am
great update ....those boards look commercial quality ..... 8)...

mppt ...i wonder if it is really worth it for homemade mills ...if the stator can be wound "matched" relatively close to the load ...is mppt really worth the extra expense ?

The boards are made with pre-coated PCB material from a local shop and using the prototyping UV exposure box and etching tanks at work. The 'negative' is laser printed onto 'tracing paper' - can't remember what its called offhand but its translucent rather than transparent but UV goes straight through it!!

I've thought about mppt but getting suitable cores and winding them for the sort of current likely to be flying about from a decent mill is just too much like hard work. Switching supplies, inverters etc are a black art. Thats why the guys (and gals) that can get them to work earn the big bucks!!
Title: Re: My New Controller
Post by: frackers on February 04, 2013, 04:35:45 am
As the proud owner of the copy controller I can say it works exactly as Robin says and it seems easy enough to workout even for the electronically challenged  ::)
Its also controlling my pv  ;D
   
        A big thanks Robin

You're very welcome Shawn - you're a very brave to risk some of my nutty ideas ;)
Title: Re: My New Controller
Post by: frackers on March 10, 2013, 09:26:27 pm
As a result of a few months testing there are a few minor tweaks to the code. Nothing drastic and the full commit log can be found here https://github.com/g8ecj/turbine/commits/master (https://github.com/g8ecj/turbine/commits/master)

The highlights:

Sources from github, hex file will be updated by the time this post is read by anyone :)

Title: Re: My New Controller
Post by: MadScientist267 on March 10, 2013, 11:30:18 pm
I want one!

But... Well... One little problem... where is the RPM sensing for my PV? :P

Very nice project. All jokes aside, got one that's an entire kit, shunts and all that I can twist into a PV only monitor? I would LOVE to have everything right in one spot like that ;)

Steve
Title: Re: My New Controller
Post by: frackers on March 13, 2013, 09:58:49 pm

Very nice project. All jokes aside, got one that's an entire kit, shunts and all that I can twist into a PV only monitor? I would LOVE to have everything right in one spot like that ;)


I'll be adding 500watts of PV to my system shortly so I'll report back on how it handles it.
Title: Re: My New Controller
Post by: shawn on March 23, 2013, 12:57:15 am
It handles 2 KW of pv no problem it blew norwest night last night I woke up to allmost floating batteries, I was going to be away all day so I turned my mill off the sun shined all day with no cloud cover got home to a floating bank everything going fine.
Title: Re: My New Controller
Post by: frackers on March 24, 2013, 06:18:12 pm
Good to hear that Shawn. My PV may be a bit delayed as the earthquake repairs start after Easter so I may be short of working space for 2-3 months while that is done.
Title: Re: My New Controller
Post by: frackers on September 18, 2014, 08:39:06 pm
Just a minor update to give an idea of the tweaks that have come about in the last 18 months.


Still a few ideas to go yet! Next version might use a better display rather than the basic 20x4 character LCD.