For this project the aim was to make a very small desktop companion robot, but one packed with functionality, . I have been using the Raspberry PI Zero in a number of my bots. I also wanted to add a Camera, Ultrasonic sensor for distance measurements and also needing a combination of motors and servos to control a gripper, head and drive the track based chassis I wanted.
This instructable will only contain details of the build and what I used and how I constructed it. The programming side of things has been tested just using Python to initially test parts I had added, and ensure the gripper, head and drive worked correctly.
I decided on my favourite PI motor controller which is the 4tronix Picon Zero, this is a great add on board which allows multiple servos to be added as well as already having pins ready for a HC-SRO4 ultrasonic sensor. You can also add neopixels easily if you want.
I wanted to also add a small Oled display to represent facial expressions in the mouth area of the robot. This I would interface with the PI Zero using I2C.
Step 1: Equipment Required
- Raspberry PI Zero
- Mini PI camera
- HC-SR04 Ultrasonic sensor
- Small plastic clamps from DIY store to use as robot hands / grippers link
- 2 x Micro servos 90g
- 2 x micro metal gearbox motors, either 50:1 or 100:1 ratio (I used 50:1 which is a little fast for fine control)
- 2 x micro metal gearbox holders
- 1 x picon zero motor controller board
- 1 x Pololu 22T track set
- An OLED SSD1306 for a display.
- approx 10cm of stiff wire to use as a servo control rod
- USB powerpack - I used a 5700ma one that you can use to charge phones via USB
- plastic sheet 1-2mm thick that can be used as panels for chassis or body
- Drill dremel size if possible
- Small screwdrivers set for terminals and other screws/bolts
- Hot glue gun (ideally or plastic glue
- Wire cutters
Step 2: Building the Chassis
I wanted to keep the chassis narrow and as small as possible so I decided to offset the motors so each track would be driven from a different end of the chassis.
I cut a small piece of the 1.5mm plastic that was large enough to hold the small micro metal gearbox motors, as shown in images above.
I then used some plastic I had from an educational strips to add to the chassis cutting and attaching these with hot glue.
Its important before positioning the motors and working out the position of the idler wheels, that you ensure there will be enough track tension when they are mounted in place.
Its also key to ensure the alignment of the drive wheels and idlers is good so the track does not come off when drive is powered.
I drilled through 2 holes for the idlers where I had found they would create enough track tension when fitted. This measurement will require a bit of trial and error until you get the distance right between the drive and idler wheels.
As the motors are offset its important to ensure before final fixing that the axels line up so the motor and idler on the opposite side are in line with each other. Without this there is no way the robot will travel in a reasonably straight line without constant correction.
One mistake I made was not soldering the wires to the motors before fitting, this was rectified quickly and I continued with the chassis build.
Once complete I added a final piece of my 1.5 plastic sheet to enclose the motors and creating a nice flat surface.
Step 3: Fitting the USB Powerpack
I have used usb power packs many times with the PI Zero and have found it will easily drive the PI and small motors from the Piconzero motor controller.
I had a 5700ma USB power pack the type you normally use for charging phones. This was about the right size so I hot glued it in place on to the flat surface now at the top of the chassis.
The piconzero motorboard allows you to power the board by usb or by 2 screw terminals, or to get the power from then PI itself, I have found running these tiny motors it can run from the PI itself, however if on use you notice a dimming or flickering of the green light on the PI when the motors are moved then consider one of the other power options.
Step 4: Fitting the PI and Motor Driver Board
Using plastic spacers I mounted the PI and piconzero motor driver board to the rear of the chassis.
I fitted the motor wires to the screw terminals.
Step 5: Building the Gripper
I used some small plastic clamps available in DIY stores to be my grippers, and I wanted to experiment with a servo and simple control rod to open and close the gripper.
I started by removing the spring in one of the clamps so it opened and closed without resistance. Then cutting the handle parts off one side of the claws.
Attach the one remaining handle to the body on one side of the chassis, I also before drilling and glueing had to find a place I could attach a micro servo so that with a control rod added it was in line with the gripper. Initially I was going to have 2 grippers and 2 servos operating independent but I changed this to be a single gripper and servo with another gripper the other side attached by plastic strips.
The gripper could only hold something small like a pen, or be used when moving the head to gesture and show some kind of personality in my little bot.
Step 6: Making the Head
The head I made used an old toy car blue windscreen as its top, with a HC-SR04 ultrasonic sensor which I used a sharpy to colour black. and between each part of this sensor I fitted a raspberry pi mini spy camera, you don't need to add a mini camera, a full sized PI camera would be fine its just you would to find somewhere in your head design to fit it. I wanted to keep everything small.
I also added the Oled display under the eyes (camera and HC-SR04), this was so I could display key info on boot up like status or IP address, and once up and running using it for facial expressions like smiling or sad.
I hot glued most of the parts mentioned above in place and added a servo to control some simple up and down movement of the head, this would allow me to control the angle of the PI Camera and also the Ultrasonic sensor. I also wanted the robot to be able to look up and pivot on its tracks to appear like it was looking around.
The servo leads for the head and the gripper plug straight into piconzero motor board, and can be tested with the test python scripts that can be downloaded from here. http://4tronix.co.uk/blog/?p=1224
Step 7: Adding the Oled to the PI
Adding the Oled display was the only challenging part of the build this uses I2C for its connections, I soldered directly to the bottom of the PI zero 4 wires directly to the 40 pin GPIO for the Oled display.
There's a great tutorial I used from adafruit here which I used to set my PI up and to work out the wiring.
This worked great and with the software available from this adafruit tutorial I managed to construct simple facial expressions.
Sadly I did get over ambitious at this stage and tried to add another I2C device which was an accelerometer, during this I managed to short something out and killed my PI Zero. So that needed replacing, but if your careful that should not occur.
Step 8: Conclusion
It was great to build this and keep everything so small, it has a lot crammed into a 13 x 7 cm footprint and the aim is it will be my desktop robot companion, I need to still add sound and then also constantly come up with a good program to allow it to interact more, and also have things like security mode at night where with a PIR sensor it could trigger the cam, or turn on perhaps neopixel lights, or send me an alert.
I am sure at some point I will update this post or add a part 2 to show how far I have taken this.