I'm having a silly problem trying to control a 12v motor with a relay. The positive side of the motor is wired to the Normally open terminal of the relay. The relay turns off and on with the code below. I have connected the other side of the motor to each of the ground pins on my arduino, to the dc- pin of my board, as well as anywhere else I thought might complete the circuit, but the motor never turns on. It does work when wired directly, without the relay.
There must be an obvious solution that is just too obvious for me. What is it?
The positive side of the motor is wired to the Normally open terminal of the relay. The relay turns off and on with the code below. I have connected the other side of the motor to each of the ground pins on my arduino, to the dc- pin of my board, as well as anywhere else I thought might complete the circuit, but the motor never turns on. It does work when wired directly, without the relay.
The relay board takes 12V across the DC+ and DC-
The arduino GND connects to DC - terminal
Each relay can be individually configured as ACTIVE HIGH or ACTIVE LOW (with the jumpers)
What is NOT clear from your post is if you are using the SAME 12V P.S. for both the relay board AND the motor ?
If so the POSITIVE side of the motor should NOT go to the N.O. contact.
It should go to the POSITIVE terminal of the 12V supply. [EDIT] The NEGATIVE terminal of the motor should go to the N.O. terminal of the relay. The COM terminal of the relay should go to the NEGATIVE terminal of the 12V P.S.
When the relay energizes, the motor is grounded by the relay contacts.
That is the standard method of controlling a motor with a relay. Most people (these days) DO NOT use relays to control 12V motors. They use mosfets.