Petit Studio Raspberry Pi HDMI extender cheap cable fix

Note: This fix is NOT due to a fault of the Petit Studio Raspberry Pi Camera extension kit, it’s due to the use of cheap HDMI leads.

I brought some Petit Studio Raspberry Pi HDMI camera extenders from Tindie. These boards passively convert the 15 pin ribbon cable into a convenient HDMI connector so the cable can be extended using HDMI cables. It doesn’t convert the signal to HDMI, it simply uses the HDMI cable as an extension. Sidenote: The $5 shipping only took 4 days to get to New Zealand from Japan!

I brought some cheap 3m HDMI cables from a supplier on TradeMe and thought I was all set.

It turns out not all HDMI cables are made the same. The cables I brought work perfectly between a PC and monitor, but not at all on the Tindie camera extender.

A quick Duck Duck Go (That’s so much harder to use as a verb than Google) and I found a fix – There are meant to be shields for each data pair but in cheaper cables these are not connected. It’s an easy fix, just use the metal shield of the HDMI plug as ground…..

Or not..

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

AVR – Detecting loss of power and writing to EEPROM

As part of a recent AVR project, I wanted a way to increment a counter and store it even if the power was lost. This could be done with an external flash memory device, but I wanted to use the internal EEPROM of the AVR.

The internal EEPROM is limited to around 100,000 writes. Independent tests have shown this can be doubled, but 100k writes is only about 27 hours if saved once every second, so not practical for a device I wanted to last at least five years.

It takes a maximum of 34ms (8448us per byte) to write a 32 bit (4 byte) integer to EEPROM. Due to the low power requirements of an AVR, I was confident that a decent sized (say 2200uF) capacitor would allow an AVR plenty of running time to complete EEPROM writes/saves before power is totally lost.

Written by John in: AVR,Embedded Systems,Weather Station |

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.


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:


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/.


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.


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.


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.

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

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 |

Running the network cable for the Anemometer

Those who know me, know I don’t like doing things properly, so it was only natural that the Anemometer for my weather station was wired rather than using an RF link such as an XBee and a solar panel.

I obtained 100 metres of Underground rated CAT5E network cable. A lot of techie people have heard of Underground rated four core cable as it’s used by telephone companies to run the telephone cable through your front lawn to your house. The cable has a hard thick sheath to resist the elements and it’s filled with a sticky gel substance with the consistency of Vaseline.

Underground rated CAT5E network cable has a thick sheath and is filled with a waterproof Gel.


Written by John in: Projects,Weather Station |