From poolDuino to bbPool

My fisrt pool monitoring system was Arduino based (more info here.) It could collect pH, ORP and temperature from my pool and store it on an SD card. But I wanted to send all this data to some web site like my own emoncms.

So I needed Internet access. To do this with an Arduino, I either need

  • An Arduino Uno + an ethernet shield (~20€ + 35€ = ~55€)
  • An Arduino Ethernet (~60€)
  • An Arduino Uno + Wireless Shield + RN-XV Wifly (~20€ + +17€ + 44€ = 81€ )
  • An Arduino Yùn (~62€)


  • If I want Wifi, I found RN-XV module difficult to use and quite instable (no sure though if it is my program, the libs I use or the wifly itself.)
  • A Raspberry Pi is less than 40€, has build in ethernet, is way more powerfull… and adding Wifi is ~20€

Problem though : Pi has only 1 UART available… and I needed 2. I known there are workarounds but having a look around, I stumbled upon BeagleBone Black (BBB) :

  • Build in ethernet
  • Many GPIO ports and several UARTs
  • Running Linux

And “only” 45€ !

So I decided I’ll give it a try : poolDuino is now becoming bbPool !


Let’s build a pool monitoring system : poolDuino

Because my parents have a quite expensive pool monitoring system that is not even able to grah collected data, I decided to have a look at what I can do.

What do I need to measure ?

  • pH
  • ORP (redox)
  • temperature

Well… temperature is easy. There are plenty of easy to use sensors available. It becomes a bit tricky for pH and ORP. Actually, you can’t just connect an ORP or pH sensor directly to an Arduino as you would with a temperature sensor. pH and ORP probes are generating very small voltage and current. Their output needs to be amplified quite a lot.

As I am not an electronics specialist, I desperately looked for some “pre-build” pH and ORP sensor that would be quite easy to use. There are quite a few very nice and smart projects around :

  • LeoPhi : only pH though, no ORP
  • phDuino : still only pH
  • Arduiarium : got pH, ORP, EC,  1wire, I2C… a bit of an overkill for what I needed
  • and probably many more…

I finally found Atlas Scientific pH and ORP stamps : not that expensive (before I had to pay VAT on parcel collection plus a fee… for VAT collection !), very nicely build, small, easy to use… Exactly what I needed.

orp&ph 640x480

I then build a first prototype using an Arduino Ethernet. Not that I will be using ethernet capability but it has an SD card slot so that I could record collected data on a 2Gb SD. I would just have to connect the Arduino to a power source and plunge the 3 probes in the pool.

PoolDuino 640x480

I left the probe for around a day and a half running and took the SD card back, loaded the data into a Google Fusion table which gives the following results :

[iframe width=”510″ height=”100″ scrolling=”no” frameborder=”no” src=”″]

[iframe width=”510″ height=”100″ scrolling=”no” frameborder=”no” src=”″]

[iframe width=”510″ height=”100″ scrolling=”no” frameborder=”no” src=”″]

Works great ! The pH drop is due to adding (a bit too much) pH minus solution as pH was a bit high.

NFS root partition for Raspberry Pi

UPDATED on 12/04/2015 : added a way to get the offset and added -t ext4 option in mount command.

As stated in Raspberry Pi & SD card reliability, I had a try at using an NFS share as the root file system for one of my Raspberry Pi.

There is quite a lot of information on the subject on the net. But here is what I did.

Creating an NFS share

I own a Synology NAS. So I just created a shared folder and give permission to my Pi’s IP address. That is quite easy.

  • First enable NFS sharing if it is not already the case. Go to Control Panel > Win/Mac/NFS > NFS Service, tick Enable NFS and then apply
  • Then create an NFS share
    • Go to Control Panel > Shared Folders.
    • Create a new shared folder called piroot for instance
    • Click on Priviledges > NFS priviledges
    • Click create to add you Pi IP address (or a range if you prefer)

Copying proper files

