Demo video (old interface)
Introduction and mission statement
I have long wanted to build my own automation framework for my residence. All existing solutions were either expensive, poorly designed, underperformant, bulky or not versatile enough for what I needed. So I created the Moteino, a low power wireless Arduino compatible based on the popular Atmega328p chip, that accepts RFM69W/HW/CW or RFM12B transceivers on reverse, is of SD card size, is wirelessly programmable and can fit in very small enclosures.
Among other things, I wanted this system to be:
- Open source
- Easy to build/replicate by those with some Arduino experience
- Easily extensible and customizable
- Inexpensive compared to other systems like Z-wave and Zigbee
- Use common parts/sensors that are easy to source
- Main components should have a very simple design, no exotic or complex frameworks/compilers
- Easy to scale and hardware build with manufacturability in mind
Sample integrated devices
Once I tested a few revisions of the Moteino and I had a robust revision, I started conceptualizing several devices that would make it easy to monitor or control certain things like:
- Mailbox via MailboxNotifier (aka MailboxAlert or MailMote). This little sensor box can run for many months on a small LiPoly battery and reports back motion detected at the mailbox, battery level, and the last time the mailbox was opened. It became one of the most loved Moteino based devices at our house, and very popular blog project. The love for this device grows more with every Michigan winter storm. Thank you MailboxAlert!
- Garage door via GarageMote. This device can detect the garage doors position (open, closed, unknown), and trigger an open/close action. Very useful on those stressful days when you wonder if you closed the garage.
- The sump pump mote via an ultrasonic sensor. Going on vacation? If your sump pump fails you could come home to a few feet of water, so better safe than sorry.
- Motion via the MotionMote. Care to know when there's motion in your house when there shouldn't be any? Me too!
- Lights via SwitchMote. Swap your current mechanical light switches with SwitchMotes and control your lights wirelessly in addition to the new push button. They work at 120-250V but are designed to fit US electrical boxes.
- Water meter via a photo reflective sensor. Useful to monitor water usage for potential pipe breaks or water leakage.
Self imposed requirements
To make it truly useful, flexible and secure, I imposed several critical requirements for my Moteino automation framework:
- Remote SSL secured control. The RaspberryPi gateway computer can relay a SSL secured web interface to the internet allowing the owner to check status and take actions from anywhere on the internet.
- Real time updates. Secure sockets allow the remote interface to receive real time updates from the Pi gateway. No more boring browser refreshes.
- Wireless over-the-air programming of critical devices or those enclosed in difficult locations (especially the SwitchMote which is wired to mains and attached in electric boxes behind covers).
- Use the RFM69's hardware AES128bit encryption for secure wireless communication
- Allow Email/SMS/Pushover notifications
- The central Moteino+RaspberryPi gateway computer has to survive a power outage and continue to receive critical messages from battery operated nodes such as MotionMote.
- Components have to be easy to source, manufacture and system easy to scale. The network can be extended with new Moteino based devices at any time without changing the topology or disturbing existing devices.
I've spent several weeks developing the RFM69 library which I made free and open source, is now widely used in RFM69 based projects, and now also forked/used in several other THP entries. I'm very happy others found my work useful and I applaud project such as the Reactron Overdrive and PlantFriends which used Moteinos (or clones) and RFM69 library and took the time to give credit, I wish them all the best. Some of the components of this system have been in the works for many months and it's still a work in progress.
Why RFM69 transceivers
I've tested the popular Nordic NRF24L01 and their higher power modules. The non power module was hopeless and there's virtually no usable range on those modules. I know some will object at this statement but I've actually done the open air testing with each of these modules. I also started with RFM12B which was popular at the time but was not happy with the range and lack of features. I've finally settled on the RFM69 as the default choice since it has excellent range and penetration performance, is inexpensive, ideal size to fit Moteino, and has many nice hardware features like AES encryption, packet engine, signal strength reading etc. See this project log where I go into more details about the choice of transiceveiver and MCUs. Here's a video of me testing the RFM69 and comparing it to the older and still popular RFM12B:
This feature was important because many nodes are deployed to difficult to reach locations. SwitchMote was especially problematic. To make wireless programming possible I've developed DualOptiboot, an augmented Optiboot version which allows safe wireless programming. The way this works is like this:
- The sketch listens for messages and checks for wireless programming tokens
- Once a token is detected, a special handshake and wireless transmission sequence begins to transfer the new HEX file from the sender into the local external FLASH chip
- Once completed the node is restarted and DualOptiboot takes over. It checks the SPI FLASH chip for the existence of a new flash HEX image, and if present it copies it into the atmega's flash memory.
- If any step in between fails, the node returns to the old sketch and any partially transferred flash image is discarded
- Click here for a series of posts related to wireless programming.
- Here's a demo of wireless programming in action:
This component is rather special because of the complexity and the time spent developing it (since late 2013). It's been through 2 major revisions and is now ready for prime time. UL certified components were used and safety factors were included to make it as safe as possible. The R2 revision of SwitchMote is much more robust as a design and also works at 250V. Here's an installed SwitchMote R1 concept demo: