I'm running Akihabara Hackerspace in Akihabara, Tokyo. Thanks to its automatic ventilation system, the hackerspace remains open and welcomes up to 5 fully vaccinated guests even under the COVID-19 pandemic.
ProblemJust limiting the number of guests is not enough to prevent COVID-19, so we have mandatory rules of wearing a face mask, practicing social distancing, washing hands, and disinfecting after use.
In addition to these rules, we believe that keeping the air clean is also one of the effective measures to prevent the disease. Researchers say that COVID-19 transmission risk can be reduced if the space is well ventilated [1].
How do you know if the space is well ventilated? One of the indicators is CO2. CDC recommends that indoor CO2 level is below 800ppm during pandemic conditions[2].
There are several ways to keep indoor CO2 levels low, for example, opening doors/windows regularly or keeping ventilation fans on. But they require human intervention and are not energy efficient.
SolutionThis is where the automatic ventilation system comes in. What it does is to monitor CO2 levels at different spots in the hackerspace, automatically turn on/off a powerful ventilation fan depending on the measured CO2 levels, and keep the air in the space clean therefore lowering COVID-19 risk.
CO2 monitors
CO2 levels are measured with CO2 monitors at the following 4 locations: the main area, the video studio, the hallway, and the restroom. Each CO2 monitor is made up of the M5Stack Core2 for AWS IoT EduKit reference hardware[3], an NDIR CO2 sensor, 2 orange mini mini breadboards, and a 3D printed enclosure.
CO2 monitors send measured CO2 levels in ppm to AWS IoT Core every 10 sec. The display color changes from green to red once the CO2 level exceeds the threshold, 600ppm.
Ventilation Fan
Since the fan inside the kitchen hood is powerful enough to pull in clean air from every little opening in the space, it alone can ventilate the whole space.
If CO2 levels are above 600ppm for more than 1 min at any of the measurement locations, AWS IoT Events triggers an action and AWS IoT Core publishes an MQTT message to turn on the fan. Once the elevated CO2 levels are back to normal, IoT Events triggers an action again to turn off the fan. This way the whole ventilation process has been fully automated.
Fan controller
So how do you control the fan inside the kitchen hood? What's the trick?
The answer is that another M5Stack Core2 for AWS IoT EduKit is inside the kitchen hood and connected to the fan! It looks almost the same as the CO2 monitors but has an SSR unit instead of a CO2 sensor.
The SSR is connected to the fan's mainboard via a connector and the EduKit is powered by an AC 100-240V to DC 5V power supply module that draws current from the AC power lines inside the kitchen hood. Happy hacking!
Dashboard
Measured CO2 levels can be viewed in real-time with the AWS IoT SiteWise dashboard. Just in case for later analysis, CO2 levels are also stored in DynamoDB.
Since the system's action threshold is set to 600ppm, CO2 levels at any of the 4 measurement spots rarely exceed 800ppm, which is CDC's recommended standard [1].
4 CO2 monitors
Avoid super cheap VOC gas sensors because they are not specific to CO2. I used a relatively inexpensive, specific-to-only-CO2 NDIR (Non-Dispersive Infrared) CO2 sensor, MH-Z19C [4]. This sensor requires 5V power and outputs sensor values via UART (3.3V compatible). Don't forget to perform zero-point calibration before use.
The M5Stack Core2 for AWS IoT EduKit comes with a UART port (PORT C: GND, 5V, Tx, Rx) [5], which makes this sensor a perfect choice. I think you can easily design a custom HAT for the sensor because the port is on the top of the EduKit. I used Fusion 360 to create a custom HAT 3d model and .stl file, which is included in this project for you to use.
To connect the EduKit and the sensor, you can use Grove universal 4-pin cables. Just cut one into a half and attach male crimp pins and black housings.
As far as the programming goes, I modified AWS IoT EduKit Examples - Basic Arduino [6] so that it sends an MQTT message like the following to AWS IoT Core every 10 sec.
{
"id": 1,
"co2": 531
}
Make sure you change the topic name and id in main.cpp (CO2 Monitors).
Fan controller
The kitchen hood usually comes with a powerful AC ventilation fan. If you can integrate this fan into a CO2 monitoring system, ventilating the space can be fully automated. So I hacked the fan with an SSR kit [7] and the EduKit so that it can be turned on/off with an MQTT message from AWS IoT Core. Yes, it's really fun to turn regular things into AWS IoT-enabled things!
Just remove the control panel cables and attach the fan controller to the fan's mainboard. Don't forget to supply 5V to the fan controller within the kitchen hood. I think this process really depends on the kitchen hood model you have. If you need help, please let me know.
As far as the programming goes, I modified AWS IoT EduKit Examples - Basic Arduino [6] for the fan controller so that it ditialWrites a GPIO HIGH/LOW depending on a received payload. Make sure you change the topic name in main.cpp (Fan Controller).
AWS IoT Core
Set up a total of 4 Rules for 4 CO2 monitors to send measured CO2 levels to
- AWS IoT Events
- AWS IoT SiteWise
- Amazon DynamoDB
Refer to the rule.json for the detail.
You can use the AWS CLI and the JSON file to recreate rules. Make sure you change the topic name, the input name, the property aliases, the asset name, and the table name, as needed.
AWS IoT Events
I used AWS IoT Events for the following three reasons.
- Sensors in nature give you transient, abnormally high, false values.
- The fan should not be turned on/off so frequently.
- The system needs to know the states of individual CO2 monitors.
Set up a detector model that has the NORMAL and the VENT states and sends turn-on/turn-off signals to the ventilation fan.
If any of the 4 CO2 monitors continues to output CO2 levels above the threshold (600ppm) for more than 1 min, a detector should shift from NORMAL to VENT and send a turn-on-the-fan message like
{
"vent": 1,
"id": 1
}
Once CO2 levels are below the threshold, the detector should shift from VENT to NORMAL and send a turn-off-the-fan message like
{
"vent": 0,
"id": 1
}
When you set up a detector model, you can either create a detector for each unique key value or a single detector. I chose the former option because there are 4 CO2 monitors and I need to tell which CO2 monitor is at which state. Make sure each CO2 monitor publishes a message with its unique identifier (1, 2, 3, and 4).
When writing a code for the fan controller, don't forget that there are 4 detectors. Otherwise, the system fails when one CO2 monitor shifts from VENT to NORMAL while another is still in the VENT state. Make sure the fan remains on if one of the detectors is in the VENT state.
By the way, when you cook and need to turn on the fan, send {"vent": 1, "id": 0} from AWS IoT Core. To turn it off, send {"vent": 0 "id": 0}.
Refer to input.json and detector-model.json for the detail.
You can use the AWS CLI and the JSON file to recreate the detector model.
AWS IoT SiteWise
It's becoming easier than ever before to collect and store IoT sensor data, but when it comes to data visualization, it still requires some effort. So for this project, I tried to use AWS IoT SiteWise for the first time and I was totally fascinated by how easy it was to visualize sensor data. But keep in mind that it costs $10 per dashboard user per month, which I believe is worth the cost.
I set up a model for the space, which has 4 measurement definitions, namely, Main Area CO2, Video Studio CO2, Hallway CO2, and Restroom CO2. The model contains just 1 asset, which is the hackerspace.
Refer to model.json and asset.json for the detail.
You can use the AWS CLI and JSON files to recreate the model and asset.
ConclusionI guess I was able to turn Akihabara Hackerspace into one of the "Smart Spaces" with reduced COVID-19 risk by combining the M5Stack AWS IoT EduKit reference hardware, basic publish/subscribe actions, and a couple of IoT-related fun AWS services!
I've included everything necessary to recreate the project for you, and I hope this solution helps not only individuals searching for an automatic ventilation system but also people organizing offline events.
Finally, if you have a chance to visit Tokyo, we're waiting for you!!!
[2] Indoor CO2 Sensors for COVID-19 Risk Mitigation: Current Guidance and Limitations
[3] AWS IoT EduKit
[5] M5Stack AWS EduKit Bottom Part Schematic
[6] AWS IoT EduKit Examples - Basic Arduino
[7] K-00203 SSR Kit
Comments