This ais a mini Sumo robot I designed for the Zebra Explorers post. It has the following features:
- Controlled by a Raspberry Pi ZeroW
- Two analog reflectence sensors
- Laser TOF distance sensor
- AVR micro for power management and analog/IR input
- Uses Python 3 for programming, and c for the driver libs.
The BOM has all the parts/pricing as well as sources. The cost when building 30 units was around $72 each.
The instructions to setup the bot from a standard Raspbian install are included in setup.txt, The sumo.zip file has the needed software.
If you prefer, there is an already setup image at: sumo_img.zip
Instructions for building the bot are in Assembly.pdf
You communicate with the Pi using ssh either over wifi or USB. The Zero will appear as an NDIS ethernet adapter when plugged into your PC. It shows up at 192.168.42.1, the account is of course pi, and the password is SumoBot.
After logging in, cd to code/test. There you will find some test code. sensors.py displays the distance and reflectance sensor values, as well as the battery voltage. motors.py can be used to test the motors, as well as for adjusting the center point pots. The last one, move.py will move around a Sumo ring, reversing whenever it hits the edge. It will also stop if anything is within about 4" in front of the bot.
To turn on the bot, press and hold the switch for a second, until the blue LED on the board comes on.
To turn the bot off, press and hold the switch for a few seconds until the blue LED starts to blink. When the LED goes off, the bot is completely powered off. The battery is blocked by a FET so you don't have to worry about leaving it plugged it.
If the blue LED starts to blink while running, that means the battery is getting low. The bot should shutdown before the battery gets too low, but you might want to turn it off at that point, just in case.
A full disk image for the bot is at: https://drive.google.com/open?id=1Gz2-_0Ix04LEAgToGsfgUNn8eieP8vRQ
You will need to go into code/AVR and do the command: make prog
That will program the AVR micro. Also, you will need to setup the WiFi to your local access point.
The 3D is all done using openSCAD. You will need all the OpenSCAD files in the same directory to use them. The main file "NewSumoMKIV.scad' has a flag called 'show' when set to 1 the bot will be shown assembled. When set to 0 it will be draw ready to print.
If the file is too large for you printer you can comment out sections and print it a bit at a time.
The wheels are separate files so you can pick whichever you like. By un-commenting some code in the main file the wheels can be printed at the same time as the rest of the bot.
The I/O board plugs into the pi and allows it to run off batteries, as well as read analog sensors, and interface to multiple servos. There are many extra connectors that were not used for the Sumo bot, but are for future projects.
The board was designed in Kicad, and all the files are in the IO Board,zip archive. There is also an archive of the gerbers needed to order the board from a board house in there too. The BOM with sources and prices are in the Thing files.
The bot is programmed in Python 3. There are drivers to talk to the AVR, the distance sensor, and ServoBlaster which drives the motors. Those drivers are written in C using the Python C API so they load and are used like any other python import.
There is an AVR micro on the I/O board. It handles power management, and does A to D conversions for the Pi ZeroW. It can also return the battery voltage in mv. The source for the AVR code is in the code/AVR directory. To program a blank part, just run 'make prog' in that dir.
There are services that run at startup to handle power on/off stuff and shutdown on low battery.
There are also a few added commands like 'batt' that dislay the battery voltage in mv.