lm339 comparator for battery charger - switching on and off too fast or going half on?

Discussion in 'The Projects Forum' started by rudyauction8, Aug 16, 2015.

  1. rudyauction8

    Thread Starter Member

    Jan 27, 2012
    252
    2
    So I'm using a lm339 comparator to switch my charger on and off for my 60v battery. Even with hysteresis it switches the relay so fast the relay melts from the arcs. It seems to go to a state where it is half on, instead of being either on or off. Note that the relay is driven by a power transistor. My circuit is near identical to this one: [​IMG], vref is 7805 regulator, r8 is 10k plus 10k trimmer in series, r9 1k, r10 100k. What am I missing here? I just need it to slow to no more than one relay cycle per second. I'm guessing a capacitor somewhere would help, but I'm new to comparators.
     
  2. rudyauction8

    Thread Starter Member

    Jan 27, 2012
    252
    2
    The comparator is powered by a 9v 1a supply, and there is an LED in parallel with the relay, thats how I noticed the half on - the LED would be dimly lit while the relay was switching. The relay is part of a digital timer I took apart, it has its own power supply and transistor and only takes a couple ma to activate.
     
  3. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    Post the full schematic. The bits you posted make no sense.
     
  4. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    5,791
    1,103
    That gives only ~1% hysteresis. Try reducing R10 to, say, 10k. Have you got a reverse-biased catching diode in parallel with the relay coil?
     
  5. rudyauction8

    Thread Starter Member

    Jan 27, 2012
    252
    2
    Tried 10k the relay was buzzing 3x as fast, and no i don't.
     
  6. GopherT

    AAC Fanatic!

    Nov 23, 2012
    6,025
    3,789

    I think you left off the most important part of your story. Do you understand that the LM339 is an open collector output and you need a pull up resistor to supply current to the NPN output inside the chip?

    Also, is your load on your 9V at 1 amp power supply so big that you have some voltage sag when charging vs not charging. If you have sag, that may be causing the oscillation. To remove the effects of sag, you can have the NPN drive a PNP in your output and flip your input signals on the comparitor (that way, the sag will give you desirable hysteresis instead of undesirable oscillation). It was already requested above, please post the WHOLE schematic so we can see if my speculation is true - or if any other obvious error exists.
     
  7. rudyauction8

    Thread Starter Member

    Jan 27, 2012
    252
    2



    In the end I forgot my charger was not ground isolated, and when I tried to use the 60v battery to power the relay I accidentally pumped about 70 volts through the comparator, 7805 and power transistor, all 3 literally exploded (as expected when overvolting chips to 2x their max voltage with reverse polarity). Since I'm upgrading to lithium this wednesday I decided to just use the timed setup I was using until then. Yes I do have a proper lithium charger coming as well btw so no need to worry about blowing my battery up.
     
    Last edited: Aug 17, 2015
  8. GopherT

    AAC Fanatic!

    Nov 23, 2012
    6,025
    3,789
    Well, that's another way to solve the problem. It happens to all of us (if it hasn't happened to someone, they are either lucky or not building anything. Thanks for the update.
     
  9. rudyauction8

    Thread Starter Member

    Jan 27, 2012
    252
    2
    Sure, and I may revisit this with one of my 36 volt scooters at some point. As great as lithium is, SLA batteries will always power something in my garage, and with a non-automatic charger that I use on all of my packs (current limited and can charge 6v to 96v packs) I cook my SLA batteries all the time. That's why I always buy them used from the scrap yard. I can get a dozen batteries for $20, that hold half their charge, and new they'd be $20 each. And of course I get about $10 back when I'm done with them.
     
Loading...