julian on July 15th, 2010

It may be possible to upgrade the specification of the PWM5 to a maximum current more than 4.8 amps. I really want to rate it for use with solar panels up to 100 watts which have a short circuit current around 6 amps.

The 4.8 amp current limit is pretty arbitrary really. It was chosen to ensure that the MOSFET and the external Schottky diode don’t get hot. These are the only two components in the high current path between the solar panel and the battery.

The IRFZ44N MOSFET has a very low on resistance so it dissipates only a tiny amount of power. At 4.8 amps it gets mildly warm. It’s data sheet rating is 49 amps although it would have to be heavily heatsinked to withstand that for any length of time. In the PWM5 charge controller, there’s no heatsink - how much warmer will it get with 6 amps flowing through it?

The TSR845 Schottky diode has a very low forward voltage (relative to standard diodes) but it does dissipate some power and at 4.8 amps can get quite hot. It’s only losing a watt or so, but because of its small surface area the temperature rise is significant.

I use a couple of copper crimp connectors to attach the diode to the yellow wire. These not only anchor the diode to the wires, but also act as heatsinks. The TSR845 is rated at 8 amps continuous and is designed to operate at up to 125 degrees C.

However I might start using the 90SQ040 Schottky diode  which has a 9 amp maximum current rating and can run at 150 degrees C - that’s hot!. It’s a slightly larger component (6mm diameter rather than 5mm) so I’ll need to change the yellow heatshrink from a 2:1 type to a 3:1 type.

So I won’t be ordering any more TRS845s and I’ll change the spec when I start using the 90SQ040s. There’s no significant price difference between the two components, but being able to source the 90SQ040 from Farnell is a bonus. The TSR845s I could only get from a guy in Miami!

julian on May 12th, 2010

The charge controller project has largely exited the design and test phase and entered a production oriented period of activity. However, that doesn’t mean there aren’t any design challenges still to tackle. At each stage of production there are processes that take time, and opportunities exist for the design of production aids or ‘jigs’.

PCB Scoring jig

PCB Scoring jig

One such jig already constructed is a scoring tool to aid cutting of the printed circuit boards (PCBs). This is nothing more than a few pieces of plastic with a sharp knife blade pushed through one of them. It’s simple, but highly effective for making accurately cut circuit boards which had proved very difficult using a ruler and knife.

Another tool is a simple strip of plastic cut to different widths so that component leads can be pre-formed to fit into the holes on the PCB. Yet another facilitates the cutting of short, but accurate lengths of heat shrink tubing.

Even stripping back the connecting leads was proving to be slow and not entirely accurate, so an automatic wire stripper was acquired which solved that particular problem.

All this ‘tooling up’ gives an insight into the massive growth of  automated assembly and test systems that make modern electronics cost effective to manufacture (even if it has to be done in the Far East). It also  explains why technology tends to drop in price dispite ever increasing complexity.

It has to be understood though, that this only possible because energy is cheap. If energy becomes more expensive in future, the cost of technology will increase accordingly.

julian on April 25th, 2010

pwm5-wholeThe PWM5 Charge Controller is now available in my new shop - click on the shop link at the top of the page. There are two items for sale - both identical, one is priced in pounds and is intended for UK buyers, and the other is priced in US dollars and is for purchasers from the rest of the world.

Since one of the main features of the PWM5 is the way in which two controllers can be used in various configurations, I will add a twin pack product soon.

julian on April 14th, 2010

julian on April 14th, 2010
Non-linear voltage/current curve

Non-linear voltage/current curve

Too great a compromise. That’s the upshot of trying to use two 5.6 volt zener diodes in series instead of a single 9.1 volt diode.

The 9.1 volt has a completely stable reverse voltage over a wide range of current. The 5.1 and 5.6 volt zeners are completely different and have a non-linear current/voltage relationship. I thought I could find a straight line approximation and factor it in by altering the potential divider ratio, but I’m not happy with either approximations or compromises, so this idea is abandoned.

That takes us back to the 9.1 volt diode, or a different solution altogether. The 9.1 volt diode has a temperature coefficient that I’m not happy with, so I propose to do away with the diode.

So this opens up a whole new can of worms because the A/D converter will now have to span the entire battery voltage from 0 volts right up to 25.575 volts. The full 10-bit range of the A/D converter will have to be used. Once again, 40 A/D steps will equal 1 volt, so 1023 steps equals 25.575 volts. There will be a number of new techniques required to make this work including some 16-bit maths, A/D reading during processor sleep (to minimise noise) and synchronisation of the A/D with the pulse width modulator.

