Introduction: Sound –level Governor and Door Alarm System Using LINKIT ONE
Put the linkit one as a control unit as a sound governor!
Step 1: Introduction
LINKIT ONE board is a
one-stone-masterpiece that you can use to kill many birds! This board has amazing architecture that defines its tremendous capabilities. It shines among its equals! You surely want to know more? Then check it out in the link below: http://labs.mediatek.com/site/global/developer_tools/mediatek_linkit/whatis_linkit/index.gsp
In this instructable, I have highlighted the very fundamental guidelines into creating your sound controlled room environment using linkit one.
Ideally, the ultimate goal on this project on a vast dimension would see the noise level in PSVs, Clubs/bars and events are controlled by setting allowable ceilings for the volume level.
Case: I have a workstation within a premise that sometimes gets so noisy when I play loud music, as such I rarely hear someone knocking at my door. Besides, I have perceived the noise level is dangerous to my ears and would soon be spending a lot of money to manage the damage I shall have caused. The loud music case is even worse in our Public Service Vehicles (PSV) in my country-Kenya. Many passengers have to bear with this state of a situation. My solution is simple; I just want to employ linkit one to do the job.
Step 2: Required
However,
in this document I have only explained simple connections to start you going, phase 1.
Required:
Sound sensor (mic)
LINKIT ONE board
Base shield IO
3 LEDs
Buzzer
Connectors (jumpers)
Touch sensor/push button
Step 3: Circuit
Plug
the buzzer into the D5D4 port on the base shield IO, push button onto D4D3 port and touch sensor into D6D5. Note that the touch sensor and the push button can be used interchangeably because they represent the same scenarios being digital sensors.
Plug the sound sensor (mic) into the A0 port on the base shield IO. Mic is an analog sensor; you could use other slots as well i.e A1, A2, or A3. You can read more about the difference between analog and digital sensors.
Feed 5v DC power supply to the breadboard. This can be tapped from the linkit one board using pins 5v and GND pins.
Extend output pin 8 to the breadboard using a jumper wire. Connect positive lead of one of the LEDs.(for this case I have used the red LED). Feed the other lead to the ground.
Extend output pin 7 to the breadboard using jumper wire. Connect the positive lead of another LED (for my case I have used a blue one). Ground it.
Extend output pin 2 to the breadboard to the positive of the remaining LED (I have used green LED). Ensure its grounded
Step 4: Functionality.
The
project is about setting up a sound control limit in a house/club or vehicle. Further, it works as a door alarm to notify you of someone at the door to your working station who wants your attention. The latter is done by setting a push button at the entrance to your worstation/room which anyone coming to your room would press to alert you through the buzzer output.
In the case of the former: there are two thresholds; when the first threshold is detected from the sound level being detected by the sound sensor, it ligts the blue LED. This sound level is still within the allowable limits. If the sound threshold 2 is detected, the red LED lights. This sounds a warning that the sound level is beyond the acceptable limits thus the deemed action would be taken.
The touch sensor can be used as a feedback signal to the other room as appropriate. It has an output pin 2.
Step 5: Coding Time
Below
is the code that controls the system. It further helps you understand hoe to do the connections.
const int pinSound = A0;
const int pinLed1 = 7;
const int pinLed2 = 8;
const int pinLed = 4;
const int pinLed0 = 2;
const int pinTouch = 3;
const int pinButton = 5;
int thresholdValue =100;
int thresholdValue1 =300;
void setup()
{
pinMode(pinTouch, INPUT);
pinMode (pinButton, INPUT);
pinMode(pinLed,OUTPUT);
pinMode(pinLed0,OUTPUT);
pinMode(pinLed1,OUTPUT);
pinMode(pinLed2,OUTPUT);
}
void loop()
{
int state = digitalRead(pinTouch);
Serial.println(state);
digitalWrite(pinLed, state);
delay(10);
int sensorValue = analogRead(pinSound);
if(sensorValue > thresholdValue)
digitalWrite(pinLed1,HIGH);
delay(200);
digitalWrite(pinLed1,LOW);
if (sensorValue > thresholdValue1)
{ digitalWrite(pinLed2,HIGH);
delay(100);}
else
digitalWrite(pinLed2,LOW);
if(digitalRead(pinTouch))
digitalWrite(pinLed,HIGH);
else
digitalWrite(pinLed, LOW);
if(digitalRead(pinButton))
digitalWrite(pinLed0, HIGH);
else
digitalWrite(pinLed0, LOW);
}
NB: 1.
the threshold level depends with the sound system you have. You can start with low threshold and increase till you get the favorable one. My sub-home theatre system is amazing in sound J
2. linkit one has a problem in controlling the buzzer, its normally open therefore when you feed power to the buzzer it goes off nonstop. Ensure youu the Vcc power input by using the side switch of the base shield IO to get rtealistic connection.