Posts

Showing posts with the label arduino

i used python on raspberry to read ph water from arduino

i used python on raspberry to read ph water from arduino I create a project to read pH water, but my module sensor doesn't fix with raspberry pi 3 so I using Arduino to read pH, then send to raspberry and upload the data to firebase. but, I have some problem, when raspberry read data from Arduino, the looping doesn't work. the error message is serial.util.serialexception here's source code on Raspberry import os import serial import time from firebase import firebase arduino = serial.Serial('/dev/ttyACM0',9600) firebase = firebase.FirebaseApplication('https://raspi-ph.firebaseio.com/', None) def update_firebase(): phair = arduino.readline() if data is not None: time.sleep(1) pieces = data.split("sensor= ") ph = pieces print ph else: print('Failed to get data. Try Again!') time.sleep(10) data = {"Sensor pH": phair} firebase.post('/sensor/ph', data) while Tr...