EDPM Lite to uniwersalny, lekki framework do monitorowania i kontroli procesów w systemach embedded. Oferuje prostą komunikację przez ZeroMQ/WebSocket, kompletny Web UI dashboard i wsparcie dla protokołów przemysłowych.
# Clone repository
git clone <repository-url>
cd edpm
# Start EDPM server with Web Dashboard
python3 edpm-lite-server.py
# Open dashboard in browser
open http://localhost:8080
# Start full environment with all protocols
make extended-up
# Access web dashboard
open http://localhost:8080
# Run protocol tests
make test-all-protocols
from edpm_lite import EDPMLite
client = EDPMLite()
client.log('info', 'Hello EDPM!')
client.gpio_set(17, 1)
temperature = client.send({'action': 'read_sensor', 'type': 'bme280'})
| Panel | Funkcje |
|---|---|
| 🔌 GPIO Control | Pin status, toggle buttons, PWM control, live charts |
| 🌡️ I2C Sensors | BME280 temp/humidity/pressure, ADS1115 ADC, bus scanning |
| 🔊 I2S Audio | Test tones, recording, playback, FFT analysis, level meters |
| ⚡ RS485/Modbus | VFD control, power monitoring, industrial device communication |
| 📊 System Stats | CPU/RAM usage, message rates, uptime, connection status |
| 📝 Live Logs | Real-time colored logging with filtering and search |
edpm-lite-server.py)
web/dashboard.html)
protocols/)
i2c_handler.py - I2C sensors (BME280, ADS1115, PCF8574)i2s_handler.py - Audio generation, recording, FFT analysisrs485_handler.py - Modbus RTU industrial protocolsedpm_lite.py)
Simple JSON message format:
{
"v": 1, // Protocol version
"t": "log", // Type: log/cmd/evt/res
"id": "123", // Message ID
"src": "app1", // Source identifier
"ts": 1234567890.1, // Timestamp
"d": {} // Data payload
}
# Read BME280 environmental sensor
from protocols.i2c_handler import I2CHandler
i2c = I2CHandler(simulator=True)
data = i2c.read_bme280()
print(f"Temperature: {data['temperature']}°C")
print(f"Humidity: {data['humidity']}%")
print(f"Pressure: {data['pressure']} hPa")
# Scan I2C bus for devices
devices = i2c.scan_bus()
print(f"Found devices: {[hex(addr) for addr in devices]}")
# Generate and play test tone
from protocols.i2s_handler import I2SHandler
i2s = I2SHandler(simulator=True)
# Generate 440Hz tone
audio_data = i2s.generate_test_tone(440, duration=1.0)
i2s.play_audio(audio_data)
# Record and analyze audio
recording = i2s.record_audio(duration=2.0)
fft_data = i2s.analyze_audio_fft(recording)
# Control Variable Frequency Drive
from protocols.rs485_handler import RS485Handler
rs485 = RS485Handler('/dev/ttyUSB0', simulator=True)
# Read holding registers from device
data = await rs485.read_holding_registers(slave_id=1, address=0, count=2)
# Write VFD speed control
await rs485.write_holding_register(slave_id=3, address=0, value=8000) # 80% speed
# Basic EDPM server
docker-compose up
# Access web interface
open http://localhost:8080
# Full environment with I2C/I2S/RS485 simulation
docker-compose -f docker-compose-extended.yml up
# Access enhanced dashboard with all protocols
open http://localhost:8080
# Protocol simulator interface
open http://localhost:8083
# Build and start extended environment
make extended-up
# Test individual protocols
make test-i2c
make test-i2s
make test-rs485
# Test all protocols together
make test-all-protocols
# Stop and cleanup
make extended-down
# Run comprehensive test suite
python -m pytest tests/ -v
# Test specific protocols
python -m pytest tests/test_i2c.py -v
python -m pytest tests/test_i2s.py -v
python -m pytest tests/test_rs485.py -v
# Integration tests with Docker
make test-integration
# Message throughput test
python test_server_connection.py --messages 10000
# Protocol latency test
make benchmark-protocols
# System resource usage
make monitor-resources
# Server configuration
EDPM_ENDPOINT="ipc:///tmp/edpm.ipc" # ZeroMQ endpoint
EDPM_PORT=8080 # Web server port
EDPM_DB="/dev/shm/edpm.db" # SQLite database path
EDPM_DEBUG=true # Enable debug logging
# GPIO simulation
GPIO_MODE=SIMULATOR # Use GPIO simulator
SIMULATE_SENSORS=true # Enable sensor simulation
# Protocol simulation
I2C_SIMULATOR=true # Enable I2C simulation
I2S_SIMULATOR=true # Enable I2S simulation
RS485_SIMULATOR=true # Enable RS485 simulation
# For real hardware (Raspberry Pi)
GPIO_MODE=BCM # Use BCM GPIO
I2C_BUS=1 # Real I2C bus
I2S_DEVICE="hw:1,0" # Real I2S device
RS485_PORT="/dev/ttyUSB0" # Real RS485 adapter
# Complete industrial control scenario
async def industrial_automation():
# Read temperature from I2C sensor
temp_data = i2c.read_bme280()
temperature = temp_data['temperature']
# Control VFD based on temperature
if temperature > 30:
# Increase fan speed to 80%
await rs485.write_holding_register(3, 0, 8000)
# Sound alarm via I2S
alarm_tone = i2s.generate_test_tone(1000, 2.0)
await i2s.play_audio(alarm_tone)
# Activate warning LED
edpm.gpio_set(17, 1)
# Log critical event
edpm.log('warning', f'High temperature: {temperature}°C')
# Monitor power consumption
power_data = await rs485.read_holding_registers(2, 2, 1)
# Update status display via GPIO expander
status_byte = calculate_status(temperature, power_data)
i2c.write_byte(0x20, status_byte)
# IoT sensor data collection
def environmental_monitoring():
while True:
# Read all environmental sensors
bme_data = i2c.read_bme280()
adc_data = i2c.read_ads1115_all_channels()
# Collect data
sensor_data = {
'timestamp': time.time(),
'temperature': bme_data['temperature'],
'humidity': bme_data['humidity'],
'pressure': bme_data['pressure'],
'light_level': adc_data[0],
'soil_moisture': adc_data[1],
'battery_voltage': adc_data[2]
}
# Send to cloud via EDPM
edpm.event('sensor_reading', **sensor_data)
time.sleep(60) # Read every minute
git checkout -b feature/amazing-featuregit commit -m 'Add amazing feature'git push origin feature/amazing-featureThis project is licensed under the MIT License - see the LICENSE file for details.
Made with ❤️ for the embedded and IoT community