Enerduino

Hi there, I'm here again with a new project.
Problem: I have two dogs. When we go hiking outdoor, sometimes I leave them without leash. I'm always worried about loosing them. I know there are plenty of tracking systems out there, but no one with the following feature:

subscription free

open source / open hardware

low maintenance cost

smartphone application for tracking

GSM tower (rough) positioning

The concept is: I'll probably need to use it one time in the life (hopefully never), so why I need to spend money for a subscription service. This is working with a basic mobile contract, without data subscription (even if, if you want, you can have an online tracking system).

The prototype is built around the SeeedStudio Xadow and a Lonet Board, but I'm working now on a dedicated board....for the time being, have a look to the current format:

Then, now I have the new dedicated board....here it is:

And also I have the design for a waterproof enclosure:

I'm working hard on the last details, like battery life, functions, and so on.

Maker Faire Rome ended. Great experience, thanks to all of you visiting the faire!

Update (5 Dec 2015): I have the case ready to be prototyped and I'm now going to do that.
In the meantime I'm fixing a couple of issues I have on the board and working on the sowftware. I hope to release it on GitHub soon.

Update (29 Jan 2016): Here below the first 3D printed protoype

I'm still working on fixing a couple of minor issue on the board, I'll release the code shortly (I hope....;-)).

Another professional 3d printed prototype:

Update (15 May 2016):

Finally, I published the code on GitHub. I think you'll see a lot of "strange" programming decision there, but I assure you, that every choice has been done to save bytes of RAM and FLASH...

Here I am, more or less a year later....a new project I'm going to share with you.
The project short description could be something like "Remote shipment pickcup system".
In other words, I need solve a problem: I need a way to receive couriers shipments when I'm away from home. So what I did is to create a system to interact with my doorbell :-).

When the courier pushes my doorbell, a phone call is placed to my cell phone. Then, I'm able to connect to the system (The-Box-O) through a data connection and do the following things:

- open a door/mailbox/gate while you can follow what happen with a webcam
- remotely read with a scanner the shipment number
- print a receipt

I think the code is quite self-explanatory, it basically read the GSM shield for SMS messages (only coming from authorized numbers) and it turns on/off remote switches.

In order to connect the "RF relay controller" to the Arduino, Seeedstudio site has very good documentation on how to do it. Anyway, if you need calrifications, feel free to ask me.

This is the "core", able to get SMS message and to process them:

The core is able to control, via 433 Mhz, some custom sockets. The socket is built with a RF relay and a little 12v transformer (in order to keep the relay listening for RF). When it gets the signal from the "core", it turns on/off the switch:

Finally, after one year of work (few hours in the weekend...), Enerduino 2.0 is here!!
What's new? Let's have a look:

In few words, I upgraded the Enerduino (power meter monitor, see old post) with a wireless connection (XBee), I added another logger to monitor the solar power plant (Rotex) and both are sending data to a coordinator which sends the data in CACTI (an rrd tool) to show graphs. The idea was to build two autonomous nodes, able to store data locally and send them to a central system (coordinator) when it is available. Then data are loaded in a web tool like CACTI:

How I did it

I decided to buy a couple of Arduino Stalker from www.seeedstudio.com with enclosure. The reason is mainly because these boards already have a built in storage (SD Card), clock, XBee socket and look very very robust. I'm very happy with them.
With these I bought also 3 XBee modules (XBee PRO Series 2) with one UART module to connect (via USB) the XBee coordinator to the PC.

