Project:
Like many others in this class, this project took me forever! But it was pretty awesome putting it together. I am a little disappointed, however, as a very slight hitch arose when I transferred my breadboarded prototype to a soldered Arduino shield. Somehow, every time I press my switch (which is supposed to make the motors reverse directions), it looks like the board shorts. I'm still not sure why this happens, and I have no idea how to mitigate this issue.
I breadboarded the whole setup prior to putting it on the shield, and it worked perfectly! The setup is shown below, and I added a switch. This switch was attached to 5V input, GND, and a digital pin. In this manner, I used a while loop to tell the Arduino to set the motors to the forward direction when the digital pin connected to the switch has a low value (switch is open). When the switch is closed, the digital pin reads a high value, and reverses the direction of the motors. Like I mentioned, it seems as if the switch in the shield version just causes a very large voltage drop to the board, and the motors stop running when it's pressed.
I used a piece of cardboard I cut as my remote, and stuck the potentiometer and the switch in it. These components were wired to the shield via a 4ft leash.
The wires got pretty cluttered, so I labeled my shield and leash as to what the wires do so as to make sure that I don't mistake the wires or pins.
I have very bad wifi so I could not figure out how to upload my fritzing file. But here is a picture of it:
Full car control:
Turning control:
Troubles I experienced:
I have the same issue as last week with my motor controller, as two of the output pins don't sent out power. I found this out using a multimeter on the pins, and they read 0 voltage, despite the code for my motors initiating a current to the pins. As a result, I wired the two motors to the same two output pins (in series), so there's a voltage drop to both of them. As a result, they go a good amount slower than they should.
Like previously mentioned, I could not get the switch on my car to work. It is supposed to make the car go backwards while pressed, and it doesn't. As a result, my car currently does not go backwards.
-UPDATE: I forgot to add a resistor to the ground pin so the switch has stopped shorting my Arduino (thanks, Michael!)
Lastly, since I am using a semi-broken L298 motor controller (utilizing the two output pins that work) and connecting my motors in series, there is no way to reverse their direction using the switch as was originally intended. However, I have wired my Arduino and created code which will implement this correctly in the situation where the motor controller functions correctly (code is below).
Comments