We have have permit to make homemade ethanol. We used to do it all manually by sight, sound, and smell but we wanted to add some automation and sensors to the device. I have pretty a pretty in-depth knowledge of the Arduino system so we went that rout to begin with. We have an Arduino Mega, 3 thermocouples, an LCD screen for the temps, a couple relays to turn our water circulation and cooling system on as well as a contractor switch to turn on our heating element to heat the "mash". This worked pretty well however now we wanted to be able to read the temp data online as well as plot the data (the data being the specific temperatures of the different thermocouples among other things) on a spreadsheet for later review. The spreadsheet part was easy I simply downloaded a program called PLX-DAQ (an excel add on) that reads serial data from the Arduino and makes it into an excel sheet, this worked very well. However the printing on a webpage was more difficult we were going to do this with a WiFi or Internet shield. However when we tried this it didn't work, long story short there was so much going on with the Arduino it crashed after 5min every time. So we decided to go with a Raspberry Pi and make the Arduino essentially a slave to it. I'm new to the python language but I feel like I'm catching on pretty quickly however I'm stuck. Below is what I currently have with the Pi setup and in bold is what I can’t figure out.
We currently have 2 ways of reading the thermocouple data on the pi. Either with the terminal window using the code
Code: Select all
python grabserial Code: Select all
>> test.ods Code: Select all
import time
from datetime import datetime
import serial
datetime.now()
ser = serial.Serial(‘/dev/ttyACM0’,9600)
while True:
print (ser.readline())
print(“%s:%s:%s” % (datetime.now().hour, datetime.now().minute, datetime.now().second))
time.sleep(2)
If someone could help me that would be great. If there is an easier way than the two methods I have shown above please let me know I’m open to any advice. Also remember I would like the thermocouple data to be able to be printed on a webpage at some point in the figure but that is a different topic that I haven’t researched as much yet so I’m not too worried about it yet.
Currently using python 2 but can use python 3.
Any fool can write code that a computer can understand. Good programmers write code that humans can understand