The source code for the data loggers and the server side scripts are available at SourceForge (it was compiled with arduino 0023, in a while I'll convert them for 1.0).

The Coordinator and XBee modules

The first thing to remember is to upgrade the XBee firmware with the last (and correct) version. Then, I selected the AT command mode. The modules must be configured as ROUTER for the two nodes (ENERDUINO and ROTEXUINO) and as COORDINATOR for the Coordinator.

The nework identifiers (ATNI) will be

ENERDUINO
ROTEXUINO

All the modules must be in the same PAN.

The Coordinator will be just an XBee module (with antenna) mounted on UART to connect it to a PC via USB. As you can see I used some "friendly plastic" to lock the module at the case:

The Coordinator will be only an interface to connect the two nodes, all the logic is in the xh.pl perl script which waits for the "SYN" packet from the nodes and then saves locally the data collected. Then, data are loaded in two different RRD databases with the rrdload.pl script.
Look at the comment of the rrdload.pl script to see the rrdtool command used to create the databases.

Then you can have a look to this to understand how to configure CACTI to read the databases.

ENERDUINO & ROTEXUINO

The two nodes are built with two Arduino Stalker and two XBee:

To build the ENERDUINO cable (to read flashes) see the old ENERDUINO post. ROTEXUINO uses a serial connection to the Rotex R3 solar plant. You can refer to the manual to configure the serial connection on it.

The two modules, try to reach the coordinator at configured hours (see sources). If the coordinator is found, collected data are sent and removed from the SD card. Otherwise they will retry later. You can modify the source to meet your requirements on this. The sources are here (Rotexuino.pde and Enerduino.pde).

Updated 22 Apr 2012: Checksum added

I modified the sources for Enerduino, Rotexuino and xh.pl. I added a checksum when the file is sent via XBee, so that xh.pl checks for it before saving it and give the OK to the Enerduino/Rotexuino.
I did it because sometimes the data were corrupted during the wireless transfer.

What's Enerduino? This is a project created to monitor the energy consumption of my house. The reasons behind this monitoring can be more than one: to evaluate offers from energy suppliers, to understand where I'm wasting energy and to save some money. Or just for curiosity.

There are a lot of project out there, very similar to this one. This is my way, a DIY solution based on Arduino controller.

I think everybody can build this: it is very simple and require few electronic knowledge. This project is mainly built on the italian power meter installed by the national company, but it can be easily adapted for any other device, I guess.

HOW IT WORKS

Very simple: thanks to a photoresistor that will be applied on the RA LED of the power meter, we can count the flashes. Every flash should be 1W/H, so by counting these and saving them in a file, we'll be able to do some graphs by using a spreadsheet.

Get the Arduino board. The SD card shield must be placed directly over the controller. PIN D9 must be placed in Arduino PIN 9. The SD power switch must be placed on D9, as the Filelogger library we'll use, requires this mode (http://code.google.com/p/arduino-filelogger/).
Now we have to connect the DS1307 module. Also this one should be placed on top of the Arduino, but since we already have the SD shield, this is not possible. So, we'll place it beside the controller. The two pins shown on top-left of the picture will be connected to analog ports 4 and 5. Power (+ and GND) will come from the ICSP port (please, have a look to the schema at the end of the post).

Then, we have to assemble the photoresistor. It must be used with a resistor in this way

+5V ---PhotoResistor-------.-------Resistor 10K--- GND

|

Pin 0 ------------------------------------------

To connect this, I used a scrap cable: I extracted one pin (this will be connected to analog PIN 0)
This is the picture of the opposite side of the cable: the red wire is placed in the PIN that is connected to port 0 on the other side)
There is shortage of power lines...we need to connect this to ICSP port again...

OK, we mostly completed our work here. Now we need to load the software (see the end of the post), place a SD card (BE CAREFUL: Filelogger works only with FAT16 partitions, with 512 bytes block. You need to create a 64MB partition and then format it with "format f: /fs:fat /a:512". Remember to create a file named data.log in root directory, otherwise nothing will be logged).
I sticked the photoresistor to the power meter LED with Patafix:Here below a schema to clarify some of the connectionsI tried to use it with a 9V battery, but it last very few hours....it's better to use an external power supply.

Wait some days, then extract the SD card: the data.log file will contain a list of "DATE # OF FLASHES". With a common spreadsheet you can build a graph like this one:

WARNING

This blog assumes that you know what you are doing when you try to interface with appliances or electrical devices. You are also responsible to comply with regulations of your country when you connect high voltage devices.