RF Sensor Ethernet receiver

Feeling inspired by writing up the last post I decided it cant be that hard to convert my USB receiver into an Ethernet based one.

My USB implementation was using an old Freetronics Twenty Ten (the Eleven seems to be the latest equivalent) with one of the nRF modules soldered onto a ProtoShield Short.

I didn’t want add more shields as things start to look ugly so I happened to have an EtherTen in my Arduino parts box so in theory its just swap the shield to the new base board, change the code to add the ethernet connection and all done! That’s the theory anyway.

Like all good theories it wasn’t that simple. The pins I happened to choose for the nRF module conflicted with the pins used for the Wiznet chip for Ethernet connectivity. No matter, I rewired the offending pins and changed the code to suit – fixed.

So the firmware connects to network and the sensor readings are being received, all working great – but where to send the data to?

Xively

While I’d eventually like to have the data stored and processed locally, Xively seems like a choice to get things up and running with little fuss. I can let the receiver run 24×7 for testing while I sort out something more permanent locally – or if Xively does all I need that it can stay there – meh at this stage who knows.

Anyway, the developer section of the Xively site is pretty simple, find and download the Arduino library from git add it the the Arduino libraries folder and your away.

Total integration time was less that one hour including some optimizations.

Here is the public link for the prototype.

  • 1000.01 Temperature Sensor 1
  • 1000.02 Temperature Sensor 2
  • 1000.03 Light Sensor
  • 1000.08 Battery Voltage

The format is of the channel is XXXX.YY, where XXXX is the transmitters serial number, and YY is the sensor input number on that particular device.

Xively Test Data RF Ethernet Receiver

 

You can see the setup is nice and compact but I don’t like that I cant use the POE adapter board and a shield on the EtherTen at the same time so I still need to power the device from USB or the DC jack.

The nRF module is pretty much sitting over the shielded RJ45 connector which is probably acting as a ground plane – so not ideal.

Anyway for now I have a handy 12VDC source readily available so I’ll hook up the DC jack. Then I don’t need to have it connected to my desktop PC all the time – except for debugging.

Update: Things have gone fine expect for an outage at exactly 9 PM one night. Not sure why – but the timing seems to perfect, perhaps the DHCP lease expired?

I changed the code to renew the DHCP lease and left the debugging output running to hopefully catch something. Could have been a random power issue resetting the Wiznet chip – who knows.

 

Whats The Temperature?

What is the temperature outside now? In the pool? Inside the garden bed? How much light did we get today?

To answer these marginally useful questions the obvious solution is to build a solar powered, RF transmitting sensor – paired up with an RF receiver to act as an interface to the computer.

First thing some basic requirements

  • Multiple temperature sensors
  • Simple light sensor
  • RF transmitter/receiver pair or transceivers
  • Solar powered – implying battery powered
  • Able to run 24×7
  • Weather proof/resistent
Sourcing the Parts

Again better not reinvent the wheel so after a few Google searches and numerous distractions I found the Seeeduino Stalker.

Seeeduino Stalker

A nice starting point to get the main things I needed. In particular the Arduino board with solar input, lipo battery charger circuits, a cheap solar panel, a lipo battery and importantly a waterproof case ready to go.

I got a Bluetooth XBee module for quick testing as I already had a USB Bluetooth dongle so I could get something up and running pretty quickly without needed to prototype the receiver.

Now some cheap temperature sensors – Aliexpress has many options here. I went with some cheap 10K NTC resistor based items. I didn’t hold much hope about sticking these particular ones in the pool (salt water / chlorine) on inside the garden bed (moisture in general) but its a start and at the price  they were cheap enough to be disposable.

The light sensor was just an LDR I already had in my parts draws.

Cheap 10K NTC Sensor

 Initial Setup and Results

I put some quick firmware together and as it was summer time with plenty of sun around I stuck with using Bluetooth as the communications put it all together and installed in by the pool with one temperature sensor dangling in the pool and the other just in free air.

Setup 1

 

Unfortunately I don’t have an image of the sensor that was in the pool – it lasted maybe a month before the temperature readings starting dropping – it appeared that the potting compound wasn’t really adhered to the wires and eventually the salt / chlorine / heat got into it – not unexpected.

The Bluetooth was marginal from the pool to the office – maybe 17 meters away and through a few walls and metal window shutters – not unexpected.

The battery recharging worked quite well – it was full Adelaide summer after all, weeks of 35+ degree days with no clouds. The graphs of battery voltage did indicate that the battery was pretty much marginal as is each night it almost expired only to be saved by the sun the next day.

Happy with the initial results none the less as I hadn’t done any power optimization at all.

 Autumn Radio Upgrades

The initial prototype was retired after summer as the battery drain from the Arduino and Bluetooth modules running 24×7 was just too much. Plus the pool isn’t heated and there was little interest in the water temperature – you already know its cold. Naturally it was time for an upgrade.

I have no idea how much power the Bluetooth module required as I didn’t measure it properly but my assumption of power usage and the range being quite poor I decided to upgrade the to some RF modules. An obvious and cheap choice was one of the numerous nRF24L01 modules you can source just about anywhere these days. $10 for 10 transceivers is very hard to beat so its worth a try.

nRF24L01

There are plenty of Arduino libraries out there for these modules so changing the code over was also pretty straight forward. I also needed to make a receiver in the office to get the data sent from the sensor.

