91av

How to make a BBQ thermometer with a BBC micro:bit

With a BBC micro:bit and a temperature sensor, you can make a device that tells you when your food is perfectly cooked

barbecue

BARBECUES are a great joy of the outdoors – but undercooked food isn’t. So let’s make our own digital temperature sensor to check both coals and food are piping hot.

The BBC micro:bit has a built-in temperature sensor, but we will use a DS18B20 temperature probe instead. This is more accurate and more flexible – we can even poke it into food (just check the coating of your sensor is food-safe).

The sensor has three wires: black, yellow and red. Slot each into a different row on your breadboard, then use a crocodile clip jumper wire to connect the black wire to the micro:bit’s ground. We will need a resistor to help it talk to the micro:bit. Place your 4700 ohm resistor so that one leg shares a row with the yellow wire, and the other leg with the red. Connect the row with the yellow wire to micro:bit’s pin 0, and the row with the red to 3V.

Let’s add an LED to alert us when we reach the desired temperature. Connect the LED’s short leg to micro:bit’s ground, and the longer leg to one end of a 470 ohm resistor. The other end should go to pin 1, so the resistor stops the LED drawing too much current.

Now to teach our micro:bit some new tricks. In the MakeCode editor, go to “Advanced”, then click on “Extensions”. In the search box, enter “DFRobot/pxt-ds18b20”. Clicking on the result will cause an option called “DS18B20” to appear in the editor menu. We have just added some code to help us read the sensor more easily, just like a programmer uses a pre-existing “library” to add functions to their programs without having to write all the code themselves.

Grab a “show number” from “Basic” and clip into “forever”. Clip into that a “round” block from “Math” and, from “DS18B20”, a “Pin 0 Temperature_number”. This will show the temperature as a whole number on the micro:bit screen.

Now for the alert. From “Logic”, take an “if/else” block and clip into it a “0 \> 0” comparison. Clip another “pin 0 Temperature_number” on the left-hand side of the comparison, and write a value on the other. This is your target temperature – whatever you want the coals or the food to be.

Nestled under “if” add a “digital write pin 1” from “Pins” and type 1 in the box. Put another under “else”, but leave the default zero. This turns the LED on and off as the temperature goes above and below the target. As ever, you can .

Finally, some safety frills. To keep the sensor cable away from the coals, I bent a wire coat hanger into a stand. For extra heat protection, I padded the wire with swatches clipped from oven mitts.

Now go forth and cook. Just don’t forget to change the target temperature between checking the BBQ and food, or you will end up with very well-done wings!


New stuff you need


Next in the series

1 Moisture-sensing plant

2 Moisture and temperature-sensing plant

3 Plant auto-waterer

4 Tweeting wildlife cam

5 Pest scarer

6 BBQ thermometer

7 Rain alarm Tell if precipitation is on the way

8 Mini weather station

9 & 10 Remote controlled pest-proof bird feeder parts 1&2

To download a printable version of this page click here

Email:maker@newscientist.com

Topics: Electronics / Food and drink