I have installed in my car a central lock system, that when i press the button the car locks, when it does so a led turns ON while the car locks, i tried to connect the pins from the led, from the car lock controller, to the arduino, i tried to do it like with the button “example” but it does not work.
I connected the arduino to the same power supply of the car locking system, so the ground should be the same.
I tried to find a solution on google, i typed “arduino reading data from another/foreign device” but i can t find anything that could help me.
What i am trying to do is, when i lock the car, the arduino reads it and turns on a relay module, the carl lock system has a 2 relay module, but the problem is that 12 volt is passing trough the COM and NO, and as a sygnal i think it would fry the arduino,
if someone has a code or a link to help me understand how to do the i would be grateful
If you just want to read the 12V signal with a 5V Arduino, a simple voltage divider will drop the 12V to a suitable level.
Exactly. Use a voltage divider. Connecting to the LED could also 'fry' your Arduino, depending on how the LED is wired.
Connecting to the LED could also 'fry' your Arduino, depending on how the LED is wired.
Yep. And even if the LED is connected directly to ground, a standard LED will only have about 2V across it when 'on' - not enough to register as a HIGH on a 5V Arduino. That's probably why it didn't work when 'Von-The' tried it.
@Von-The , note that the values in my schematic above are for a 5V Arduino, which has a threshold of 3V for a HIGH.
If your's is a 3.3V board, you'll need different resistor values. A 3.3V board has a 2V threshold for a HIGH, so a 47K resistor instead of the 27K would work fine. You'd get 2V at 9.8Vin, (the minimum that would work), 2.44V at 12Vin, and 3.25V at 16Vin, (the maximum safe voltage).
A car's battery will be at about 12.6V with the motor off, and about 14.2V to 14.4V with the motor running.