[null, {"document_url": "http://www.espruino.com/Freezer+Alarm", "unformatted_src": "refimages/Freezer_Alarm_finished.jpg", "src": "https://www.espruino.com/refimages/Freezer_Alarm_finished.jpg", "formatted_filename": "Freezer Alarm finished", "alt_text": "Finished Freezer Alarm"}, null, {"document_url": "http://www.espruino.com/Freezer+Alarm", "unformatted_src": "refimages/Freezer_Alarm_ds18b20.jpg", "src": "https://www.espruino.com/refimages/Freezer_Alarm_ds18b20.jpg", "formatted_filename": "Freezer Alarm ds b", "alt_text": "Types of DS18B20"}, null, {"document_url": "http://www.espruino.com/Freezer+Alarm", "unformatted_src": "refimages/Freezer_Alarm_to92.png", "src": "https://www.espruino.com/refimages/Freezer_Alarm_to92.png", "formatted_filename": "Freezer Alarm to", "alt_text": "TO-92 DS18B20"}, null, {"document_url": "http://www.espruino.com/Freezer+Alarm", "unformatted_src": "refimages/Freezer_Alarm_sensor.jpg", "src": "https://www.espruino.com/refimages/Freezer_Alarm_sensor.jpg", "formatted_filename": "Freezer Alarm sensor", "alt_text": "TO-92 DS18B20 on ribbon cable"}, null, {"document_url": "http://www.espruino.com/Freezer+Alarm", "unformatted_src": "refimages/Freezer_Alarm_assembled.jpg", "src": "https://www.espruino.com/refimages/Freezer_Alarm_assembled.jpg", "formatted_filename": "Freezer Alarm assembled", "alt_text": "Assembled sensor"}, null, {"document_url": "http://www.espruino.com/Freezer+Alarm", "unformatted_src": "refimages/Freezer_Alarm_dashboard.png", "src": "https://www.espruino.com/refimages/Freezer_Alarm_dashboard.png", "formatted_filename": "Freezer Alarm dashboard", "alt_text": "TinyDash dashboard"}, null]
Freezer Alarm We've got a problem where every so often the freezer door doesn't close properly, and everything inside gets thawed out. While some freezers have an alarm built in, ours doesn't - so this tutorial shows you how to make one using Pixl.js. It beeps when the freezer gets too warm, but also shows the current and historical temperature and sends the data over Bluetooth LE so it can be logged.

 I'm using the DS18B20 because it's accurate, and digital - so there are no inaccuracies caused by having a long wire.

The sensors come in a few forms - you can get them with a cable attached (as above) or in a TO-92 package (in the middle of the above picture). While the cable is easy, you may find it difficult to fit into your freezer so the door shuts unless you're willing to drill a hole in it.

To work around this, I used the small transistor-style TO-92 type of DS18B20 with a thin cable that I added. It's wired as follows: While you could buy a thin ribbon cable, I made one by placing 3 thin wires between two lengths of sellotape. It can then be fitted to your freezer along the side of the door and it won't interfere with the door closing: 
Wiring up is pretty simple:

To simplify wiring, I used a small strip of PCB and with some pins in it to plug into the back of the Pixl, then taped the ribbon cable down to stop the wires from twisting and breaking. However it's fine to just poke wires into the pin headers to make connections if that's easier: Connect to Pixl.js with the Web IDE, copy the following code to the right-hand side and click upload.

Once uploaded, type save() - this will save everything to Flash memory and will start the code running.



Since this code broadcasts the temperature via Bluetooth LE on the standard characteristic 1809, you can install the EspruinoHub Software on a Raspberry Pi with Bluetooth LE. When a log directory is created, it will keep a log of the temperature in that directory.

You can then use the TinyDash library to plot those temperatures, for example: Details of this will follow in another tutorial.