A Python-based sensor node service that reads GPIO sensor data and transmits it to RabbitMQ. This service is designed for continuous monitoring and data collection from hardware sensors.
- GPIO sensor data collection
- RabbitMQ integration for data transmission
- Configurable node settings
- Comprehensive logging system with rotation
- Sensor data logs
- Operations logs
Before running this service, ensure you have:
- Python 3.8 or higher
- Poetry (Python package manager)
- RabbitMQ server
- Access to GPIO pins (if running on hardware)
- Install dependencies using Poetry:
poetry install
Edit node/settings.py
to configure:
- Node identification (
node_id
) - Geographic location (
latitude
,longitude
) - RabbitMQ connection settings:
- Host
- Port
- Queue name
- Credentials
Default configuration:
{
"node_id": "belandur_01",
"rabbitmq_host": "localhost",
"rabbitmq_port": 5672,
"rabbitmq_queue": "node_data"
}
Start the service using Poetry:
poetry run start
The service will:
- Initialize logging systems
- Begin reading GPIO sensor data
- Transmit data to RabbitMQ
- Repeat at 1-second intervals
node/
├── node/
│ ├── read/ # GPIO sensor reading functionality
│ ├── transmit/ # RabbitMQ transmission logic
│ ├── logger/ # Logging configuration
│ ├── settings.py # Configuration settings
│ └── app.py # Main application logic
└── tests/ # Test suite
Logs are stored in:
logs/sensor/
- Sensor data logs (rotated daily)logs/operations/
- Operational logs (size-based rotation)
Run tests using:
poetry run pytest