Author Topic: advanced controller design  (Read 2432 times)

0 Members and 1 Guest are viewing this topic.

WindJuggler

  • Newbie
  • *
  • Posts: 36
advanced controller design
« on: July 20, 2007, 04:00:55 PM »
It has been some time since my last post (Homebuild windmill/solar panel control circuit).


Since then I have made a schematic of my controller and I want you all to brake it down.


A short explenation:


Current measurement: measures the current generated from the windmill.

Generator voltage measurement: measures the voltage from the generator.

       Combine the last 2 and we know the power generated.

battery voltage measurement: measures battery voltage for the battery charge sequence

       and gives a low battery signal.


I use zener diodes for the voltage measurement. This is easy in use and actually makes an more accurate AD conversion. Ex: the windmill voltage needs to be above 22V before I can use it.


The power mosfet switches the high currents. This is done bij PWM from the µC.

The logic that I use is for selecting the right mosfet at the right time.

It works like this:

       If the windmill gives enough voltage to start loading the batteries will load.

       If the batteries are ending their load cycle or the windmill produces to much

       power for the batteries 1 of the 2 dump loads will take partialy over.

       Like this: the battery only loads 50% of the time but the windmill produces

       more.

                                     _ _ _         _ _ _

       battery PWM:           _ _ _ |      |_ _ _ |      |_ _ _

                                     _ _ _ _ _     _ _ _ _ _  

       Dump load PWM:         _ _ _ |          |_ |          | _

                                            _ _           _ _  

       Dump load after logic:  _ _ _ _ _ _ |   |_ _ _ _ _|   | _


       The extra power goes to the dump load.


There are 2 dump loads: the first one could be water heating or something like that.

       I have made it like this so that your water wouldn't boil dry. It is possible

       to apply a heat sensor so that this load would switch off and the other would

       take over automatically. That is the purpose of the dump load select

       interrupt. This is connected to an interrupt on change pin.


The rpm measurment can be applied to 1 fase before the rectifier or to a reed switch.

       the optocoupler protects the circuit. The output is connected to an interrupt

       of the µC.


The real time clock is for logging. I could also add an extra eeprom. The logging

       could be RPM, Generator voltage, current, power output.


The purpose of the lcd will be to configure the controller. This can be done with 3

       buttons connected to 2 wires(3 usefull logic states).


The µC is a pic18f2550. You can connect this one to usb. This is easier and more

       random available then rs-232. I think it is easy adaptable to picaxe28x.


Finally: One small question: would it be best to connect the lm7805 to the lm7810 or not. I think the lm7805 would become less hot.

« Last Edit: July 20, 2007, 04:00:55 PM by (unknown) »
Wim

elt

  • Sr. Member
  • ****
  • Posts: 328
Re: advanced controller design
« Reply #1 on: July 20, 2007, 03:49:47 PM »
Hi Juggler,


I'm partially color blind so I put too big of a load resister on the output of my asc752; when I got no reading from the device I simply cut the lead on the load resister and it seamed to work fine so I never revisited it... nevertheless, there is a minimum load required on the output of the device according to the data sheet that I don't think the input pin on the PIC will provide. Hope that helps.


- Ed.

« Last Edit: July 20, 2007, 03:49:47 PM by (unknown) »

domwild

  • Sr. Member
  • ****
  • Posts: 357
Re: advanced controller design
« Reply #2 on: July 21, 2007, 12:17:22 AM »
Interesting circuit! Thanks for that. Have noticed that one contributor had problems with frying FETs and remembered from the Desulphator's forum two ways of avoiding overheating:


  1. Attaching a thermistor, which then autoregulates the PWM to stop overheating,
  2. Measuring ambient and FET temp. and letting the Picaxe or other PIC alter the PWM once the FET temp. went 20 deg. above ambient.


How do you keep the temps in check?

Do you think the PWM will give you longer battery life because of the pulse charging?

Do you intend to vary the PWM for a two-stage (bulk, float) or three-stage charging?
« Last Edit: July 21, 2007, 12:17:22 AM by (unknown) »

scottsAI

  • Hero Member
  • *****
  • Posts: 884
Re: advanced controller design
« Reply #3 on: July 21, 2007, 12:03:53 PM »
Hi WindJuggler,


Not sure where to start. I will list some of the big ones and see how this goes.

I do hope you have not bought the parts yet or built it.


Input voltage measurement: Dropping the battery / gen voltage with zener is NOT recommended.

To monitor battery voltage for charge control need something much more accurate.

Data sheet (DS) list zener voltage 18 - 21 volts... The zener point varies by the current through it. Take a look at the plots, it's a curve! So as the battery voltage changes so will the voltage dropped across it. You may think, it can be calibrated, wrong, temperature changes by a few deg and the cal is not so accurate.


