Battery Charger
Tapperman
Posts: 319
I Hope I'm not duplicating another post? I searched the forum for such a device, and did not find anything really close.
Has anyone built a battery charger from a propeller? I would love to see a schematic, if so. I've been toying around with the attached circuit, and think it has promise. It only gives feed back on the battery for now, but that's a great starting point.
A Good Charger should plot the battery voltage versus load current at any given instant, and keep track of amp hours installed in the battery, etc.
... Tim
Has anyone built a battery charger from a propeller? I would love to see a schematic, if so. I've been toying around with the attached circuit, and think it has promise. It only gives feed back on the battery for now, but that's a great starting point.
A Good Charger should plot the battery voltage versus load current at any given instant, and keep track of amp hours installed in the battery, etc.
... Tim
Comments
Paul
Well, Im not very good at explaining things. But Ill try. If you look at the picture attached, youll see the functional block diagram for the 555 (8 pin DIP). There are 3 (internal) 5K ohm resistors that divide the supply voltage (Vcc, from 5 to 15v) powering the chip on pin 8. And the two comparators set and reset the internal flip-flop. The internal flip-flop operates the output line (high for on) on pin 3, as well as the discharge transistor connected to pin 7.
But, perhaps you are already familiar with the internal design of the timer. I have wired the 555 as an astable oscillator. And in a typical application, your RC network would be powered by the same voltage supplied to the 555. But, in the circuit I uploaded earlier, I have removed the RC network connection from the 5v supply line and connected it to an external voltage to be checked.
One side note, Im not sure what value my capacitor is? I am unable to read the label. But, when I connect to the RC network to the power pin (pin 8) the circuit generates a 95 Hz signal. And below is what I have measured to far:
... Tim
In essence you are comparing the input voltage to the 5V powering the 555 timer. The thresholds for the comparators would be at 1.67V and 3.33V, so you are measuring the time it takes for the unknown voltage to charge the capacitor from 1.67V to 3.33V through the 470K resistor. This determines the frequency, which is proportional to the unknown voltage.
Yes ... That was better said than I expressed it ... the input voltage controlls the output freq.
... Tim
Paul
Here's the Scope look at the voltage on the cap, when measuring 9v. Notice the Max & Min voltages?
... Tim
Using it to map voltages up to 18v today!
Going to charge a good 12v battery and then a bad 12v battery that wont take a charge, and post those scans as well.
... Tim
The Bad battery is a deep cycle 12v lead acid battery from Sears. It will no longer take a charge.
The other battery is a group 78 12v lead acid battery from my chevy van, and it takes a charge.
... Tim
I'm trying to calibrate my routine and I'm using the following:
But, I am unable to read the square wave from the same pin? Will the output from the timer to a pin, be readable from the same cog containing the timer?
... Tim
There! Maybe it will work better if I put it in a quote box.
... Tim
If you are charging NiMH, check this out: http://www.panasonic.com/industrial/includes/pdf/Panasonic_NiMH_ChargeMethods.pdf
At the momemt ... I'm not charging any type of batteries ... I was asking a question about the propeller's internal structure and operation.
Here is the very same question, for the third time!!!
Thank you in advance,
... Tim
To answer your question: Will the output from the timer to a pin, be readable from the same cog containing the timer?
Yes, you can read the state of any I/O pin at any time from any cog, even if a counter module is driving the pin. If one part of your program is driving a pin and you sample that same pin with INA[pin], whatever the state the pin is being driven to (high or low), INA will return that state.
Even though this does not make use of a counter, consider the following demo program:
The code in the "meh" method sets pin P1 to an output and toggles that pin every second resulting in a .5 Hz frequency. This code runs freely in its own cog, cog 1. In the starting cog, cog 0, the "go" method freely runs. It sets up the pin directions of P0 and P1, then continuously copies the read state of pin P1 to pin P0.
The resultant operation of the program is that pin P1 toggles at .5 Hz, and pin P0 mirrors the state of pin P1.
I hope this answers your actual question.
RE: "I'm trying to calibrate my routine" - What are you trying to calibrate ? If you are trying to calibrate the voltage measurement I would have expected that you would have put known voltages in to the '555 and record the voltage and average count to create a calibration table and/or curve over the range of voltages you are interested in.
Try running this program:
This starts up counter A in cog 0 to toggle a pin (in my case, pin P1) at 1 Hz. The main loop then copies the state of P1 to P0 so that P0 mirrors the state of P1. If I understand your question correctly, this proves that you can read the state of an I/O pin being driven by a counter module at any time.
I have that in a spread sheet already ... but, spin is slow ... and the READ555() method has an expression in the return line, so my thinking was, if I used the same routine to read the reference signal (500 Hz), which is 1 ms on and 1ms off, I should be able to calculate the 'error' between 1ms and what is being returned by the spin method. Does that make sense?
... Tim
It seems to return 80,000 every time I calibrate off of the 500 Hz wave ... curious, I thought it would be slightly higher.
... Tim
BTW - I forgot to say thank you for the feedback!!!!
I think I understand what you are doing here, but I don't see how it can help with speed or accuracy. Subtracting the 500 Hz reference from the '555 signal is basically the same as subtracting a constant from the '555 frequency.
My approach to calibrating this would be:
Create a calibration table ( input voltage vs counts ) that has more points in the area of interest ( say 11 - 14V ) and fewer above or below that area.
Count the pulses from the '555 for a fixed period that is long enough to provide a good stable average and store the count for each voltage point.
To calculate the battery voltage search for the first point that is lower than the current count and use that point and the next one higher for a straight line interpolation between those points.
Simple to program and provides pretty good accuracy.
the timers have no capture-mode, so they are not very well suited for time measurements.
But there is the wait-port-equal statement, which makes it possible to wait for a signal and store then cnt. If you do that twice, you can measure the time-.difference bewteen two flanks.
wait for low
wait for high
a = cnt
wait for low
wait for high
b=cnt
difftime = b-a
I assume, that spin will be fast enough for 500Hz.
Good luck!
Christof
Thankyou for your input. And that will give you the period time. But I should explain
This would return the wrong time! You see when you charge the cap with a high enough external voltage, the 'off' time begins to increase! So I choose to read only the 'on' time for the 555. This is the time pin 7 is 'open' and not discharging the cap. Then I calculate a freq from that time (as though it were the period time [on+off])
The hope is to avoid including any of the 'off' time from the 555.
This means the a-stable formula for the 555 (ie, ln(2)rc) to charge will not apply. You need to realize that the charge time is the integral of current into the cap. And this is the difference between (applied external voltage and cap voltage)/470k ohms integrated from a lower limit of 5/3 volts to 10/3 volts (assuming the external voltage doesn't vary to much in that time).
The nice part, is when reading voltage between 10v and 24v (my current max), the change in freq is linear with voltage (nearly).
... Tim
I believe this should clear up 'how'... as to why? Because I like it! Even though I often re-invent the wheel (as it were), I truly enjoy the learning experience that goes with it, more than the final product!
... Tim
Can't argue with that. It will work at least as well as what I suggested.
Have never had a current meter fast enough to see this before.
... Tim