This system was developed for a startup working on smart flower pots. It offers an all-in-one solution to monitor and manage various environmental parameters such as light, temperature, and soil moisture in real time. The focus is on creating an interactive and intelligent system for flower pots that can send notifications, control LEDs, adjust Water Pump states, provide visual feedback on an OLED screen, and much more, based on sensor readings and user preferences.
- Sensor Management: Handles readings from LDR, temperature, and soil moisture sensors.
- Bluetooth Communication: Sends commands and receives sensor data via BLE.
- Water Pump and LED Control: Dynamically controls Water Pump states and RGB LEDs.
- Visual Feedback: Displays happy/sad faces on an OLED screen based on conditions.
- Threaded Execution: Runs multiple concurrent threads for seamless operation.
- Exception Handling: Robust error handling for ease of debugging.
- Flexible API: Provides an API for interaction, including calibration and custom actions.
- MicroPython-compatible microcontroller
- Supported sensors (LDR, temperature, soil moisture)
- OLED display
- RGB LED, Water Pump motor
- BLE support
Below is the list of modules used in this project and their corresponding pin connections:
- Light Dependent Resistor (LDR): Pin 34
- Temperature Sensor (DHT22): Pin 18
- Soil Moisture Sensor: Pin 32
- OLED Display: Pin 22, Pin 21
- RGB LED: Pin 5, Pin 17, Pin 16
- Water Pump: Pin 4
- Connect the Modules: Connect all the modules to their corresponding pins as described in the Modules and Pins section. Ensure proper connections and consult the hardware documentation if needed.
- Place Sensors in Soil: Place the temperature and soil moisture sensors into the soil in the planter or pot.
- Upload the Code: Transfer the MicroPython code to your microcontroller.
- Run the Code: Execute the code on the microcontroller.
- BLE Mobile App: Use a mobile app to send functions over Bluetooth (as there are many applications on mobile app stores.)
- Water Pump Caution: Do not connect the water pump until the system is fully ready and calibrated to avoid any unexpected behavior.
- Enjoy Your Smart Flower Pot: Monitor and manage your smart flower pot through the app and watch as it takes care of your plants.
The system accepts various JSON commands to control and monitor the smart flower pots. Below is a detailed explanation of each command:
- JSON:
{"command":"c"}
- Description: This command is used to start the calibration mode for the sensors. Calibration ensures accurate readings and optimal functioning of the smart flower pot.
- JSON:
{"command":"r", "reqLight":"80", "reqMoist":"70"}
- Description: This command sets the required light and moisture levels to make the face on the OLED display happy. If these requirements are not met, the display will show a sad face.
reqLight
: The required light percentage.reqMoist
: The required soil moisture percentage.
- JSON Example for Light:
{"command":"v", "type":"light", "min":"50", "max":"60", "action":"notification", "param":"An example notification"}
- JSON Example for Moisture:
{"command":"v", "type":"moist", "min":"50", "max":"60", "action":"led", "param":"255,255,255"}
- Description: This command sets the software to perform specific actions (e.g., sending notifications or lighting an LED) based on the given sensor values (light, moisture, temperature).
- type: The type of value to monitor (e.g., "light", "moist").
- min: The minimum value of the range.
- max: The maximum value of the range.
- action: The task to perform when the value is within the specified range. It can be "notification" for sending a message or "led" for controlling the LED.
- param: Parameters related to the action. For LED, it's the color, and for notifications, it's the message content.
- Description: This command sets the software to perform specific actions (e.g., sending notifications or lighting an LED) based on the given sensor values (light, moisture, temperature).
- JSON:
{"command":"get", "type":"LDR/Moist/Temp/SoilTemp"}
- Description: This command retrieves the specified values (light, moisture, temperature) asynchronously.
- type: The type of value to get. Can be "LDR", "Moist", "Temp", "SoilTemp".
These commands enable you to interact with and control the smart flower pot system through the recommended mobile app via Bluetooth, providing you with a seamless and user-friendly experience.