Creating a Thermometer with the Circuit Playground Express

This little project is great for teaching about temperature and we like to tie it in to some learnings about our immune system.

The CPEX has the ability to measure temperature. When we teach about this we bring in an old school thermometer as well as a newer digital thermometer. It is fun to get the children to take each others temperature during this as part of a lead in to demonstrating making our own thermometer with the Circuit Playground Express.

In Microsoft MakeCode the first thing we need to do is ensure we have “forever” loop. As we all know, computers are great at doing the same thing, over and over again, as long as we give them a little power. This can be great for tasks that require automation and would otherwise be boring for us to be doing…

The finished blocks are shown below, and under this picture we will break down what is going on.

MakeCode Thermometer

In the “forever” loop we start by dropping in an if-then-else condition from the LOGIC section. When you drop it in you might have the condition defaulting to something like if true then else – we will sort that bit out in a moment.

What we want to simulate is that if the temperature has got above 37 degrees Celsius then we will turn all of the pixels red, play a siren sound and a small animation for 2 seconds.

The show ring block needs to be dragged from the LIGHT section and placed under the if condition. Next from the MUSIC section, drag the play sound until done block and change it to ensure it is siren – of course you can pick any of the other sounds that are available with the CPEX should you wish. Finally we drop on a block from the LIGHT section to play an animation and we set that to 2 seconds on the drop down options.

Now we have the blocks of the if-then condition completed we need to tell the CPEX what to do as part of the else condition. The CPEX has a graph block that will turn the lighted pixel ring into a graph display to display number values. If you are not sure on this block then please refer to here. In the else condition we map the lights using the graph block up to 37 degrees celsius.

Next steps would be to show the children the console simulator in MakeCode and explain the plotting concepts. For more advanced work you could download the results into a CSV file in Excel having let the CPEX collect data for a longer period of time.

Image Credits: [credit – Besjunior], [credit – huhabra].

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.