Temperature Controller using Raspberry Pi and Arduino

In this blog I will show you how to develop a heater control system(On/Off controller). We will also develop a web interface from which you can see the current temperature and control the some parameters like what will be min allowable temperature. The circuit will try maintain temperature in between set limits (minimum temperature and maximum temperature). if temperature drops below the minimum level then heater will be turned on, if temperature reaches the maximum level heater will be turned off. You will be able to adjust these two parameters from a web page.

we will use SerialPublisher driver to provide communication between Raspberry Pi and Arduino UNO. Download SerialPublishSoft and place in your Arduino library folder. Upload the following sketch

Now on Raspberry Pi we have to setup a web server to serve web pages. If you haven’t it already you can follow Setting up Python webserver guide to setup web server. if this is the first time your using the serial port of Pi you may need to disable the port. follow this guide to Disable Serial Port the Serial port.

I have removed the css on Pi version of project you can add them back if you want. you can get complete version form here. The TController.py contains the routing infromation and templete folder contains the html pages.I have forwarded all the requests from clients to the Arduino to get the values. This is ok if you one or two clients. If you more clients accessing the service you might want to cache the results form Arduino and serve the cached results to the clients.

The same python code you can run on windows machine as well. just change the Serial port name in TController.py file.