Slightly overdue, but here comes the final post for this little device. Code and documentation has been uploaded to github.
What is it?
A water level monitor device built using WiPy. WiPy is a thumb-sized device that can run Micro-Python code, use WiFi/Bluetooth and get a ton of things connected to the 28 pins. It consumes very little power and can even be in deep sleep mode, consuming almost no power at all. For the curious, full details here https://pycom.io/hardware/wipy-3-0-specs/
But why?
I needed to get indication/warning when water in a system rises above certain levels. There are lots of small and cheap devices for this, simple things that for example start beeping like crazy when they get in contact with water. While something like this would be OK, for me it would be best if I got notified in a more proper way, as it is not certain I will be around to hear the noise. I also needed a good excuse to dive into IoT and do some fun project over the holidays. Hence the WiPee was born.
The final box ready for deployment
OK, so how does it work?
There are two cables connected to the WiPy. Dipping them in water will make the WiPy notice this and if they stay in the water it will transmit a message. There are two cables so that you can have checks for two levels, in my case elevated and critical.
Specifically this happens:
- Device is started for the first time. It does a monitoring run, and if no cables in water, it sends of a message saying it is up and running.
- Device goes to deep sleep, 5 minutes later it wakes up, does a new monitoring run, if nothing changed it goes back to sleep. If something changed it calculates some time measurements and sends of a message with the data, then goes back to sleep. Process repeats.
- Every week it sends a message letting me know it is there.
Using 5200 mah battery the device can be left running like this for about 3 months. This can easily be expanded further simply by making it sleep 10 minutes or more. In my case I need to do a visual check of the area every 3 months and that I why I made this the target.
How it sends messages:
- The device sends MQTT messages to a topic at Amazon AWS IoT.
- The message is picked up and triggers an Amazon AWS Lambda function that runs a Python script and sends the email using Amazon AWS SES (Simple Email Service). This part can easily be changed to something else, for example sending a text message to a mobile phone.
As you can steal the WiPy and easily read the contents (unless you read lock it) some security has to be considered. In my case I decided on the following:
- WiPy uses a guest network that only allows specific mac addresses. You can get the network and pass from the WiPy but not access the WiFi, unless you are a bit computer savvy. For my usage this is safe enough.
- The certificates for communicating with AWS can be obtained. Again for me this is OK. The certificate can only send a very specific type of message to one specific topic. This topic in turn can only trigger one thing and that is to send the email. The email in turn can only be sent from me to me and bounce back to me and is limited as to what the mail can contain.
As I live out in the almost middle of nowhere and the device is in a place where you can access it, but I'm not sure you would want to, this seemed fine to me. Worst case is you can use the info to screw with me, but not with anyone else. Please, don't take the next plane and troll me.
WiPy hooked up and doing its thing
You said something about code & documentation?
For more details on the device, the cloud bit and the micro-python code, go to https://github.com/smjnab/WiPee
Thanks for reading!
Don't forget to do a round of Raid Ponzi Steemit if you are bored.