Andrew Cowan
Senior Member
I built this as a simple battery discharger recently. A friend wrote some software to draw voltage/time graphs based on incomming data.
It uses a FET driven by an analogue voltage to maintain a constant discharge current.
The current is monitered by a 0.33 ohm (1 watt) shunt resistor.
The unit is designed to discharge AA batteries (1.5V) at 500mA or 50mA, selectable by a switch.
A voltage regulator provides constant voltage to maintain calibration.
The LED in the box is on the serout pin, to show when the 08M is sending data.
Andrew
It uses a FET driven by an analogue voltage to maintain a constant discharge current.
The current is monitered by a 0.33 ohm (1 watt) shunt resistor.
The unit is designed to discharge AA batteries (1.5V) at 500mA or 50mA, selectable by a switch.
Code:
init:
setfreq m8
symbol desiredcurrent = w0
symbol actualcurrent = w1
symbol pwmoutput = w2
symbol actualvoltage = w3
symbol convertedvoltage = w4
symbol convertedcurrent = w5
pwmoutput=0
main:
desiredcurrent = 50 'mA (14.5mA min). Enter low value here.
if pin3=0 then
desiredcurrent = 500 'mA. Enter high value here.
endif
readadc10 1,actualcurrent
readadc10 4,actualvoltage
convertedvoltage = actualvoltage * 100 / 21
convertedcurrent = actualcurrent * 145 / 10
if convertedcurrent < desiredcurrent then
pwmoutput = pwmoutput + 1 MAX 400
endif
if convertedcurrent > desiredcurrent then
pwmoutput = pwmoutput - 1 MIN 400-400
endif
pwmout 2 , 99, pwmoutput
sertxd ("I",#convertedcurrent,"V",#convertedvoltage,cr,lf)
goto main
The LED in the box is on the serout pin, to show when the 08M is sending data.
Andrew
Attachments
-
560.1 KB Views: 189
-
40.3 KB Views: 278
Last edited: