Comments: SparkFun Inventor's Kit for micro:bit Experiment Guide
Looking for answers to technical questions?
We welcome your comments and suggestions below. However, if you are looking for solutions to technical questions please see our Technical Assistance page.
If you've found an issue with this tutorial content, please send us your feedback!
I was working through the experiments in preparation for working with my niece this summer when she visits. I found a slight issue with experiment 8: Using a Servo Motor.
The experiment shows connecting the servo power connections to the power rails of the Micro:bit. These are 3.3V. But the servo is more likely to want something closer to 5V. In my case, the servo behaved erratically. I tried another servo and that one did not work at all. I could tell it was getting the correct signal and power was connected. It just wasn't happy.
I first connected a capacitor in parallel with the supply pins of the servo. That helped a lot. But it still wasn't quite right. I then grabbed a breadboard power supply and connected the power pins on the servo to the 5V output. I then connected the ground of the supply to the ground of the Micro:bit. This worked perfectly: with both servos. The 3.3V signal from the Micro:bit was high enough to work. The servo just needed a bit more voltage for its supply.
Thank you for the feedback and comment. For anyone reading the comments, we understand that the 3.3V rail is not the recommended operating voltage for the micro servos. For testing purposes, it was just enough to get the servo moving but not accurately. There is a note about the voltage. Other examples online using the micro:bit and in micro:bit's official makecode example have accepted the same circuit for testing. Some of those examples also have a note about it.
The note has been moved to the hardware hookup and updated with some clarification. =)
Is it possible to use the potentiometer to control a servo motor? Like having the servo rotate as you turn the potentiometer instead of the servo only turning to an incremental value?
Hello, Try this stripped down program....
https://makecode.microbit.org/_T2a0oVdRhUcp
This stores the potentiometer value (0-1023) on Pin 0 to a variable and then maps that value to degrees (0-180) and writes that to a servo on Pin 2 of the micro:bit.
I have not tried this using the micro:bit but it is possible just like any other microcontroller. You just need use the circuits from experiment 2 and 8. Then translate the analog values from the potentiometer to the servo motor pin. Try using the
map
code block to translate the values from the potentiometer to the servo motor pin like the code used in experiment 10.