CO Detector Hack – Part 9

CO Detector Hack – Part 9

This will be the last post on the subject of interfacing the First Alert CO Detector with a wireless ESP8266 module. The limits of the ESP8266 and lower costs of the higher functioning ESP32 module prove that this effort is not worth continuing. I will say that the overall simplicity of this project should provide a firm footing for future projects. The process from start to finish can be applied to any number of electronic devices. So with that said, lets move on.

I’ll continue in this post with the Arduino code used to program the ESP8266. The code base will be based off of Rui and Sara’s work. It will be a combination of two projects, https://randomnerdtutorials.com/esp8266-web-server/ and http://randomnerdtutorials.com/door-status-monitor-using-the-esp8266/. The first project provides a way to test the CO Detector. The next project provides a way for the CO Detector to send an alarm.

Arduino Code

Most of each code set had similar settings. Merging these code sets together required finding the differences in each. It was easier to merge the smaller code set with the larger one. Once the merge was complete, testing the code required a test circuit on a breadboard.

This circuit will work fine with the ESP8266, but I’ll need something different when I connect with the CO Detector. The first part of the circuit will test that the ESP8266 can toggle the alarm test button. It does this by turning a LED on or off to indicate that it works. The next part takes input from a switch. This mimics the alarm that would be activated during an event. When the switch is active, this is detected by the ESP8266.

With the code verified, the next step was to fine tune it. Initially, there were changes made since each of the code sets needed to use unique GPIO pins on the ESP8266. This required that non used pins be removed from the base code. Once that was done, each code set had to use unique GPIO pins.

The alarm test code was for the most part ready. However, the alert code did need some work. In its default state, any change to the trigger resulted in a notification. This was undesireable because it generated too many notifications. The alert state was defined in a way so notifications are only set when the alarm condition begins and not when it ends.

Testing the final code yeilds the expected results. There are some interesting limitations with the hardware though. If either of the GPIO pins are left at a grounded state, the ESP8266 appears to lock up during power up. I suspect that the GPIO pin is behaving like an interupt. This will need to be considered with the circuit used to interface the ESP8266 with the CO Detector.

Comments are closed.