The SHT75 sensor has an I2C ‘like’ communications protocol (data sheet link below). It seems to have a default address below the range of the BBB I2C bus. Does anybody know how to go about logging this sensor on the BBB, and the necessary steps required to do so? Even general, hand waving in the right direction is welcome!
I’ve gotten the SHT15 humidity sensor working on my IOIO. I haven’t done so on the BeagleBone Black yet, though pretty much the same approach should work. It looks like the SHT75 has a similar protocol.
You just want to use one GPIO pin for the clock and one for the data line, and then write some routines to bring them high and low per the protocol described on the datasheet. The only difficulty I had was that the SHT15 seemed to respond slowly, so I had to sleep for 10 or so milliseconds between pulses.
Give it a shot. Connect up your sensor to some i2c pins. Load one of the i2c device trees to enable the i2c pins. Then load up the driver and check to see if it detected a monitor, ie ‘sudo insmod sht21’ or ‘sudo insmod sht21.ko’
You may need to run ‘echo sht21 0x40 > /sys/class/i2c-adapter/i2c-X/new_device’ where X is the i2c line the sensor is on.
If all goes well, there should be an interface somewhere in the /sys directory where you can run “cat temp” or something like it to read the temperature.
See http://www.raspberrypi.org/phpBB3/viewtopic.php?f=44&t=7086 for an adventure in trying to get it working the raspberry pi or do a search on google for “sht21 linux” to try to find some examples of usage[as opposed to all the links to the sourcecode which you don’t care about]
So you would need to compile that driver[easiest method is to recompile the kernel and during the configuration find the sensor in the options and enable it].
So that’s promising. Not sure how you go about invoking modprove to specify which GPIO pins to use, but I’d think it would be much easier to use the module than write new code.
Thank you very much for all the pointers for getting this to work on the BBB, Gary. It actually was pretty easy to write some custom code to get the SHT15 to work on the IOIO (in Java), but I am just at the stage in my BBB education where I’m curious about compiling the kernel for myself and configuring the device tree, so I will give this a try too. Your pointers are very helpful.
Thanks Eric and garyamort - really helpful suggestions and it’s good to see that it is not only possible, but is in multiple ways too. Now that I can see how to deal with the I2C protocol, I feel more comfortable with the programming approach but will give the recompiling option a shot first as it does sound quicker, and the Angstrom Wiki page seems to lay it all out.
Well, I got the sht15 kernel module compiled and installed. Now the rub is indeed, as you say, how to specify which GPIO pins to use!!! So far I’m not seeing it in the c code. If I figure it out, I’ll post a how-to somewhere… In any case, it has certainly been educational so far!
It looks like it has to be done within the device tree, setting gpio_data, gpio_sck, and supply_mv in a platform device struct. I have yet to tackle the device tree myself, and it’s too late here for me to start that tonight…
I think your right about it being in the device tree - I know there is a way of specifying drivers and such there, but have not gotten around to needing that yet.