Then, connect to you NAS using ssh for instance. Now you should have a new folder called /volume1/piroot on your NAS (/volume1 may be different on yours if you have several volumes.

I copied over an img file from and mounted the root fs included in the img file as a standard fs.

Took me a while to understand how to do it… To get the offset, you can use the command “file” but it is not available on the Synology. So I used Cygwin version of it on my Windows machine :

The offset to look at is the start sector of the second partition : 122880. And you need to multiply it by 512 (size of a sector in bytes) which gives 62914560. The other interesting stuff is partition ID : 0x83 which means ext4, thus the option -t ext4 in the following command.

Now, you just need to copy the files from the img file to your new NFS share, taking care of preserving permissions (-p option) !

Modifying fstab

You need to modify /etc/fstab on the Pi to remove the root fs entry. You will tell the kernel where is the root fs on its command line. If you keep this entry, Pi will not fully boot and it will complain about no being able to run fsck !

Preparing the SD card

Now we got our NFS share loaded with root fs files. Let’s configure the Pi boot. After dumping the raspbian OS to an SD card (I am on Windows so I use Win32DiskImager to to do that.) You then need to modify the cmdline.txt at the root of the SD card. Mine look like that :

Note that I removed all references to serial port which is by default used for connecting a debug console.

I did this because I need it for other stuff (Pi will be used for an emoncms server.) This is not mandatory for NFS to work.

The following entries are mandatory :

  • root=/dev/nfs : tells the Pi that the root fs will be on NFS
  • nfsroot=ip:/whatever/dir,udp,vers=3 tells Pi where is the root fs to be mounted
  • ip=dhcp : startup IP stack because you need it for NFS (I use DHCP but you could used a fixed IP.) If using a local fs, fs is mounted prior starting up the IP stack.
  • rootfstype=nfs : tells that the fs type is nfs


By the way, no, you just can’t use PXE boot. The Pi doesn’t support it. The ONLY viable boot device is the SD card.


Here is a list of links that point to sources I used :

WiFridge : hardware details

In this post, I will give the details of the WiFridge hardware : how to connect the probes to the Arduino. It follows the post here.

The hardware

Here is the bill of material :

  • 1 AM2302 Humidity & temperature sensor
  • 2 DS12B20 1-wire waterproof temperature sensor
  • 3 3mm LEDs (green, yellow, red)
  • 3 1kΩ resistor
  • 1 10kΩ resistor
  • 1 4.7Ω resistor
  • 1 Arduino Wireless shield
  • 1 RN-XV Wifly module
  • some solderless breadboard
  • a bunch of wires

Fritzing Wifridge

It is connected as describe on the previous figure (created mostly with Fritzing.)

  • AM2302 : data connected on digital input 3 for kitchen temperature and humidity connected to a 10kΩ pull-up resistor
  • both DS18B20 : data on digital input 2 for fridge and freezer temperature, connected to a 4.7Ω pull-up resistor
  • status leds on digital inputs 6, 9 and 10 (optionnal though, just here for displaying status when operating) through 1kΩ resistors.

The 3 sensors are also connected to ground and +5V through their corresponding wire.

WiFridge Front Final with notes

Also, to simplify debugging, I decided to connect WiFly UART to a software serial port on the Arduino so that the hardware serial is free for programming and debugging. I simply cut off the Rx and Tx legs on the shield and reconnected them to digital pin 7 & 8. But it is possible to only bend the legs so you can revert the process.

Wifridge Rx Tx cutoff 640x487

 That’s it for the hardware. In a coming post, I will describe the software part.

Raspberry Pi & SD card reliability

As described in a previous post, I use a Raspberry Pi as an emoncms server. And as it seems to occur for quite a number of users, SD card eventually gets corrupted after a week or so and Pi would crash and never reboots until I re-installed the OS.

First thing that came to mind was : “ok… the only thing that is quite write intensive is the mySQL database…” so I moved it to my Synology NAS. Now, emoncms barely writes anything onto the SD card. Did not last much longer…

So my second thought was “ok… SD card is not good enough, lets try another one…” My Pi worked for a while… a month or so… and finally crashed.

I came to the conclusion that I could not use a Pi for a reliable 24×7 system, and more specifically my emoncms setup… until I stumbled across this blog post : Rock-solid RFM2Pi gateway solution. The idea is quite simple but clever : set the file system as read only, using this version of Raspbian : IPE. But… hey… (almost) any apps needs some place to write to… Even if, in my case, I already setup an external database, apache probably won’t work on a read only file system out of the box. And worse, emoncms code probably writes some stuff on the file system (like traces or logs.)

So I thought I could mount the root file system from an NFS share that I created on my NAS. I will then have R/W capability on root file system but a read only SD card. I also had a look at iSCSI instead of NFS… but it way more complex and probably an overkill for a Raspberry Pi.

Stay tuned… I will try that soon !


Introduction to one of my first Arduino based project : WiFridge…

… or why one would want its fridge to be connected to the internet !

This is one of my first Arduino based project. I had some issue in the past with my freezer that would let the temperature going to high for too long and I had no way of knowing before it was too late. I could barely detect it happened by using an ice cube in a glass that would melt in case of a huge temperature problem. That is why I decided to build the WiFridge : a wifi device that would monitor my fridge’s and freezer’s temperatures and send an alert in case anything goes wrong.

I first tried using an Arduino Ethernet because it was far less expensive than an arduino with a wifi shield. But… I have no ethernet port near my fridge and I did not want to have an ethernet cable across my kitchen… So I had a look on internet and decided to go for a RN-XV WiFly Module from Roving Networks and the ad-hoc shield.

WiFridge 1000x750

For the temperature part, I bought 2 DS18B20 sensors, in a waterproof package, coming with a 1m long cable and its 4.7k pull-up resistor. I also bought an DHT22/AM2302 temperature and humidity sensor so I can get my kitchen’s environnement data along with fridge’s and freezer’s temperatures. Both sensors are digital sensor. That is, they send the temperature (and humidity for the AM2302) in the form of bits, not an analog voltage. DS18B20 sensor is using 1-wire protocol which I found very nice because I can connect both DS18B20 sensor to the very same input.

Add a few leds for monitoring the status of the gizmo, a bit of soldering after some testing on a breadboard, a few lines of code, and that’s it, I got my WiFridge up and running, sending data to the internet…

In a coming post, I will go into more details, give a detailed schematic for the hardware, describe Arduino’s code that I used (I am still working on it though as I have some Wifi stability problems…) and how I sent data to my emoncms web sites (one local on a Raspberry Pi and one on a shared hosting.)

IP remote controlled power strip

Before discovering Arduino’s world, I found a nice ethernet relay board from a french manufacturer : the IPX800 v2. It is a bit expensive (~125€) but works out of the box : no programmation needed. Power it, connect through a brower, and it works !

It comes with (not an exhautive list, see here for more details.)

  • 8 outputs relays (250V / 10A)
  • 4 digital inputs that can be associated to the output (i.e. you can open / close the relays)
  • an ethernet port
  • an embedded tcp and web servers for remote control

What I did with it is a powerstrip for my audio/video system so that I can individually switch things on and off when needed with my smartphone and not leave them in standby mode.

ipx800 01 643x473

I first used the build in web site (with a bit of customization for switch names) and the started using OpenRemote software to build a nicer interface for my smartphone. From there I can individually switch on and of the 8 outlets.


But remote control is not always as handy as physical button. If you don’t have your phone around, or have not battery left… it is usefull to have a way of manually switching you amp & projector on when you want to watch your film ! So I added 4 buttons connected to the 4 digital inputs available…

IPX800 04 722x386

… and then configured the IPX to toggle the relays.

2013-08-27 20_12_27-gce.electronics relay board

And here I go : I now have an IP remote controlled power strip !