It’s been a while since I was so excited about a project. After much struggle (to do with a very hot voltage regulator) I have come up with a working circuit for the hosepipe tap trigger.
I was hoping to power the whole thing from 12 volts but the voltage regulator was getting a bit hot, and my main directive for this whole project is to not spend any money (otherwise I would have a relay shield like this one instead of the bare 5v relay which I had to trigger with a transistor)…
The other exciting thing was the Android app. I decided to create a stand-alone app which recognizes monkeys to put on the play store. Right now it plays a loud siren sound when a monkey – or baboon – is detected. I can’t even count how many times it would have been useful to have a simple alert which would warn me about vervets attempting to break in on the other side of the house.
Don’t get me wrong, I love the monkeys. They are really interesting to watch, their kids play in our yard, they do tight-rope on the telephone wires, and the troupes have all-out warfare sometimes on the road. The other day we found out that our neighbor’s dog has a pact with the monkeys: they open the bin for him and he helps them eat the contents. Just some monkeys and a dog getting along just fine!
So the Android app is pending review, it’s called Monkey Detector, I will add a link to it when available. My third play store app!
Update: Monkey Detector on Google Play Store – unfortunately some devices are having a problem where the app isn’t playing the alert sound. I am looking into this (it works on my phone…)
It’s amazing how machine learning has improved over the last few years. I was dabbling with TensorFlow for a while, then moved on to look at pyCharm, but ultimately I was going to go with the easy-to-use Google image recognition API for the mobile version of my monkey detector.
The current version of the app (detects monkeys but doesn’t send a signal to my WiFi connected sprinkler system yet) is here: circusscientist.com/seeMonkey.apk – now available on the Google Play Store! In order to use it you need to give camera permissions before first run, otherwise the app will force close. Just point it at a monkey and get alerted* (pictures of monkeys work fine)
*If you are wondering what happens, my 6 year old son shouts “Hey you, get away from my lunch!” when a monkey is detected.
The next step is to adapt my Arduino controlled tap valve (more on this to come soon) to receive WiFi (using ESP8266 of course) and then send the signal from the app (in Kotlin…!)
I can’t wait to make the demo video, those monkeys are trying to get into the bin (and our house) every day, and they hate getting squirted.
2020 is the future! In the future I want to have many projects complete and be working on something new. So here is the everything I have been working on for the past few years, all in one go. Is this complete? You tell me!
I have uploaded the code to github, and some programs to my site, all is explained, although possibly in a rather rushed way.
Significant things which I have finally open-sourced (as promised) are the Android App (for streaming images and patterns to the poi), the full firmware for ESP8266, the circuit and PCB I used, CAD files for 3d printing and more.
Still to come is the code for uploading the backup images to the poi (an old windows .exe is available for now).
To read about how all of these programs work together check out the SmartPoi menu option above, which include the following 3 new pages:
If anyone is interested in making their own streaming poi all of the parts are linked.
Affiliate links are included on this website. Please support my future projects! Another way to support my work, and help yourself to free stuff at the same time, is to check out DigitalOcean with their promotional 2 months free hosting. If you haven’t yet heard of them, they are the best and cheapest virtual server on the market right now, the link is in the banner at the top of my site.
If you are trying to make the poi please consider signing up to the mailing list, I am emailing updates to quite a few interested parties right now. No spam, just updates. In the last two years there have been only four emails, so not a whole lot…
I have been trying to make my poi easier for anyone to duplicate by eliminating the costly custom circuit board. So I tried to make it on stripboard, which was a disaster. Here is the idea:
And here is how it ends up looking on the stripboard (with tilt switch):
So that looks great and all but in practice, having to cut the stripboard and solder and everything else, there are too many possibilities for shorts and troubleshooting it was turning out to be a nightmare. There are 18 solder points on the board above, not to mention cutting the metal on the stripboard (under the esp-01)
Here is another idea, I am trying to make this simple, the D1 mini costs just $1 more and can run on 5v which is the right voltage for the LED strip anyway. This is the new circuit:
Now we have only 9 points to solder (not including the LED Strip, I didn’t include it above either).
I also re-imagined my poi outer shell, to give access to the usb programming port on the D1 Mini, so this will help with development as well.
Looking forward to putting this all together, and updating my tutorial series (if it all works as planned)
So, my Smart Poi are battery powered, of course. I chose AAA NIMH batteries in a pack of 4 for this originally as this provides around 5 volts of power for the LED strip, and I have a voltage regulator to turn that into 3.3 volts for the ESP8266. Originally I got the batteries with tags on and had them soldered together into a battery pack (by a pro) and added a jack input for the charger. Nothing lasts forever, and after almost two years of use I find my battery packs are degraded to the point that they don’t power the poi anymore.
The simple solution would be to get some more packs made and simply replace the old ones, however I have found myself in situations where the one hour (big poi) or two hours (small poi) is simply not enough time. While they are charging the poi are not earning me money, so the plan now is to take the same batteries and make them replaceable. I found a cheap spring loaded plastic battery holder which fits inside the poi housing, so a simple jtag connector (molex whatever you want to call it, I am getting the cheapest one) will give me hours more poi spinning time, which means more money of course!
In addition, I am going to be adding a tilt switch to the LED strip power line, so while the poi are held upside down the strip will be off, but the controller will still be on, and connected to the Android app. This will save power significantly during down time (walking from one area to another for example).
Simple improvements, but with a major impact on my performance.
Now to get onto improving the code I promised to release as open source! A hard task but it’s coming.
So I have been working on the vervet monkey detector idea for a little while now. So far I have had some success with the back end. Here is an update on how it works so far. (tldr I used Google Cloud Vision api and some bash scripts)
1. I take a photo of the monkey (I still need to automate this, with motion detection)
2. Upload to my server using scp
3. Some moving around on the server to make the image public for Google Cloud Vision to see it – using inotifywait and mv
4. Google cloud vision api call with image url using curl
5. To do: parse json response from google to check if a monkey is actually there.
6. Send a signal to wireless valve (switches on the sprinkler and hopefully gives the monkeys a fright) – I have built one already, just need to modify the code slightly for wireless. Thinking of using esp8266 for this, since I have so many lying around, and a 12v battery since the tap valve solenoid runs off of 12v. I have a nice circuit board I built for my wireless poi which incorporates an ESP-01 and a voltage regulator. Add in a relay to switch 12v and it’s done.
So there is much to do. There is also the question of accuracy, obviously I don’t want any false positives wetting any unwary visitors, so I need to test this a lot before using it. The first version will trigger an alarm only, which in itself could be useful as a phone app, for example. We might be able to leave the windows open on occasion, with a monkey detector to alert us when one tries to get in and steal our food (this happened twice in the last week)
At some point I will have to make my own machine learning classifier for monkey images, as Google charges $1.50 currently per 1000 images classified. The first 1000 are free, but they have a habit of changing the pricing on their products without notice.
Just wanted to mention a couple of projects in the pipeline for 2019.
I recently moved house and it’s a great opportunity to look at home security. In South Africa this is quite an important topic. Most homes here have burglar guards but while these may go some way to delaying an intruder they are by no means fool proof. An alarm provides an added layer of protection, especially if you are asleep, or not at home. The cheapest alarm I could find cost R2000 (around $150) but all it does is blare a siren. For a proper system which will alert you it’s significantly more pricey.
Of course I have so many microcontrollers around so I have started looking at the options of making my own super secure system. A friend has made his using an Arduino Uno connected to magnetic switches on the doors and windows. A GSM module provides connectivity, so both he and his security company receive SMS alerts if an intruder gains access. The whole thing is one long circuit with wires connecting every switch (this is true of many commercial home alarm setups as well) and each “zone” can be bypassed or set by sending an SMS code.
I made him an Android application to send the codes so that he doesn’t have to type them in manually any more but with my system I am hoping to eliminate the wires entirely as well. Not sure yet about the GSM module, SMS cost more and you need a dedicated SIM card (also I don’t have one and would have to order).
So it’s wireless, ESP8266 to be exact. I have been looking at mesh networks (the wifi doesn’t quite extend to every corner of the house) and have settled on painlessMesh as the best one. Each node in the network will consist of one ESP-01 connected to a battery and some sort of spring switch (or possibly a tilt switch) which will be turned on by the opening of a door or window. As soon as it is turned on, the node will send a message, alerting the main (always on) node that something has happened, possibly triggering the alarm (and sending me an SMS, email or some other notification). This way the battery is not draining all day, only when it is needed.
The other problem at my new place is a bit more novel, we have a monkey problem. Situated near a nature reserve the birds and butterflies are prolific but Vervet Monkeys come in and poke through our trash on a daily basis. I found a manual method at https://www.wikihow.com/Repel-Monkeys-from-Residential-Areas – just tie your bin shut with slinky cables but the monkeys are so brazen, they steal our bananas from inside the kitchen as well. Basically as soon as you hear them it’s total lockdown, shut all the doors and windows and with the heat here that’s not great.
Image below: Monkeys on my car. One of them took a dump up there, which was the last straw for me.
My plan is to leverage Google’s Cloud Vision API to assist here. The image recognition works great for monkey detection (try it yourself here: https://cloud.google.com/vision/) – I upload a still from a webcam if motion is detected and then Google will tell me if a monkey is present. If one is, on come the sprinklers. The garden gets watered and the monkey runs away. Vervets hate getting wet, we have water squirters stationed at each entrance.
The only issue is Google’s pricing, it’s $1.50 per 1000 images scanned (after the first 1000 per month free). Ideally I would be creating my own recognizer with Tensorflow and using that but my CPU can’t handle this currently. Not to mention the time it takes. So Google it is. For now.
So.. lots to do, much code to write. Let me know what you think, if you have anything similar to share, or ideas for me to try.
I emailed my favorite visual poi graphic artist, Axel Belhache and he agreed to let me use his images in my shows. Here is an online animation showcasing his amazing work. You can click on the animation to advance to the next image.
There are two .apk files included in the zip file (4mb). In order for the app to work correctly you need to install and run “Smart Poi Setup.apk” – it creates the necessary folders inside the “Pictures” directory on your device. You may need to run this twice, depending on your Android version (file access permissions may only work the second time) – just check if WirelessSmartPoi and WirlessSmartPoi72px folders have pics inside or the main app will not work correctly. Smart Poi Setup.apk can then be uninstalled.
The second “Smart Poi Demo.apk” is a test app to show the capabilities of the poi. This version of the app is for anyone demonstration purposes only, the UDP send is disabled and visualization enabled. In other words it does everything but send signals to the poi. This is because my app slows down function if no poi is connected, trying to send to nowhere. You may need to be connected to WiFi for this to work, I haven’t checked if that check is still in place.
The Timeline option won’t work on this demo unfortunately as it requires a zip file created by the Timeline creator desktop program which isn’t quite ready for sharing. To see what the other options are meant to do on the poi check out my post here:
Anyway, have a look and let me know what you think! So far tested working on Android KitKat through to Nougat. Please note all images need to be rotated 90 degrees to the right for the app to work correctly. One day I will fix this..
I will be uploading the full app to the Play Store once the Poi Arduino code is ready for sharing. The ultimate goal is of course to enable anyone to make a set of affordable Wireless Streaming Smart Poi of their own, and hopefully find some programmers interested enough to contribute to the development of this project.
Some images from one of my poi spinning gigs, animated to show how they look on the poi. I am hoping to be able to make this into a service for other poi spinners, so they too can showcase their work. All images copyright Nu Metro Cinemas, adapted for poi by my talented wife, Amanda Hastings.