Basic Arduino Robot v1
Created as a simple, inexpensive (<$15) robot platform for experimentation & programming at the end of the FIRST Tech Challenge season. I made 8 of them - buying parts in 5, 8, or 10-packs helped bring the cost down.
Uses the claws from https://www.thingiverse.com/thing:984360 printed at 10x size
Code available at: https://github.com/Broadsword85/ClassRobot
Bill of materials:
2x "TT" gearbox motors
2x 65mm wheels
1x L298N 5v dual motor driver board
1x SG90 micro servo
1x 3-AA case with switch & non-rechargeable batteries (see note below)
1x Wemos D1 R32 ESP32 (or an Arduino if you have another control method)
1x micro breadboard
2x #6 x 1/2 or 3/4" screws with a flat base (not angled for countersink)
double-sided foam tape
Solder pins, jumper wires, zip ties, etc.
Assembly:
First, snap the micro servo into the slot in the front with the shaft coming up through the top of the robot plate. It's a tight fit, but it should fit.
Second, attach the TT motors using one #6 screw each - either screw hole should work. The protrusions on the motors should line up with the recesses in the mount.
Next, attach the microcontroller to the battery pack with a couple small pieces of double-sided foam tape. Make sure you don't cover the switch
Attach the battery pack to the robot plate with a couple more small pieces of foam tape. Leave enough room to put the breadboard next to the battery pack
Before attaching the breadboard, use it to help align the pins while soldering the motor driver board. The pins don't line up perfectly (or well), but they can be made to work. Make sure the motor controller is centered so that you can access the outer pins on both sides.
Finally, the breadboard has attached foam tape - peel off the backing to attach it to the robot.
(we'll attach the servo jaws later)
Wiring:
A note on breadboards - every 5 pins in a row on each side of the middle are connected to each other, so plugging into the same segment will connect the wires together. With this in mind, I chose to use the two segments on one end of the board to be the - and + power buses.
Connect the battery leads to the outer two corners on one side of the board (make sure they don't line up with anything in the driver board.
Next to them on the + and - lines, connect jumper wires to connect to the microcontroller's GND (-) and 5v (+) connections. If the board has multiple, any can be used.
Connect another pair from the + and - lines to the motor controller's + and - power input.
If you're using the sample code at the Github link above, you'll need to connect the pins defined in the app.
The servo's power connected to the + and - lines, and the data line should be connected to pin 13 on the microcontroller. If your servo has the brown/red/orange coloring, then brown is -, red is +, and orange is data. If your servos use a different wiring color, look up which pin is which before you connect them
The microcontroller's pins 18 & 19 should be connected to IN1 and IN2, and 23 & 5 should connect to IN3 and IN4.
The left motor (driver's side, in America) should be connected to the MOTOR-A port, and the right motor to MOTOR-B. Arrange the cables so the the two red cables are in the middle. This reverses one motor so that driving both forward will run the robot forward instead of spinning in place.
Now you should be able to turn on the robot, launch the Dabble app on your phone, and connect. The default Bluetooth name is "TeamBot"
Once connected, verify everything works. When you're happy, press the reset button on the control board, and wait for it to boot up cleanly again. Tap to Circle button to barely turn the servo to the left. Now, attach the servo horn with the larger hole, using the smallest single-arm servo horn & one of the small self-tapping screws. Make sure it's basically straight in front of the robot. Using the other small self-tapping screw in the servo package, attach the other claw piece to the small hole in the robot body. Once again straight in front, but it should be pretty close to touching the tips of the jaws. Note that both of the claws should be slightly loose so friction doesn't stall the motor. Now on a reset, the servo should be able to open & close the jaws, provided there's adequate power in the batteries.
I chose the Wemos D1 R32 board due to the Arduino form factor, the ability to use the Arduino IDE (not the cloud version, unfortunately), and the ability to use the Dabble libraries & app to easily use a phone as a BLE remote control.
Note that 3x AA's are barely sufficient current to drive the micro servo without dropping the voltage too low for the ESP32 - stalling the servo definitely crashes the microcontroller. Power was the biggest tradeoff I had to make on the design - 4.5v is fine to avoid needing voltage regulators, but it really needs more amperage. Let me know your solutions!
The LN298N motor controller's pins don't line up with the breadboard, so they're a bit wedged in at an angle. This isn't ideal - again, I'd like to know how others solve this problem.