My new team started a project that involves programming and building circuits. We are creating a system that will monitor the temperature, gas, humidity, sound, light, and motion in the airstream trailer at our school. There has been a problem with break-ins in the past, so we decided to create a system to prevent people from breaking in, notify in the event of a fire or gas leak, and make sure all lights are turned off and doors and windows are closed. This system will include alarms for the people in the trailer and notifications that are sent through an app to the owner’s phone. To do this we must code each sensor to function as we want it to.
We were given a starting code from Instructables, but found that it didn’t function as we wanted it too. Luckily, my computer science class started coding on Arduino this semester, which is the coding language we are using to program the sensors. I am personally in charge of coding for the PIR Motion Sensor (http://www.adafruit.com/products/189) and the Analog Gas Sensor (https://www.dfrobot.com/index.php?route=product/product&product_id=681). The motion sensor code was fairly simple, and required only a few modifications from the code found on the Arduino coding website. The PIR motion sensor will detect movement up to 20 feet away. The code begins with the normal delay necessary for calibrating the sensor. In the void setup() section the pins that connect to the electrical circuit are activated, and in void loop() the motion sensor is on HIGH if there is motion and stays LOW if there isn’t. Much to my excitement, the code was verified by the Arduino program. Now we need to actually build the circuit to test and see whether the code allows the sensor to detect motion.
I am expecting the gas sensor to be much more challenging to understand and debug. The gas sensor detects many types of gas including smoke, propane, and methane. This might mean I will need to code for the sensor to react to each gas. I haven’t yet had the chance to look at the gas sensor code online. I imagine the void setup() and void loop() will be similar to that of the motion sensor because they are both sensors, but the gas sensor will have specific loops that detect gas. For example, if the sensor detects a certain level of methane then an alarm will go off and a notification will be sent to the owner’s phone via the app.
I hope we can do all of the coding on our own and it isn’t too ambitious. It seems fairly simple right now, but I think that once we connect it to the circuits and sensors it will involve a lot more debugging. Wish us luck!