Reversing Motor Problems


New to Arduino, using for Engineering Class Project to turn a motor on and off. Decided to use a relay in order to switch the current back and forth as described to me in the ARDX experimenter's kit manual.. The unfortunate thing is that I have no idea how to code for the relay to switch the current back and forth. The link to the curcuit diagram is here(2nd one on page) and I would really appreciate any help on how to get it to reverse the direction via coding.


You don’t need to use coding, when the program tells what would be the LED to light up, the coil will become energised, swapping the contacts over, and when the LED goes off, it de-energises, and makes contact with the normally closed poles, in the picture attached is what you’ll need to do for your relay looking at the positioning of the poles.


I would also add a push to break switch or a toggle switch inline between the relay and the motor, as you won't be able to stop it from going once you plug everything in. That's if you're allowed to do that of course :D

So the code itself would have lines of changing the values from High to Low to correspond to the different sides? The motor is just spinning in one direction after doing what you said..

Is your relay clicking?

The wires crossing over are seperate wires to the ones which go to the motor, IE, they connect the opposite pin before connecting to the motor.

Having had a look through the instructions, they tell you to do it in a different way, however it shouldn't make any difference.

Yea, I got it to work with a smaller motor, I guess it just doesn't have enough juice to power the motor that I want to use for this project. Do you happen to know how much voltage and/or current that I could input to the Arduino Uno before it is fried, so that I could be able to use it (it needs a lot of force).


Stop. Do not power any motor directly from the arduino, you WILL fry it.

All you need to worry about is powering the motor via the transistor, there's a diagram here:

and a picture to help you here:

The main point with these things is trying to isolate the arduino from pretty much everything, it can't handle much current (i believe it's something like 30mA)

Alright, got that to work.. Now do you have any suggestions on how to stop the motor once it starts going? I know you said something about a button or switch, but I really do not know what that means, or if there is a better way of doing it without having to actually mechanically do anything...

Easy, just take one of the jumpers going from your relay to your motor, and have it so you can pull it out whenever you need to, it's just a basic manual switch that way.

If your motor is wired directly to the relay now, just take one wire, and remove it from the relay so there's a break, then take a jumper, put it in where the wire used to be, and when you want to turn on the motor, plug in your jumper to the same strip your disconnected motor wire is, simples! :D

We figured that out.. but is there a way to do that without actually touching the wires, something that you can manipulate with code??

Nope, because if you de-energise the relay, the normally closed contacts will close, and you will have power going to your motor in the normal direction.

When I say de-energise the relay, I mean, disconnect the coil of the relay (un-click it)

You could power, reverse and stop a motor with a h-bridge I guess, but this is a little more tricky, you have to know exactly the currents and voltages you'd be dealing with in your motor, as some h-bridges don't like high current/voltage as I found out when one burst into flames on my breadboard.