Project Development Blog Entry

hi everyone!!! In this page, I will be documenting my team's project development.

1. Our team's Chemical Device


The objective of our team's chemical device is to stop the accumulation of carbon monoxide (CO) in houses, and help vent out the toxic gas before it reaches a lethal level.

In rural areas of Vietnam, people still make use of traditional fireplaces, and if they burn charcoal or wood in an area without proper ventilation, it can lead to the accumulation of carbon monoxide, which is deadly if it reaches too high of a concentration.

My team's chemical device is a CO detecting system that is linked to a ventilation system. When the CO detector detects carbon monoxide in a high concentration, it will produce a signal that turns a red LED on, which also turns on a fan to vent out the air, as well as turning a gear that opens a window to let even more air out, thus stopping the accumulation of the carbon monoxide gas. The signal will also produce a loud buzzer noise to alert the user that the system is activated.

By using this device, our target user, being those in rural Vietnam, would be able to make use of fireplaces in their homes to keep warm, while also staying safe from the dangers of carbon monoxide poisoning.

Here is the finalised sketch of our chemical device:




2. Team Planning,  Allocation,  and Execution


Here are my team members and their roles:

Jeevan: CSO (Chief Safety Officer)

Yan Zhen: CFO (Chief Financial Officer)

Van Anh: CEO (Chief Executive Officer)

Jeremy: COO (Chief Operating Officer)


Finalised BOM:


GANTT Chart (Planned)


Finalised GANTT Chart (actual)


3. Design and Build Process


Part 1: Design and Build of Rack and Pinion, Door and Stopper, and Cylinder for fan (done by Jeevan)

Here's the link to Jeevan's blog:

https://axrega.wixsite.com/cp5070-2022-2b02-gro/post/blog-6-project-development


Part 2: Design and Build of Room, stands for DC motor and servo (done by Yan Zhen).

Here's the link to Yan Zhen's blog:

https://yanzhen21.wixsite.com/cp5070-2022-2b02-gro/post/blog-6-project-development


Part 3: Programming of DC motor, 360 degree servo, LED and Buzzer (done by me). 


Objective of Arduino Programming

Before starting on the programming for the chemical device, I first had to be clear on the code's objective, to better visualise how the code would function as well as how it would look like.

If the CO detector senses CO gas:

  • Green LED will turn off
  • Red LED will turn on
  • Buzzer will turn on for 3 seconds
  • Fan Motor will turn on
  • Gear Motor will turn to open window


If the CO detector does not sense CO gas:

  • Green LED will turn on
  • Red LED will turn off
  • Fan Motor will turn off
  • Gear Motor will turn to close window

The Code

Before starting on the first program properly, I first allocated the various components of our chemical product to different pins on the Arduino board.

// Pin 0 - Gas Sensor

// Pin 3 - Fan Motor

// Pin 5 - Gear Motor

// Pin 8 - Buzzer

// Pin 10 - Green LED

// Pin 12 - Red LED


After this, I defined the pin allocated to the gas sensor, as well as setting the serial port to be activated, and I then displayed the value measured by the pin on the Serial Monitor.

#define MQ2pin 0

void setup() {

Serial.begin(9600);
Serial.println("MQ2 warming up!");
delay(1000);

}

The delay at the end is to allow the CO detector to warm up for a bit before it actually starts transmitting signal, as the CO detector needs time to warm up if not in use for very long, but as our system is not actually detecting gas, the delay is set to a lower time, being 1000 milliseconds, or 1 second. During this delay, the serial monitor would display a short text indicating that the sensor is warming up.

Next, I set a variable that would change based on the amount of CO detected.

float sensorValue;

And under void loop(), I then read the signal at pin 0, which is connected to the CO detector, which is then set to the sensorValue variable, and subsequently is displayed on the Serial Monitor.

 sensorValue = analogRead(MQ2pin);
Serial.print("Sensor Value: ");
Serial.print(sensorValue);

I then set a Threshold for the system, which would be a number that would represent the concentration of CO detected. 

#define Threshold 1000 // Gas Sensor

Different functions would occur, depending on whether the concentration of CO was reached or not, and so I then added in an if / else argument, which would decide what functions would occur if the CO Threshold was crossed or not.

if(sensorValue > Threshold)

{

} else {

    }

I will be elaborating more on the various lines of code within these arguments later, but after the argument, I then set an extra delay, which would represent the time in between readings for the CO detector being taken.

Serial.println("");

delay(1000);

