CO2 Sensor Arduino for next weather balloon

 


I finished soldering and made the code. I finished soldering. The soldering dragged due to my inexperience soldering skills and the tiny pads. To accelerate, Rik, experienced with soldering, helped so I waste little time. I made the code. The code involved downloading the Arduino, sensirionI2CScd4x (found in spec sheet), wire (AKA I2C), Softwire (for compatibility of digital outputs on our analogue flight data recorder), and AsyncDelay libraries. Firstly, I declared the analogue pins, but note that we intended initial testing on a digital Arduino to reduce confusion regarding sensor malfunction or set up on our analogue board. Additionally, we initialized the variables and libraries using a void set up design to loop through once. Within, Serial.begin(115200) initialized serial communication with a baud rate of 115200. Wire.begin() called the I2C library: within the parenthesis is the master, so we included nothing within to make the Arduino the master. Scd4x.begin(Wire) initializes scd4x (the sensor) communication making scd4x the slave and wire (AKA the Arduino) the master. I2C.begin() initializes I2C communication. I2c.setTimeout_ms(200) declares the maximum wait time for serial data to be 200 miliseconds. In addition, uint16_t error declares the data type for the error. Furthermore, error = scd4x.startPeriodicMeasurment() sets the error as the start because the sensirionI2CScd4x library defines the start as the error. Additionally, we have a void loop to loop what comes after forever. Within, we declare how we want the CO2, temperature, humidity, and error displayed regarding data types. Error = scd4x.startPeriodicMeasurement sets the start as the error, so we can rule out the error first before continuing. Afterwards, a basic if else statement occurs. If the first condition is not met, the program moves on to the second, if the second condition is not met, the program moves on to the third. Upon soldering and making the code, I was ready for testing.



Below is the data.

One issue was that I noticed that the CO2 sensor had to be pressed down to display actual data. Whether this resulted from the poor soldering or the way the sensor is connected on the bread board is something I am trying to figure out. I decided it was best to get rid of the if statement involving c == 0 to avoid the output only displaying "Invalid sample detected, skipping."

Comments

Popular posts from this blog

Weather Balloon Spring Flight

System Block Diagrams Introduction Week 5

Temperature Sensor week 8