2021 Christmas is in two months, I would like to do a special gift to my 3yo son. He loves Lego and trucks , I like hardware and programming. Why not try to embed a board with servos and motors inside a Lego truck. I know Lego already provides a set with motors but it’s expensive and very limited.
I started to search a good board and found a very promising one, the Cytron Maker PI. It a brand new board having the new RP2040 from Raspberry. Here is the main features of this board:
- 4 Servos driver
- 2 Motors driver
- 13 LEDs and 2 RGB LEDs
- 7 Grove ports
- Multiple ways to power the board LiPo/LiIon/USB/VIN with Power on/off switch
- Some switches
- A buzzer (this is cool !)
- 4 holes specially sized for Lego
- It’s pretty cheap, ~$10
In the past my son shown interest in my PS4 controller. Well why not use the PS4 controller to control the Lego truck ? The Maker Pi board can act as a host for a USB dongle but for now I don’t want to use this functionality. It’s not straightforward to decode the PS4 controller stream, and I need time to experiment (and I don’t have lot of time…).
Instead I will use some kind of gateway between the board and the PS4 controller. I just need DS4Windows on my PC to get the PS4 inputs, then encapsulate the commands and send it to a Bluetooth chip connected to the Maker Pi. Here is a perfect Grove sensor that gives a Bluetooth support.
On the mechanical side, some servos/motors compatible with Lego are available for cheap. Here is what I will most likely buy.
For this project I will have to write two pieces of Software: one for the board (supporting MicroPython, CircuitPython, or C/C++), one for the gateway in C++ with MFC, it should be straightforward and fun !