Skip to main content

Featured

RELAY

RELAY A relay is like a switch that can be controlled electronically. Relays are very simple devices and can be used to control devices with higher loads(Like AC controlled devices and devices that require heavy voltages to operate). Relay modules can be used mainly in IOT projects and home automation. Relays can be used to make useful hobby projects.  A two channel relay. *Dealing with high voltages may cause injuries or even death, please use relays with utmost care. Working of Relays. Relays work like electromagnets, when a voltage is applied the coil,  the coil gets charged and acts like an electromagnet and moves the switch to the desired position. In simple terms, relays act as magnets when a signal is applied or removed. Basic circuit of a relay Connections. +5V of Arduino-  5V of relay module. GND of Arduino- GND of relay module. Pin no. 8 of Arduino- In1 of relay module. Basic connection of a relay module CODE void setup() { pinMode(8, OUTPUT); } void loop() { digitalWrite(8,

HOW TO USE A SOUND SENSOR?

SOUND SENSOR

Now that we have learned about various other sensors, it's time to learn about the sound sensor. Have you ever wondered how people turn on and switch off their lights with just a clap?, I think I may have an answer. 

HOW DOES IT WORK?

Since we all know that microphones create an electric impulse when we tap them or speak in them, we can apply the same principle to the sound sensor. We can use this feature of a microphone and send signals to the Arduino board. when we clap or tap on the microphone, the microphone sends a signal to the Arduino board and according to our instructions we can interpret the magnitude of the sound waves and use it to do different functions.

CONNECTIONS

  • Connect the GND of a sound sensor to GND of Arduino board.
  • Connect the +5v of a sound sensor to +5v of Arduino board.
  • Connect D0 of a sound sensor to the A0 pin of Arduino board.

THE CODE


const int sp= A0;

const int tr=1000;
void setup() 
{
 Serial.begin(9600);
 pinMode(13, OUTPUT);
 pinMode(sp, INPUT); 
}

void loop() 
{
int ss= analogRead(sp);
if(ss>=tr)
{
  digitalWrite(13, HIGH);
  delay(1000);
  Serial.print(ss);
}
else{
  digitalWrite(13, LOW);
  Serial.print(ss);
}
}

P.S: set the potentiometer in such a way that the light under it just lights up.
If you want to buy one send me a mail, I sell it for the cheapest price.

Comments

Popular Posts