# PyPortal IoT Plant Monitor with Google Cloud IoT Core and CircuitPython

## Overview

Warning: 

![](https://cdn-learn.adafruit.com/assets/assets/000/080/128/medium800/sensors_IMG_7822.jpg?1566952255)

 **Turn your black thumb into a green thumb** by building an**&nbsp;internet-enabled plant monitoring system by combining [Google Cloud IoT Core](https://cloud.google.com/iot/) with CircuitPython.**

This smart-planter&nbsp; **monitors your plant's vitals** on the PyPortal's screen, **logs this data to a Google Cloud** registry for long-term storage and even **&nbsp;correctly waters your plants remotely** by controlling a peristaltic water pump.

**Using Google Cloud IoT with your CircuitPython IoT projects&nbsp;allows you to quickly prototype** &nbsp;(and even _mass_-prototype)&nbsp; **advanced internet-of-things devices** &nbsp;and connect them to the Google Cloud Platform.&nbsp;

## Google Cloud IoT

[Google Cloud IoT](https://cloud.google.com/solutions/iot/) provides a complete solution for collecting, processing, analyzing, and visualizing data from IoT devices in real time:

- **Device management** , with per-device authentication and management.
- **Data aggregation&nbsp;** with Cloud IoT Pub/Sub&nbsp;
- **Scalable** - Google Cloud IoT is serverless and scales instantly.

Connecting CircuitPython to Google Cloud IoT [unlocks over 100 products and services available from Google Cloud Services](https://cloud.google.com/products/). Some of these services are&nbsp;_especially_ useful with IoT projects, such as:

- **Analyze your data** &nbsp;with [Dataflow](https://cloud.google.com/dataflow/), [BigQuery](https://cloud.google.com/bigquery/), or&nbsp;[BigTable](https://cloud.google.com/bigtable/)
- **Machine Learning** with [Cloud AutoML](https://cloud.google.com/automl/)

![sensors_GCP.jpg](https://cdn-learn.adafruit.com/assets/assets/000/079/927/medium640/sensors_GCP.jpg?1566827497)

## CircuitPython

**CircuitPython is perfect for building Internet-of-Things projects**. This project uses the [ESP32SPI CircuitPython](https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI) library, which can use the ESP32 as a WiFi-coprocessor.

We've built a **[CircuitPython Google Cloud IoT Core](https://github.com/adafruit/Adafruit_CircuitPython_GC_IOT_Core)** helper module to make interacting with Google's Cloud IoT MQTT Broker _incredibly_ simple. Provisioning CircuitPython for Google Cloud IoT Core is as simple as adding your device's settings to a file. Our library even handles JSON Web Token ([JWT](https://jwt.io)) generation.

**You can rapidly update your code without having to compile** and store WiFi, device configuration, and secret keys on the device. This means that there's no editing code and re-uploading whenever you move the PyPortal to another network - just update a file and you're set.&nbsp;

![sensors_blinka.png](https://cdn-learn.adafruit.com/assets/assets/000/080/073/medium640/sensors_blinka.png?1566936617)

## Prerequisite Guides

If you're new to CircuitPython, take a moment to walk through the following guides to get you started and up-to-speed:

- [Welcome to CircuitPython](https://learn.adafruit.com/welcome-to-circuitpython)
- [PyPortal Introduction Guide](https://learn.adafruit.com/adafruit-pyportal)
- [MQTT in CircuitPython](https://learn.adafruit.com/mqtt-in-circuitpython)

## Parts
### Adafruit PyPortal - CircuitPython Powered Internet Display

[Adafruit PyPortal - CircuitPython Powered Internet Display](https://www.adafruit.com/product/4116)
 **PyPortal** , our easy-to-use IoT device that allows you to create all the things for the “Internet of Things” in minutes. Make custom touch screen interface GUIs, all open-source, and Python-powered using&nbsp;tinyJSON / APIs to get news, stock, weather, cat photos,...

In Stock
[Buy Now](https://www.adafruit.com/product/4116)
[Related Guides to the Product](https://learn.adafruit.com/products/4116/guides)
![Front view of a Adafruit PyPortal - CircuitPython Powered Internet Display with a pyportal logo image on the display. ](https://cdn-shop.adafruit.com/640x480/4116-00.jpeg)

### Adafruit STEMMA Soil Sensor - I2C Capacitive Moisture Sensor

[Adafruit STEMMA Soil Sensor - I2C Capacitive Moisture Sensor](https://www.adafruit.com/product/4026)
Most low cost soil sensors are _resistive_ style, where there's two prongs and the sensor measures the conductivity between the two. These work OK at first, but eventually start to oxidize because of the exposed metal. Even if they're gold plated! The resistivity measurement...

In Stock
[Buy Now](https://www.adafruit.com/product/4026)
[Related Guides to the Product](https://learn.adafruit.com/products/4026/guides)
![Demo Shot of the Adafruit STEMMA Soil Sensor - I2C Capacitive Moisture Sensor in a small potted plant, with wires connecting it to an Adafruit Metro.](https://cdn-shop.adafruit.com/640x480/4026-01.jpg)

### Peristaltic Liquid Pump with Silicone Tubing - 12V DC Power

[Peristaltic Liquid Pump with Silicone Tubing - 12V DC Power](https://www.adafruit.com/product/1150)
Move fluid safely from here to there with this very nice little pump. Unlike most liquid pumps, [this is a peristaltic type - the pump squishes the silicone tubing that contains the liquid instead of impelling it directly](http://en.wikipedia.org/wiki/Peristaltic_pump). The upshot?...

In Stock
[Buy Now](https://www.adafruit.com/product/1150)
[Related Guides to the Product](https://learn.adafruit.com/products/1150/guides)
![Peristaltic Liquid Pump with Silicone Tubing ](https://cdn-shop.adafruit.com/640x480/1150-07.jpg)

## Materials

You'll need some extra parts and supplies to finish this project. If you do not have them already, pick some up from Adafruit.

### Part: PN2222 Transistor
quantity: 1
NPN Bipolar Transistors (PN2222) - 10 pack
[PN2222 Transistor](https://www.adafruit.com/product/756)

### Part: 1N4148 Diode
quantity: 1
1N4148 Signal Diode - 10 pack
[1N4148 Diode](https://www.adafruit.com/product/1641)

### Part: 220 ohm resistor
quantity: 1
Through-Hole Resistors - 220 ohm 5% 1/4W - Pack of 25
[220 ohm resistor](https://www.adafruit.com/product/2780)

### Part: Breadboard
quantity: 1
Half-size breadboard
[Breadboard](https://www.adafruit.com/product/64)

### Part: Breadboarding Wire
quantity: 1
Breadboarding wire bundle
[Breadboarding Wire](https://www.adafruit.com/product/153)

### Part: Female DC Power adapter
quantity: 1
Female DC Power adapter - 2.1mm jack to screw terminal block
[Female DC Power adapter](https://www.adafruit.com/product/368)

### Part: 12VDC 1000mA Switching Power Adapter
quantity: 1
12V DC 1000mA (1A) regulated switching power adapter
[12VDC 1000mA Switching Power Adapter](https://www.adafruit.com/product/798)

### Part: PyPortal Stand
quantity: 1
Adafruit PyPortal Desktop Stand Enclosure Kit
[PyPortal Stand](https://www.adafruit.com/product/4146)

### Part: USB Cable
quantity: 1
Pink and Purple Braided USB A to Micro B Cable - 2 meter long
[USB Cable](https://www.adafruit.com/product/4148)

- [Next Page](https://learn.adafruit.com/pyportal-iot-plant-monitor-with-google-cloud-iot-core-and-circuitpython/pyportal-wiring.md)

## Featured Products

### Adafruit PyPortal - CircuitPython Powered Internet Display

[Adafruit PyPortal - CircuitPython Powered Internet Display](https://www.adafruit.com/product/4116)
 **PyPortal** , our easy-to-use IoT device that allows you to create all the things for the “Internet of Things” in minutes. Make custom touch screen interface GUIs, all open-source, and Python-powered using&nbsp;tinyJSON / APIs to get news, stock, weather, cat photos,...

In Stock
[Buy Now](https://www.adafruit.com/product/4116)
[Related Guides to the Product](https://learn.adafruit.com/products/4116/guides)
### Peristaltic Liquid Pump with Silicone Tubing - 12V DC Power

[Peristaltic Liquid Pump with Silicone Tubing - 12V DC Power](https://www.adafruit.com/product/1150)
Move fluid safely from here to there with this very nice little pump. Unlike most liquid pumps, [this is a peristaltic type - the pump squishes the silicone tubing that contains the liquid instead of impelling it directly](http://en.wikipedia.org/wiki/Peristaltic_pump). The upshot?...

In Stock
[Buy Now](https://www.adafruit.com/product/1150)
[Related Guides to the Product](https://learn.adafruit.com/products/1150/guides)
### Adafruit STEMMA Soil Sensor - I2C Capacitive Moisture Sensor

[Adafruit STEMMA Soil Sensor - I2C Capacitive Moisture Sensor](https://www.adafruit.com/product/4026)
Most low cost soil sensors are _resistive_ style, where there's two prongs and the sensor measures the conductivity between the two. These work OK at first, but eventually start to oxidize because of the exposed metal. Even if they're gold plated! The resistivity measurement...

In Stock
[Buy Now](https://www.adafruit.com/product/4026)
[Related Guides to the Product](https://learn.adafruit.com/products/4026/guides)
### AdaBox011 - PyPortal

[AdaBox011 - PyPortal](https://www.adafruit.com/product/4061)
Reach out beyond your desk - to the stars and beyond - with **PyPortal**! This ADABOX features a new, easy-to-use IoT device that allows you to customize and create your very own "Internet of Things" portal. We take CircuitPython to the max, pairing a SAMD51 chip with a...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/4061)
[Related Guides to the Product](https://learn.adafruit.com/products/4061/guides)
### Pink and Purple Braided USB A to Micro B Cable - 2 meter long

[Pink and Purple Braided USB A to Micro B Cable - 2 meter long](https://www.adafruit.com/product/4148)
This cable is&nbsp;super-fashionable&nbsp;with a woven pink and purple Blinka-like pattern!

First let's talk about the cover and over-molding. We got these in custom colors, and if you&nbsp;_have_&nbsp;to have visible cables, then you might as well have the nicest fabric-bound...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/4148)
[Related Guides to the Product](https://learn.adafruit.com/products/4148/guides)
### Adafruit PyPortal Desktop Stand Enclosure Kit

[Adafruit PyPortal Desktop Stand Enclosure Kit](https://www.adafruit.com/product/4146)
PyPortal is&nbsp;our easy-to-use IoT device that allows you to create all the things for the “Internet of Things” in minutes. Create little pocket universes of joy that connect to something good.

And now that you've made a cool internet-connected project...

In Stock
[Buy Now](https://www.adafruit.com/product/4146)
[Related Guides to the Product](https://learn.adafruit.com/products/4146/guides)
### STEMMA Cable - 4 Pin JST-PH 2mm Cable–Female/Female

[STEMMA Cable - 4 Pin JST-PH 2mm Cable–Female/Female](https://www.adafruit.com/product/3568)
This 4-wire cable is a little over 150mm / 6" long and fitted with JST-PH female 4-pin connectors on each end. These types of JST cables are commonly found on small rechargeable battery packs, RC receivers and transmitters, tiny cameras, and other small electronic devices

We're...

In Stock
[Buy Now](https://www.adafruit.com/product/3568)
[Related Guides to the Product](https://learn.adafruit.com/products/3568/guides)
### NPN Bipolar Transistors (PN2222) - 10 pack

[NPN Bipolar Transistors (PN2222) - 10 pack](https://www.adafruit.com/product/756)
Transistors are powerful little electronic switches, and we really like these NPN transistors whenever we need to control medium-power electronics such as small motors, solenoids, or IR LEDs. We find them so handy, they come in a pack of 10!

Each transistor is a general-purpose...

Out of Stock
[Buy Now](https://www.adafruit.com/product/756)
[Related Guides to the Product](https://learn.adafruit.com/products/756/guides)

## Related Guides

- [Adafruit STEMMA Soil Sensor - I2C Capacitive Moisture Sensor](https://learn.adafruit.com/adafruit-stemma-soil-sensor-i2c-capacitive-moisture-sensor.md)
- [Adafruit PyPortal - IoT for CircuitPython](https://learn.adafruit.com/adafruit-pyportal.md)
- [PyPortal Oblique Strategies](https://learn.adafruit.com/pyportal-oblique-strategies.md)
- [PyPortal Philips Hue Lighting Controller](https://learn.adafruit.com/pyportal-philips-hue-lighting-controller.md)
- [Twin Peaks Light Reactive Picture Frame](https://learn.adafruit.com/twin-peaks-light-reactive-pyportal-picture-frame.md)
- [PyPortal Twitter Follows Trophy](https://learn.adafruit.com/pyportal-twitter-follows-trophy.md)
- [Cleveland Museum of Art PyPortal Frame](https://learn.adafruit.com/cleveland-museum-of-art-pyportal-frame.md)
- [Adafruit IO Basics: Schedule Actions](https://learn.adafruit.com/adafruit-io-basics-scheduled-triggers.md)
- [PyPortal Quarantine Clock](https://learn.adafruit.com/pyportal-quarantine-clock.md)
- [PyPortal Discord Online Counter](https://learn.adafruit.com/pyportal-discord-online-count.md)
- [PyPortal Wake-Up Light Alarm Clock](https://learn.adafruit.com/pyportal-wake-up-light.md)
- [Portable PyPortal](https://learn.adafruit.com/portable-pyportal.md)
- [EZ Make Oven](https://learn.adafruit.com/ez-make-oven.md)
- [Welcome to CircuitPython!](https://learn.adafruit.com/welcome-to-circuitpython.md)
- [Program CircuitPython USB Devices with iPhone & iPad](https://learn.adafruit.com/use-circuitpython-devices-with-iphone-ipad.md)
- [PyPortal IoT Data Logger with Analog Devices ADT7410, Adafruit IO and CircuitPython](https://learn.adafruit.com/iot-pyportal-data-logger-adafruitio-circuitpython.md)
- [Karel The Robot In CircuitPython](https://learn.adafruit.com/karel-the-robot-in-circuitpython.md)
