Aug
13
2012
9

Reading data from a Sensirion SHT1x with a Raspberry Pi

Note: An updated version of my code is available at /2012/11/update-reading-data-from-a-sensirion-sht1x-with-a-raspberry-pi/

The Sensirion SHT1x range of sensors provide a rather convenient way to accurately measure Temperature and Relative Humidity.

They aren’t the cheapest sensors as they typically sell for around $40, but they seem very accurate. I obtained a Sensirion SHT11 a while back as a free sample. I’d managed to get it working with an AVR ATMEGA328P for a planned project to build an Incubator, but now I wanted to read data from it using the GPIO of a Raspberry Pi.

I decided to keep the SHT11 allocated to my Incubator and bought an SHT15 for my weather station. The sensors are very similar. The data sheet shows that the SHT11 has an accuracy of ±3% Relative Humidity and ±0.4° Centigrade while the SHT15 is slightly better at ±2%RH and ±0.3°C. The communication interface is identical so no problems changing sensors in the future.

Before you can use my code sample, you’ll need to get the latest BCM2835 Raspberry Pi GPIO Library from http://www.open.com.au/mikem/bcm2835/ and wire up the sensor to the Raspberry Pi GPIO port.
(more…)

Aug
02
2012
12

Reading data from a Bosch BMP085 with a Raspberry Pi

Update(2): I’ve fixed some reported bugs in this code. Please use the newer version here.

Update: If the LM Sensors website is still down, you can get smbus.c and smbus.h from here.

I needed a way to measure air pressure as part of my Raspberry Pi controlled weather station.

I decided to use the Bosch BMP085 as it is very sensitive (down to 0.03hPa, or 3Pa) and SparkFun Electronics offer it already soldered to a break out board making it relatively easy to interface.

The breakout board includes pull up resistors on the Data and Clock lines, so it’s a simple four wire connection to the Raspberry Pi.

Breakout Board pin Raspberry Po GPIO Pin
SDA P1-03 / IC20-SDA
SCL P1-05 / IC20_SCL
XCLR Not Connected
EOC Not Connected
GND P1-06 / GND
VCC P1-01 / 3.3V

I had real trouble talking to the sensor using the standard file write and file read commands. I was having to do multiple reads to get usable data, but I noticed that the i2cget and i2cset commands worked perfectly every time.

I took a look at the i2cget and i2cset source code and noticed it was using smbus to talk to the sensor. A little further delving and I had a working solution.
(more…)

Written by John in: Electronics,Raspberry Pi,Weather Station |
Jul
05
2012
0

A new toy to play with

Look what I received in the mail today….

A shiny new Raspberry Pi single board computer.

These things are revolutionising the world of embedded electronics – They have a 700MHz ARM processor, 256MB RAM, Two USB Ports, HDMI and Composite video outputs, Audio output, use an SD Card for storage, use less that 3.5 Watts of power and (drum roll please…..) 100 Megabit ethernet built in.

All this for under $50 New Zealand Dollars.

Oh I almost forgot, they also provide 8 GPIO pins plus access to I²C, SPI and UART Interfaces through a 26 pin Header on board.

First up, get it connected to a Sensirion SHT1x (SHT10, SHT11, SHT15) Temperature and Humidity sensor using the GPIO – Then I’ll be back on track to completing my Weather station project.

Watch this space….

Written by John in: Projects,Raspberry Pi,Weather Station |