**PlantTemp** *Jonna Kytölä* *jk223yr* Growing plants in an apartment can be difficult due to wrong temperature and air quality. I decided to do this project to make it easier to maintain a good environment for plants at home. The device will work as if the temperature gets at 26C or higher, it will light up in a red coclor, to make it easy to find a god spot to grow your plants. **Material** - Lopy 4 – Lopy4 is an Micropython-programmable quadruple bearer board and that works with LoRa, Sigfox, Bluetooth and WiFi. And it is available to buy at pycom.io for about 363kr. - Pycom Expansion board 3.1 or 3.0 – The board is compatible with WiPy 3.0, LoPy4, SiPy, FiPy and GPy. Available at pycom.io for about 166kr. - Wiring – Used to connect sensors to your expansion board. Available at Electrokit.se for about 36kr. - DHT11 - Sensor for measuring temperature and humidity. Available at Kjell.se for 49.90kr. - USB cable A-tap – Micro B – To connect the device to the computer. Available at Electrokit.se for about 29kr. - Breadboard – To connect sensors to the device in a very simple way. Available at Electrokit.se for about 59kr. **Computer setup** To start the project, you need to follow a few steps to set up your computer and device. Steps 1. It is recommended that you update the firmware on your expansion board (It is not always necessary) you can follow this guide to do so: https://docs.pycom.io/pytrackpysense/installation/firmware/ 2. The next step, you will have to connect the lopy 4 to the expansion board. When connecting, make sure that the Pycom on the expansion board and the lopy4 is in the same direction and simply click the together. 3. After connecting your hardware, you need to update your device firmware, pycom has a easy tutorial for this as well: https://docs.pycom.io/gettingstarted/installation/firmwaretool/ 4. Next you will need a IDE, my choice was atom, but if you prefer you can also use Visual studio code. You can download atom at atom.io. 5. Ones you have Atom installed on your computer; you need to install pymakr plugin in Atom. Follow this guide to install: https://docs.pycom.io/pymakr/installation/atom/ **Putting everything together** Now it is time to setup your device with the sensor, now you will need the wiring, sensor, and the breadboard to connect with your device. ![](https://i.imgur.com/WZTF9Cj.png) Connect the DHT11 sensor to your breadboard, and wire. 1. Connect the ground to GND on your expansionboard. 2. Connect the Vcc to the 3V3. 3. Connect the signal to P23 (you can connect the signal to almost any pin on your expansion board, but if you want to copy the code from this tutorial use P23) **Platform** In this tutorial we will be using Pycom’s Pybytes, that is a cloud based, very easy to use and free website to manage your device. 1. To start, you will have to create an account to be able to create your project. 2. When you have created an account, the next step is to add a device to pybytes, and there is an easy tutorial on how to do so: https://docs.pycom.io/pybytes/connect/ 3. When you have added your device, the next step is to download the pycom firmware updater tool. You can download the updater from this link: https://pycom.io/downloads/ 4. After downloading, you need to connect your device to your home WiFi, you can follow this guide: https://docs.pycom.io/pybytes/connect/quick/. And your device should be successfully connected to your home WiFi. **The code** In Atom, create a project folder with any name you’d like and, in the project,, create a main.py file, and then you can copy and paste the following code to the main.py file. ``` import pycom import time from machine import Pin from dht import DHT pycom.heartbeat(False) red = 0xFF0000 green = 0x00FF00 pycom.rgbled(0xFF0000) th = DHT(Pin('P23', mode=Pin.OPEN_DRAIN), 0) time.sleep(2) while True: result = th.read() temp = result.temperature humidity = result.humidity #print('Temp:', temp) #print('RH:', humidity) pybytes.send_signal(3,humidity) if temp >= 26: pycom.rgbled(red) pybytes.send_signal(2,temp) else: pybytes.send_signal(1,temp) pycom.rgbled(green) time.sleep(5) ``` In this code, I have “told” the device, do always light a green color, unless the temperature rises to 26C or more, then it will light up in a red color to warn that the temperature is too high. I have also set the sensor to measure the temperature and the device to send a signal to pybytes every 5 second with both temperature and humidity. If the temperature rises to 26C or more, the device will also send a signal to pybytes letting us know that the temperature is too high. **Transmitting the data** In this project, I have only been using WiFi, and as I explaind before, the data are sent to pybytes every 5th second. **Presenting the data** In pybytes under signals, you will see that it updates every 5th second with the temperature and the humidity. If you click on any signal, you can create a chart of choice to visualize the data. ![](https://i.imgur.com/gdiz5Ce.png) This is the chart of the temperature, and you can see it changing. ![](https://i.imgur.com/D16Nh9V.png) The humidity signal is being updated every 5th second. **Finalizing the design** Pictures of the device with the right and the too high temperature ![](https://i.imgur.com/GWU5bzT.jpg) ![](https://i.imgur.com/2uWEucL.jpg) Unfortunately, I did not have enough time in the end to 3D print a case for the device but would like to do so otherwise. This is the first ever sensor that I have built, and I do like the purpose of it. To be able to see a chart of how the temperature and humidity changes, makes it easier to learn how to handle my plants.