
BreatheIQ: Warning Train Passengers When Coach Air Turns Bad, Built on AWS
How Team Purity built a per-coach air quality node on an Arduino Mega and AWS. It tracks pollution, warns the most exposed passengers, and runs a playbook when the AQI goes past 500
Around 2 crore passengers ride Indian Railways every day, many of them in packed, weakly ventilated coaches. Doors open into diesel exhaust at crowded platforms, routes cross stubble-burning belts and tunnels, and CO₂ and heat build up within minutes. Nobody on board is measuring any of it, and bad-air days have no playbook.
For the Environmental Hacks Air track, our team (Team Purity) built BreatheIQ, which puts a sensor node in every coach and answers the track’s three themes with three verbs: track the pollution, warn the most exposed, and change what happens on the worst days.
How it works
The node. An Arduino Mega 2560 reads a DHT11, an MQ-2, an MQ-135 and a PMS7003 dust sensor every two seconds. It shows the verdict on a 16×2 LCD and switches an exhaust fan and two ozone generators through a relay board.
The model. Four small Random Forest classifiers, one per sensor, each decide one relay command. They were trained on 200 labelled rows with an 80/20 split and score 95–100% on the held-out data. On AWS, a Lambda function serves them as exported decision trees at about 15 ms per frame. We checked that it matches scikit-learn on all 4,704 test inputs.
The interlock. Ozone purifies air but harms people, so the model only suggests. A safety interlock lets ozone run only when the cabin is unoccupied and the estimated ozone is under the US EPA’s 0.07 ppm limit. Otherwise the fan runs instead, and every decision is logged.
Warning the people most at risk
The same air is not equally risky for everyone. BreatheIQ calculates a separate inhaled dose for children, the elderly, people with asthma or COPD, pregnant passengers and rail staff. It compares each dose against the WHO and India NAAQS PM2.5 limits. Each group sees how much of its daily budget is used, how many minutes are left, and one plain sentence of advice, such as moving children to the cleanest coach.
When the AQI goes off the chart
India’s AQI scale stops at 500, and most systems clamp there, so every terrible day looks the same. We never cap it. In our bad-day run on AWS, the cabin AQI peaked at 729.
Crossing 500 raises an
AqiOffTheChart event on Amazon EventBridge, which starts an AWS Step Functions playbook:- Boost ventilation, with the interlock checked
- Write an announcement in English and Hindi
- Read it aloud with Amazon Polly
- Alert staff through Amazon SNS
- Point sensitive passengers to the cleanest coach
- Save an incident report to Amazon S3
The AWS stack
- Ingest: AWS IoT Core (MQTT with X.509 certificates), with an IoT Rule feeding Lambda
- Decide: Lambda for the model and AQI, DynamoDB for telemetry, incidents and the interlock log
- Respond: Step Functions, Polly, SNS, S3
- Track: Amazon Location geofences around stubble-burning belts, a tunnel, an industrial stretch and a freight yard, so ventilation boosts before the air turns
- Serve: AWS Amplify for the dashboard, API Gateway and Cognito for the signed API, CloudWatch and Budgets for alarms and cost
- GenAI: Amazon Bedrock is defined in our CDK app for bilingual announcements, advice and reports, plus an “Ask BreatheIQ” agent with a Knowledge Base and Guardrails
The whole stack is defined in AWS CDK, so one command deploys it and one tears it down.
What we learned
- Letting the model suggest and a rule-based interlock decide made the system much easier to trust.
- Exposure, not just AQI, is the number that matters, because the same air carries very different risk for different people.
- Event-driven AWS services made the bad-day playbook easy to build, with every step visible in Step Functions.
What’s next
- Send PM2.5 and PM10 from the firmware, not just PM1.0
- Add occupancy sensing, so the interlock runs on a measured signal
- Let the ESP8266 publish straight to IoT Core with its own certificate
- Put one node in every coach, with a fleet-wide view
Try it: the live dashboard is at main.d3abjrsxzx174i.amplifyapp.com and the demo video is at youtu.be/rmrwR7-hI4U.
Built by Team Purity: Harsh Yadav (Leader), Samriddhi Ganguly, Avishkar Jaiswal and Prayag Sharma.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article