Sensors  are sophisticated devices that are frequently used to detect and respond to electrical or optical signals. A sensor converts the physical parameter  into a signal which can be measured electrically. There are many types of sensors like temperature, sound ,light, Infrared. Sensors are used to monitor changes in environment and according to that can be used for controlling operations.

Condenser Mic (mic) is a transducer that uses capacitor to convert acoustical energy into electrical energy(voltage or current).

  • The acoustic energy has the capacity of to pass through and be modified by: solid, fluid, plasma or gas medium.
  • The sound wave can, also, be reflected from these media.
  • The sound waves results into electric signals that can be used to drive circuit or device.
  • Condenser mic is  a simple capacitor. It has two plates with a voltage difference between them.
  • Capacitance depends on the distance between these plates. In condenser mic, a diaphragm acts as one of the plates.
  • When sound waves strikes the diaphragm, the distance between the plates changes and so does the capacitance.When the plates comes closer thereby increasing capacitance, a charge current is generated.
  • Similarly the capacitance decreases and discharge current occur when the plates move apartIn this we are using mic for controlling robot movement.
  • Program for sound operated Robot: Goto mblock software and open it. Goto edit menu and select Arduino mode

 

  • Playme Motor Program is a Header file for Robot programming. It makes programming simple.
  • By using this we can access all blocks easily and smoothly.
  • If we are not using this then it may give us errors in program. So put this at start of program.

  • Here we are using loop. Loop is area which will be repeated for certain times depending upon its type.
  • If we write anything inside loop then it will be repeated along with loop.
  • Forever loop means program will run continuously.
  • For example if we write a program to run motor in forward direction with forever loop then it will run until we remove power applied to it.
  • In this we are taking one more loop i.e. if-else loop. If-else loop is used to   check condition.
  • Condition may be anything such as whether switch is pressed or not, whether sensor is sensing parameters or not.
  • If condition is true then and then only it will run program inside it. Otherwise it will run program of else loop.

 

  • Put that if-else loop inside forever loop. Because we want to run this program again and again.
  • Take Sound detected block for sound sensor program.

 

  • Put that block inside if loops condition.

  • Now we want to move robot forward when sound is detected. For robot movement we need both motors left as well as right motor along with its speed and its HIGH/LOW value.

  • Here take block of left motor and put it inside if loop block. Set its speed to 255.

 

  • This is because we want to move robot only when sound is detected. Similarly take right motor block and set its speed.

 

  • Give a wait statement after forward movement of robot.
  • In this we want to move robot forward for 2 sec when sound is detected, after that it should be stop.


 

  • In this program if sound is detected either it may be clap or any form of sound then robot should move forward for 2 seconds and after that it should be stop.
  • If sound is not detected then robot will not move from its position. It will be in stop condition until sound is detected by sensor.

Upload this program and see the output