Breed perfect bread, brew beautiful beer, and perfect chickens with the Arduino Temperature Controller. If you live in a less reliable climate like England, instructions that say you have to keep something at a set temperature aren’t particularly helpful — we don’t have air conditioners, and raising the thermostat for the whole house is impractical. just make a loaf of bread. Even if kept inside, the chicks may die if the temperature drops at night; and getting them in the first place has an even stricter temperature range. But I need my bread, and the chickens need to hatch — so instead of buying expensive equipment, we can build a competent temperature controller with an Arduino and household bits.

The same goes for keeping food cool—it can be wasteful to use an entire refrigerator just to make yogurt—but the principle is the same with a temperature controller. Instead of activating a heating element, you will activate a plug on a mini fridge or other cooling element such as a Peltier (thermoelectric cooler) — and of course the logic is reversed.

What will you need

This is an Arduino project — if you’ve never worked with an Arduino before, our free beginner’s guide this is a fantastic place to start.

  • Arduino
  • Temperature sensor — I use the TMP36, a cheap one-pack device that comes with the Oomlout (UK) / Sparkfun (US) starter kit.
  • Relay or RC plug switches
  • Screw terminals
  • Heat retention box
  • Heating element or incandescent lamp and fixture (or both)

The last point was left deliberately vague. If you have an incandescent bulb (one that heats up, not an energy-saving bulb) or a hot sports injury bulb and the like, that’s probably the easiest to install. I use heating tape — basically a rubber band that heats up with the passage of electricity, used on barrels and kegs for the initial stages of fermentation when making wine or beer — this could technically start a fire if not wrapped around something Please don’t do this, I’m only using this for testing. . You can also buy heating pads for the same purpose.

For safety reasons, I use these RC plugs to switch AC devices, with the broken controller detailed in this home automation article. . It’s wireless so I don’t have to touch the wires.

Temperature sensing

Let’s start by connecting and testing the sensor. [ Диаграмма из Адафрута ]


Flat side towards you and feet down TMP36 temperature sensor connected + , signal , GND in that order. + Goes to 3.3V output from Arduino; you also need another line going from the +3.3 to the AREF pin — this tells the Arduino to use 3.3V for the analog reference input instead of 5V. Connect the probe signal to A1. In previous attempts, I used the TMP36 directly on the 5V line; it works, unfortunately, when paired with a relay, each time the relay was triggered, there was a drop in power, which led to strong fluctuations in readings.

For the signal cable, I used an old network cable — it’s very convenient to have it around, since there are 8 wires inside. The cable is quite thin though, so be sure to harden the other end with solder where it will be screwed into the terminal block.


The formula in the code assumes you are using a tMP36 sensor; You should be able to find sample code for other sensors. This sample code is from Adafruit — download it and open the Serial console to check the output.


Compare with a thermometer if possible. Reading wrong?

  • Verify that the applied voltage is actually 3.3V
  • AREF is also connected to 3.3V?

Adding to Switch Logic

To control the heating element I use these RC sockets from Maplin and dismantled the controller . Only ground and control contact should be connected. I have modified the code to include the relevant libraries which you can download here.

radio controlled switches

At this point, I’m also going to remove all references to Farenheit and continue with Celsius only. I then defined the desired temperature to maintain and added in a simple control structure like this:

if(temperatureC < desiredTempC){ mySwitch.switchOn(1,1); Serial.println("Heater ON"); } else{ Serial.println("Heater OFF"); mySwitch.switchOff(1,1); } 

There is nothing complicated here that you will not understand - just compare the current temperature value with the required one and turn on the switch if it is lower; otherwise, turn it off.

The complete code can be found here, although you will need to set it up if you are using a relay (it's not difficult). Here is the complete wiring diagram I used:


Putting it all together

Tape the sensor inside the box you are using, and place the heating element where appropriate. Set your desired temperature and turn it all on. If you keep your computer connected for now, you can use the serial console to watch for changes as your box heats up.

box controller temperature

Further work


Finally, what would this project be without a little test? I whipped up a batch of the finished dough in a bread maker and divided it into two loaves. That starter inside the box was a little bigger, but then the ambient temperature today is about 26 degrees Celsius - it would be much healthier in winter. In any case, I'd better make soup to accompany this fine bread.

bread dough

So what would you do that requires a constant temperature?

Похожие записи