05 February 2018
Gather around readers, this is the story of how my quest for automation caused the deaths of three (Bonsai plants), launched a semi-operational side business and helped me create The World’s Most Advanced Flower Pot. The first death occurred last summer, after an unsuspecting Bonsai was gifted to me by my best friend, as a ‘Thank you’ for allowing him and his girlfriend to crash at mine while they searched for a new flat. It was unintentional — but I was still devastated. This poor plant had survived years in a plant nursery but barely a month at mine.
Not the best moment for my bonsai
Little did I know at the time, Bonsais have abnormally fragile constitutions. Only too late (and many YouTube videos later) did I learn that Bonsais:
Bonsais lack any kind of feedback system, if you are doing something wrong or forget to water it (even for a day) you won’t get any kind of warning about your mistake. Well, maybe it ‘warns’ you, by dying. How could I give my (future) plants the best care they need, when I myself was busy with work and life? This incident re-ignited my dormant, but unforgotten passion for automation. I had vowed that this would not happen again (it did. Twice).
For this story to make sense, we have to go back to when I was in my final year of school studying Software Engineering. I had dipped my toes in many different technologies; I had created an e-mail system in Java, modelled the Battlestar Galactica using primitives in OpenGL, built an enormous database in Oracle to run a theoretical airport, created a vikings strategy game in PHP, and created an application to manage a video store in COBOL — to name a few. My time at university was coming to an end, yet I wondered: Where are the automations?
Thanks to sci-fi movies such as Demolition Man, The 5th Element, Judge Dredd, Blade Runner and Back to the Future (to name a few) I grew up with the promise that the future would be filled with smart homes. A home that would automatically switch on the lights as you enter, after being warmly greeted by your home virtual assistant.
It was with this mindset that in my third year in university, I enrolled in a class called “Automation Theory”. I imagined self-driving cars, robotics and being one step closer to my dream smart home. I realised a few months later, that focusing on partying did nothing to help me succeed in one of the most theoretical and difficult subject my university had to offer. Still I pursued my passion as much as I could within a small university, in a small city in Spain.
Sadly I discovered that this was not the era of the smart home. Steve Jobs had opened the iPhone SDK to third party developers thus launching the era of smartphones. The promise of a smart home was once again pushed to the back burner. I specialized in iOS development, kept coding and learning about apps, startups digital business models, MVPs, etc. But honestly, I never forgot about the smart home, even when I felt the world had. This is the irony of our time. You can video-call your mum from a jungle in Thailand to show her the biggest snail you have seen in your life (I did that) but apparently window blinds opening in the morning are science fiction.
With thoughts of ‘changing the world’ firmly embedded in my mind, I started a side project to create a “smart home hello world!” and learn a little bit more about automations. I learned that the equivalent of “Hello world!” in electronics is called a “blink” and consists basically of switching on a light (makes sense). I had to learn some basic electronics and add this knowledge to my expertise in software to create a “smart home blink”. In other words, switch on a light when some event happened. Determined, I started reading about electronics, electricity and automation and spent money buying Arduino boards and its electrical and electronic components.
Being a complete newbie, I limited myself to buying components solely to familiarize myself with them. I thought this could be like learning a new framework. My mantra was, “If I can learn Haskell, I can power a bulb.”
I was wrong.
To switch on a light without directly flicking the switch with your finger, requires knowledge from many different technologies. One would need experience in three different engineering careers and maybe a couple of religions. Try to connect something you have created with your hands to a 220V wall plug and you will understand why religion (or at the very least some potent prayers) is needed.
Probably too many skills for one person with a little free time
After some time spent here and there without the remotest of idea of what I was doing, I had to face reality. It was probably unrealistic to pretend to acquire electrical and electronic knowledge in my free time. In all honesty, I could not even solder two cables together. I was the kind of noob that applied heat to the tin instead of the component. Eventually I admitted defeat. I put everything in a box on the top of my closet and I forgot — once again — about the smart home.
But the dream of a smart home lingered. I might not have done anything practical but I continued talking about it, read up on projects by other people, and watch Arduino tutorials on YouTube. I even attended some Meetups.
Powerful allies
Through a workmate with some electronic knowledge, I learned how to solder basic components and how to use the multimeter. At the same time, thanks to YouTube, I had learned basic electronics and basic electricity. The handling of a relay, a capacitor or a transistor didn’t scare me anymore. I also discovered a distribution chain for electronics, a place where I could buy nearly anything for almost no money: AliExpress. Through AliExpress, for 20€ you can buy a bag full of sensors and microcontrollers. It’ll take a month to arrive, but hey! you can use that time to watch more YouTube videos.
So, back to the present. I had a dead bonsai, and years of experimenting, learning, discovering and obsessing over automation. This was it, the moment to put it all to good use. Future plants needed saving — or at the very least, houseplants would need to be remotely watered. I finally had the knowledge, and my side project had a purpose. I took to my whiteboard and started my plan as any good engineer would, with the requirements gathering phase:
The most important decision I had to made was about the brain of my system. I bought and tested many different chips. A Raspberry PI, C.H.I.P, Arduino — I had seen similar projects on the internet use a Raspberry PI, but the problem here was that it’s a computer, that does way more work than required. I just needed to read a couple of sensors and send a POST request to a service. I finally settled for the ESP8266, probably the most famous platform for IoT hobbyists.
An ESP8266 is a microcontroller fully compatible with the Arduino IDE that runs at 86 mhz, has around 100 Kb of internal memory AND WIFI at a low price of $1 per chip. On AliExpress you can find the WeMOS development board which makes the development as easy and fun as prototyping with Arduino. Why would I use this board instead of a Raspberry PI that has more features, you may wonder. Aside from the price difference, I also had to take into account energy usage. In the future I would like to power the system with a small solar panel or small battery and this would not be possible if you have a full CPU running all day long.
Picking a sensor was fairly easy. For the temperature and air humidity I bought a pack of DHT11 sensors, for the detection of soil moisture I bought something that looks like a weapon, and for measuring light, I got some photocells.
The components took about a month to arrive to Barcelona from Shenzhen so I used this time to familiarize myself with the software. Espressif, the ESP manufacturer, provides a good SDK in C++ with an HTTP client that allows you to do REST calls.
I toyed with the idea of creating my own server, but I was afraid that the infrastructure would once again become too large to handle. After some quick research I found ThingSpeak, a project from the Matlab company. I discovered that even with a free account they’d provide me with a url that accepts query parameters with measurements that is displayed in a fancy chart! Bingo! I now had the components, the software and the server. It was time to get my hands dirty.
After a dozen or so different prototypes and two more dead bonsais (science requires sacrifice) I have created a flower pot that can keep the soil moisture with an accuracy of +/- 1%. It monitors the quantity of light, air humidity and temperature thanks to the 600 samples it takes per day and it waters the plant when needed.
Note: The first prototype was able to take more than 80000 samples per day but my field experiments concluded that the life of a bonsai doesn’t change significantly in a fraction of second…
As it stands, after the second sacrificial bonsai, I switched to parsley as 40€ per prototype was hard to justify. According to my friends, chopping fresh parsley from my garden over homemade hummus was a real highlight too! To date my main flower pot prototype has been taking care of my parsley for nearly six months without any errors!
Achieving up to 5% of humidity oscillations along the day - room to improve.
Current version working like a Swiss watch
One question I get very often is, “Can you water the plants remotely?” Quick answer: Yes. But I don’t need to, because it is AUTOMATED.
This project has now moved from being a waste of time, to my most successful side project. So far I have already pre-sold five units of my flower pot and this has lead to a new side project. Creating a prototype is one thing, but creating a reproducible device with a software and UI that a non-experienced user can configure and setup in their house is a very different thing.
This version might require a bit of work before going on sale!
While this would be a good moment to recap this article and make some smart reflection about not giving up on the things you like, this is however, the end of this post but just the beginning of the story.
This post is based on a short demo powerpoint I did for the Mobile Jazz team during our weekly meeting. Special acknowledgement to them for inviting me to share my story. It is a pleasure for me to be a part of this company.
This article was sponsored and originally published in the blog of MobileJazz. Edited by Ohani Gurung Khaursar