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!

No comments: