Micro:bit Solar Tracker
In this instructable I'll show you how to easily build a solar tracker based on the micro:bit. My goal in doing such a project was to teach my students about one of the basics of machine learning, which is gradient descent (which is usually the strategy that allows neural networks to learn).
Supplies
To build such a solar tracker you'll need:
- one micro:bit,
- one micro:bit extension to give you access to the pins of the micro:bit easily,
- 4 light sensors modules with an analog output,
- 2 servo motors MG 90,
- 3mm MDF (17mm x 29 mm)
- 12 M2 x 10mm screws and 16 M2 bolts.
Cut the Parts
I designed the 3D model of the solar tracker on tinkercad. This way you can easily copy the model and improve it anyway you want. The design is made to be cut in 3mm MDF wood which makes it cheap but also relatively robust to be handled by teenagers. To cut it either use the svg or dxf file attached to this section, or select the parts in tinkercad that you want to cut you'll be able to export them in svg.
Assemble
To assemble all the pieces together, open the tinkercad project I shared in the step above. I colour-coded 3 groups of pieces. Assemble those first and assemble the 3 groups of pieces together to finish. One thing that does not appear clearly on the model is the way to mount the sensors on the head of the robot. For this have a look at the picture above. I would recommend to first put all the wooden pieces of the head together, wire the sensors, make the wires go through the head, then screw the modules on the head.
Note: the design could be improved to facilitate the assembly. Indeed the screws and bolts that attach wood pieces together could be replaced by wooden clips as presented in the picture above.
Wire
I decided to plug the analog sensors on pin0, 1, 2 and 3 of the micro:bit (only 0, 1, 2, 3, 4 and 10 support analog read an it can be found here). The motors are plugged on pin13 and 14. To do so you only need female/female wire. Indeed the extension board gives you access to each micro:bit pin to a 3 headers with signal/VCC/Ground. So for each motors and sensors, just connect the signal/VCC/Ground headers to the corresponding headers of the extension board.
As the motors can run on 3.3V but that the input pin of the micro:bit are not made to withstand 5V, I set the jumper of the extension board so that V = 3.3V. Also do not forget to remove the jumper of the buzzer.
Program
As said in the introduction, this robot has been designed to support a lesson about machine learning and more particularly gradient descent. You can find this lesson as well as different ways to program this robot using Makecode on this website. For the moment everything is in french but I'll work on doing a bilingual version.
Run It Live !
I'm working on a little setup to share my solar tracker online with a raspberry pi, so that people can program it in python and get a visual feedback as well as the prints. You can find it here. It's working relatively well right now already but I need to dedicate it a space in my flat which is a bit tricky so I might have to disconnect it some times.
The robot can only be controlled by one person at a time, so be kind and use it wisely. Thank you.