RaspberryPi wifi networking, programming and hardware IO

As part of a small project to do energy and environmental monitoring of our home I have been getting to grips with some RaspberryPi hardware that I purchased perhaps 3 years ago.

A few challenges came up! I’ll cover a few in a couple of posts.

  • Getting a wifi dongle to work.
  • How to go about programming stuff on the rPi
  • Getting to grips with rPi GPIO hardware interfacing.
  • Getting rPi I2C IO working
  • yii2 on RPI

A quick general overview of the project. I previously had an Arduino Mega with a wifi shield from Async Labs monitoring some systems around the house. I changed broadband providers and the wifi network changed. After not having the monitoring in place for about a year I decided to get back in to it and get the hardware working. I quickly discovered that Async Labs went out of business nearly 5 years ago and their excellent piece of hardware needed some new software. The Arduino development environment had moved on and migrating to it broke both my web server software and the wifi connectivity. It didn’t take long to bin the idea of trying to revive the old hardware and to decide to move on to the RPI platform. I had never before bothered with GPIO on the PI so it seemed like a good time to roll my sleeves up.

Basically I have installed 3 pieces of hardware that allow me to monitor resource useage around the house.

  • A magnetic door security switch installed on a standard fitting gas meter provides simple pulse counts as the meter ticks over.
  • Installing a mains water meter with monitor contact under the sink in the kitchen provides one pulse per litre of water used so I can track our water useage.
  • I installed an industry standard electricity meter with pulse output that allows me to monitor power useage. A comment here, about 6 months after I had installed my electronic meter our electricity supplier came to the house and removed the old ‘spinning disk’ mechanical meter and installed an identical unit to mine in the main feeder box outside the house.
  • Outside environment monitoring – Air pressure, Outside Air Temperature and Relative Humidity.
  • Future expansion possibilities such as Light and IR level monitoring.

Details on the meters and sensors used can be found here.

I wanted to monitor the 3 pulsed signals with interrupt driven monitoring so challenge number one was achieving that!

My energy and water signals are all fed to a point in my garage so it seemed logical to get the RPI to connect to my network via wifi to save having to run a new ethernet spur to the garage ( I wired the house some 15 years ago, much of it has fallen into disuse apart from a spur that is used by my son for WoW and other online gaming )


I fired up my PI and got a basic installation working. I checked networking was working and used the ethernet connectivity of the PI. Working directly on the PI with a small keyboard and an old screen simply wasnt hacking it for me and I quickly reverted to SSH’ing in to the PI with my favourite terminal package and working from my PC or the Mac. I manage a couple of servers an I’m used to working this way.

After a couple of false starts I quickly discovered that backing up the PI SD card by taking an image of it before major changes is the way to go. At one point I installed upstart to automatically run scripts at startup. This bricked my PI on the next boot and I had to spend an hour or two rebuilding what I had done until then.

Getting RPi wifi working.

Here’s where it started to get interesting. I have several wifi dongles, several of which did not match anything I could find on accepted lists or other blogs on the web. none of he stuff I found on getting a TPLink dongle working delivered any connectivity so I gave up on that after two days of fiddling.  I went out to my local PC ripoff store and got hold of a Netgear  WNA3100 usb adaptor.

Bookmark the permalink.

Comments are closed.