-
Notifications
You must be signed in to change notification settings - Fork 1
Data Collecting Device
Yasantha Niroshan edited this page Oct 2, 2024
·
7 revisions
This embedded device is part of the IntelliBee (Smart Hive Monitoring System for Meliponiculture). It is responsible for collecting environmental data (temperature, humidity, and sound) from the bee hive, which will be used for developing machine learning models to detect bee swarming and diseases.

- Environment Sensing - Collect temperature and humidity data.
- Sound Monitoring - Records sound activity in the hive using a microphone sensor.
- Data Logging - Data and Logs are stored in SD Card
- WiFi Connectivity - The device connects to a WiFi network to synchronize time via NTP.
- Power Efficiency - Uses deep sleep mode to save power between data collection intervals.
- Error Handling - A state machine controls the device's operation with retries and error logging.
- ESP32 - Main microcontroller.
- AHTX0 Sensors - Two temperature and humidity sensors.
- MicroSD Card Module: To log data.
- MAX9814 Microphone - Captures sound data for analysis of bee activity
| Component | Pin/Connection | Description |
|---|---|---|
| AHT10 Inside | SDA = GPIO26, SCL = GPIO27 | AHT10 Sensor inside the hive |
| AHT10 Outside | SDA = GPIO32, SCL = GPIO33 | AHT10 Sensor outside the hive |
| SPI for SD Card | SD_SCLK = GPIO18, SD_MISO = GPIO19, SD_MOSI = GPIO23, SD_CS = GPIO5 | SD card module for logging data |
| LED_PIN | GPIO2 | LED indicator |
| MIC_PIN_OUT | GPIO34 | Microphone input |

- PlatformIO: For development and deployment.
- Libraries:

- Connects to a predefined WiFi network using credentials.
- Retries connecting to WiFi up to a maximum number of times.
- If unsuccessful, the device goes into sleep mode and restarts later.
- Uses an NTP server to synchronize time.
- The time is used for timestamping data logs.
- Initializes two AHTX0 sensors on separate I2C buses.
- Logs a warning if the sensors cannot be initialized.
- Configures the SD card module using SPI.
- Creates a new file in the
/datadirectory with a timestamped filename for logging.
- Logs Tempurature and Humidity Data
- Logs 30 seconds sound data sampled at 1khz
- Logs are written to the SD card in a text file.
- After completing its tasks, the device enters deep sleep mode for a set interval to conserve power.
The device uses a state machine to transition between various stages
- WiFi Initialization
- Time Synchronization
- Sensor Initialization
- SPI Initialization
- SD Card Mounting
- Data Logging: Logs sensor data to the file.
- Sleep Mode: The device enters deep sleep to conserve power.
If any step fails, the device retries before proceeding or going force restart

-
WiFi Credentials: Modify the
ssidandpasswordin theconfigurations.hfile to match your network. -
NTP Server: You can change the NTP server URL in
configurations.h. -
Directory Path: The directory where files are saved is defined in
DIR_PATHinconfigurations.h.
