Week Two

 Week Two


This Week's Overview:

We effectively combined the different blocks of code for each component to create a coherent code that works in unison. We also constructed our first circuit containing most of our components. The completed alarm system was not yet implemented at this point.



Flowchart

We created a flowchart to help visualize how the circuit operates and all its different functions.


This system takes the inputted sensor values (carbon monoxide (CO), carbon dioxide CO2 and the temperature and humidity sensors) and continuously checks whether the CO and CO2 values are breathable (9 - 10ppm and 400 - 1000 ppm respectively). If they are safe to breathe, the system displays the measured sensor values on the screen. However, if the CO or CO2 levels are dangerous to breathe, the system sounds the alarm, opens the "window", by approximately 5cm, using the simulated mechanism comprised of the motor driver and stepping motor, shuts off the fan for quicker gas exchange, and displays a warning message on the screen until both gas levels are breathable again.


 

Main Tasks:

1) We tackled the issues that arose from the previous week:


- We switched our micro controller from a Raspberry Pi Pico W to a pre-soldered Raspberry Pi Pico 2 W. This solved our soldering issue since making permanent connections at this stage was not required.


- Additionally, the display required a second voltage source (VSYS) to work as intended.



2) We used MicroPython to code our system


- MicroPython was our chosen coding language because it's easier to use than other languages and faster execution speeds were not required for our system. 


-Additionally, it grants us the chance to broaden our knowledge and to work with other languages apart from C/C++. We used Thonny as our IDE since it is user friendly.



3) All the separate bits of code for each component were combined into one coherent code to test that they work in unison:


a) Temperature and humidity sensor (DHT11): This sensor utilizes a python library called "dht" with built in functions that can read the values read from the sensor using the measure() function and return the value as temperature (in degrees Celsius) using the temperature() function or humidity (as a percentage) using the humidity() function.


b) CO and CO2 sensors: These two sensors needed to be calibrated to produce sensible results.


c) Stepping Motor: We used a full step sequence to rotate the mechanical shaft:

full_step_sequence = [

    [1, 0, 0, 0],  

    [0, 1, 0, 0], 

    [0, 0, 1, 0],  

    [0, 0, 0, 1],  

]


d) E-Paper Display: We used "EPD_2in7_V2" from the "epaper2in7" file to display our sensor values or warning message on the e-paper display.



4) The fan required a control system that could switch it on and off; therefore, we used a transistor as a switch.



5) We constructed the circuit with all the components that were tested:



The message displayed on the e-paper display reads:

ENVIRONMENT DATA
TEMP: 22.6C
HUM: 42.3%

CO Gas: 0.68V
Air Quality: 1.92V

Fan: ON

The CO and CO2 sensors were not calibrated, but we had their uncalibrated values displayed as a place holder.



Issues:

- Both the CO2 and CO sensors must be calibrated to produce sensible values.


- The stepping motor was moving at an insufficient pace, so the sequence must be changed to a half or quarter step or we could change the motor to a servo motor.



Next steps:

- Integrating the alarm (buzzer and LED light) into the system.


- Starting to work on the 3D printed linear gear to simulate the window's mechanism.


- Calibrating the CO and CO2 sensors.


- Producing a code that performs the following effectively:

1) Senses the temperature, humidity, CO and CO2 levels

2) Displays those values on a screen

3) Opens a "window" by using the simulated mechanism when harmful gas levels make the air unbreathable and closes them again when the air is safe to breathe again

4) Shuts off the fan to promote faster gas exchange

5) Sounds an alarm and displays a warning message when the CO and CO2 levels are harmful to breathe.



Comments

Popular posts from this blog

Week Three

Week One