Shop OBEX P1 Docs P2 Docs Learn Events
Interfacing 12V Square Wave — Parallax Forums

Interfacing 12V Square Wave

tdeyletdeyle Posts: 85
edited 2008-12-20 20:39 in Propeller 1
I need to interface a 12V Square Wave into the Propeller.

This is coming from a MSD 8913 Tach Driver. What it does is take the electrical signal from my engine's ignition coil and turn it into a square wave that is relative to the engine's RPM. I am unsure of the current output that this device can put out, so I do not think a series resistor is safe.

I am leaning more towards an optoisolator but am unsure as to how I am going to wire it into the prop.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-12-20 02:57
    You can use a simple voltage divider to divide the 12V in 1/4 to give a 3V signal. This assumes that you can have a common ground and that there's not too much noise on the ground that the Tach Driver is using. The simplest way would be to connect 4 - 10K resistors in series with one end of the string connected to ground and the other end of the string to your Tach Driver. If you connect a Propeller I/O pin to the non-grounded end of the resistor connected to ground, you'll have a 3V signal when a 12V signal is output by the Tach Driver.

    See this article on voltage dividers: www.doctronics.co.uk/voltage.htm

    An optoisolator would also work well and would isolate the Propeller from the tach circuit. Search the web for "wiki optoisolator" and follow some of the links to get details on how to use them. Also read the manufacturer's datasheets.
  • Erik FriesenErik Friesen Posts: 1,071
    edited 2008-12-20 03:37
    I have had trouble with just resistors. If you do a voltage divider I recommend some sort of surge protection like a 3 volt zener or an automotive tvs on the high side. Another simple but very effective way is to use an npn with a pullup. Since the npn is not cmos it is much more resistant to voltage spikes.
  • tdeyletdeyle Posts: 85
    edited 2008-12-20 16:43
    That gives me an idea, since the signal is a 0-12V square wave, would I be able to use a 3V Zener to clip the signal and send it to the Prop?
  • LeonLeon Posts: 7,620
    edited 2008-12-20 17:52
    Or, just use an ordinary diode connected to 3.3V to clip the signal. You'll get better rise and fall times.

    Leon.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • Ken PetersonKen Peterson Posts: 806
    edited 2008-12-20 18:19
    I just did a simple series resistor, but I chose a rather high value like 40K - 100K. It should work well unless you have a noisy environment. In my application I used the input to turn on a device whenever a vehicle is put into reverse, so I tapped the line to the reverse lights. So it wasn't high frequency or anything, and easily debounced in software.

    If you figure a maximum 25V input and 500uA maximum current through the protection diode, that comes to about 42K for a series resistor.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"I have always wished that my computer would be as easy to use as my telephone.· My wish has come true.· I no longer know how to use my telephone."

    - Bjarne Stroustrup
  • CannibalRoboticsCannibalRobotics Posts: 535
    edited 2008-12-20 20:39
    Since you said Tach I'm assuming you just need to look at the frequency of the sin wave, not the amplitude. TVS's are an issue in cars. So, you could opto isolate it with an IR emitter/detector pair. Put them into a piece of black heat shrink pointed at each other.
    Line up the emitter on your source with 470ohm resistor and bias the detector with 3.3 volts from the prop.
    If you decouple the Emitter output with a capacitor you will only illuminate the emitter when in the top half of the sin wave. That should be enough to get a very good zero crossing time figured out and you would not have to worry about transient surges at all.
    J-

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Signature space for rent, only $1.
    Send cash and signature to CannibalRobotics.
Sign In or Register to comment.