---
# System prepended metadata

title: '**Lemon Tree- room temperature**'

---

***Title:*** 
# **Lemon Tree- room temperature**


***Name:***
Emma Persson

***Student credentials:***
ep222wq

***Short project overview*:**
My project is that I will measure the temperature of the room where my baby lemon tree is placed. I will measure during mid day and send it to Pybytes, so I can store it and show it in a diagram.

***How much time it might take to do (approximation):***
I think the project will take up to half an hour to complete for a person with some experience, and up to 2 hours for a beginner. 


---


# ***Objective***
***Why you chose the project:***
I chose to do this project because I love growing plants from seeds. I have now grown a little baby lemon tree. I've grown lemon trees before, but I've had the problem of them dying in the summer. After a conversation with a gardener, she suggested that I maybe have it placed so that it does not get enough sun and heat during summertime. I've now changed the location of the lemon tree to a sunnier place and in a window. 

***What purpose does it serve:***
With this project I want to investigate and see if the room I now placed my lemon tree in is optimal for its continued growth. An optimal temperature for a lemon tree is at least 21 degrees Celsius (daytime) during the summer months, according to the gardener. 

***What insights you think it will give:***
My hope is that I will come to insights what temperature the room has that i´ve placed my lemon tree in, and that I hopefully have find the perfect spot in my home for my lemon tree´s future growth.



---


# ***Material***
***List of material:***
¤MCP9700 TO-92 Temperature Sensor
¤PyCom- LoPy4 with headers 
¤PyCom- Expansion board
¤PyCom- Antennae
¤Wire
¤Breadboard- 400 connections
¤USB-cable A-hane- micro B 5p hane 1,8m 

***What the different things (sensors, wires, controllers) do - short specifications:***

## ¤MCP9700 TO-92 Temperature Sensor: 
Is analog temperature sensor that converts temperature to analog voltage.

![](https://i.imgur.com/5Nt0vad.png)



## ¤PyCom- LoPy4 with headers: 
Is a small IOT device that can take data from sensors and send it further with WiFi/Lora/Sigfox.
![](https://i.imgur.com/q4oT0tY.png)


## ¤PyCom- Expansion board: 
Is a extension to the Lopy4 device, so that you can connect sensors and power the device. 
![](https://i.imgur.com/db0nHW3.png)


## ¤PyCom- Antennae: 
The antennae send information from the device with the help of WiFi/Lora/Sigfox.
![](https://i.imgur.com/NGHfoYW.png)

## ¤Wire:
Transfer electricity. 
![](https://i.imgur.com/XKo8DIE.jpg)

## ¤Breadboard- 400 connections: 
The breadboard connect sensors to the wires. 
![](https://i.imgur.com/sYt8qUo.jpg)

## ¤Micro USB cable: 
Is for connecting the Lopy4 to the computer. Its connects the device to the computer by the USB port. 
![](https://i.imgur.com/hPtIcAV.jpg)


***Where you bought them and how much they cost:***
All my material I've used in my project is purchased from electro:kit. I bought the kit; LNU- IDT305 Tillämpad IOT- LoPy4 and sensors and bundle. For the whole kit I paid 819 kr before taxes. Since i bought a kit, I can´t specify the price for each separate material. 


---


# ***Computer setup***
***Chosen IDE:***
I choose to work with Atom. I used the Pycom website to download the Pycom firmware updater. With this I flashed the bios and updated to the latest version. Then I installed Pymakr on Atom. With the Pymakr plugin I connected the Lopy4 device to the Pybytes website. 
On Pybates website I had to register my WiFi(use the 2.4GHz). Then I defined a signal, which I used in my code later. 

***How the code is uploaded:***
I used Atom to write the code, and I also used Atom to upload the code to the Pycom device. 

***Steps that you needed to do for your computer. Installation of Node.js, extra drivers, etc.:***
To make the Pymakr plugin work I installed Node.js on my computer. 

---


# **Putting everything together**
***Circuit diagram:***

![](https://i.imgur.com/fHyd8Yb.png)


---

![](https://i.imgur.com/5o28o3j.png)


---

![](https://i.imgur.com/P3GWHVG.png)


![](https://i.imgur.com/O1V9LR6.png)


---
![](https://i.imgur.com/Yk4vuxS.png)

---

![](https://i.imgur.com/9vxz81n.png)


---
![](https://i.imgur.com/Gj9zt6x.png)


---

# ***Platform***
***Describe platform in terms of functionality:***
I decided to use the Pybytes platform. It´s free to use and is easy to understand the user interface. I only used one platform, to make it as simple as possibly since I´m a beginner. 

---


# ***The code***
1-2. importing library, so that Atom understand the codes. 

4-5. Tell Lopy4 to read the information from the P16 pin.

7-9. While there is a signal from the P16 pin, the Lopy4 should read the voltage and then convert the voltage to degrees Celsius. 

13-14. Print the temperature in the consol, and send it to the Pybytes website on signal 4. 

17. This process should repeat every 5 minutes. 

*My code:*
![](https://i.imgur.com/8t3Qr6K.png)

---


# ***Transmitting the data/connectivity***

***How often is the data sent?***
Every 5 minutes. 

***Which wireless protocols did you use (WiFi, LoRa, etc …)?***
WiFi. 

***Which transport protocols were used (MQTT, webhook, etc …)***
MQTT.

---

# ***Presenting the data***


***Provide visual examples on how the dashboard looks. Pictures needed:***
The data is shown in a linear diagram, that shows temperature and time of the day. 
![](https://i.imgur.com/lHL3PMu.png)


***How often is data saved in the database:***
The data is saved for 30 days on Pybytes website and the device sends a new temperature reading every 5 minutes. 




---

# ***Finalizing the design***
***Give your final thoughts on how you think the project went:*** 
I think the project went well and I´m happy with the result I got. As we can see in the diagram below the temperature during this day was between 23.9-26 degrees. Witch is a good temperature according to the gardener I spoke with. That gives me the result that the room my lemon tree now stands in is optimal for its continued growth.

![](https://i.imgur.com/oybq1A4.png)

***What could have been done in an other way, or even better?:*** 
I don't really know what I could do differently, I'm a beginner in this area and still think everything is very tricky and difficult, so I'm happy with my work. With more knowledge I could also connect a moisture sensor so that I can see when I need to water the plant.


---

## **My lemon tree**
![](https://i.imgur.com/bY2gNaJ.jpg)
## **My device**
![](https://i.imgur.com/fJtoG16.jpg)


