Using Basic Stamp to Control a Charger
Slylark
Posts: 2
I am new to the Basic Stamp and started learning.· I wanted to ask the group about my project and the best way to proceed.
In a nutshell, I have a VW Rabbit that was converted to a 96V electric car and this car has a "dumb" charger.· I would like to use the Basic Stamp to turn off the charger when a specific number of Amp Hours are replaced in the batteries during charging.
I currently use an E-meter with RS232 which measures the Amp Hours used and replaced.· I should be able to connect the Basic Stamp to the RS232 and read the data (which is sent every second).
So.... I need to write a program that looks at the string of data and sends instructions to a switch when the defined value is reached.· This switch will then turn the charger off.
Anyone know how to do this?· I am interested to hear any thoughts on this project.
Thanks
Joel
In a nutshell, I have a VW Rabbit that was converted to a 96V electric car and this car has a "dumb" charger.· I would like to use the Basic Stamp to turn off the charger when a specific number of Amp Hours are replaced in the batteries during charging.
I currently use an E-meter with RS232 which measures the Amp Hours used and replaced.· I should be able to connect the Basic Stamp to the RS232 and read the data (which is sent every second).
So.... I need to write a program that looks at the string of data and sends instructions to a switch when the defined value is reached.· This switch will then turn the charger off.
Anyone know how to do this?· I am interested to hear any thoughts on this project.
Thanks
Joel
Comments
Do you know what a typical stream looks like? How about connecting your computer up to it and posting an example of the stream.
Do you have any code started?
How is your charger connected to the system? Does it plug in to 120Vmains? Does it have any controls on it?
Do you just want to shut off the charger, or do you want to ramp through different stages of charging (start with a hard charge, and then lighten up as it gets closer to full charge?)?
Anyhow, you'd essentially want to read in the serial data and look at the data that reflects what the A/Hr capacity is....then you'd want to activate some sort of relay to shutoff the charger.
You'd want to have some safeties in there in case you lose communication with your meter....you wouldn't want the charger to keep running.
Maybe have an audible alarm for when it's done charging.
Do you Have PBasic installed? Go to the help file and read up on the SERIN command.....
Further....if you are new to the stamp, go to the Parallax website and download (FOR FREE) their "What's a Microcontroller" pdf and go through it. It's a great way to learn the stamp.
They also have other free texts on their website that would allow you to further learn how to program....I've yet to go through them all!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·
Steve
"Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
You should already have a shunt inline with your battery that the E-meter is using to monitor the current. You can use it with a comparator like originator99 suggested to tell what the current is. Please tell us what type of shunt you have it should have the numbers on it.
The charger that I am using is an old K&W BC20 charger that works on 110V.· This charger has settings for current and voltage.· The charger is setup to do the bulk charge and then decreases the current to 2%-4% of AH to complete the finish charge.
The key is to turn the charger off once the finishing charge has been completed.· In this case, the charge does not know when that is.· This can affect how much energy has been put back into the batteries,·can also cause a loss of more water than is needed and can shorten the life of the battery due to over/under charging.
I will check on the shunt.· THere are some specs in the manual.
Thanks for the input, this is going to be a fun project for me.
Using a shunt might be a better representation of what's happening....of course, the only real test is to load test the battery and remove the surface charge.
So far as your rs232 stream goes....it'd really be helpful if you captured this in Hyperterminal (or some other like program) and posted the stream.
But, essentially what you would be looking at is a stream of data where each value is separated, from the other, by a comma.
So you can use the SERIN command like this:
SERIN Rx, Baud, TimeOut, No_GPS,
······· [noparse][[/noparse]WAIT("@"), SKIP 6, DEC2 hr, DEC2 mn, DEC2 sc,
········ latHemi, DEC2 latD, DEC2 latM, DEC2 latF, SKIP 1,
········ lonHemi, DEC3 lonD, DEC2 lonM, DEC2 lonF, SKIP 1,
········ SKIP 4, altSign, DEC5 alt,
········ ewDir, DEC4 ewVel, nsDir, DEC4 nsVel]
Now, I've taken this from a program that grabs the RS232 data from a GPS...you're basically looking for the same capabilities.
This serin line waits to see an @ and then SKIPs 6 bytes.· If you look at the PBasic help file under SERIN, you see how the modifiers work.
But, if your data changes size (goes from a 77 to 188 -- 2byte to 3byte) then you may have to come up with another way to pick your data out.
I'm not sure I'd trust the meters temperature measurement....you should maybe look at installing your own temp sensor on the batteries to monitor for overcharging.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·
Steve
"Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
In this corcuit, LM339 need 12 volts to its +v in, and 5 volts on the output pullup resistor to get 5volts logic out.
The two leads going downward that are cut off are going to the shunt resistor, in my case, a 1.2 ohm 3 watt. In+ goes to the + side of the battery, In- is to the opposite side of the shunt resistor.
This IC handles very large voltages. You may be able use an existing shunt though. Unless you are just realy trying to learn serial i/o, this is the easiest application of current and temp to get a logic output to the stamp.