Who's never done it? Well, ok, I did try this for a while but I don't like talking to someone/something that doesn't answer...
Oh, and not to forget that every year dilema of going away for a couple of weeks. Who's taking care of the plants?
So well, Snips, plants, water, intelligent plant pot idea is born! I decided not to only make a talking flower pot, but to integrate a pump, a water level sensor, a humidity/temperature sensor, a UV sensor as a soil moisture sensor.
The idea is simple. Put some water in the tank, place the cover over it, place your plant in it, insert the soil moisture sensor in the earth and place the water tube. Plug your pot to one of your outlets and let the magic begin. The plant will respond to your "Hey plant" wakeword and at first, as a new born, will ask you some details about herself, mainly what she is. This information will make the pot independent but also let the plant alert you when she's thirsty, needs more or less sun, cold, warm.
I have decided to integrate 5 LEDs, discrete ones, in the pot, so that asking about the water level will answer not only by voice but also visually. The best part about RGB LEDs is that it will also show you the temperature, moisture and light levels!
This project is meant to be a satellite of a Snips main unit to reduce the costs and hassle of having multiple pots all running a Snips full engine. As a satellite you can easily connect them to your main unit for a centralized plant data center!
BTW.... Check this, Google almost took my idea... https://www.youtube.com/watch?v=nsPQvZm_rgM
Let's go!For this to work, you'll need both a main unit and as many satellites you want, one for every plants you want to connect to your system.
Let's start with the easy one, the main unit. You won't even need a speaker or mic on it, it's just here to compute a few things. Flash the latest raspbian on your SD card, I recommend Raspbian stretch lite: https://www.raspberrypi.org/downloads/raspbian/ and flash it to your sd card using Etcher per exemple https://www.balena.io/etcher/. You do know how to configure Raspbian without keyboard and screen don't you? Well, here's a link just in case... https://www.raspberrypi.org/documentation/configuration/wireless/headless.md
Create an account on Snips: https://console.snips.ai
Create a new assistant. Choose the name, but keep something in relation with this project: "My flower", "My plant" or something like that would be a good idea.
Choose a language. Please note that for now this project only fully supports english and has french preimplemented.
Click on add an app and search for "Snips My Flower" by me. That's all! Wow, it's so easy to create an assistant with Snips!
You will need SAM to configure your raspberry pi, but don't worry, it's pretty easy. There's many different OSes so I will not go through the installation of this tool, but here's the official guide for it: https://docs.snips.ai/getting-started/quick-start-raspberry-pi#step-3-install-the-snips-platform. Follow this guide up to point 6 and you should have your raspberry and assistant configured, ready to go! We need to configure a few things before we go for the plant installation.
Configuring Snips on main unitConnect to your raspberry main unit through ssh, using the tool of your choice (on windows Kitty.exe is a good idea...). If you did configure your raspberry pi headless I hope you did not forget to add an empty file called "ssh" on the boot partition?
sudo nano /etc/snips.toml
If you are using your main unit only for your flowers and don't have any mic and sound on it, you can disable their inputs under "[snips-audio-server]"
disable_playback = True
disable_capture = True
More important is to configure the satellites now. Both under "[snips-asr]" and "[snips-hotword]" you should have a line that says "# audio = ["+@mqtt"]". This is where we declare the satellites for the main unit. This is where we are going to add our plant! So, let's say you have a "dragon tree" to monitore. The satellite should logically be called "dragon tree", so you can call it by it's name, right? Let's do this! Oh, also, if the plant name contains a space, replace it with an underscore!
audio = ["dragon_tree@mqtt"]
Don't forget to remove the # in front of the lines! For now I have only implemented dragon tree support. You can add your own plants in the plantsData.json file! I recommend this perfect site for the data: https://www.houseplantsexpert.com/a-z-list-of-house-plants.html
Ok, we're done configuring the main unit. Hit CTRL+X and hit Y for yes and enter to confirm the filename to save. Restart Snips:
sudo systemctl restart snips-*
You will need my app to run on the main unit, here's the link: https://console.snips.ai/store/en/skill_yP1nNbKgZZY
Use sam to deploy it to your main unit.
Configuring our plantWe have our main unit, now we need our plant to have a more basic Snips installation!
Follow the exact same raspbian installation as for the main unit. Once flashed, connect your raspberry pi and connect to it through ssh.
I have made you an automated installer that will take care of updating your install, download and install snips-audio-server, install your respeaker (or 4 or 6), download and install the flower software and configure Snips!
wget http://bit.ly/snipsFlower -O snipsMyFlower_download.sh
This downloads the installer. You need to execute it. It will ask you the main unit ip adress as well as the name of the plant. Remember the one you used when installing the main unit?
sudo chmod +x snipsMyFlower_download.sh
sudo ./snipsMyFlower_download.sh
If everything went according to the plan, it should download the required files, install the needed libraries and create a link for the service to start all by itself.
Let's check if everything is fine:
sudo systemctl status snips-*
sudo systemctl status snipsMyFlower
These two commands should now return you, in green, running statuses without errors.
Good, we are up and running, software side! If you call your plant by saying "Hey Snips" it should play a little detection sound. Unplug your raspberrypi zero. Hardware time?
Hardware partI guess while you were trying to get the software part running, you had the 3D parts printing right? I can't tell you much about them, printers are so different. What I can tell you is that I printed everything at 0.2mm layer and that you want the water tank to be watertight. One solution for this is to use some X3C 3D print epoxy coating, but it's up to you.
Concerning the P B parts, I have included the gerber files. It's up to you, making them yourself, using a mini cnc or etching with chemicals or even order them and last solution, ask me to make them for you against a little something. There's basically two mini PCB. An interface for all the wiring and a little mosfet to turn the pump on and off and a PCB for the water level. You could do without the first one, but you need to read the water level in the tank.
Once everything is printed and etched, start by assembling the electronic part:
I you have a pi zero without header (that's great, tell me where you bought it please!), here's the pins you need for the respeaker 2: https://fr.pinout.xyz/pinout/respeaker_2_mics_phat
- For the water sensor you will need to connect some wires on pins [13, 15, 16, 22, 29, 36]
- For the pump you need pin [37]
- For the LEDs we need [19. 23] (SPI)
- For the sensor we need [3, 5] (I2C)
- For the whole we need power and ground: [1, 2, 6]
Here's the EasyEDA project if you need the pin numbers: https://easyeda.com/editor#id=|a420c6682bae48238382cc1488a42705|ffbf67304f75418c817beecc04a4c69b as well as where to connect what on the PCB.
Before it gets to this mess:
Clean a little.... Trust me, it's better for your relation with your partner...
Take your micro usb power supply and cut the usb port off. Go through the pot bottom with the wire and strip the wires so you can crimp them and add the dupont housing. Connect the power supply to the PCB and place the entire construction in the pot.
We need to build a flexible led stripe, this is why I took the DotStar LEDs and soldered them together:
It's basically daisy chaining them together and running the ground and current along them all using some little metal wire. Here's the schematics for these LEDs:
Place the LEDs inside the led support and glue them wherever you see fit, but inside the pot, LEDs heading through the pot wall! Yes, I'm using tape, because I couldn't come up with a good solution for this led construction...
It's not on all pictures because discovered only after, but twist the LED wires together and twister the pump wires and keep them as far as possible from each other! The pump generates a lot of electrical noise that disturbs the LEDs! I ended up adding the 470uf capacitor and a resistor on the pump wire:
Run the plastic tube for the water through the printed tube and through the support hole. The sensor wire runs through that tube as well. The other cables not.... Because.... They've sent me a thick i2c wire and there's not place left for the other wires. Place for improvements!
Place the water tank in the pot
Place the support over the water tank
Ok, stop, we stop here with building. Before placing the plant we should add some water. But for that, the program can help you!
First startMake sure you main unit is plugged in and snips is running on it as well as my app.
Now plug in the flower pot and wait it to boot. The pot should play a little led animation, a blue bar filling up.
Which will immediately be followed by a single blue led and your plant telling you it is out of water!
Tell your plant you want to fill its tank and follow her instructions. Make sure the water tube, that comes from the pump is actually aiming down to the support! The plant will try to water itself when it gets water! At this point the plant will start recording data and alert you when something is out of range:
- Moisture: too high / too low
- Temperature: too high / too low
- Light: too high / too low (over the last 24 hours)
- Water: tank empty
The plant will speak the alert only once, but will keep the led bar on alert state
Place your plant on top of all that. Place and connect the water dispenser and place the soil sensor! You've made it! It's completed!
- What's up? If your plant is showing status LEDs you can always ask her what's wrong.
- Tell me about your soil moisture yesterday. Ask for data that was recorded.
- How's your moisture? Asks for instant telemetry data.
- I want to refill your tank. If you want to refill the water tank you better ask her first and follow her instructions!
- Empty your tank! Make sure you have disconnected the water dispenser and the water tube is aiming outside of the pot, preferably in your sink.
- Have something to drink. Tell your plant to water herself. She'll do it automatically, but you can always ask for more :) Be carefull not to drawn her!
Well, this is merely a concept of something that could become bigger if given more love and care. Feel free to contact me if you have ideas. Feel free to fork on github if you have improvements to the code. Feel free to have fun!
RetrospectiveNow that the deadline is reached, here's my little retrospective on the project itself.
- What would I do differently? I would definitly take more time. I allowed myself exactly one month only. And I would team up maybe, not sure, I'm kind of a lone wolf
- Would I redesign? Yes, definitly. There's not enough place for the whole electronic. Yes there is, but it wouldn't hurt to have a few milimeters space. I'd definitly rethink the wiring
- What about the PCBs? I would totally make them different. This is only an evolution from an idea to a concept/prototype. They need to be redrawn, together with the design
- The code? Well, code is constantly evolving and some part are stuck due to some random and weird bugs. All the main functions run, don't be scared, but some heavier functions won't return correct results.
- Bug hunt? I know for a fact that loading i2c and spi devices side by side (and together with a motor!) is not optimal and that some random weirdness happens due to that. If I was to continue this project I'd go i2c only. The respeaker 2 also suffers some i2c bugs sometimes.
Comments