Introduction: Motor 'N Motor

This project began as two separate ideas. One was to make an electric skateboard and the other was to make a remote control car. As strange as it sounds the basics of these projects are very similar. It obviously gets more complicated when it comes to the mechanics, but the electrical engineering aspects are very similar.

Step 1: Beginners

We started straight away with a basic inventors kit because it is best to become comfortable with coding whatever board you want to use first. In this project we used the Arduino Uno throughout. We practiced simple circuits in order to gain some experience; such as a blinking LED or one spinning DC motor. The truly important thing we learned during this step is just that one side of the motor should go to power and the other to ground. If the wires are switched it will change the direction of the motor.

Step 2: Two Motors

Our next step in the process was to attempt to have two motors move in sync with one another. This requires a motor driver with an H-bridge. We were originally using the L293d motor driver. At this point we needed to include another power source because the Arduino could not provide enough power for both motors. Also, we then realized the L293d was not capable of handling the amount of power needed to run both DC motors. Instead, it was dangerously heating up very quickly. Because of this, we decided we needed a new approach.

NOTE: Always remember to check if things are heating up or burning.

Step 3: New Motor Driver

This left us with a decision to make. We could either solder two L293d drivers together, or we could try using another motor driver. We chose to switch over to the L298n which would be able to handle the amount of power we needed without burning up.

The L298n however is not breadboard friendly. Our first thought was to attempt to solder a wire onto each pin of the L298n. This would allow us to use the breadboard for the time being. Although this originally seemed like a good solution, it became very time-consuming and difficult. I would not recommend doing this unless you know you will being using the motor driver in your final project and need a long-lasting solution. Otherwise, it is best to just use female wires. It saves time and stress.

Step 4: L298n

Something we misunderstood at first with the L298n was how the pins were organized. We originally assumed without fully checking the datasheet that the top pins would control one motor and the bottom pins would control the other motor. However, the L298n is actually separated down the middle, with the left pins controlling one motor and the right pins controlling the other motor.

On the L298n the current sensing pins and the ground pin must be set to ground, while the supply voltage and the enable pins should go to power. If you read the datasheet you’ll find that the logic supply voltage pin must be both connected to power and connected to ground through a 100nF capacitor. The output pins 1 and 2 should be connected with the wires of one of your motors. Then input pins 1 and 2 should have one set to power and one set to ground, which one goes to which depends on the direction you want the motor to spin. You can then do the same to the other motor instead with output and input pins 3 and 4.

This step requires a lot of testing things to see how they work. We recommend not using your microcontroller at this point and just testing your circuit. You can add the board in after you have everything in the circuit working.

Step 5: Arduino Uno

In fact, that was our next step. We connected the input pins of the L298n with pins on the Arduino Uno. Keep in mind that we still could not use the Arduino to power the circuit, but the Arduino must still be connected to ground. We tried simple codes after this to see how it affected our board. You should test to see what setting the different input pins HIGH or LOW does to the motors. Since this project is ultimately meant to be something that could theoretically run a remote-control car or electric skateboard, we had one motor spin clockwise and the other counter-clockwise. This makes it as though the motors are both spinning forward if they are on opposite ends of the circuit.

Step 6: Button

It was at this point that we began to run out of time to continue our project. We decided that with our last few hours we would simply add a button to the circuit. We went with a tactile button switch since it was breadboard friendly. The button makes it so that the motors only spin when the button is pressed down,and as soon as you let go of the button the motors stop.

Incorporating the button into the motor was simple after we understood how the button worked. The button has four pins and they are very straightforward. We tested the button by making a quick small circuit with two LEDs. We found that each side of the button had what was essentially a ground pin and a power pin. Therefore the two ground pins were connected directly to ground, while the other pins were a bit more complicated. The other pins needed to be connected to power through a 330 Ω resistor. These pins were also connected to the Arduino Uno. This allowed for the Arduino Uno to read when the button was being pressed. The code would read whether or not the pins were HIGH.

One pin on each of the LEDs was set to ground, and the other pin was connected to the Arduino Uno. We wrote an IF statement in our code that would read the output from the button, and if that was HIGH it would then set the pins on the LED HIGH.

Once we had a better understanding of how the button worked we then incorporated it into our original circuit. We used the same general code from the LED circuit in our code for the motors. Since we already had a a specific input that we wanted HIGH for each of the motors, we were able to easily change our IF statement to apply to those input pins.

Step 7: Next Step

If we had more time to work on this project we would have started working on the code. We both wanted our projects to be able to speed up slowly and come to a stop slowly. In fact this is one of the reasons we used an H-bridge in the first place because they can incorporate pulse width modulation. We may not be able to continue our project, but we would love if this could help someone else.