Tags: , ,

julian on April 4th, 2010
Zener Voltage vs Current

Zener Voltage vs Current

Time to have another look at the battery voltage measurement circuit - and in particular the behaviour of the zener diode.

The purpose of the zener diode is to shift the relevant range of battery voltages (between 10 and 15 volts) to the 0 to 5 volt range of the PICs analogue to digital converter. About 10 volts needs to be dropped, so the choice of a 9.1 volt Zener was logical. What would be the impact if a 5.1 volt zener had been needed instead?

I’ve discovered that 9.1 volt and 5.1 volt zener diodes are like chalk and cheese! Not only do they have opposite temperature coefficients, but also they have an entirely differently voltage/current relationship. The 9.1 volt zener has a completely stable reverse voltage over a wide range of currents; the 5.1 volt device has a predictably non-linear relationship.

The point of this post is to find a way to minimise zener voltage variations caused by changes in ambient temperature. The 5.6 volt zener has the smallest temperature coefficient of the lot, so we need to find a way to replace the 9.1 volt zener with two 5.6 volt zeners stacked in series.

The relationship between ADC voltage and battery voltage is:

Vadc = 0.78125 (Vb - Vz)

The 9.1 volt zener has a fixed reverse voltage, so Vz is a constant. Two 5.1 volt zeners have a combined reverse voltage that is a function of the current flowing through them, and therefore a function of battery voltage. Plotting the zener voltage curve and approximating to a straight line of the form y = mx + c, the formula becomes:

Vadc = 0.78125 (Vb - (mVb + c))

m and c must be derived from the plotted graph. Ignoring the constant for a moment, m simply alters the ratio of R1 and R2 in the potential divider, so we can compensate for the behaviour of the zener diodes by using different resistor values.

OK, now let’s think this through. As Vadc rises from 0 to 5 volts, Vb must rise from 0 to 6.4 volts (ignoring the level shift). This is to create the one tenth of a volt to four bits relationship. Hence the 0.78125 factor (0.78125 x 6.4 = 5). However, if the zener voltage (Vz) increases as Vb rises, then Vpd won’t move the whole 6.4 volts; it’ll rise less far, perhaps even (spookily) 5.0 volts.

Hmm…

Tags:

julian on April 1st, 2010

PWM for precise voltage control

The PWM5 uses pulse width modulation to connect and disconnect solar panel and battery 122 times a second. This allows for very precise control - battery voltage is held at the optimum level. Some charge controllers just disconnect when an upper voltage is reached.

Bulk, Saturation and Float

The PWM5 has a full suite of charge phases. This ensures the battery is charged as quickly as possible and also protected against overcharging.

Flexible configurations

If you have more than one PWM5 charge controller you can do some clever things. You can connect a separate solar panel (up to 85 Watts) to each controller and feed the combined power into one battery. Or you can charge two or more separate batteries from a single solar panel (85 Watts max) - great for sailboats! All we ask is that you don’t put more than 4.8 Amps through each controller (hence the limit of 85 Watts per solar panel).

Series connected

Beware of ’shunt’ controllers which short circuit the solar panel when the battery is full. This is a waste of precious solar energy. The PWM5 is series connected so when one battery is full, surplus solar power can be used to charge another battery.

Extremely low self-consumption

The PWM5 uses less than 1 milliamp of precious battery current. And that’s with the LED switched on (it uses even less with the LED turned off). Compare that with other charge controllers - some don’t even publish the current they consume.

LED voltmeter and PWM indicator

Our blue LED doesn’t just tell you when it’s charging - it tells you the battery voltage as well. Two slow flashes and five rapid flashes - that’s 12.5 volts. And when it starts modulating (pulse width modulating that is) it shows you how much power is being used to hold the battery voltage steady.

Protected

The PWM5 is protected against short circuit and reverse polarity on both the battery and solar panel connections (just don’t short circuit your lead-acid battery, that ain’t good). It’s also protected against power spikes on the solar panel cables and it emits almost zero radio frequency interference.

Waterproof

Lead-acid batteries should be kept outdoors and so should your solar charge controller. So it needs to be 100% waterproof. If your controller has screw terminals, it’ll let moisture in. The PWM5 is 100% waterproof.

Load Disconnect?

