I am trying to connect a car alarm proximity sensor to an Arduino. My goal right now is just to view the output on the serial plotter. The reason I am concerned is because the sensor's outputs are not referenced to the ground, instead they are referenced to the positive wire.
So basically I need to make the Arduino read the voltage between the red wire and blue/green wires. Can I connect the red wire into the ground of the Arduino? And can the analog in ports read negative voltage?
I took a quick look at your sensor and it is not clear if the (-) signal is:
12V going to 0 V when triggered
Open going to closed to gnd (common) when triggered.
Do you have a device you can test this on? Do you have a multimeter?
Until you verify, I am going to assume your sketch is incomplete and the Red is positive but DOES NOT go to the Arduino GND. And you have a ground wire from the battery to the arduino.
if your alarm is going on a newer car, Built after 2000, the above information is correct. But many older cars overcharged the battery. Normal charge on some of these vehicles can go up to 14.5V continuous and briefly after first starting the voltage can go up to 15.5V. on vehicles built before 1970 this voltage can be slightly higher. This is because many of these cars did not have electronic regulators. The use vibrating relays to control the voltage. Not very accurate. it is also whybatteries boiled over and leaked acid all over the battery compartment, corroding it until it had to be replaced.
From my testing with the multimeter it seems the output wires will read 0 volts when referenced to the red wire, until motion is detected, at which point it will read -12 volts for a brief moment. When tested against the black wire, it will just read ~0 volts at all times, whether or not motion is detected. This is weird to me, because I would have thought you would get the same result testing against either the black wire or the red wire, just that your result would differ by the difference of the two wires (12 volts). But I guess that's not how it works. (or did I just test it wrong?) There seems to be no useful information when testing against the black wire, and that is why I think I need to connect the Arduino to the red wire.
I am currently using 68k and 10k because 68k is the next one I have after 10k in my kit. I do have 220 ohm and 100 ohm, which would be the same ratio. It would result in much more current flow right? Is that safe for the Arduino and/or sensor?
And as I'm typing this I realize maybe I drew the diagram wrong. Because the current will be flowing from the red wire to the green/blue when triggered, so maybe I want to switch the locations of the 68k and 10k resistors?
You are better off using optical isolators on each of the outputs, and isolating the Arduino from the circuit. the output of the sensor drives the optical isolator LEDs. The Arduino receives the light information from the LEDs to triggers the inputs. You don't have to worry about voltage levels. The Arduino itself can be powered from the vehicle Using a switching regulator.
PS, I do not believe it is a negative voltage, I believe it is a active low circuit. the circuit is going from Positive to 0 voltage, when triggered. But you need to verify this. Use a multimeter and make sure you get the polarity correct.
If I assume the battery is a constant 12 V and the arduino is disconnected for this test then your readings are impossible. Yet you believe what you read with the multimeter was correct.
Consider the voltages you read are really heights off a surface.
+12 V = 12 inches = Surface B
common (aka ground, black wire etc) = 0 inches. = Surface A
So think about the distances as if they were voltages, you can see your readings don't make sense.
I suggest you recheck your measurements and if needed be sure your wiring matches the drawing.
Good analogy, just remember, An active high circuit provides power when circuit is active. But when not active, it does not have to provide a negative signal, just a high impedance, (resistance) state. An active low signal might do the opposite. Either provide a path to ground, or present a high impedance state.
it would be highly unusual for any automotive circuit to present a negative output voltage. Especially one design to interface with other components from other manufacturers. It is more likely that it would pull the signal low, or have a high impedance state. Doing this allows you to hook up any device at any voltage, 3.3 V or 5V to the circuit, without damage. you would just need a pull up resistor to the desired voltage.
Hi,
I think you need pull up resistors on each of the sensor outputs.
They quote up to 200mA load, so to be conservative, use 50mA.
So 12 and 50mA will be
12/ 0.05 = 240Ohms.
So a 220R or 270R on each of the outputs and the other ends connected to the 12V supply, will probably give you the expected result.
Please note, Unless the manufacturers have changed the specifications in recent years, the maximum draw for the automobiles computer and alarm system, that is in active mode, armed but not going off, is 25 mA. That is to prevent battery depletion over long periods of time. this means the processor should be in sleep mode until an event happens. It also means that the draw needs to be about 1/10 or less of the current discussed in the previous message.
Thanks for the help guys. I'm just getting back into this project. I did some reading on pull up resistors and I think I understand it now. Would wiring it up this way and using input_pullup be okay?