Author Topic: My New Controller  (Read 22616 times)

0 Members and 1 Guest are viewing this topic.

Offline frackers

  • Full Member
  • ***
  • Posts: 239
  • Karma: +9/-0
  • If it moves - computerise it!
My New Controller
« 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.

1581-0

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

1583-1

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.

1585-2

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.

1587-3

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.

1589-4

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.

1591-5

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.

1593-6

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

Robin Down Under (or are you Up Over!)

Offline bj

  • Hero Member
  • *****
  • Posts: 735
  • Karma: +23/-0
  • Lamont, Alberta, Canada
Re: My New Controller
« Reply #1 on: September 26, 2012, 05:27:23 am »
Very,Very nice.
"Even a blind squirrel will find an acorn once in a while"
bj

Offline Wolvenar

  • Senior Moderator
  • Hero Member
  • *******
  • Posts: 1474
  • Karma: +40/-0
  • Mr. Murphys pawn
Re: My New Controller
« Reply #2 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.
Trying to make power from alternative energy any which way I can.
Just to abuse what I make. (and run this site)

Offline ghurd

  • Global Moderator
  • Sr. Member
  • ******
  • Posts: 442
  • Karma: +22/-0
    • GHurd Solar
Re: My New Controller
« Reply #3 on: September 26, 2012, 06:00:44 am »
Very Nice!
G-

Offline frackers

  • Full Member
  • ***
  • Posts: 239
  • Karma: +9/-0
  • If it moves - computerise it!
Re: My New Controller
« Reply #4 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, I'll be putting up another repository for the turbine specific bits.
Robin Down Under (or are you Up Over!)

Offline tomw

  • Not as bad as you might think
  • Senior Moderator
  • Hero Member
  • *******
  • Posts: 739
  • Karma: +35/-0
  • hoplophobic people will fear my lifestyle
    • Zubbly's photos!
Re: My New Controller
« Reply #5 on: September 26, 2012, 07:34:07 am »
Great stuff!

Thanks for the share.

Tom
Do NOT mistake me for any kind of "expert".

( ?° ?? ?°)


24 Trina 310 watt modules, SMA SunnyBoy 7.7 KW Grid Tie inverter.

I thought that they were angels, but much to my surprise, We climbed aboard their starship and headed for the skies

Offline frackers

  • Full Member
  • ***
  • Posts: 239
  • Karma: +9/-0
  • If it moves - computerise it!
Re: My New Controller
« Reply #6 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


Robin Down Under (or are you Up Over!)

Offline frackers

  • Full Member
  • ***
  • Posts: 239
  • Karma: +9/-0
  • If it moves - computerise it!
Re: My New Controller
« Reply #7 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 leakage (self discharge) is assumed to be 1% per week. This will get a setup option in due course!
  • During a discharge, the charge recorded is adjusted by the ratio of the total charge/discharge tracking registers. eg if the totals registers show a 92% efficiency then a 100amp hr discharge will be recorded as 108 amp-hrs to account for the cyclic losses.

The charging control is based on a 3 stage charge such that
  • Less than 90% in the batteries then bulk charge where the shunt load is only operated if the Max voltage is exceeded.
  • 90% to 100% in the batteries then absorb mode is used where the shunt load starts to come in at float voltage but clamps to the absorb voltage max.
  • 100% in the batteries and float mode is used where the voltage is clamped to between 99% and 100% of the float voltage by the shunt load.

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).


Robin Down Under (or are you Up Over!)

Offline Wolvenar

  • Senior Moderator
  • Hero Member
  • *******
  • Posts: 1474
  • Karma: +40/-0
  • Mr. Murphys pawn
Re: My New Controller
« Reply #8 on: September 26, 2012, 07:55:36 pm »
Any info on the hardware involved?
Trying to make power from alternative energy any which way I can.
Just to abuse what I make. (and run this site)

Offline frackers

  • Full Member
  • ***
  • Posts: 239
  • Karma: +9/-0
  • If it moves - computerise it!
Re: My New Controller
« Reply #9 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.

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!!


Robin Down Under (or are you Up Over!)

Offline frackers

  • Full Member
  • ***
  • Posts: 239
  • Karma: +9/-0
  • If it moves - computerise it!
Re: My New Controller
« Reply #10 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.

Robin Down Under (or are you Up Over!)

Offline frackers

  • Full Member
  • ***
  • Posts: 239
  • Karma: +9/-0
  • If it moves - computerise it!
Re: My New Controller
« Reply #11 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

You'll need avr-gcc installed, note that although it uses an Arduino, it doesn't use the Arduino IDE or environment.
Robin Down Under (or are you Up Over!)

Offline ghurd

  • Global Moderator
  • Sr. Member
  • ******
  • Posts: 442
  • Karma: +22/-0
    • GHurd Solar
Re: My New Controller
« Reply #12 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-

Offline tomw

  • Not as bad as you might think
  • Senior Moderator
  • Hero Member
  • *******
  • Posts: 739
  • Karma: +35/-0
  • hoplophobic people will fear my lifestyle
    • Zubbly's photos!
Re: My New Controller
« Reply #13 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
Do NOT mistake me for any kind of "expert".

( ?° ?? ?°)


24 Trina 310 watt modules, SMA SunnyBoy 7.7 KW Grid Tie inverter.

I thought that they were angels, but much to my surprise, We climbed aboard their starship and headed for the skies

Offline frackers

  • Full Member
  • ***
  • Posts: 239
  • Karma: +9/-0
  • If it moves - computerise it!
Re: My New Controller
« Reply #14 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.
Robin Down Under (or are you Up Over!)