Feb
13
2013
0

Update – Bosch BMP085 Source (Raspberry Pi)

I have updated my code to Read data from a Bosch BMP085 with a Raspberry Pi to correct some bugs reported back to me.

The main bug was that I’d forgotten to close the i2c file at the end of bmp085_ReadUP() – This shouldn’t have caused any problems if you were calling the function once per execution, but if calling it multiple times, it may crash. On the same note, if you are calling the functions multiple times, you may want to move the opening and closing of the i2c file outside of the functions so the files aren’t opened and closed multiple times. Thanks to Radu P for reporting these issues.

It looks like lm-sensors.org is back up now, but if not, you can find a locally hosted copy of smbus.c and smbus.h in this earlier blog post.

Note that I’ve written a number of posts on using this sensor. Here is a link to all posts on the topic.
(more…)

Written by John Burns in: Electronics,Projects,Raspberry Pi,Weather Station |
Feb
02
2013
0

Water Meter Project

Our water at home is supplied by way of rainwater off the roof of the house. We have about 55000 Litres (~14500 Gallons) of storage capacity but a long dry summer sees the levels drop considerably.

I decided it was time to add a water meter into the circuit to be able to monitor our water usage.

I picked up an Elster S100 water meter complete with an electronic Pulse output.

IMG_1587

The meter outputs one pulse per Litre of water. It’s only a two wire output so it appears to be a simple switched output such as that from a reed switch, but I’ll need to check before committing to any specific circuit design.

I’ll Probably use an Atmel AVR Microcontroller to count the pulses. The AVR will be setup as an SPI Slave to talk to a Raspberry Pi. I should have a better idea how best to implement it soon.

Written by John Burns in: Electronics,Projects,Raspberry Pi,Water Meter |
Dec
17
2012
0

Update – Reading data from a Bosch BMP085 with a Raspberry Pi

Since my earlier post on Reading data from a Bosch BMP085 with a Raspberry Pi, the lm-sensors.org website has gone down.

If you need smbus.c or smbus.h, here are copies from back in August 2012.

Note that I have made some changes to smbus.c:

  • Defined NULL
  • Changed the path for including smbus.h

Here are the two files:

Written by John Burns in: Electronics,Projects,Raspberry Pi,Weather Station |
Nov
01
2012
5

Update – Reading data from a Sensirion SHT1x with a Raspberry Pi

After a few comments regarding my code to read data from a Sensirion SHT1x with a Raspberry Pi, I’ve got some updated code.

Please see my previous post for general information, but use the code here.

The list of changes are:

  • Added Dewpoint calculation from Page 9 of Datasheet
  • Updated Humidity calculation Coefficients to recommended (12 bit) figures from Page 8 of Datasheet
  • Updated Temperature calculation Coefficients to recommended (3.3 Volt Interpolated) figures from Page 9 of Datasheet

Any references to the datasheet refer to the Version 5, Dec 2011 datasheet found on Sensirions website.

Also note that the bcm2835 GPIO library has been updated and is now version 1.8 – Get the updated version from http://www.open.com.au/mikem/bcm2835/.
(more…)

Sep
09
2012
2

Raspberry Pi – Increasing the USB power limitations Part 2

Last week I wrote about how to bypass the USB Polyfuses on the Raspberry Pi to Increase the available power for USB devices.

Unfortunately, my Raspberry Pi is still unstable (I’ve tried both Raspian and ARCH Linux), so I’m playing around a lot with increasing the USB power capability.

The next option, which will definitely void the warranty is to completely remove the Polyfuses and run power direct from the DC input to the USB ports. This bypasses all the fuses on the board and replaces the thin PCB traces with a heavier gauge wire.

Without fuses, you could get into trouble if you don’t know what you’re doing. Consider yourself warned!

Here’s how to do it.

First, remove the USB Polyfuses from the Raspberry Pi.

Raspberry Pi with USB Polyfuses removed


(more…)

Written by John Burns in: Electronics,Projects,Raspberry Pi |
Sep
02
2012
3

Raspberry Pi – Increasing the USB power limitations

I bought a Logitech C920 webcam last week. It’s a very nice unit which outputs Full HD (1920×1080) video. The picture is really clear but it draws more power than the Raspberry pi can supply.

For me this power problem affects my network connection. It seems that the Network adapter is very picky when it comes to it’s supply voltage.

The Webcam seems to draw about 240mA at 5 volts when it focuses, while the Raspberry Pi is limited to 140mA per USB port and 1.1A total current draw.

The Raspberry Pi limits these currents by way of Polyfuses which are a fuse made of a special polymer. They “blow” like a fuse if too much current goes through them, but then over time “heal” and conduct again. Unfortunately due to their inherit design, before they “blow” their resistance increases as the current increases. This can cause a drop in voltage, commonly referred to as voltage droop.

Without going into too much more detail, this basically means that as a USB device approaches a 140mA current draw, the voltage going to the device will drop and in much that same way, if the total current approaches 1.1 Amps, the system voltage will drop.

I decided the best way to fix this problem is to bypass the Polyfuses on the USB port with wire links. This would mean that the 140mA limit was bypassed, but the total 1.1 Amp limit would still apply. Note that this more than likely voids the warranty on your Raspberry Pi.

You first need to find the PolyFuses on your Raspberry Pi. They are easy to find, they’re the two green “blocks” on the board between the USB port header and the activity LEDs.

Photo showing the Polyfuses (Green blocks) protecting the USB ports.


(more…)

Written by John Burns in: Electronics,Projects,Raspberry Pi |
Aug
26
2012
4

La Crosse TX23U Anemometer Communication Protocol

I’ve previously documented the protocol of the La Crosse TX20 Anemometer, but mine recently failed.

The La Crosse TX23U Anemometer is almost half the price of the TX20, so I decided to buy one and see if I could decode the protocol.

The big difference between the TX20 and the TX23U is that the TX20 will send a datagram every two seconds (when the DTR line is pulled low), while the TX23U won’t send anything until triggered by briefly pulling the Data line low.

Here’s everything you’ll ever want to know about the pin out and the communications protocol of the La Crosse TX23.
(more…)

Written by John Burns in: Electronics,Projects,Raspberry Pi,Weather Station |
Aug
13
2012
7

Reading data from a Sensirion SHT1x with a Raspberry Pi

Note: An updated version of my code is available at http://www.john.geek.nz/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
9

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 Burns 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 Burns in: Projects,Raspberry Pi,Weather Station |