Shop OBEX P1 Docs P2 Docs Learn Events
I'm looking for help in safely connecting my BS2 to a 12volt auto electrical sy — Parallax Forums

I'm looking for help in safely connecting my BS2 to a 12volt auto electrical sy

slmranchslmranch Posts: 3
edited 2009-02-12 16:33 in BASIC Stamp
I'm new at this and looking for some guidance. I want to connect my BS2 to a 12 volt automotive system. From forum searches, Google searches, etc., I understand that I need to protect my BS2 from inductance voltage spikes by using something called a flyback diode. Correct? I read that it should go as close to the load as possible. The load in this case is my BS2, not a transformer as most diagrams show?

I have a positive and negative wire coming off of the accessory terminal of the key switch to a plug on my project box. Is it correct that the diode would go across the BS2 pins Vin and Vss, but inverted with the anode(+) to Vss and the cathode(-) to Vin?

And...because an alternator puts out higher voltages for awhile after starting (to recharge the battery), would it be safer for the BS2 if I were to use a couple of resistors as a voltage divider before I connect to the Vin? Something to drop the voltage down around 9 volts, but still high enough to allow the BS2's on board regulator to do it's job?

Or, if I going about this all wrong please set me straight.

Thank You in advance,
Steve

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-02-11 18:23
    Steve,

    I am not clear on what 12V signals you want to connect and how, however I do have experience at this using both the BASIC Stamp and the Z80. Modern car electrical systems are significantly less noisy than older cars used to be. That said, I’m sure you’re aware that the actual voltage varies significantly depending on engine RPM and charging cycle. For this reason, diodes and resistor voltage dividers are not the best choice for interfacing. My suggestion would be optical isolation for any inputs you want to read and MOSFET or relay outputs depending on what you want to control. Because cars are negative ground to the chassis it is often desirable to switch devices on the high-side which can make otherwise simple interfaces slightly more complex.

    If you could list details on what you’re trying to do exactly, I might be able to provide you with some examples of how to go about this. Others may have input as well. But it is necessary to first define your needs in detail. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
  • slmranchslmranch Posts: 3
    edited 2009-02-11 20:16
    Hi Chris,
    Thank you for your speedy reply.

    I'm just trying to learn about the stamp by playing around with it. I want to use the BS2 to interface with some of the sensor modules Parallax has available like the temperature/humidity, compass, acceleration/tilt and Ping. The interface is to an old 4 cylinder diesel tractor and is purely to keep from eating up nine volt batteries with the Board of Education.

    Steve
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-02-11 21:23
    Well if you’re just trying to get power into the BOE you can get what you need from Radio Shack. You’ll need a DC Barrel Plug for power, and the wire. You may even be able to buy a pre-fab harness from them that plugs into a Cigarette Lighter. The main thing is that your old tractor power may need filtering. If this is the case you can probably get an Audio Noise filter from them as well. These used to be sold to remove alternator and spark plug noise from stereos that would whine as you revved the engine. Of course, when looking at noise spikes on the scope it’s important to notice if they’ll interfere with voltages regulated well below their noise floor. One final consideration is maximum input voltage. If you’re using a BASIC Stamp 2, the maximum voltage you’ll want to run into the BOE is 15V. For other BASIC Stamp models it is 12V. This is because on the BOE the VIN goes directly to the BASIC Stamp regulator. I hope this helps. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
  • MrBi11MrBi11 Posts: 117
    edited 2009-02-11 21:23
    Steve, for powering your Stamp, look into a 78H05 regulator used with a heat sink, you should be able to power your devices up to 5 amps.
    for input from your 12 Volt switches [noparse][[/noparse]i.e. connected to the brake lights] I'd optically isolate it.
    attachment.php?attachmentid=58643
    Output I'd use transistor driver or maybe a ULN2803 Driver
    attachment.php?attachmentid=58640

    Obviously devices not 12V need to be connected as needed, your modules will all be TTL (5V) level

    [noparse][[/noparse]oh, and connect pin 10 on the 2803 to +12V to prevent surges backfeeding into the circuit]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Smile ... It increases your face value!

    Post Edited (MrBi11) : 2/11/2009 10:43:41 PM GMT
    590 x 340 - 23K
    590 x 172 - 11K
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-02-11 21:45
    Your Opto circuit seems to have two issues…the first is the LED can’t light. It has no ground reference. On the photo-transistor side the emitter should be to ground, and the collector should be tied to the I/O pin as well as to a pull-up resistor. Granted, this is inverted logic, but the normal way it would be done. If using it the way you suggested you would need a pull-down resistor. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
  • Carl HayesCarl Hayes Posts: 841
    edited 2009-02-11 21:58
    I concur in Chris's analysis and recommendations.

    Optoisolators are often recommended here in applications for which they are not the best choice (because they seem gee-whiz to many, I guess), but in an automotive sensing application they are the perfect choice.· Applications like yours are what optoisolators were invented for.

    You do have to wire'em up correctly, though, which is easy.· The way shown by MrBi11 cannot possibly work.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    · -- Carl, nn5i@arrl.net
  • MrBi11MrBi11 Posts: 117
    edited 2009-02-11 22:09
    opps.. I only screwed up a few things when I drew it up.... Sorry

    I'll get on that

    Okay, changes made.. it's amazing what you can come up with if you drink enough NyQuil

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Smile ... It increases your face value!

    Post Edited (MrBi11) : 2/11/2009 10:52:04 PM GMT
  • Craig EidCraig Eid Posts: 106
    edited 2009-02-11 23:49
    Steve,

    You should add some inductance and a large capacitor at the input of the 7805 to filter unwanted spikes from the electrical system. I have attached a schematic for a·design that we use that includes a 220 uh inductor and a
    47uF capacitor at the input to the 7805.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Craig Eid

    www.TriadRD.com
    1280 x 768 - 55K
  • slmranchslmranch Posts: 3
    edited 2009-02-12 16:33
    Thank you everyone for your suggestions and help. The diagrams are very helpful. You've given me several solid starting points. Being a beginner I don't have any idea which of the suggestions would work best for my situation, so I think I'll play around and try them all. I'll repost later and let everyone know how it goes.

    Again, thank you for your time and help,
    Steve
Sign In or Register to comment.