A React Native Expo application for monitoring CO2 levels from ESP32 sensors via MQTT.
- Real-time CO2 monitoring from dual sensors
- MQTT connectivity to ESP32 devices
- Push notifications for high CO2 levels
- Historical data visualization
- Configurable thresholds and settings
- Dark/light theme support
- Install Node.js (v18 or later)
- Install Expo CLI:
npm install -g @expo/cli
- Install EAS CLI:
npm install -g eas-cli
-
Clone the repository
-
Install dependencies:
npm install
-
Start the development server:
npm run dev
Since this app uses native dependencies (MQTT, notifications), you need to create a development build:
-
Create an Expo account at https://expo.dev
-
Login to EAS CLI:
eas login
-
Configure your project:
eas build:configure
For Android:
eas build --platform android --profile development
For iOS:
eas build --platform ios --profile development
- Download the APK/IPA from the EAS build dashboard
- Install on your device
- Run the development server:
npm run dev
- Scan the QR code with your development build
For Android APK:
eas build --platform android --profile preview
For iOS TestFlight:
eas build --platform ios --profile preview
For Production:
eas build --platform all --profile production
The app connects to HiveMQ Cloud with these settings (configured in contexts/CO2Context.tsx
):
- Host:
495e05bee6cb40cd97eeb41fc597850e.s1.eu.hivemq.cloud
- Port:
8884
(WebSocket Secure) - Username:
esp32-device1
- Password:
Password@2025
- Topic:
sensors/esp32-co2-01/data
This app is designed to work with ESP32 devices running the provided CO2 monitoring firmware that publishes data in this JSON format:
{
"device": "esp32-co2-01",
"co2_1": 450,
"co2_2": 460,
"timestamp": 1640995200,
"wifi_rssi": -45,
"heap_free": 234567
}
- Builds in the cloud
- Supports both iOS and Android
- Automatic code signing
- Easy distribution
# Android
npx expo run:android
# iOS (macOS only)
npx expo run:ios
Use EAS Submit to distribute to app stores:
eas submit --platform android
eas submit --platform ios
-
MQTT Connection Failed
- Check internet connection
- Verify HiveMQ Cloud credentials
- Ensure ESP32 is publishing data
-
Notifications Not Working
- Grant notification permissions
- Check notification settings in app
- Verify device notification settings
-
Build Errors
- Clear cache:
npx expo install --fix
- Reset Metro:
npx expo start --clear
- Check EAS build logs
- Clear cache:
- Use
npx expo doctor
to check for common issues - Monitor logs with
npx expo logs
- Test on physical devices for best results
- Use EAS Build for production deployments
MIT License - see LICENSE file for details