Part 1 - Simulation of sound activated light bulb controller

In this section, we will simulate the usage of a relay device with an LED. Once we understand the basics of interfacing a relay device, we will move on to using an actual AC bulb with a relay.

For building the simulated prototype the following parts will be required:

  • Arduino Uno R3
  • USB connector
  • Two pieces 1.5V AA batteries + holder case
  • One sound detector sensor module
  • One 5V 10A AC power relay
  • One red LED
  • One 100 Ohms resistor
  • Jumper wires as required
Purchase the relay based on the AC mains rating in your country. For example, in some countries the voltage rating is 220V, whereas in other countries it may be 110V.

Before moving on, since we will also use a sound detector module with our prototype, let us quickly take a look at the basic pin out of a typical sound detector device:

Figure 3: Sound detector module

As we can see in the preceding figure, a typical sound detector module has the following main parts:

  • Microphone: The microphone is used to receive ambient sound waves.
  • Potentiometer: The potentiometer allows us to manually adjust the sound level threshold at which the sound detector module will detect ambient sound. Depending upon the sound detector module, you will have to perform some trial and error for finding out the right position at which the potentiometer must be kept at, for meeting your project requirements. For the sketch in this chapter, there is no need to manually modify the position of the potentiometer.

Once all the components are available, follow the breadboard diagram shown to build the circuit:

Figure 4: Sound-activated light bulb simulation with LED and DC power supply

As shown in the preceding figure, the sound detector to Arduino Uno connections are tabulated as follows:

Arduino Uno pin

Sound sensor pin

Analog I/O pin A5

OUT

5V

VCC

GND

GND

Table 2: Sound sensor to Arduino connections

As shown in the preceding figure, the relay to Arduino Uno connections are tabulated as follows:

Arduino Uno pin

Relay Port/Jack/Pin

Digital I/O pin 7

IN

5V

VCC

GND

GND

Table 3: Relay to Arduino connections

The relay to DC power and LED connections are tabulated as follows:

Relay port

DC Power/Device

COM

Positive terminal

NO

To LED (via bread board)

Table 4: DC devices to relay connections

The positive terminal of the power supply should be connected to the COM terminal of the relay device. The negative terminal of the power supply should be connected to the other end of the LED. Once everything is in place, load the sketch mentioned in a later part of this chapter and see how the sound detector triggers the switching of the LED light. All you need to do is to snap your fingers in front of the sound detector.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.118.90