Shop OBEX P1 Docs P2 Docs Learn Events
I need some advice on interfacing a 12v 20% duty cycle to a propeller pin — Parallax Forums

I need some advice on interfacing a 12v 20% duty cycle to a propeller pin

The project is a tachometer for a watercraft using a MSD total loss ignition. The MSD
provides a wire to drive a tachometer. The signal from the MSD is a 12v, 20% duty cycle.

The project is nearly complete, except I am not sure how to connect the Propeller to the
tachometer wire. I have been thinking of using a voltage divider, or possibly a voltage
divider with a 1k resistor before the propeller pin.

My first problem is the watercraft is 250 miles away. I am trying to build it, and then let
my friend install it. I have thought about trying to simulate the MSD signal with a pnp
transistor controlled by a Propeller. There is simulation software available in the obex
that I should be able to modify to use a transistor, but frankly I am worried that my
idea of a circuit may be to simple? and endanger the Propeller.

Any help is greatly appreciated.


Bill M.

Comments

  • kwinnkwinn Posts: 8,697
    You could go with a simple voltage divider and 1K resistor but you may want to consider an optoisolator instead.
  • I read on a robot site that optoisolators do not put out a square wave.
    Would I need to put a schmitt trigger or a comparator before the propeller
    pin?
  • You got bad advice from that site. An H11L1 optoisolator has a built-in Schmitt trigger and a digital output.

    -Phil
  • Optoisolator is the safest, but if the signal is a 12v AND there are no coils or similar involved that could add high voltage spikes, it seems to me that a simpler circuit would do. If I were to make it, I would use a voltage divider - or if I could not rely on the 12 volt to be 12 volt only - I would use a 3v zener diode (4 diodes in series would also do the trick) to make sure the voltage is capped at a propeller acceptable level. Probably I would use a blue led as a zener, but a led is less reliable long term, so I would not recommend that to others.

    Erlend
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2017-02-04 11:46
    A pullup on the input then through a 100k resistor straight to the Prop pin is the simplest solution for this. No need for a "voltage divider", just limit the current which it certainly will be. This circuit can also be tested with 3.3V excitation signal straight from another pin on the Prop itself since there is no divider circuit. Easy to build, easy to test. Don't complicate something that doesn't need to be complicated.

    btw, to reply to your impressions that optos don't output a "square wave" that is partially correct IMO. Very few have active push-pull output and rely on pull-ups on the output, even when they have schmitt trigger buffers. Passive pull-up by its very nature means that the rising waveform will take longer than the active pull-down. There are however push-pull optos as well as solid-state isolators, the latter being the type I prefer these days for many reasons. But in saying all this I am not advocating nor recommending the use of any of these devices for this application of yours.
  • +1 for opto
  • I think an optoisolator is the safest choice. I tested the technique by placing an infrared LED and a phototransistor next to each other in a tube and then wrapped the tube in electricians tape to keep ambient light out. I ran my first test with a 9V battery and used one of the counters to pwm an LED at different duty cycles.
    I'm working on a project that has two steppers and a 12V power supply. When the steppers run slow they get louder so I put a PNP transistor between the load and the positive side of the power supply and used PWM at 20khz to reduce the duty cycle when my steppers run at low speeds.
    In short, I would test a 20% duty cycle by placing a PNP transistor between the positive side of the power supply and the load. I would then use either an 'opto' or an NPN transistor to drive the base of the PNP.
  • Capt. QuirkCapt. Quirk Posts: 872
    edited 2017-02-04 20:20
    Just for information: The MSD supplies a wire that is dedicated to drive a universal
    tachometer. There are no coils or anything that I am aware of that could cause
    unwanted characteristics.
    A pullup on the input then through a 100k resistor straight to the Prop pin is the simplest solution for this.

    Something I don't understand, a 100k resistor still sends a 12 signal to the Propeller
    pin. But it limits the current to 60ua. I was trying to square this in the Propeller data
    sheet, and it said max pin voltage was ~3.6v.

    I suppose I have been doing the same thing, when I use a 1k resistor to protect a
    Propeller pin from 5v ?

    All these years, and I never used ohm's law to test it.

    Would a 6k resistor work as good or better than the 200k resistor? the amps would
    be ~2ma and the watts ~25mw. That is similar to using the 1k/5v to protect a pin.

    I realize the 200k would be very safe, is there any drawbacks using the 200k resistor
    for detecting a rising edge on the Propeller?


    Thanks
  • kwinnkwinn Posts: 8,697
    The propeller pins have protection diodes that are connected to Vss and Vdd. They conduct if the input voltage goes a bit above Vdd or below Vss, but can only handle 500uA of current. By placing a 100K resistor between the 12V signal and the propeller pin the current will be limited to about 84uA, which is well below the 500uA maximum current.
  • Capt. QuirkCapt. Quirk Posts: 872
    edited 2017-02-04 22:09
    Thank you all for your input!

    I have something I need to get off my chest, that doesn't seem to have a home in the
    new generation forums?

    It has been a long time since I posted, and while the people that answer posts on
    these forums have always been what makes this site great, but the new site IMO is
    lacking. I really dislike having to read posts that stretch at least 4/5ths of my screen
    from left to right. That is why I try to post with ~15 word sentences.

    Where is the "Basic Stamp Experience" that seemed important in the past. An imaginative
    transparent background would go a long way to improve the white Levis look (Just like my
    old pit pants to try and make a bunch of mechanics look professional).



    Bill M.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2017-02-05 01:59
    the new site IMO is lacking.

    There doesn't seem to be much that Parallax is willing to do but why can't it just be "open source" to a registered group of forumistas? We could all contribute while following Parallax guidelines. We are already providing the content, let's improve the framework and experience too.

    Btw, I picked 100k as starting value but you can go down to 18k and still limit the current to under 500ua. The CMOS structure does not start clamping for another 0.3V above Vdd, so 3.6V, but the voltage won't be clamped solid to 3.6, it will rise with current to the point where other structures will conduct at just over 4V.


    EDIT: Just to confirm what I am saying here is a simulation using LTSpice of the effects of a 12V signal driving via a simple current limit resistor. The clamp diodes are not zeners, they are like schottky diodes and simply start conducting around 0.3V above whatever the Vdd is, which in turn could be affected by this current too. Pad and track capacitance I set at around 20pF for this sim and I have reduced the series resistor down to 22k. The signal shown for the 12V pulse is passed through a voltage divider simply for the purposes of displaying the signal at around the same amplitude in the sim.
    V1 = 12V 20kHz 20% pulse
    V(ref) = input pulse (scaled)
    V(iopad) RED = what the Prop would see (remember its switching threshold is half Vdd)
    I(D1) = the clamp current (<400ua)
    RC-IOPAD.png

Sign In or Register to comment.