Monday, December 27, 2010

End of the year

The end of the year is approaching fast! And if I look back at this blog, for this year it was pretty dead...so one of my resolutions is to make it more active, and report often on the developments here, which are slow, but plentiful.

So I will start by a project which I developed and build early in the year, and never used it, as it was a very impractical solution for the problem it meant to solve.

So, in my quest to measure things around here, and as you might remember from here, I was always curious about how much garbage we make. We separate organic garbage, glass, paper and normal garbage. And since January we have been separating plastics as well.
We then decided that we should aim at bringing the least amount of bags home, by reusing the bags we are given. But as we all know, what we can not measure we can not control, and as such I needed a way to measure how many bags we bring home.

Paper and pencil by the door would probably have done it (and resulted in a more usable solution) but I saw an opportunity to apply some electronics and build a button box, where one could press a button to indicate that a bag was brought home.

I expanded the system to be able to log all kinds of garbage, organic, paper, glass bottles, plastic garbage, bags and all other garbage.

I made use of a JeeNode, of course, and used a pen box to make an enclosure. The result was pretty good I think:


(A few days later I went to California, and found a much nicer knob at a Radio Shack...no pictures though...)

Here is a picture of the guts of the machine:


I made a small board to connect everything to the JeeNode, and managed to scavenge enough pins from the JeeNode for all the necessary connections.
So here is a hint, if you need more than 8 I/O pins with your Jeenode you can use:

The IRQ pin in every port is connected to the IRQ 1 of the Arduino, which is in fact pin 3
Pins 1 and 2 of the SPI connector - connected to Arduino pins 8 and 9 (as in the JeeNode datasheet)
RX/TX in the FTDI connector - connected to pins 0 and 1 of the Arduino
SDA/SCL on the TWI connector - connected to Analog 4 and 5 of the Arduino (I think...I don't remember anymore)

and I bet you can also scavenge a few from the ISP connector. of course, by doing this you are once more away from the encapsulation that the JeeNode libraries aim to achieve...but it is always worth considering for those projects that need a lot of input/output.

In the above project, I used 6 lines to drive the LCD (in 4 bit mode), one for the switch and 2 for the knob, which uses interrupts.

The rotary encoder changes occur during the action, so I needed an interrupt to detect the action in there. More on that on a later post.

So when the power switch is turned on (no low power states) one can choose the type of garbage by turning the knob.
Upon pressing the button, it enters a "add garbage" state, where the user can add (or subtract) garbage in increments of 50 gram again by turning the knob. When a certain time elapses with no changes that amount is added to the running total and the system goes back to the choose garbage mode.

One of the options in the root menu is to send the stuff, which sends the data via wireless to the server.

The data is kept internally in the EPROM and sent over in units of 50 gram (to simplify and use integers only instead of floats), and is converted for display only.

For plastic bags and bottles the user adds units and not weight.

After all this story, I stopped using the machine after one week, after having spent hours weighing all the garbage as it went out - it is a lot of work - and my wife convinced me that I must find a better solution, or just admit that we make as much garbage as everybody else.

One simmering in the back of my head is to connect a scale directly to the system, and maybe use RFID tags to detect which garbage it is...but that is a project for the next 5 years...

I am now considering using this machine to implement my opentherm thermostat, as it has pretty much all I need, apart from the special circuitry for the physical layer.

Next post will be about the JeeNode controlled RFID lock, which, is ready, and if it wasn't for the cold outside I would have installed already!

Sunday, December 12, 2010

Weather station update!

It has been quite a while since I last posted here, it was a busy year! I became a father, and that took a lot of the time available to report - I still get quite some time to do the things, only no time to spend here reporting :) , but I hope to revive it now!

So here is an update on the weather station!

Finally, after 11 and a half months the thing died! in the coldest night of the year, after sending a packet indicating -8.1C outside at 3 in the morning...

funnily enough, the FS20 switch that turns the boiler on and off died (stopped receiving) at approximately the same time...can't explain it, it wasn't cold in the room where that one is located...

It sent 51273 messages on a set of 3AA GP branded units, which were not new when it was put outside. Since for each packet I measured the wind for 1 second, this means the JeeNode was in full power mode for a bit over 14 hours.

Anyway, I opened it, days later, and when the temperature outside was up to -1 and the batteries read about 1.9V, or about 0.6V per cell.

I wonder if the fact that the Atmega runs at 16MHz, which is out of the specs at 3.3V (let alone 1.9V), contributed to it failing at low temperature/very low voltage as well, or if it could have been pushed any harder! It is out now with a new set of batteries, since 8/12/2010, but I need to redo the anemometer, so I don't think these batteries will be out until they die!

I think this was a victory for a JeeNode in low power mode!


As for the FS20 switch, I still do not know what happened...It just would not receive, until I moved it to a different place, where reception is fine. I wonder if all the snow on the roof created some effect, which prevented it from working properly. Maybe i should try now that the snow melted. However, if that is the case, then I definitely can not leave it there, as it is precisely when it is cold and snowy outside that I need it the most!
Plans are on the making anyway for a JeeNode OpenThem controler, which should be comming soon. I already developed the control loop (PI) which determines the desired water temperature, now I just need to adjust the PI coeficients and implement the hardware, for which most components are already in the house!

I hope to report before the new year again on another project!