Using the zener for input protection can limit your range and accuracy. DS zener voltage is 4.4 to 5v with 0.25 to 10 ua leakage current.


On your other post, cost was a big deal. So here goes:


Opto couplers:

Logic FETs cost little more than regular FETs, direct drive from micro.


RTC is redundant, micro has RTC capability already. EEPROM may be nice. DigiKey has several megabyte serial flash for $1. I assume something like it is available locally. Or just a plain EEPROM.


Charge controller

Controlling by voltage is not the best, measuring current in and out of the battery with voltage is better.


ASC755xCA Current measurement

correct part number is: ACS755xCB (ACS vs ASC:-)

Cute part, I would only use it if I needed isolation, what does it cost?


You have cabling to / from gen/batt. Copper wire has resistance. OK it gets messed up by temperature changes, so measure it. Using an opamp with gain can measure current in one direction, so use another for current in the other or offset the device. One advantage to doing it this way, different gain resistors can be used to measure wide current ranges.


Most of the logic gates are not needed, use the micro.


Add up the circuits running current, is much higher than I would like.


Last thing for now:

Based on the timing diagram provided, the controller controls power to load dump or to battery or both. You mention this is for a wind generator. The output of a PMA varies greatly from cut in to furling. The output voltage will be several times the battery voltage at furling. If cut in is 6mph at 24volts, then at 24MPH the voltage is 4x or almost 100v, exceeding the 80v MosFETs...


How was this?


Have fun,

Scott.

« Last Edit: July 21, 2007, 12:03:53 PM by (unknown) »

commanda

  • Hero Member
  • *****
  • Posts: 731
Re: advanced controller design
« Reply #4 on: July 21, 2007, 08:50:21 PM »
Scott's comment about the Zeners curve is correct. Look at using TL431 (shunt regulator) as an adjustable zener.


Amanda

« Last Edit: July 21, 2007, 08:50:21 PM by (unknown) »

DamonHD

  • Super Hero Member Plus
  • *******
  • Posts: 4130
  • Country: gb
    • Earth Notes
Re: advanced controller design
« Reply #5 on: July 22, 2007, 02:04:26 AM »
For SLAs it seems you need quite high precision and Zeners are unlikely to cut it.


I will be trying the MAX8212 which has a precision voltage reference and comparator built in and only needs 2 or 3 resistors to set up.


Rgds


Damon

« Last Edit: July 22, 2007, 02:04:26 AM by (unknown) »
Podcast: https://www.earth.org.uk/SECTION_podcast.html

@DamonHD@mastodon.social

WindJuggler

  • Newbie
  • *
  • Posts: 36
Re: advanced controller design
« Reply #6 on: July 22, 2007, 03:22:36 PM »
Hello,


Thanks for the comments.


First ones first:


Ed:

I don't exactly understand what you mean but I think that you mean that there has to be some kind of resistor to the ground from the pin that gives the voltage signal to the micro.


Domwild:

Nice idea I have some TTO-220 heat sensor that I will connect to the heatsink that is connected to all the FETs.

I believe the contributer you are talking about used to small and separate heatsinks.

Separate heatsinks is a bad idea if you connect FETs parrallel because some will heat up more than others and then you get an imbalance. (This is a bigger problem with BJTs)


Scott:

I had forgotten the fact about the zeners. I will try to find another solution.


Even if I would use TTL FETs I would still use optocouplers because it is safer and it will protect the rest of the circuit. Besides I have some til111 here that ik can use for it.


The acs755 costs €4 - €5 That's not that expensive for such a good and handy part.

Thanks for noticing the typo.


The other solution for current measurement is also quit good and easy but the cost will be close to that of a ACS755.


Maybe you are right about some of the logic gates but 1 IC has several of them so I want to use most of them. The logic for the battery/Dump load control is to complex to do correctly with a micro.


Maybe you are right about the powerfets. But it is not my intention to let the mill run full speed without any load. The load will pull down the voltage. But still good advice because if you use PWM you get a short time there is no load.


Damon:

I will look into that IC and see if it is an option for me.


Wim

« Last Edit: July 22, 2007, 03:22:36 PM by (unknown) »
Wim

scottsAI

  • Hero Member
  • *****
  • Posts: 884
Re: advanced controller design
« Reply #7 on: July 22, 2007, 04:38:54 PM »
Hi WindJuggler,


Using two 0.1% resistors as a divider should not be too costly, Keeping series impedance above 100k will limit the current to couple hundred micro amps. Add diodes to +5v and gnd for ADC protections along with some cap. Transistors have a very good low leakage diode in them...


"use optocouplers because it is safer"

I am scratching my head on this one, safer how? The Gate is isolated from the FET, The shorted voltage would be the source pin which is at ground... So where is there a potential to be safe from?


