TLDR; Im using a 4 button key fob to relay (pictures below) to trigger the arduino but I cant get the arduino to recognize the HIGH inputs.
Long version:
So im using a 4 button key fob wireless transmitter that triggers a relay that is hooked up to the arduino. Now the plan is to use the arduino to trigger relays in the car to do certain things: start car, windows up & windows down, then button "C" a short press will release the trunk while a long press will toggle the sunroof open/close.
The problem is that in the frist few lines of my code i cant even tell if the arduino is getting the signal or outputting one.
I have set up the relays to either output a high (12v) voltage to the pins or complete a circuit to the arduino's ground. Then using a multimeter or the serial monitor i'm not getting any output on my output pins.
Setup:
Code:
It is kinda unclear from your pictures what you are doing, exactly - the second picture doesn't really match the first.
That said, it looks like you are trying to use the Arduino to detect when a relay is closed, by detecting the voltage. But - in the second picture (though unclear) - you seem to have connected the positive of the relay power supply (12 volts?) to each relay's common pole, and then a wire to the arduino inputs (?) from the switched pole - then finally a wire from the Arduino's ground to the ground on the relay (that part is unclear, btw).
This is -wrong- if you have done this - or any variation thereof. If you haven't damaged the arduino, I'd be really surprised.
What you need to do is hook the ground to each of the common poles on the relays, then hook the ground to the Arduino's ground, then from the switched side of the relay, put that to each input.
Then - enable the internal pull-up resistors in your code setup - see here how:
Once that is done, you check the input pins in your code for a LOW signal - meaning the relay is closed; when the signal is HIGH - the relay is open.
That's the proper way to do it. Again - it is unclear from your wiring pictures exactly how you have things hooked up - but it doesn't look completely kosher to me...
Good luck.
The relays have a n/o and a n/c output, Ive used the normally open output. For the wiring I wried the hot for powering the unit to the com of the relays, from there I took the ground of the unit to the arduino. I did notice the ardiuno's leds were getting brighter and the thing was getting hot so i stopped that pretty quickly.
Let me see if i get what you're getting at:
The commons of the relay board all hooked together then to the ground of the main power. Link the ground of the main power to the ardiuno's ground (not the ground by vin right?)
Inputs would then come from the n/o side of the relay
Now shouldn't the code be looking for the HIGH input as this would complete the circuit to ground?
Thanks a tun man!