Intro: Plantagotchi! Smart Planter
Plantagotchi dies so your plant doesn't have to.
I recently became the proud owner of a new houseplant (named Chester) and I really want him to have a long and healthy life. Unfortunately, I do not have a green thumb. I was instantly convinced that I would send Chester to an early grave if I didn't get help. He was already a little sad looking when I got him.
This is how I came up with Plantagotchi - a smart planter that lets you know when you are being a neglectful plant parent. Plantagotchi turns your plant into a cyborg that gives feedback when its needs aren't met. If it doesn't get enough sunlight or water it dies (its eyes turn to Xs). This allows you to make it up to your plant before it's too late!
Note: this is an entry into the Planter Challenge & I used Tinkercad in my design.
Step 1: Design Inspiration & Functionality
While dreaming up Plantagotchi, I imagined a cross between a Tamagotchi (the digital pet from the 90s that was impossible to keep alive), and Anana (an anthropomorphic pineapple from the low-budget 80s Canadian French educational show - Téléfrancais!)
At a most basic level, I understood that my plant needed two things in order to survive: Water, and Light. Accordingly, Plantagotchi has a water sensor and a light sensor. If the plant does not receive light for an extended period of time, or if its water dries up, the Plantagotchi's eyes turn to Xs.
During the day, Plantagotchi's eyes look around the room. When it gets dark it shuts them (see video in intro). This gives it a little bit of personality!
Step 2: Gathering Supplies
This is not a difficult project; however, I don't recommend it for an absolute beginner for the following reasons:
- You need to solder the TFT screens
- You need to feel comfortable installing and troubleshooting Arduino libraries
- If you wish to customize the eye design you need to run a Python program in the command line.
...If all this sounds OK - let's get started!!
The eyes are based off an amazing Adafruit tutorial: Electronic Animated Eyes using Teensy. I made modifications to customize this project, but the original tutorial has lots of excellent resources and troubleshooting tips in case the screens aren't working properly.
Supplies for the eyes & sensors:
- 2 small TFT screens
- Teensy 3.1 or 3.2 microcontroller
- 10K Ohm resistor
- 2 small galvanized nails
- 2 Alligator Clips (optional)
- A bit of a sponge
- Electricians tape
- 3D printed case for the eyes
Supplies for soldering
- Soldering iron
- Solder wick (in case you make a mistake)
Supplies for the planter:
- Large coffee tin
- Hard candy box to house the microcontroller (I used a pack of Excel mints)
- Acrylic Paint
- Nail & hammer for punching holes
- Masking tape (optional - not pictured)
- Juice box (optional - not pictured)
- Glue gun (optional)
- Tinfoil for decoration (optional - not pictured)
Step 3: Getting the Eyes Working
As previously mentioned, I followed this Adafruit tutorial to get the eyes initially set up.
The Adafruit tutorial has more in-depth instructions than I have space to cover here. I will summarize the general instructions, and highlight the challenges I experienced.
1. Solder wires to the screen.
You will need to connect wires to the following pins:
Challenge - I soldered headers to my screen right away for breadboarding, but then they wouldn't fit in the 3D printed enclosure. This meant I had to remove them and re-solder on wires. Skip this frustration by using wires instead of headers in the first place.
2) Install the Teensyduino library
Challenge - don't let the installer include any Adafruit libraries when you go through the setup process. These libraries are outdated, and will cause your code to throw errors.
3) Test the Teensy
Upload a simple blink sketch to see if your Teensyduino installation was successful.
4) Install the graphics libraries in the Arduino IDE
You will need the Adafruit_GFX library, and the Adafruit_ST7735 library
5) Wire up screen to the Teensy using a breadboard
Connect your wires as follows to the Teensy ( click here for a map of Teensy's pins)
- VIN - USB
- GND - GND
- SCK - SPI CLK
- SI - SPI MOSI
- TCS - Pin 9 (left eye), or 10 (right eye)
- RST - Pin 8
- D/C - Pin 7
6) Upload the "uncanny eyes" file to the Teensy
It's best to start with the original code from the Adafruit Tutorial, rather than my modified version, as mine may just display Xs instead of eyes when there are no sensors.
Challenge -Breadboarding with TFT screens can be a pain as they are very sensitive. If the unsoldered wires were jiggled at all, I would end up with a white screen until I reloaded the sketch. Soldering the connections fixed this challenge for me.
Step 4: Customizing the Eye Design
The default eyes that come with this library are very realistic. However, they felt too creepy for this project - I wanted something more like a googly eye.
To make your own custom eye, modify the png files saved in the "convert" folder in the code repository. You can then transform this into a new bitmap by running the tablegen.py script in the repository.
This is the command you will need to run in order to generate the new bitmap (note you require Python* & several packages including PImage for this to run properly).
python tablegen.py defaultEye/sclera.png defaultEye/iris.png defaultEye/upper.png defaultEye/lower.png 80 > defaultEye.h
Once you run the script, a new .h file should appear. Simply drag this file into the same folder as the uncannyEyes.ino file, and then modify the #include sectionin the Arduino code so it knows to look for your newly generated .h file. When you upload the code to the Teensy, your screens should display your brand new eye design.
*Note that the tablegen.py file from the Adafruit tutorial only works on Python 2. The version I uploaded above works with Python 3.
Step 5: 3D Printing
I'd never 3D printed before, so this was very exciting!
I originally wanted to print a whole pot with cut-outs for the eyes & microcontroller, but I wasn't sure about the logistics of printing something this size. I decided instead to start small by use a modified version of the 3D printed casing offered in the Adafruit tutorial. It was cheaper to print, and could be reused in other projects in the future.
I assumed customizing the 3D printed case would be the hardest part of this project, but it turned out to be ridiculously easy. I used Tinkercad, and the onboarding process only took a couple minutes.
After playing around for a few minutes making crazy designs (for future projects). I uploaded the .stl file from Adafruit, and then added a stake to help it stand up in the dirt. I just had to drag and drop a rectangle shape onto the design and resize. Easy! It was ready for printing in no time.
This process was not entirely without human error though - I accidentally sent the wrong file to the print shop, and ended up with only "front" pieces (two with the rectangle stake included, two without), and no closed back piece. This worked out well though, the extra front pieces could double as a back, and the extra large hole made it was easier to pass the wires through (an accidental win!)
The 3d printed design from Adafruit also had space to include a round plastic bead on top to make the eyes look more realistic. I decided after printing that I didn't want to include this because it verged on uncanny valley, so I covered up the gaps this left on the side of the screen with electrician's tape. The tape also helps keep my components protected from moisture. Admittedly, electrician's tape is not a long-term solution. If I redid this project I would modify my 3D components to suit my design better.
I've attached my modified version of the 3D casing below. The originals can be found at this link.
Step 6: Adding Sensors and Housing the Microcontroller
I followed a diagram from Adafruit's website to connect the photoresistor to pin A3 on the microcontroller.
In the code, when the photoresistor sensor value is below a threshold, the Plantagotchi enters sleep mode. It's eyes close, and a timer starts. If the timer continues for 24 hours without being interrupted, the Plantagotchi's eyes turn to Xs to indicate that it needs some light.
Note: plants need natural light to thrive, but the Photoresistor is sensitive to both natural and artificial light. It is therefore important to position the Plantagotchi such that this sensor wouldn't be facing towards an indoor light source.
I read that water sensors rust easily, so I decided to go super DIY for this so it could be easily replaced. I attached alligator clips to two wires and connected one to ground, and the other to pin A0. If A0 is not connected to ground, it typically picks up values around 50-150, once I connect it to ground the values go down to 1. I used alligators to hold onto two galvanized nails, which I stuck closely together using a piece of sponge. The order is as follows:
(Ground ------->Nail1 [stuck in sponge] Nail2<------ A0)
Bromeliads store water in cups that form in the base of their leaves (see photo). When the sponge is wet from the water in these cups, the two wires maintain a connection, and the A0 sensor value remains low. Once the sponge dries, however, the connection is broken, and the input value spikes. This triggers the Plantagotchi's eyes to turn to Xs.
To protect my components I used a package of mints that perfectly fit my teensy, it even had a lid with a hole the right size for the wires. I wrapped the package in electrical tape so it would look similar to the eyes.
In the end I wrapped the sensor wires with black tape as well because it kept the wires together and made them easier to move. If I were to redo this project, I would definitely invest in some Heat Shrink and rely less on tape..
Step 7: Decorate a Pot & Add a Spot for the Microcontroller
Having spent more money on components and 3d printing that I care to admit, I wanted to make the pot as cheaply as possible.
I recycled a coffee tin that perfectly fit the size of my plant's pot (although, I had to hammer down the lip a bit so it could fit inside). Before decorating the pot, I nailed some holes in the bottom in case it was ever overwatered.
As I wanted to keep my electronics somewhat removed the planter (water + electronics = not always a great idea), I cut up a juicebox and glued it to the back of the can to hold the components. This keeps them dry, and lets me remove them easily when needed.
I didn't like how the juicebox jutted out at the back, so I used masking tape to give it a bit of shape. Next, I painted the whole thing with acrylic paint. For decoration, I left a stripe of silver on the tin, and mimicked this on the juicebox with a small strip of tinfoil. Finally, I added a stripe with black electrician's tape...because why not!
Step 8: Putting It Together & Next Steps
Place the microcontroller into the pot and adjust the sensors as needed. Stick on an electrician's tape smile, and your Plantagotchi is ready to go!
I'm oddly fascinated by this planter - it just seems so weirdly friendly.
A few ideas I've had to develop Plantagotchi further include adding another screen for a mouth (allowing it to smile, frown, or look shocked), or redo-ing the project with a modified 3d printed design and heat shrink for the cables.
If you want to say hi to Plantagotchi, or if you have any suggestions for future mods, I would love to hear from you.
First Prize in the