Thermistors are rather cheap, as is an opamp like AD8500 Micropower Precision CMOS Operational Amplifier should work along with couple 1% resistors, third resistor for offset to measure +- currents. The opamp output can go rail to rail allowing full ADC range.


The beauty of a micro is its ability to handle complex logic, give it another look!


My comment about quiescent current is based on the 7805 and 7810 they draw 5-8ma each. Removing one and the optos will save over 15ma running current. Does not sound like much but it's at battery voltage or 1/3 watt load 24/7.


Have fun,

Scott.

« Last Edit: July 22, 2007, 04:38:54 PM by (unknown) »

WindJuggler

  • Newbie
  • *
  • Posts: 36
Re: advanced controller design
« Reply #8 on: July 24, 2007, 08:43:11 AM »
Hello,


The use of the 0.1% resistor is a good idea. But should I make it to measure high voltages? (The high voltages if the windmill goes full speed.) Or just so it measures up to 50V and clipps higher voltages?


Like I have made the circuit right now it is impossible to do it without optocouplers. The ground for the 5V circuit is the battery. So when I want to make the circuit without them I have to make 1 ground otherwise the FETs won't work. But if I do that I'm not able do the battery charging with a FET. The 7810 won't draw any power from the battery. It will draw power directly from the rectifier. So the FETs and optocouplers are only drawing (quiescent) power when the windmill is running.


To do the logic with this microcontroller is impossible. There are only 2 outputs of PWM. When one PWM (battery) is on, the other one needs to be out and start only when the first one goes down, if there is enough power from the generator.

There is a mode with this micro that is called half bridge mode. This mode turns on the first FET and when that one goes out the other one is turned on for an equal time. The timebase of the 2 PWM signals need to be the same. So separate PWM is out of the question. When I started with this controller I wanted to make it without logic components but I couldn't find a way to do it.


For power consumption I can turn out a lot of stuff. Like the display when it is not in use for a minute just turn it off.


Controlling by voltage is not the best What did you mean by this? Do I have to use a current measuring system on the battery? So measure power in and power out and compare them.


A few question:

Would I place the FETs on the board or not?

« Last Edit: July 24, 2007, 08:43:11 AM by (unknown) »
Wim

elt

  • Sr. Member
  • ****
  • Posts: 328
Re: advanced controller design
« Reply #9 on: July 24, 2007, 12:42:56 PM »
Ed:

I don't exactly understand what you mean but I think that you mean that there has to be some kind of resistor to the ground from the pin that gives the voltage signal to the micro.


Yes, it's mentioned in the electrical tables on the data sheet and in the FAQ... I assume that it's internal voltage regulator needs a minimum load of about a milliamp but that's just a guess.


- Ed.

« Last Edit: July 24, 2007, 12:42:56 PM by (unknown) »

scottsAI

  • Hero Member
  • *****
  • Posts: 884
Re: advanced controller design
« Reply #10 on: July 24, 2007, 10:55:12 PM »
Hi WindJuggler,


Please see:

http://www.arttec.net/Solar_Mower/4_Electrical/Battery%20Charging.pdf

Looking over the document to get 1% SOC accuracy, 20mv (eyeball number from the plots)

Lets assume 30v full scale a nice round number to measure the battery voltage.

The micro's ADC is 10 bits.

30v / 1024 = 30 mv per bit, not quite making the 20mv number.


LM7805ct initial output voltage is 4.75 to 5.25 v or +-5%

The ADC reference is the 5v supply, so the measurement error is +-5%

Over 30v 5% is 1.5v error.

Rather difficult to measure SOC with this much error?

We have not included the ADC errors or the voltage divider resisters errors etc.


Looking at the plots maybe 100mv total error may be acceptable? For 12v or 200mv for 24v batt.


200mv / 24 = 0.8% total error.

This is not expensive or hard to do, look at the cheap DVM for less than $10, they claim 1%

I have a 5.5 digit very accurate DVM, all the cheap DVM check out against it.

I prefer not to calibrate error out, takes time and is sloppy considering usually not more costly.


By incorporating Amp-hr counting in/out along with battery voltage a decent estimate of SOC can be determined.


Please let me know what your goals are!


Some other considerations:


Resister divider current considerations

Data sheet page 376 (will show as DS p376) states the max input leakage on any one pin is 1ua. To obtain a good reading the resistors current must be 100x or more higher to get better than 1% reading.

Using a very low input leakage opamp (AD8500 ) can fix this problem and allow for the use of higher resister values, but the opamp will add its own errors and it draws current.


ADC

DS p263 the input sample hold cap is listed as 25pF no max listed I could find. The filter cap with the input resisters must be 100-1000x bigger than the 25pF. The filter cap will supply the charge into SH cap introducing a droop error.