Here is the sensor at the bottom and receiver at the top as it is now.

The winter kit

It was now autumn and there was still enough sun during the day to keep things running overnight even though the Arduino was still running 24×7 at full speed (8Mhz). At this point I was already powering down the nRF module in between transmissions to save power.

Winter Firmware Upgrades

Winter comes along and the amount of sun during the day – assuming there is any at all – is just way too short. So time to finally get the firmware to do proper power management.

Lucky for me the Stalker board had an on board RTC. The firmware basically uses the RTC to set an interrupt/alarm every minute, wakes up, takes the readings, sends the message, and goes back to sleep.

The results were much better – lasting over a week with little sun and the panel flat of the ground – less than ideal. Here is the graph for the last week.

Weekly data

Something Still Obviously Wrong

You will notice the graph is quite sparsely populated – to say the least. The sensor is pretty much outside my office window about 4 meters in the garden bed. The receiver is on my desk. At night the metal window shutters get closed and the sensor readings tend to disappear – not unexpected but annoying.

I think this is a problem with using the nRF modules, at least these ones with the PCB antenna. Some problems I have seen

  • The angle at which I have the transmitter and receiver matters. Flat seems worse than upright.
  • The range I get from the modules, while good, just isn’t good enough to reliably have communications from outside to inside, let alone from one side of the house to the other.
Future Upgrades

For now it will suffice but some future upgrades will include …

  • Using a receiver with the nRF module that has the built in amplifier and normal antenna.
  • Mounting the receiver on an outside wall to eliminate the metal window shutter problem.
  • Using an POE powered + Ethernet enabled Arduino for the receiver and upload the data to a server rather than having the receiver connected to my desktop PC.
  • Creating a few more sensors for around the yard
  • Finding a solution for a pool water temperature sensor.
  • Having the data available and graphed on a website so I can check whats happening from anywhere.
  • Add a soil moisture sensor
  • Add a humidity sensor
  • Integration with my watering system

 

Alarm Panel – Programming settings

With the interface installed I needed an easier way to program the settings. Having to recompile the Arduino code each time you want to change something is pretty poor.

The V2 firmware supports

  • 16 zones, each with
    • Name (15 characters)
    • Enabled flag
    • Alarm flag
    • Cancel flag
  • 4 phone numbers, each with
    • Number (15 characters)
    • Enabled flag

Nothing too complicated but enough to get the job done. All the settings are stored in the EEPROM of the Arduino (atmega2560).

First thing I wanted was a simple command line interface. Worst case all you need to program the interface would be a terminal (something like Putty, TeraTerm, HyperTerminal, etc).

Being lazy its always easier to see if something already exists before you roll your own. Even if its not exactly what you want you can get some ideas. Lucky for me, with a few Google searches, I found the serial command library.

So simple, install the library, include the header, add a few lines and a few callback functions – done!

So now via the command line we can

  • enable/disable debug mode
  • update zone data
  • update phone data
  • display the current information
  • enter setup mode
  • turn on/of SMS message sending

This is enough really for the prototype – but – if you want to make it a bit easier for the average Joe to use then it’s time to a make a simple UI.

Behold – the alarm interface programming tool. Of course it looks like crap but it gets the job done. Simple operation Read the data, modify the data, and then write the data back.

Under the covers it uses the serial commands we defined earlier to to read and write settings. The hardware version and firmware versions do work but not in this early screen shot.

Program some settings

Cool – simple programming tools done – now to customize for my alarm panel and see if we get some SMS messages out!

Alarm Panel – SMS Interface Installation

For what seems like forever Simon and I have been working on an alarm panel to SMS gateway device. Mainly to be used with an existing alarm panel, this device will plug into the phone line socket of the alarm panel, allow the panel to “call” and then respond with the proper Ademco tones.

Click here for Simon’s blog posts on the hardware design.

With prototype V2 finally complete and the latest firmware uploaded it was finally time to give it a test run on my alarm panel. Now how to mount it and monitor it for testing? Here is all the stuff where I need to make it happen. Seems like a mess before I even start – this was after I cleaned up the original mess – sigh.

Alarm SMS Items What a mess

  • Alarm panel, alarm SMS interface, phone cable and GSM antenna
  • Raspberry Pi and USB cable for debug interface monitoring
  • 5V switch mode power supply module for the RPI
  • 12VDC Plug pack for the home automation gear
  • 12VAC Plug pack for the alarm

I decided to remove all the existing items from the wall and remount everything on a sheet and MDF. That will make it easier to mount things without the need to locate any wall studs. I roughly measured the wall area, alarm, RF receiver, and power point locations. Marked them up on a piece of MDF the let rip with the drill and jigsaw to get the power point hole removed.

A - Markup B - Drill C - Jigsaw

Looks nice, let’s hope it fits! Of course it did, was there ever any doubt? Now to remount everything. It all went pretty much to plan for a change. The alarm panel was slightly painful as it didn’t really have a lot of movement but some handily placed boxes took care of that.

It fits Remounted Almost done

I rewired my automation input module and finally installed the alarm SMS interface and RPI ready for testing.

Remember this is for testing so yes its all just spread over the shelf for now, the proper installation will not have the RPI and the interface will most likely be mounted inside one of the two cases with just the antenna on the outside.

Now finally I can start testing !