Legos and Servos
I played around the other day with a micro:bit and Legos. I ended up building a simple machine. It didn’t do much except push Legos around the table, but it was a great experience learning code and simple mechanics.
Besides some Lego parts, I used:
micro:bit: https://amzn.to/3s9k5oB
Crazy Ciruits Bit Board: https://bit.ly/2RtxxXU
and Geek Servos: https://amzn.to/32aoCwo
Micro:bit uses some really simple online software. The “block” interface is so easy – perfect for kids or adults new to coding. You simply go to https://makecode.microbit.org to start a new project and drag and drop blocks of programming. There are also tons of great tutorials there. (More advanced styles of programming are available as well.)
The Crazy Circuits Bit Board is a breakout board for the micro:bit. It adds header pins for servos, Lego compatibility, connects to conducive tape, includes a relay output, and more. It’s a great way to turn any micro:bit project into a Lego robot!
Geek Servos also snap right onto Lego, literally making the project a snap.
I simply put all the parts on a Lego board, added power with a two AAA cell battery pack, and loaded the code over a USB cable.
While the code is NOT complicated, I did tweak it quite a few times. For example, I made each push of either of the two buttons on the micro:bit move the main servo left or right by 30 degrees per push. I did that by having it add or subtract to a variable, then pull data from the variable and set the servo to that position in degrees between 0 and 180. I could also use an IF..THEN statement to make sure the variable didn’t go higher than 180 or lower than 0. That prevents extra button pushes adding up, but not doing anything.
The micro:bit also counts pressing BOTH buttons at the same time as another input. I used that to control the other servo, making it move to a certain position, wait two seconds, and then return to the original position. Pressing both buttons again while the arm was in the down position would hold it in the down position for an additional two seconds.
Overall, this was a fun little project. No, I didn’t build it to solve any particular problem, just for me to learn more about servos by doing. But even by just doing this, I have a pretty good sense of what I would need to do to create a fully functioning robot arm. For kids, learning this sort of thing can directly lead to a career in industrial automation.
Anyways, I always have fun when I get to learn something new, and I hope that you do to!
-Ben Nelson
Comments on this entry are closed.