Robotics at Home with the DIY PicoBot
Since building my basic PicoBot last year, it has been a workhorse for me as I experimented with a bunch of different approaches for controlling it. But after a while, I got stuck about what to do next. That’s when I discovered Danny Staple’s book Robotics at Home with the Raspberry Pi Pico.
The title of this book says it all and is an accurate summary of the book’s contents. The presentation is thorough and accurate. It addresses a wide range of reader’s skill and knowledge. If you need to learn the basics of robotics, this book takes you through that. If you already know the basics, you can skim over quite a bit. After reading it, I became enthused about some of the things I learned, and decided to implement some new features in my PicoBot.
Although the programming language used in the book is CircuitPython and my PicoBot is programmed in MicroPython, this proved not to be a problem. There is only a small amount of code that needs to be translated. It’s mostly only the machine interface where the two languages diverge.
Here are some of the things I decided to implement after reading the book:
1. Use the Bosch BNO055 IMU connected via I2C to provide drift-free yaw data.
2. Use multiple VCSEL distance sensors with an I2C multiplexer to allow them to share an I2C bus.
3. Use the Adafruit Bluefruit BLE UART Friend device to encapsulate the Bluetooth LE communications between the robot and another device (phone or laptop).
The software architecture just got simpler
By relying on its Bluetooth communication channels, the PicoBot onboard program can encapsulate only the most essential tasks related to its own hardware. It does not have to process its own data or make decisions about where it needs to go. That programming can be done elsewhere (on a remote computer, for example).
- A joystick control sends driving commands to the PicoBot over Bluetooth LE. (A free phone app can be used to send tele-op driving commands.)
- The PicoBot receives those driving commands and
* Operates its motors accordingly
* Computes its instantaneous pose odometrically
* Reads current data from its sensors
* Sends out all data via a second BLE channel - A program running on the laptop receives data from the PicoBot and processes the data in real time. For now, the laptop displays a map showing the locations of all detected objects and the current location of the robot.
Below is a short initial run in the arena showing only the locations of objects detected by the Right distance sensor.
Before starting this project, I wondered if the Raspberry Pi Pico would be sufficiently powerful to handle the rigors of managing all the robot’s onboard tasks. Now I know that answer. It is easily able to simultaneously accomplish all the robot’s chores:
- Listen for incoming tele-op driving commands
- Drive the motors accordingly
- Count every tick from both encoders and compute pose (odometry)
- Read values from 3 VCSEL distance sensors
- Read yaw angle from the IMU
- Send all data to my laptop via BLE at 10 Hz
Here is the data format sent by the PicoBot every 1/10 sec.
{'dist_F': 677,
'dist_L': 8190,
'dist_R': 399,
'pose': [1.742779, 0.98038, 0.2385168],
'yaw': 0.09817505}
Now I can roll up my sleeves and enter the next phase of my robotics education in which I learn how to implement algorithms for:
- Localization
- Mapping
- Path Planning
These programs don’t need to run on the Pico. They can run on my laptop.
Oh, and by the way, the Pico sells for $4 (and the other components are similarly cheap) so if you really want to be a roboticist, the $$ shouldn’t hold you back.
If you would like more detail on this project, feel free to check out my GitHub repository.