In this case, as the delay is set to 1000, the CO detector would produce a reading once every second.

After I had set up the main outline of the code, I then moved on to start work on the various components of our product. To start, I set up the pinMode function for the different pins that I allocated earlier, to configure the specific pins to behave as output signals to control the components. 

under void setup() {

pinMode(fanmotorPin, OUTPUT); // Fan Motor
pinMode(gearmotorPin, OUTPUT); // Gear Motor
pinMode(10, OUTPUT); // Green LED
pinMode(12, OUTPUT); // Red LED

I also established the fan and gear motors as variables instead of numbers, as they made use of the analog pin and thus could only take in variables in their pin number, which will be seen later.

int fanmotorPin = 3;
int gearmotorPin = 5;

Next, it was time to decide what my pins would output when the if / else argument is fulfilled, starting with the LEDs. As mentioned earlier, when the CO detector detects a high amount of CO, the green LED would turn off, and the red LED would turn on, and the opposite would be true if there was no CO detected. To do this, I simply wrote in a line that would turn the correct LED on or off accordingly.

Under if(sensorValue > Threshold)

digitalWrite(10, LOW);

digitalWrite(12, HIGH);

Under else {

digitalWrite(10,HIGH);

digitalWrite(12,LOW);

After I set up the LEDs, I started work on the fan motor. If the CO detector detects a high amount of CO, the fan would turn on, and if it does not, the fan would remain off.

Under if(sensorValue > Threshold)

analogWrite(fanmotorPin, 100);
delay(1000);

Under else {

analogWrite(fanmotorPin, 0);

I then did the same for the gear motor. When the CO detector detects a high amount of CO gas, it would turn the motor anticlockwise to open the window, and when it does not detect CO gas, it will close the window by turning the opposite direction.

Under if(sensorValue > Threshold)

analogWrite(gearmotorPin, -45);
delay(800);
analogWrite(gearmotorPin,0);
delay(1000000);

Under else {

analogWrite(gearmotorPin, 90);
delay(400);
analogWrite(gearmotorPin,0);
delay(1000000);

The very long delay at the end is to ensure that the motor does not turn after it has completed its objective of opening or closing the window a certain amount.

Next came the buzzer. We wanted the buzzer to produce a sound at a high pitch to ensure the user is aware that the CO levels in the room are at a dangerous level, and so I first searched for imported a list of pitches and their assigned integers which represent their frequencies.


After this, I looked for the pitch for the high note I wanted, in this case being the note D6, and so I entered the following code under if(sensorValue > Threshold)

tone(8,1175,3000);
delay(3000);

What this line meant is that at pin 8, an integer corresponding to the note D6 would be sent out, which would play for 3000 milliseconds, or 3 seconds. A delay of 3 seconds would also run concurrently with the note, and once the note finished playing, the tone would stop with the following line:

noTone(8);

This line would effectively stop the signal coming out of pin 8, thus stopping the sound. Something I also realised was that if this code was not put in place, even if no sound was coming from pin 8, it would still be producing a signal, and so the code would not be able to allow the motors to turn. 

And with that, the code was done! The complete code is available to copy and paste in one of the later sections!

Here is the hero shot the Arduino programming! 





Finally, here is the "hero shot" of our final product!





Part 4: Assembling of Prototype (done by Van Anh)

Here's the link to Van Anh's blog:

https://ngovapz.wixsite.com/cp5070-2022-2b02-gro



4. Problems and Solutions

Problem 1: Choosing the Mechanism for our prototype

During our design process, we did not plan for a mechanism to be integrated into our product, and so we were quite panicked when our lecturer asked us what we had in mind for our mechanism for our product. To solve this, my group tried to recall the various mechanisms, and from there, we remembered that some  different mechanisms were Actuators, Cams, Gears, Levers, Ratchets and Springs. However, we did not have any moving parts in our product, so we had to brainstorm a new function to add to our product that would allow us to integrate the mechanism.

From our brainstorming, we realised that our product did not have a dedicated ventilation system, as we thought that the fan alone would be enough to ventilate the CO in the room. From here, we settled on the Rack and Pinion, which made use of the Gear mechanism. Thus, we integrated a door mounted on a gear that would open or close depending on the CO level in the room.

Problem 2: Extra 3mm of Acrylic being cut for the room

We realised this problem only after we had done our laser cut and when we were ready to assemble the product. When we did the fusion for the walls of the room, we failed to properly visualise how the walls would come out as. Our acrylic walls are 3 mm thick, and we did not realise that we have to have an allowance of 3mm so that the walls sit perfectly on top of each other when glueing. As such, the acrylic walls we had were slightly protruding out when we put them together.

To get around this, we strategically placed the acrylic walls along each other, such that the 3mm allowance and thickness does not affect the placing of the top cover for the prototype. We had to slightly shift the walls and align them accordingly so that the extra 3mm of acrylic is not visible. With that, we managed to solve the problem of the extra 3mm of Acrylic.

Problem 3: Door for the gear powered vent was unstable 

Our door that we wanted to use for the ventilation system kept falling over when we tried to prop it against the hole we laser cut to act as a window. This is because the door piece was not attached to anything, and so propping it against a wall was not a very reliable way to ensure that it stayed in place and moved in the right direction when the motor was turned.

What we did was we 3D printed a small block that would act as a wall to hold the door in place, and then we stuck it to the bottom of the inside floor of our room, which allowed the gear powered vent to function properly.

Problem 4: The wires were too short

The wires provided in our arduino kit were too short, as they could not reach to some of the components in our product such as the DC motor for the fan and the gear motor.

We solved this problem by soldering 2 wires together to make them longer. This helped us to reach the DC motor and the Servo without hindering their functions.


5. Project Design Files as downloadable files

Below is a link to our design files, being the Arduino code, and the Fusion360 files.

1. Rack & Pinion : Rack & Pinion .f3d & .stl 

2. Door & Stopper: Door & Stopper .f3d & .stl

3. Cylinder for Fan: Cylinder for Fan .f3d & .stl 

4. Servo Stand: Servo Stand .f3d & .stl 

5. Motor Stand: Motor Stand .f3d & .stl  

6. Wall: Wall .f3d & .DXF  

7. Arduino Programming: Arduino Programming

Below is the finalised 3D model of our product!



6. Learning Reflection


When we were first briefed on the requirements for this project, I was very worried about how we were even supposed to finish this project within the allocated time of a mere few weeks. I felt quite overwhelmed with all the requirements, but I still remained optimistic in my group's capabilities and pushed forward.

To start, we finalised our project's objective and the components required, in order to get a clear idea of what we should be doing to create our product at all times during the project development process. In doing so, we realised that our initial Bill of Materials (BOM) was missing a few key components of our product, as well as having some components and functions that did not make it past the ideation stage, and so we re-did it accordingly.

After this, we collected the components from the TEs at W3, and I have to say, this experience of physically collecting the components that we required in our BOM felt quite surreal, as up to this point, we were always given every component for every project that we needed, and so this project requiring us to decide what we wanted based on our product design itself was very interesting, and gave us a better idea of what we have to deal with when we move on to the working environment.

Upon collecting our components from the lab, we then started to allocate key tasks to our group. As Arduino Programming was my strong suit, and as I found myself quite interested in the field of programming from my background experience, I volunteered myself to handle the entirety of the Arduino Programming section of our prototype, which in hindsight, was a rather large portion of the entire project. Our product had a lot of components that involved the use of the Arduino board in some way, and so I sort of shot myself in the foot by picking that component to focus on.

Initially, when I was doing the program for our product, I found it rather simple, as all I had to do was refer to the previous work we had done for our past experiments with Arduino Programming, and modify the code to fit our product accordingly. However, as the project went on, and as I added more and more components into the program, I realised that with every two steps I took forward, I was taking one step back, as the addition of one component would, more often than not, lead to another component not working. I actually got really frustrated at one point, after doing the programming for more than 5 hours straight in the lab, only to realise that the whole program ceased to function due to the addition of the fan motor which just would not listen to my commands.

However, I pushed forward, and by referring to resources online, as well as consulting the programmers of other teams to troubleshoot my program, I slowly started to realise my mistake, and proceeded to correct my past errors, and even managed to complete the program without any major setbacks. Once the program was complete, and the wiring was done, I added the Arduino board that I spent so long with to our product, and with that, it was done!



Overall, after we had finished our product, I felt a satisfaction that no other practical before has given me, as the time and effort my group spent on the product had finally paid off, and the design we had initially envisioned worked perfectly. I really enjoyed my time doing this project, as it allowed me to better understand how Arduino Programming actually works, and how powerful of a tool it can be when wielded by someone knowledgeable.


Comments

Popular posts from this blog

Design for Experiment (DOE) Blog Entry

Gears Documentation Blog Entry