I started the project a few months ago, and I probably reached a stage when it's maybe worth to show it. At the moment I just have a simple blog page with a few pictures, but hey, the longest journey start with a little step.
The system is based on arduino, of course. I use 1-wire DS18B20 temperature sensors, SHT-11 humidity sensors, Sharp GP2D12 distance sensor (for water level in the fishtank), light resistors, RF transmitter for light switch control, an ugly hack of disassembled RF remote to control HRV, a couple of relay boards to control fishtank and central heating / radiators, and its still work in progress and will always be ;). At the moment I'm adding PIR sensors.
If you want details about anything in particular (I hope you do ;)) please ask.
Oh yes, and the link to the blog: http://chattyhome.com/blog.
But why are you using two Mega instead of one ?
It makes it a bit easier and maybe more reliable. One is output the other is input, in the server application I have separate thread for sensors, which run every minute, and a separate for outputs which run every second and execute scheduled actions and any input from the clients. DS18B20s are quite slow, it takes 750ms for one to calculate the temp and I have a few, at some point the software would have a problem with that, I had no proper locking. Even now when it's quite polished I would risk an occasional timeout maybe... But the software should be able to handle that at its current stage, so you are right, I could run the thing on one Mega only.
I also plan to upgrade 18B20s to 2438 which is a far superior chip - it does temp calculation in 10ms and can double as a light or movement sensor.
Subscribed. Looks to be an interesting project.
it takes 750ms for one to calculate the temp and I have a few
I hope you realize that that conversion will take about 750ms for all together. You don't have to let every sensor 'convert' one-by-one. At least without parasitic power that is. While not with parasitic power you can also poll the dataline line to check when the conversion is actually done. My string of 10 18x20 sensors takes about 600ms to convert the temperature.
You don't have to wait for the DS1820s, you can do what I do, send the read request, go away and do other stuff and then come back around a second later to get the reading. I then send the next read request ready for the next time. Just a matter of learning to code without using delay.
I have one Arduino reading 4 DS1820s, polling the electric meter rotations,measuring AC waveform,watching the gas meter (Interrupt), turning the heating on and off and measuring light levels in 2 rooms.
Yes I sort of realised that the conversion can be done in a parallel mode - but because of the architecture of the whole system, i.e. how the rest of software which connects to arduino does it, it would be very difficult if not impossible for me to program it so I decided to go the easy way - I have limited time resources and I'm lazy ;)
The server software works in a way that a single command or batch of commands sent to arduino via serial will return a value, and the server will wait for this value until it comes or until timeout.
If I were to add another 18X20 probe all I need to know is its address and I can set it in the server software through UI alone without coding or compiling anything. Add a Probe, set Name, Location, Type, Arduino address, configure a Command for it, which would be something like '1WirePin 12!readDS18B20Temp 284CBAB101000051!' and presto. Optionally you add a relay board driven by any of the remaining arduino pins, set an Action in the software, set its type to Temperature and its Location the same as the Probe you just added, its commands similar to the Probe commands, i.e. '"0"="offPin 24!"; "1"="onPin 24!";' and you are able to schedule temperature in a room via Schedule - still using UI configuration only.
My goal is to be able to offer this software to the public and for this I want to have something which can be configured via UI alone.
I added a rough sketch of the architecture to the blog yesterday: http://chattyhome.com/blog/Chattyhome_blog/Technology.html
Use software timers. It’s not hard to implement, and if you use a event-based approach you don’t even need to care about synchronization issues.
Something like this maybe ?
Someday, maybe. I really appreciate your comments and suggestions, but right now I will not spend hours if not days of my time trying to fix something which is already fixed. It works, all it needed was the second arduino and the probe loop fits neatly within one minute with plenty of room to grow and it will never interfere with the outputs, and if I ever need more room it's easier still to replace 750ms probes with 10ms probes and the problem is non existent again. I think it is better to spend your precious resources where they are really needed - and in my case this is development of new functionality. Right now I'm spending my time on integrating PIR sensors around the house, which will give my heating system more information, makes a good start for the security alarm, and makes possible funky ideas such as music following you around the house, ...
But I'm really grateful for the ideas - I'll put it on my TODO list and maybe one day I will rewrite the architecture to be event based with some sort of messaging system which is not serial like at the moment, please keep them coming.
Hello All ;)
I finally added PIRs to my system: http://chattyhome.com/blog/ChattyHome_Blog/Blog/Entries/2010/6/28_presence.html
And added some more details about my implementation of water level sensor to the blog: http://chattyhome.com/blog/ChattyHome_Blog/Blog/Entries/2010/6/26_water_level_sensor.html
At the moment I'm working on the third major rewrite of the core scheduler, this time I hope to get it as close to a realtime system as needed to be perceived as one ;) I also had some ideas about making the Overview tab configurable, so sooner or later I will be releasing the software to the public, hopefully someone will be interested ;)