Shop OBEX P1 Docs P2 Docs Learn Events
12V signal detection with a Propeller (car's auto alarm system signal) — Parallax Forums

12V signal detection with a Propeller (car's auto alarm system signal)

DRMorrisonDRMorrison Posts: 81
edited 2012-01-29 08:35 in Accessories
I hope this is the right place to post this topic. If not, please let me know.

I'm having trouble interfacing the Propeller chip with a signal coming form my car. I want to watch a signal that flashes once/second when the car's alarm is ON,
and then changes to twice/second when the alarm has been activated. I've created the code using one of the counters, but the problem lies in the signal itself.
The signal is 12V that drops to 0V for 20ms each second, lighting the LED; the security system grounds this signal for 20ms each second, and this is what lights
up the LED--the signal wire going to ground. When the alarm is activated, the signal pulses twice/second. When OFF, no pulses; the security system puts 12V to the LED
preventing it from lighting up. i.e. when a ground is supplied to the downstream line, between the LED and security system box, the LED lights (flashes each time the
signal is grounded). The security system supplies the 20ms ground/second to cause the flashing.

The security's schematic (rough)
12V
LED
SecuritySystem

The signals
steady 12V: OFF state
-|_|
1-20ms (-) pulse: ON state
-|_|--|_|
2-20ms (-) pulses: ACTIVE state

I've tried a simple voltage divider, but this gives a permanent ground to the LED, and it stays lit. Duh! I've tried puling an I/O pin of the Prop. high with a pull up resistor, and then using
the ground signal from the Security box, through a diode to prevent feedback, to cause the I/O pin to go to ground, but this doesn't work either. I'm not sure why this second
method doe not work (shown below). Perhaps something to do with the two different voltages.

The second method: A and B are nodes.
+12V
LED----A
SSystem supplies ground pulses

A
|<
B---I/Opin

B
10kR
+3.3V

I'm thinking that maybe this is the place for an Opto Isolator. But I don't have much experience with those, and am not sure if sending the 12V signal through it will work. any
experience with these devices?

If anyone can help in any way, thank you in advance, Daniel

Comments

  • ElectricAyeElectricAye Posts: 4,561
    edited 2012-01-28 15:27
    DRMorrison wrote: »
    I hope this is the right place to post this topic. If not, please let me know. ...

    You would probably get more attention if you posted this in the Propeller Forum.
    DRMorrison wrote: »
    ... I want to watch a signal that flashes once/second when the car's alarm is ON,
    and then changes to twice/second when the alarm has been activated....

    When you say you want to "watch" a signal that flashes, are you saying that you want to actually detect when the LED is flashing or do you want to directly detect voltage changes in the 12V signal line?
    If you want to observe the flashing of the LED, then I would think you could use a phototransistor or photodiode circuit connected to the Propeller and this photodetection circuit would simply give your Propeller a pulse any time the LED started flashing. But I'm not an automotive dude, so maybe I'm totally misunderstanding your situation.
  • Mike GreenMike Green Posts: 23,101
    edited 2012-01-28 15:29
    Missing from your description is the value of the resistor associated with the LED (to limit the current through the LED). This might be internal to the security system.

    You might try an optoisolator, particularly since this is in a car with large voltage spikes potentially all over the place. An optoisolator is just an LED feeding a transistor. Put the optoisolator's LED in series with the LED from your security system. When the indicator LED you already have lights up, so should the one inside the optoisolator. Whatever series resistor exists for the indicator LED should work for the optoisolator's LED as well. You'd ground the emitter of the optoisolator's transistor and connect the collector through a 10K resistor to your +3.3V supply (for the Propeller). An I/O pin would be connected to the junction of the 10K resistor and the collector. When the indicator lights up, the Propeller I/O pin should see 0V. The rest of the time, it should see 3.3V.
  • DRMorrisonDRMorrison Posts: 81
    edited 2012-01-29 08:31
    Thanks to all.

    The "watch" was meant as detect through direct connection to the circuit. I found an optoisolator in my parts bin and will connect it as described by Mike. It's an H11D1 with phototransistor output.
    This should work just fine. I'll connect a test circuit to the car with a small running program on a prop demo board to count the (-) pulses. This is how the program will know if an alarm state is active.

    UPDATE: Mike's suggestion works fine. I find that the alarm LED signal is not quite 1/second, so during the two second time period the counter sometimes counts 1 pulse, but
    mostly counts 2 pulses. I'm running this now for an extended period to see if it ever counts higher than 2--so far so good. I plan on leaving this connected over night to
    be sure that I don't get more than 2 counts in a 2 second period.

    Thanks guys, Daniel :smile:
  • DRMorrisonDRMorrison Posts: 81
    edited 2012-01-29 08:35
    Also I've noticed that some of the posts have solved and unsolved indications on the main page.
    How do they do that?

    Daniel
Sign In or Register to comment.