Electrical Circuit Design
While there were several circuits for each of our components soldered on their own circuit board, we needed to connect wires between the Arduino, power circuit, 4 wheel motors, 1 shooter motor, and switch circuit. So we ultimately decided to use a single solderless breadboard to connect everything to power. This was a better alternative than having everything soldered into the power circuit on a PCB, which would have become extremely cluttered and more time consuming to build. Overall, there were four electrical modules for LeBot James:
- Power Distribution
- Bumper Switch
- Motor Driver for Shooter
- Motor Driver for Wheels
Power Distribution Circuit
To provide sufficient power for the motors and Arduino, we wired two 7.2-V NiCd batteries in series. The resulting 14.4 V was then regulated to ~12 V using an LM317 and an appropriate pair of resistors. From there, an LM7805 regulated the voltage to 5 V required for the bumper switches circuit. To prevent fluctuations on the ground lines for these sensor circuits, we isolated the high-current motor ground.
Bumper Switch Circuit
We ended up only needing two bumpers total to detect the left and back walls. We used the above circuit for both of our bumper switches on the underside of our base, one for the left and one for the back of LeBot. While a simple resistor and switch would have been sufficient for bump detection, the low-pass filter with 10-ms RC time constant and Schmitt trigger eliminated the need for software-based debouncing. The code would then perform a digitalRead on the pin that corresponded to the bumper circuit's Vout - if digitalRead read a logical high or 1, it meant the switch was closed (e.g. the switch was depressed from hitting a wall).
Motor Driver for Shooter
For our shooter, we wanted to be able to control the speed of the motor connected to our flywheel by the setting of an external potentiometer (exactly like in Lab 3).
Motor Driver for Wheels
Since we wanted LeBot to have four 3.25" omni-directional wheels, we had to mount four 12-V motors (Jameco HN-GH12-1634T-R). We used two L298 H-bridge module, one for each pair of motors (left/right and front/back). DIR lines controlled spin direction and EN (enable) lines used pulse-width modulation (PWM) for speed control.
Arduino Pin Allocation
Overall Electrical Lessons Learned
- Copy circuit designs: feel free to exactly copy older groups' circuits that have done the same thing. No honor code violation - the teaching staff encourages you to do so as well. This will save you time in worrying about designing the circuits from scratch and wondering whether it should work or not.
- Potential problems with motor drivers: twice, we wasted many hours trying to figure out why our motor drivers did not seem to be working before asking a member of the teaching staff. For the L293, it turned out there needed to be an additional wire connecting grounds for the L293 ME 210 Revision that the TAs had to manually solder on for an older lab. So make sure that these types of small things aren't necessary for your chosen motor driver!
- Check motor voltage ratings: it took us a while to realize that the motor driver for our wheels was actually rated for 12 V, so we were confused why the motors barely moved when we initially provided 5 V.
- Be careful to not kill the Arduino pins: at one point, we couldn't understand why none of the wheels were moving. It turned out that replacing the Arduino fixed the problem. We likely overloaded the pins at certain times, so make sure not to do that and remember to try a different Arduino as a last possible solution if things aren't working.