Raspberry Pi 2 and AirPi 1.4

Not sure if this is considered bad form - talking about the RPi2 and AirPi here on the Pimoroni forum, and need to state that I’m very much new to the whole world of the RPi, Python, Linux and the AirPi! However, I wanted to post this in case it’s of any help to anyone else having problems getting the AirPi (1.4) to work with the RPi2.

Anyway, I took delivery of an AirPi 1.4 on Friday, duly assembled it Friday night, and then connected it up to the RPi2 via a BlackHat (both bought from Pimoroni).

Ran the airpi.py script up and - nothing!

After a lot of fiddling around in the python script, and the sensors configuration file I managed to establish that the basic RPi to AirPi communication was working, the two status LEDs were addressable, and while several of the sensors were okay, the problem was that the script would hang as soon as the DHT22 sensor code was called (Temp and Humidity).

I double and triple checked the DHT22 soldering, and checked it’s connections to the GPIO using a digital multimeter, and after satisfying myself that it should work, turned my suspicion to the “dhtreader.read” call, and sure enough it was failing at that point.

Much googling of “dhtreader.read” later I found references to rebuilding the “dhtreader.so” file, so thought I’d give it a try in case it needed to be rebuilt for the RPi2:

So, I cloned the AdaFruit Raspberry Pi Driver code from GitHub, and downloaded the updated bcm2835-1.42.tar.gz file from airspayce.com, built and installed the updated bcm2835 driver, and then built the AdaFruit_DHT driver for python.

Finally, copied the new “dhtreader.so” file from the build folder over int the AirPi folder replacing the AirPi original file, and hey presto, the AirPi now works successfully on the RPi2.

The necessary URLs are:

I hope this is useful to anyone new to the RPi2 world (particularly newbies like myself) that are interested or struggling with the AirPi on the RPi2.

(Now to get the AirPi to offload it’s data to somewhere useful).

Cheers - Paul

2 Likes

Heya Paul - I’ll drop Tom (the creator of Air Pi) a note asking if he would mind jumping in on this thread. :-)

Not bad form at all! AirPi is awesome and this sort of useful post is always welcome!

Hi,

Cool that’d be great! it feels like the AirPi should be getting a lot more interest, I know it’s a project that’s been around for a while, but it’s one with a lot of interesting stuff in, and showcases how well the Pi can serve up real data.

Okay, so the sensors might not be the most accurate around, but then it only costs a fraction of a lot of weather station kit out there.

Found some really useful extensions to output to CSV (after I’d started putting a basic CSV exporter together), and some discussion about adding a raingauge and anamometer to the mix, so those are things I’ll probably be looking into later on, along with maybe adding in the TGS2600 and AdaFruit GPS units later on.

For the time being the challenge is to see what the CSV data looks like after running (indoors) for a couple of days.

Cheers - Paul

Heya! Great point - I’ll make sure of noting it. Other issues which people have been having are device tree related [boiling down to ‘disable it’], but I think you’re the first to try a Pi 2 and discover this. The DHT22 code in general right now is a bit awful, I want to make a point of trying to make it better. This looks like what Adafruit are recommending now: https://github.com/adafruit/Adafruit_Python_DHT
So I might update the code to use that.

1 Like

Hi Rhencullen

Any chance of a download link for the working dhtreader.so file you created - as I am also having same problem getting AirPi working with PI 2

Thanks

Hi,

Leave it with me and I’ll see what I can do over the next day or two.

Paul.

Thanks Paul, much appreciated

Hi,

I’ve pulled the rebuilt dhtreader.so file into a .zip, and uploaded it to one of the websites I run so that it’s downloadable. It’s been zipped on a PC, so should just need extracting.

The file is at:

dhtreader file: http://solarius.net/airpi/dhtreader.zip

As far as I can remember, I rebuilt the file from the Adafruit libraries, and the resulting file was a straight forward drop-in replacement for the original file, which (after restarting the AirPi) the AirPi DHT22 calls started to work.

Fingers crossed… Paul

Thank you so much - works perfectly now!!!

Excellent, glad to hear it wasn’t just a fluke on my machine related to anything else I might have done to try to get the AirPi working.

The only issue I have with it at the moment, is that it seems to hang occasionally after it’s been running for a few days. Haven’t had the time to try to determine a pattern to it yet, so will be interested to hear if you encounter the same.

I did add a Raspberry Pi camera into the mix, capturing an image every minute or two, also the Pi here is inside the house on a window-ledge so I’m currently monitoring internal air quality and light rather than using it as a weather station.

Anyway, glad to hear you got it working.

Cheers - Paul

Hey Rhencullen,

Could you share where did you get the AirPi Kit? I am struggling to order one for myself.

regards,
André

Hi,

I ordered the AirPi from Pi Supply after a lot of hunting around for a supplier.

I think they’re currently showing as out of stock, so maybe worth dropping them an email to see if this is a temporary stock issue or not.

Thanks for the reply Rhencullen.

I did ask them, they are out of stock. No ETA for new kits, I doubt they will get any more since Tom Hardley dropped the project.
What a shame, really felt like giving it a go…


André

Hi,

There was talk about the school weather station being made available to buy if there was enough demand, not sure what happened about it though, it might be worth following up ?

Paul