Python

Getting my fridge to follow a temperature profile from a Google spreadsheet

Posted on Jan 2, 2012 in JavaScript, PHP, Programming, Python, UberFridge | 0 comments

I wanted an easy way to set temperature profiles that my fermentation fridge would follow. This would enable me to: Start a fermentation on a lower/higher temperature and gradually bring it to a normal fermentation temperature. Slowly raise the temperature near the end of fermentation to boost attenuation Google spreadsheets turned out to be a nice way to do this: They can be queried like a database They can be accessed from anywhere Working with cells is easier than working with a txt file They work well with the Google Visualization API You can view a sample of the spreadsheet I use...

Read More

Logging sensor data into Google annotated time line graphs with Python and Arduino

Posted on Dec 31, 2011 in Arduino, C++, JavaScript, PHP, Programming, Python | 1 comment

Annotated time line graphs from the Google Visualization API are a very nice way to display sensor data. With the gviz_api library for python the sensor data can be stored into JSON files that can be read by the Google Visualization API in JavaScript. Here I will explain the steps from Arduino to JavaScript. Arduino Code The first step is getting the sensor data from Arduino to Python. I have described setting up the serial communication between Arduino and Python here. The Arduino sends the sensor data as comma separated values, which can be read by a CSV reader in Python. As separator, I...

Read More

Communicating between Python and PHP/JavaScript with AF_UNIX sockets

Posted on Dec 31, 2011 in Arduino, Electronics, JavaScript, PHP, Programming, Python, UberFridge | 2 comments

I wanted a better and more direct way to communicate between PHP and Python than through files. Socket communication was the answer and this article explains how to set it up! My router runs a Python script that monitors my fermentation fridge. Only the python script communicates with the Arduino, so all commands and data requests to the Arduino go through this script. To keep loading times low for the web interface, I needed a fast and direct way to communicate between PHP and Python. Python and PHP run on the same router, so a straight forward way to communicate is through the file system....

Read More

Communicating between Python and Arduino with pyserial

Posted on Dec 28, 2011 in Arduino, C++, Electronics, Programming, Python, UberFridge | 4 comments

In my UberFridge project, my router runs a python script that periodically requests new sensor data from the Arduino. The script logs this data in files for the web server running on the router. All other communication with Arduino (getting the OLED’s content, reading/changing settings) also goes via the python script. The Arduino is programmed as a slave that responds to requests from python. With the pyserial library for python, setting this up is fairly easy. Python code My Arduino connects to the router via a USB hub. The router mounts the Arduino as /dev/usb/tts/0. See this article on...

Read More