Hello and Welcome! If you have a technical question please check out our Forums. If you have an order or shipping question please refer to our Customer Support page. Please see all COVID-19 updates here and thank you for your continued support.


Please take our customer survey for a chance to win $1000 in SparkFun credit! We really appreciate the time you take to give us your extremely valuable feedback on how SparkFun can be its best - we couldn't do it without your input. Thank you!

Getting started with the micro:bit — Making a temperature gauge

For Part 3 of the "Getting started with micro:bit" series, we read temperature from a built-in sensor and rotate a servo.

Favorited Favorite 1

As we continue with the micro:bit series, we look at another onboard feature: the temperature sensor. Interestingly, there is no separate chip for the temperature sensor. Instead, we read from the temperature sensor built into the main processor (nRF51822). While it was originally intended for detecting overheating, we can use it to get an idea of the ambient temperature (just make sure you're not taxing the processor, as you'll really start throwing off the readings with the extra heat).

In addition to reading temperatures, the micro:bit is capable of controlling small servos. We can use alligator clips to make connections to the pads or use #4--40 screws to more permanently attach wires. I say "small servos" because the sub-micro servos seem to function with the provided 3--3.3V from the micro:bit. If you need better torque (and actually want to operate the servo in the specified voltage range), you'll need to find another power source that can provide 4.8--6V.

That being said, the small servos (even at 3V) seem to perform adequately for moving small loads, such as Popsicle sticks and cardboard. In the video, you can see that I glued a Popsicle stick to the servo's arm and mounted it to a cardboard backing to create a more visually appealing temperature gauge.

Because I love the idea that I can share an interactive version of my code complete with simulator, here is the temperature gauge program from the video:

The micro:bit is still on pre-order, but you can click here to learn more about it.

For anyone who has used servos with students in the classroom, clubs, etc., what kinds of projects have worked well? What materials (e.g., cardboard) do they enjoy using with the servo? Please share your thoughts in the comments below.

Comments 3 comments

  • I have a micro:bit and it works great. Got it this week from Adafruit. Those people over there are great. They even had the edge connector for it. Which I also bought. So far I have made a faceplate for it with my 3D printer. I made a compass out of it. I used the temperature sensor for a thermometer. I also found a few bugs. But this little 32 bit processor is quite the interesting device. Reminds me of the Sinclair ZX80 I had. Those Brits are always coming up with something unusual. I suggest checking it out.

  • Two comments: First, I'd stick some sort of a delay into the loop with the servo, just to keep the CPU's temperature from rising (assumng, of course, they don't do delays the "brute force" way of having a tight loop). Second, our friends over at Adafruit seem to have the micro:bit in stock. (One downside is that last I checked, "free shipping" for Adafruit requires a $200 purchase. Another is that Adafruit is further from Phoenix than is SparkFun, so surface shipping can take longer.)

    • I actually do think loops are brute forced a la Arduino-style, so I don't know if it'll help that much. One could definitely sleep, but that wasn't something I saw available in MakeCode (which I don't think is a big deal, since it's really intended for absolute beginners).

Related Posts

Recent Posts

As Teensy As Pie



All Tags