Robot Development - Part #1
I've started a robotics project. My plan is to build a small robot with QR codes for augmented reality. The robot will be a wheeled rover with fixed wheels. The augmented reality software will take footage of the robot, identify the QR codes on its chassis, and then orient and place a 3D model in the footage based on the QR code positions.
I've written a circuit diagram. Each section corresponds to a single motor or light. Diodes protect the transistors from motor back EMF; they sink back EMF through an open loop. I skimped on diodes for the LEDs. There are only two control pins for the four motors. I'm saving pins for wireless control; the wireless device I have in mind needs SPI. The left and right rovers will have to move at the same speed. I'm not sure if I can control multiple transistors with one ADC pin.
The parts list:
- 6x PN2222 Transistor
- 4x 6V DC Motors
- 4x 270 Ohm Resistors
- 4x 1N4001 Diodes
Attentive readers will recognize this parts list as a scaled up version of existing Arduino tutorials. I didn't include the LEDs and their resistors. I'll just fish them out of my spare box.
Development of the basic rover has already started. I'm using an Arudino for the brain and DC motors to control the wheels. The motors are controlled with ADC pins and transistors. I hooked up the Arduino and wrote some basic software.
const in RIGHT_MOTOR_PIN = 10; const int LEFT_MOTOR_PIN = 11; int clamp(int min_bound, int value, int max_bound) { return max(min(value, max_bound), min_bound); } void set_right_motor(float percent) { analogWrite( RIGHT_MOTOR_PIN, clamp(0, int(percent * 255), 255) ); } void set_left_motor(float percent) { analogWrite( LEFT_MOTOR_PIN, clamp(0, int(percent * 255), 255) ); } void setup() { pinMode(RIGHT_MOTOR_PIN, OUTPUT); pinMode(LEFT_MOTOR_PIN, OUTPUT); set_left_motor(0.5); set_right_motor(0.5); } void loop() {}
Once the initial test is done, I'd like to make several major improvements:
- Power the board directly without the programmer. I've done this before, but never for an Arduino.
- Design a printed circuit board to replace the bread board. I'll get to practice surface mounted soldering.
- Attach a networking device so I can change the operations while the board runs.
- 3D print a chassis. A friend of mine has access to a 3D printer, so I can pay him for a print job. I'll get to practice 3D modeling.
Finally, I need to learn about augmented reality. Right now, I know nothing. I might be able to copy a Sherman model I have lying around.