Posts: 1
Joined: Sun Feb 25, 2018 8:04 am

Reading sensor data

Sun Feb 25, 2018 8:15 am

I am working on a project with my air quality sensor SEN 0177 connected to my raspberry pi using GPIO. I am completely new to doing projects with RPi or sensors. I have tried to find a code that will help in reading the data from the sensor so that I can then send it to the web server. The only ones I can find however are for Arduino and I have tried everything on the internet to make the code run well on the pi but to no avail. I need help with writing a code that can help me get the data and I don’t know where to start. Someone please help!!!

Posts: 3892
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Reading sensor data

Sun Feb 25, 2018 12:18 pm


This is the only reference I could find about connecting this sensor to the pi, not much help looks like he resorted to using an arduino

Please only ask questions in the forum I will not answer questions sent to me directly via PM
Remember we want information no help
The use of crystal balls & mind reading is not supported

Posts: 1521
Joined: Sun Feb 17, 2013 6:51 pm

Re: Reading sensor data

Sun Feb 25, 2018 12:34 pm

It looks like the sensor just sends a 32 byte block of data periodically on its serial interface. Each block starts with 0x42 character

It should be possible to get this directly on the Pi fairly straightforwardly. Basically you need the TX output of the sensor connected to serial RX on the Pi. This could either be a USB serial interface plugged into Pi USB or directly on the GPIO pins. For the latter method you need to config the Pi for serial input from those.

The arduino example code is not a good starting point for raspberry code although the routine to check and extract data from the block of bytes can be used as an example.

You need to check out example of say python reading from serial port then code should read characters until it finds 0x42, then read 31 bytes, then check and interpret the block like the arduino code.

Posts: 234
Joined: Wed Sep 04, 2013 10:20 am
Location: Staffordshire
Contact: Website

Re: Reading sensor data

Mon Feb 26, 2018 7:53 am

Web search for raspberry pi temperature web page

Return to “Automation, sensing and robotics”

Who is online

Users browsing this forum: DougieLawson and 14 guests