Shop OBEX P1 Docs P2 Docs Learn Events
Using Basic Stamp to Control a Charger — Parallax Forums

Using Basic Stamp to Control a Charger

SlylarkSlylark Posts: 2
edited 2006-06-15 22:01 in BASIC Stamp
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

Comments

  • steve_bsteve_b Posts: 1,563
    edited 2006-06-14 15:14
    This is certainly easy to do if your meter does indeed send RS232 data.
    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."
  • T ChapT Chap Posts: 4,217
    edited 2006-06-14 17:05
    If you are locked into the RS232 idea then forget my suggestion, but it would be very easy to put in a current sensing IC that would read the current, convert it to a voltage, send that to a comparator(or A/D) then you can put a 1 or 0 into the stamp that says very simply charged = 1 or below charge = 0 google "current sensing" if interested. The RS232 is already doing the same thng, a sense circuit > D/A. This can done with maybe 5 parts for $3 cost.
  • bennettdanbennettdan Posts: 614
    edited 2006-06-14 20:45
    Slylark,
    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.
  • SlylarkSlylark Posts: 2
    edited 2006-06-14 22:04
    It appears that the RS232 stream is 40 char, see page 49 of the attached user manual to learn more.

    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.
  • steve_bsteve_b Posts: 1,563
    edited 2006-06-15 13:33
    I haven't checked the manual....but would the E-meter mis-measure the A/hr rating while you are charging, since the charger is putting in more current/voltage than the battery is holding?

    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."
  • T ChapT Chap Posts: 4,217
    edited 2006-06-15 21:49
    If this helps: For temp you could very easily use the LM34, only 3 pins, voltage in, GND, and an output, send the out to an LM339 Comparator, set a threshold and the comparator will output a 1 at a set temp. Mount the LM34 on top of the battery using a thermal conductive compund. On a 1 the stamp can do anything you want, soun alarm, shut off charger, drain the battery slowly, etc. All these parts are under 4 bucks at all electonics.
  • T ChapT Chap Posts: 4,217
    edited 2006-06-15 22:01
    Oh also, a GREAT IC for current sensing, should you go that route, is Analog devices AD628 available at digikey. Run it to the the extra inputs on the LM339 comparator.

    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.
    847 x 507 - 52K
Sign In or Register to comment.