Have you ever wanted to be a tech-savvy individual with a Clap on/off activation system for your house? Well, this project is the perfect way to get started with a Clap on/off Light activation system that also has preventative measures for a house fire!
For our MEGR 3171 Class, each group was tasked to create a device and application using the Particle Argon Kits, which is basically an Arduino. Our group thought a feedable project that would also be useful after the class would be a Clap on/off Lamp. Since we also had a Sensor Kit that came with one of our Particle Argons, we had everything we need to take in Audio and Temperature Data and create an Output that turns on an LED.
Our video demonstrates the uses of the Temperature and Clap code. We had a lot of issues with connection problems to the particle cloud so our video is in a moment where the connection was good enough for our argons to work. In the video, you will see how the Digital Temperature sensor and Big Sound sensor work.
____________________________________________________________
____________________________________________________________
Big Sound SensorFor our project, we used the Digital and Analog applications of the Big sound sensor. The Analog Pin (A0) allows you to take real-time data displaying the voltage reading depending on the sound sensed. The Digital pin (D0) allows you to use the use comparator which will activate the digital output and the Diode (the small light under the Sound Set Point Adjust) when the sound sensed falls below a specific threshold.
Note: The threshold can be set/adjusted by twisting the Sound Set Point Adjust, Clockwise for more sensitivity, Counterclockwise for less sensitivity
This graph displays the Clap function. The Clap function uses the big sound sensor to detect sound and cut the light on or off. This sensor absorbed data over a longer period of time. Which explains the dips and peaks over time in the graph, reflecting the quiet times in the room as well as the louder ones.
Digital Temperature SensorThe Digital Temperature Sensor measures temperature changes based on Thermistor Resistance. The Thermistor on end collects signals which are sent to the Comparator to amplify the signals. The Amplified signals are then sent to the Analog pin(A0) to record real-time temperature data.
This is the graph showing the digital temperature sensor data. Started out is room temperature, then we began holding it to test the temperature reading. It spikes up past 90 due to body heat heating it up. Then afterward cools off after we let go. We did it once again which is the next peak. Then we let it steadily cool down to the room temperature of around 65 degrees.
____________________________________________________________
Code Flow Chart:The Code for our Argons has a couple of functions including Collecting Temperature data, Collecting Audio Data, Detecting sound to trigger the light, and a few "If, then" statements for if the Light overheats to turn it off.
To break up each part of the code with explanations:
Clap Code:By defining the pins on the argon as D10 and A0, and correctly connecting them with the Big sound Sensor, you can set up an If, else if function to utilize the sound detection function on the Big Sound sensor. The "trig" definition is what translates the sound detection into a variable that incorporates into the code.
Audio data Collection Code:By using the Analog pin on the Big Sound sensor and defining it with the Particle argon pins as "A0", you can simply print the values being read by the sensor on the particle cloud. Dependingonhow sensitive you set your sensor, your values can read anywhere from 200 - 4000.
Overheat code (For Argon 1):Be sure to include this line in the "void setup()":
Particle.subscribe("Overheating", Overheating, ALL_DEVICES);
Then add:
Temperature data Collection Code:
This is code that translates the data being taken by the Thermistor on the Digital Temperature sensor to allow it to read in Temperature Fahrenheit. This calculation occurs on line 31.
____________________________________________________________
Comments