Nishadh KA

DYLOS raspberry pi experiment

2013-11-11


The Dylos air quality monitor with serial to USB port was connected to the raspberry pi. Raspberry pi connected through mini USB for power, LAN is connected to RPi, for SD card preparation followed this

import serial
import time
ser = serial.Serial('/dev/ttyUSB0', 9600, timeout=60)
time.sleep(60)
logfile = open('test.csv', 'a')
while 1:
        line = ser.readline()
        now = time.strftime("%Y-%m-%dT%H:%M:%S:00.000000+0530", time.localtime())
        a =  "%s,%s" % (now,line)
        print a
        logfile.write(a)
        logfile.flush()
logfile.close()
ser.close()