SHT21 sensor to node-red

478 views
Skip to first unread message

Prashanthi Krishnan

unread,
Jun 11, 2015, 11:14:58 AM6/11/15
to node...@googlegroups.com
Hello all,
I have a raspberry Pi installed with node-red and a temperature and humidity sensor SHT21. Will I be able read temperature data into node-red via the GPIO node in node-red or is tehre anyother way in which the sensor can be made to work in raspberry pi..

Luis Montes

unread,
Jun 11, 2015, 11:21:13 AM6/11/15
to node...@googlegroups.com
Looks like that sensor uses i2c.  You can read and write bytes to it with node-red-contrib-gpio, but you'll need to read the datasheet to figure out what to send it and how many bytes to read back.


On Thu, Jun 11, 2015 at 8:14 AM, Prashanthi Krishnan <prashu93...@gmail.com> wrote:
Hello all,
I have a raspberry Pi installed with node-red and a temperature and humidity sensor SHT21. Will I be able read temperature data into node-red via the GPIO node in node-red or is tehre anyother way in which the sensor can be made to work in raspberry pi..

--
http://nodered.org
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dave C-J

unread,
Jun 11, 2015, 1:42:43 PM6/11/15
to node...@googlegroups.com

A possibly useful thread over here...
https://www.raspberrypi.org/forums/viewtopic.php?t=7086

(So may be easiest to use exec node to call to the python script to start with)

Andrew Lindsay

unread,
Jun 11, 2015, 1:51:17 PM6/11/15
to node...@googlegroups.com
I used an exec node to call an application that did all the I2C wizzy stuff. Just had to build up the parameters and interpret the response.

Andrew

Luis Montes

unread,
Jun 11, 2015, 2:09:57 PM6/11/15
to node...@googlegroups.com
Building up the parameters and interpreting the response seems like the hard part.  I'd rather do that with a js function node than shelling out, but whatever works :)

Cool thing is a lot of the logic for i2c sensors (not this one in question) is already figured out by johnny-five libraries.  So it's a good resource for i2c communication examples.

Here's a flow for grabbing temperature + accelerometer data from an mpu6050 i2c sensor:  http://flows.nodered.org/flow/f8c7a94454f79d3cfdc5

--

Dave C-J

unread,
Jun 12, 2015, 4:43:52 AM6/12/15
to node...@googlegroups.com
Luis, in most case I would agree with you. For this one as it seemed to have some odd timing/blocking behaviour mentioned in that post (which may or may not be true of course) then starting with some known working code would be the easy way to get going... If someone then then ported that over  that would be nice !

Prashanthi Krishnan

unread,
Jun 12, 2015, 1:02:37 PM6/12/15
to node...@googlegroups.com
hello sir,
i have installed the gpio in my raspberry pi..  also i found out the no.of bytes to be passed and received .. its 14/12 bits in case of detecting the temperature.. but i get the error :could not find module raspi-io although i had installed the module several times and rebooted the raspberry pi...

Julian Knight

unread,
Jun 12, 2015, 4:54:04 PM6/12/15
to node...@googlegroups.com
You might be interested in the Adafruit DHT library for the Pi. the DHT series are the same sensor I believe.

https://github.com/adafruit/Adafruit_Python_DHT

Might give some further insight.

Dave C-J

unread,
Jun 12, 2015, 6:16:03 PM6/12/15
to node...@googlegroups.com
Julian - well the DHT uses a one wire protocol - while the SHT21 uses 2 wires i2c - so unlikely...

Julian Knight

unread,
Jun 12, 2015, 7:09:44 PM6/12/15
to node...@googlegroups.com
OK, fair enough, I didn't know that. Electronics not my strong point! Still learning though.
Reply all
Reply to author
Forward
0 new messages