The Idea behind this project was to create a device that could turn on and off a light without having to get up and flip the switch. it uses two sensors, one being a sound sensor and the other being a switch, for when you want to turn on and off the light manually. The light we chose for our project is a 5 volt LED strip, that way, the relay module used to power the LED strip could be powered by the USB pin on the Particle Argon. For this demonstration we opted to use a 6V battery pack to power the relay module. Demonstration Video :
BI Directional Communication:
Both Particle Argon's are connected to the internet and can communicate with each other through the Particle cloud. When a sound is picked up by the sound sensor and the digital value of high or 1 is read by Argon #1 and "sound_received" is published to the particle console. Argon #2 is subscribed to "sound_received" and whenever is shows up in the particle console it runs the function "led_toggle" that toggles the LED strip. Argon #2 communicates with Argon #1 with the switch. Whenever the switch is in its off state (LED Is on and sound sensor is deactivated), Argon #2 publishes "soundsensor_off'' and Argon #1 subscribes to that and runs the function "SSOFFfunc" which turns off the indicator light (D7 LED) and any sound sensor readings. Whenever the switch state is on (LED is off and sound sensor is activated), Argon #2 publishes "soundsensor_on" and Argon #1 subscribes to that and runs the funciton "SSONfunc" which turns on the indicator light on Argon #1 and the sound sensors functionality can be used again.Live Data :
The live data represents whether the switch state is on or off, 1 being on and 0 being off. This corresponds to the state of the sound sensor, NOT the LED strip. Although, as an added effect, when the switch is off the sound sensor functionality turns off and the LED strip turns on. the opposite happens when the switch is turned off, so we could have manual control of the LED strip.