I'm really interested in MEMS sensors, electronics, Remote Controlled vehicles, DIY drones and of course robots. Before working on a homemade quadcopter, I wanted to learn more about sensor fusion and PID. So I decided to build a balancing robot as an exercise. I own a 3D printer so using it to build the robot parts was obvious. I also owned a few NEMA 17 stepper motors and some stepper controllers from a previous project, so I thought it was a good idea to use them. Of course I wanted the robot to be easily remote controlable so I choosed to use android and bluetooth. An Arduino brain and the work could start.
I just updated the GitHub repository with the Android remote interface file.
It uses the free Kewlsoft Bluetooth Electronics app, a nice tool to build bluetooth interfaces in no time, by sending simple serial instuctions to a Bluetooth client (the arduino HC-05 module in this case).
Controls - The joystick on the left controls the robot - The big red button on the right triggers the servo arm - The little red button in the middle triggers pro mode on and off (be careful !) - The little yellow button in the middle triggers the autonomous navigation on and off (if the robot is equipped with a IR sensor) - The little blue button in the middle triggers only the distance measurement on and off - Two big indicators show robot speed and angle
I like modularity, so I built the electronics using 2 separate homemade boards : the brain board, and the motors board.
The robot's brain board is based on an Arduino Pro Mini. I choosed this board because it is small, cheap, and because of its Atmega32u4 chip : the robot control needs two 16bit hardware timers, and the Atmega328 has only one while the Atmega32u4 has two. So if you plan to reproduce this robot, you will have to opt for an Atmega32u4 board (Pro micro or Leonardo).
The MPU-9250 IMU is connected to the Arduino using I2C. I also routed 3 additional I2C buses for future upgrades.
The HC-05 uses the second hardware serial port of the Arduino (D0 / D1), while the first hardware serial port is used by the micro-USB for programming the board.
Later, I used 2 more digital pins to wire a SR-04 ultrasonic sensor but it wasn't working too well. So I used a Sharp gp2y0a21f IR sensor on an analog pin instead (can't see it on the schematics because it just basically works at the moment, but it is present in the arduino code on github).
The micro-servo powering the arm uses the D10 PWM pin.
The motors board is based on two A4988 stepper drivers that came from a RAMPS 3D printer kit
Both A4988 stepper drivers use 2 digital pins each for speed and direction, and both share an additional digital pin to enable or disable the motors. I added 3 jumpers on each driver to adjust the microstepping setting, but I'm using 1/16th (robot could also work on 1/8). Two additional 100µF capacitors help smoothing current to the motors.
Both brain and motors board, the IR sensor and the micro-servo are powered by a LM7805 regulator and its two 10µF capacitors.
I later added the 12V 3 LEDs strip, it is wired directly on the 3x18650 batteries output.
Other parts are optional (bumpers, SR-04 ultrasonic sensor holder, sharp gp2y0a02yk sensor holder, LED strip holder, arm...). If you intend to use salvaged RC car wheels like I did later, you will also need 2 shaft drive parts, or design you own if mine don't fit your wheels.
Everything is hold together using 3mm screws and nuts. I designed the robot to be easily assembled or disassembled using just a screwdriver : just put a nut in each tray's slots and it will act as a wrench.
If you plan to use the 3D printed wheels and the shaft holes are a little too large, you could add a little hot glue to the motor's shaft and it will hold the wheel very well. You will need 2 rubber bands for the tyres otherwise the robot will slip on the ground.
If you use my shaft drive parts, you have to put a 3mm nut in the rectangular slot, and a 3mm screw will block the shaft drive to the flat part of the motor's shaft.
- Arduino pro micro brain. Any Atmega32u4 based arduino could work, but not a Atmega328, because it needs 2 hardware timers
- MPU-9250 Inertial Measurment Unit : Gyroscope, Accelerometer and Magnetometer in a single chip. The magnetometer part is not used yet.
- HC-05 Bluetooth module : for communication with the Android smartphone / tablet
- 2x NEMA 17 12V Stepper motors : High torque and high precision motors, perfect for this kind of robots
- 2x A4988 Stepper motors drivers + 2x 100uF decoupling capacitors : allows 1/16th stepping, features adjustable current limiting, over-current and over-temperature protection, and operates from 8 to 35V
- 1x L78M05 5V voltage regulator + 2x 1 uF capacitors : provides 5V to the "brain" part and servo
- 1x 12G micro servo : moves the "arm" up and down and allows the robot to stand up on its own
- 3D printed frame ; allows quick changes, repairs and lot of customization. Designed using Sketchup software
- Salvaged RC car or 3D printed wheels : diameter 10cm