Skip to content

My Plant 🪴 is an application that allows you to follow the development of a plant thanks to numerous sensors on the prototype.

Notifications You must be signed in to change notification settings

itsJakeChambers/MyPlant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🪴 My Plant

Application that allows to follow the evolution of a plant with many sensors on the prototype.

Prerequisites
Installation
Usage
Result
Resources

Important

Prerequisites

  • Python
  • Mosquitto
  • Arduino IDE
  • Tkinter
  • Matplotlib

Installation

Open arduino, then install the following libraries :

  • DHT sensor library (to run the DHT22 Time/Humidity sensor)
  • PubSubClient
  • Adafruit Unified Sensor
  • WiFiNINA
  • WiFi101

Now open a console (outside arduino) and install the MQTT protocol (Mosquitto) :

With Linux :

sudo apt install mosquitto mosquitto-clients

  • Mosquito is the MQTT broker
  • Mosquito-clients installs the Mosquito_sub client to subscribe to a topic and Mosquito_pub to publish a topic

The MQTT broker starts at startup, you do not have to do anything to receive and issue Topics from another terminal.

Warning

You must allow anonymous connections.
Edit the mosquitto.conf file : sudo nano /etc/mosquitto/mosquitto.conf
Then add these two lines :

àllow_anonymous true
listener 1883

Save the file, then restart the Mosquitto service: sudo service mosquitto restart : sudo service mosquitto restart

With Python :

For Python2: sudo pip install paho-mqtt or sudo apt install python3-paho-mqtt
For Python3: sudo pip3 install paho-mqtt or sudo apt install python3-paho-mqtt

The library documentation can be found at https://pypi.org/project/paho-mqtt/.

The Client class contains the methods to connect/disconnect to the broker, to publish a message on a topic, to subscribe/unsubscribe from a topic :

  • connect() and disconnect()
  • publish()
  • subscribe() and unsubscribe ()

To use the Client class you must include the library at the beginning of your program : import paho.mqtt.client as mqtt
Capture du 2024-03-10 00-22-17

The prototype :


Note

The different sensors :

  • a temperature sensor
  • a humidity sensor
  • a soil humidity sensor
  • a brightness sensor

Usage

Test the Mosquitto broker locally with the client on the Raspberry. Open a terminal and type the command : mosquitto_sub -h localhost -v -t "test/message so that the mosquitto client subscribes to the Topic /test/message. The terminal is waiting to receive a message on this topic

Open another terminal and type the command : mosquitto_pub -h localhost -t "test/message" -m "Coucou" to publish a message on this topic.

You should see the message "Coucou" displayed on the terminal subscribing to the Topic Capture du 2024-03-10 00-47-13

Result

Prototype and sensors connected to our plant :



Graphical display of our application with real-time data :

Resources

https://mosquitto.org/man/mosquitto_sub-1.html https://pypi.org/project/paho-mqtt/ https://pypi.org/project/paho-mqtt/#constructor-reinitialise https://docs.arduino.cc/libraries/pubsubclient/ https://wiki.seeedstudio.com/Grove-Moisture_Sensor/
https://wiki.seeedstudio.com/Grove-Temperature_and_Humidity_Sensor_Pro/

About

My Plant 🪴 is an application that allows you to follow the development of a plant thanks to numerous sensors on the prototype.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published