Micro's has 10bit ADC, more effective number of bits (ENOB) can be achieved by reducing the filtering (or increasing the frequency of the filter) and over sampling. Over sampling does not improve the accuracy, just resolution. Using a simple digital filter function.

For Each 2x over sampling an extra bit of resolution can be achieved. (4x; 2bits etc.)

Example 10hz filter = 20 samples per second for 1 extra bit.

Protect ADC input with diodes to +5v and gnd. Low leakage transistors work well.


Measuring the generator output

Range is depend on what is important to know.

If its good to know the voltage is above battery. Accuracy is not important here.


Two vs Three PWM

The micro can handle 10k interrupts per second. Using the main timer / interrupts a third PWM using a standard IO pin can be implemented. I have done this many times. No logic.


U7 opto is wired correctly U2 / 3 are not, was throwing me off about the grounds.

I was not seeing the isolation you were talking about!


I will stop here. Let me know if you want more.

Have fun,

Scott.

« Last Edit: July 24, 2007, 10:55:12 PM by (unknown) »

elt

  • Sr. Member
  • ****
  • Posts: 328
Re: advanced controller design
« Reply #11 on: July 25, 2007, 08:21:50 AM »
Hi Scott,


As you know, I'm no EE but I am working on a similar project so I do have some thoughts and questions about this...


You wrote:


to get 1% SOC accuracy, 20mv [...] 30v / 1024 = 30 mv per bit, not quite making the 20mv number.


I'm thinking that 1) 1.5% accurracy isn't too bad (compared to only charging to a 80% SOC) or that 2)using an level shifter or a different micro that has a bipolar ADC input could pick off the top 10 volts (say 20v to 30v) and then the accuracy would be 10mv per bit.


LM7805ct initial output voltage is 4.75 to 5.25 v or +-5%

The ADC reference is the 5v supply, so the measurement error is +-5%

Over 30v 5% is 1.5v error.


You could use a lm7805act to be spec'ed closer to 5 volts but as long as the voltage is stable, it doesn't matter what it is. My experience (with Atmel chips) is that you really do have to figure gain and offset into your voltage calculation if you need to have a "real" voltage reading. The actual voltage of the regulator will just appear as part of the gain constant once you do the calibration.


By incorporating Amp-hr counting in/out along with battery voltage a decent estimate of SOC can be determined.


The accuracy of the ACS755 is 1 or 2 percent at best. Is that good enough for a "decent estimate"? Also, IIRC, the ACS755 is unidirectional so I think that Juggler would need to switch devices (ACS752?) to measure both in and out...


 - Ed.

« Last Edit: July 25, 2007, 08:21:50 AM by (unknown) »

scottsAI

  • Hero Member
  • *****
  • Posts: 884
Re: advanced controller design
« Reply #12 on: July 25, 2007, 05:19:15 PM »
Hi elt,


Excellent! I may be a EE and this controller is much like what I design, then again different enough to be interesting, something to learn from.


With careful design hitting 0.5% and 10 mv resolution is not much more costly.

Just takes a little more time designing. Harbor Freight tools has $3.77 DVM with 1%.

With that said, part availability varies widely, or just want to build it from parts on hand...


30mv / bit may be good enough, don't know for sure. Automotive Vehicle battery monitoring requirements are below 10mv / bit with 150mv total measurement error over temp, time, and manufacturing. So this may be distorting my perception of the needs here.


Averaging several readings improves the ENOB, so 5mv is doable with additional code.

Signal must have some noise for this to work, so using less filtering helps!

Web searching on ENOB will get you more info.


As I mentioned I like to stay away from calibrations, makes everything a one of a kind. In my market that is a huge problem. Choosing the right parts should get you the accuracy without more cost. (or much) Several newer voltage regulators spec 2%, much better. Their voltage drift over temp is better to. Today even voltage references are offering 50ma output current. For this application I would strongly suggest a switching power supply, over all system efficiency is vastly improved.


Using current and voltage are two pieces of information they go hand in hand.

Using both allows for conformation of the other using less accurate information in their collection.

2% or even 5%may be good enough. Unfortunately I do not know. What is needed for a given accuracy in determining SOC. I agree the ACS752 would be good for battery. Then again I like the cheaper shunt using the cabling.


I must admit not sure why measuring power from gen when it would be more useful to know the power in / out of the battery! Just my thoughts.


Have fun,

Scott.

« Last Edit: July 25, 2007, 05:19:15 PM by (unknown) »

WindJuggler

  • Newbie
  • *
  • Posts: 36
Re: advanced controller design
« Reply #13 on: July 27, 2007, 03:55:45 PM »
Hello,


I have updated the controller design same link as before.


I hope this will work better.

« Last Edit: July 27, 2007, 03:55:45 PM by (unknown) »
Wim