We don’t believe your charge controller should decide when to disconnect the load. The last thing you want is lights going out without warning. You’ll probably be using an inverter to generate mains power, and most inverters have a low voltage alarm (and a disconnect circuit). Charge controllers should stick to what they do best - keeping your batteries charged.

julian on March 16th, 2010

This program uses Timer0 and the PICs interrupt system to flash an LED connected to GP2 on the PIC 12F683.

The program uses a special kind of subroutine called an interrupt service routine (ISR), but there’s no ‘call’ instruction anywhere in the code. Instead, the subroutine is called by the PIC hardware by enabling interrupts.

To keep this program as short as possible, I’ve cut a few corners. Firstly, there’s only one interrupt source enabled (Timer0), so the ISR doesn’t need to check where the interrupt has come from. Also, because the main program doesn’t use either W or the STATUS register, the ISR doesn’t need to save and restore these.

If you follow the program flow, it starts by jumping over the ISR to the init section. Here a few things are set up before the program locks itself into a tight loop at the stop label. From then on, it relies on Timer0 overflowing and generating an interrupt, whereupon isr is called. This toggles bit 2 of GPIO and so the LED flashes.

;12F683 Flashing LED using Timer0 and interrupt
;LED is connected between GP2 and ground via 220ohm resistor

 list p=12F683
#include "p12f683.inc"

 __CONFIG _INTOSCIO & _WDT_OFF

temp	equ	0x20

 org 0x00

start
	goto	init	;jump past the interrupt service routine

 org 0x04

isr
	incf	temp,f	;increment temp register
	bcf	GPIO,2
	btfss	temp,2
	bsf	GPIO,2
	bcf	INTCON,T0IF	;clear Timer0 interrupt flag
	retfie		;return from interrupt

init
	clrf	temp	;clear temp register
	clrf	GPIO	;clear GPIO

	banksel	0x80	;select upper register bank
	movlw	0xD7
	movwf	OPTION_REG	;start timer0 with 256:1 prescale
	bcf	TRISIO,2	;make GP2 an output
	bsf	INTCON,T0IE	;enable Timer0 interrupt
	bsf	INTCON,GIE	;enable global interrupts

	banksel	0x00	;select lower register bank

stop
	goto	stop

 end
julian on March 4th, 2010

At the moment, the mechanism for switching between saturation and float is relatively simple. A counter ticks steadily upwards or downwards depending on whether the PWM duty cycle is at 100% or not. At each end of the range of this counter, the mode (saturation or float) is changed.

This technique works reasonably well and is simple to implement, but it doesn’t very accurately model what is happening inside the battery. We need to model the charging process more closely to determine when to switch between saturation and float charge modes.

Let’s assume that the battery is at equilibrium between 13.0 and 13.5 volts. Within this band it is neither charging nor discharging. Above this range, the battery is taking in charge and we must let our timer migrate toward the point where we switch to the float charge phase. At higher voltages, the timer can count more quickly.

Tags: , , ,

julian on February 24th, 2010

The purpose of the charge controller is to fill the battery with charge as quickly as possible without causing any damage.

Letting the battery voltage rise to 13.5 volts, then holding it there using PWM is fine, but the battery saturates (fills with charge) slowly. Allowing the voltage to rise initially to 14.4 volts, then dropping back to 13.5 volts once the battery is full, speeds up the process. The battery should not be held at 14.4 volts indefinitely, nor should it be allowed to rise above 14.4 volts at any time.

So how do we know when the battery is fully charged? One method is to monitor current flow into the battery. During the saturation charge phase, the voltage is held at a constant 14.4 volts, but the current required to keep the voltage constant, gradually reduces. The reduction in current is not linear, but decays exponentially until a steady state current flow is reached.

We can’t measure current directly, but we can see it change by monitoring either PWM duty cycle change, or variations in the difference between voltage measurements taken when the FET is off and those when it is on.

A simpler, though less accurate approach is to use a timer. We can permit saturation charging at 14.4 volts for a number of minutes, then switch to float charging at 13.5 volts. However, the timer needs to be sophisticated enough to operate correctly regardless of external influences.

One such external influence is the grid-tied inverter. This device kicks in once the solar panel reaches about 14.2 volts, effectively preventing the battery ever going above this point. If the timer starts operating at 14.4 volts, it will fail to increment and the battery will be held at a high voltage for too long.

One approach would be to increment the timer slowly at voltages a little above 13.5 volts and more rapidly at voltages higher than this.