Sensing the Code (Chloe CW)

This is an original photograph of the inside of the air-stream trailer.

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.

This is a picture from the Adafruit website of the PIR motion sensor.
This is a picture from the Adafruit website of the PIR motion sensor.

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 ( and the Analog Gas Sensor (  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!

2 thoughts on “Sensing the Code (Chloe CW)

Add yours

  1. Wow this is so cool! I didn’t know that the security of the air stream trailer has been tampered with…that’s a big concern due to how many students (especially little itty bitty ones) that have classes outside that are close to the trailer. I think that the way that you are approaching testing the gas sensor is unique because not many students have the chance to test how a sensor will react to different types of gases. How will you release gases such as smoke, propane, and methane? Also, who will you allow to buy the app? If it’s available on the App Store then doesn’t thst mean anyone with a smart phone could download it? How will you ensure that no one will tamper with the app to break into the trailer? Last question: how do you think you’re going to code the sensor to where humidity and gases are not mistaken for the other? I realize that might be a silly question but as a newbie to coding, I don’t really know much about the capability of sensors. Anyways, this is an awesome project and I am so excited for the end result!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

A Website.

Up ↑

%d bloggers like this: