##### PROJECT
# Micro-Electronics
> [!abstract] Programming Language(s): C++
In my spare time, I love building small electronics projects on ESP32 microcontrollers, with C++ and the Arduino/ESP-IDF frameworks. I tend to integrate most projects into my Home Assistant smart home server via ESPHome, and in the future I hope to keep my YAML files hosted on a public repository. Below are some of the more useful/interesting projects I've made.
### Volatile Organic Compounds Sensor
| **Component** | **Description** |
| ------------------- | ------------------------------------------- |
| MQ-135 | Sensor: Gas (VOC) |
| BME280 | Sensor: Temperature, Humidity, and Pressure |
| ESP32-C3 Super Mini | Microcontroller |
The MQ-135 Gas sensor can detect gases like Ammonia ($NH_3$), sulfur ($S$), Benzene ($C_6H_6$), $CO_2$, and other harmful gases and smoke. However, the sensor is analog and therefore the readings must first be converted into something useful.
The most challenging part of building this was the calibration and translation of the ADC (Analog-to-Digital Conversion) values to a useful metric like PPM. The library I was using to convert these values was written for 10-bit ADC pins ($x \in [0,1023]$), whereas the boards I use are 12-bit ($x \in [0, 4095]$), and therefore I had to refactor the library to replace all the ADC values. The values were then corrected using the temperature and humidity values from the BME280 sensor.