Electronical Cricket

We are on stage again with something new!

The challenge:

Is it possible with a minimum of electronics to produce a robot able to find a pulsing sound-source?

The answer:


The EARS

These will be two identical sound-level sensors.

The sensor is derivated from Mike Gasperi's Almost Ultrasonic Motion Sensor . We added a forth amplifier-stage. The sensor is equipped with the cheapest crystal microphone. For each ear there are two audio-amplifier stages. The signal passes the diode D7. The positive peak charges C3 which is then discharged through R10 (the time constant T=RC=0,470E-6*1E5=0,047 sec). The peak-level is amplified and passed to the RCX through the 4th op-amp. The sensor has to be calibrated at R1. The RCX raw-values: +/-10-90.

Put attention that for the three first stages the + inputs are connected to the common ground, which is given through R6 and R7. One pin of the microphone is also connected to this ground.

Here the PC board:

a detail view of the finished ear:


The audition-test 

With a pulsing sweep_fast_sound from a second RCX, Robolab-tests give us the following result:

The comfortable difference of the peak-values makes possible a clear right-left decision.


The program

{Roverbot equipped with dual-sound

sensor. Do not forget that the program

should start during silence. Then using

a second RCX run there the beeper-program}

{...variables...}

#define(Threshold_L,0)

#define(Max_L,1)

#define(Value_L,2)

#define(Actual_L,3)

#define(Threshold_R,4)

#define(Max_R,5)

#define(Value_R,6)

#define(Actual_R,7)

#define(diff,8)

#define(average,9)

#define(direction,10)

#define(abs_average,11)

#define(Motor_command,12)

#define(Motor_flag,13)

{....sensors...}

#define(Left_EAR,0)

#define(Right_EAR,2)

{....sensortype....}

#define(Sound_type,3)

{...tasks...}

#define(Ear_L,1)

#define(Ear_R,2)

#define(Compare,3)

#define(motor_control,4)

{...constants...}

#define(comm_forward,1)

#define(comm_left,2)

#define(comm_right,3)

#define(Threshold,15)

#define(off,0)

#define(on,1)

{....motors...}

#define(drive_motors,4)

#define(left_motor,0)

#define(right_motor,2)

 

{-------------------------------------------------}

 

BeginOfTask(Main)

  setvar(motor_flag,con,off) {this flag shows the sound-tasks

  not to check sound during driving

  to avoid motor-noise}

  Wait(con,100) {to avoid beep_influence from run}

 

  Starttask(Ear_L)

  Starttask(Ear_R)

  Starttask(Compare)

  Starttask(Motor_control)

EndOfTask()

{-----------------------------------------------}

beginoftask(compare)

  setvar(average,con,0) {clear average difference of Left-Right-peak}

  loop(con,forever)

     if(var,motor_flag,eq,con,off) {do this only if not driving}

       setvar(diff,var,Value_L)

       subvar(diff,var,Value_R)

       mulvar(average,con,2) {weighted average}

       sumvar(average,var,diff)

       divvar(average,con,3)

 

       setvar(direction,var,average)

       absvar(abs_average,var,average)

       if(var,abs_average,LT,con,Threshold)

            {sound is straight forward}

           setvar(motor_command,con,comm_forward)

       else()

                if(var,direction,GT,con,0)

                  {sound is left}

                      setvar(motor_command,con,comm_left)

               else()

                    {sound is right}

                      setvar(motor_command,con,comm_right)

               endif()

        endif()

    endif()

  endloop()

endoftask()

{-------------------------------------------------------------}

BeginOfTask(Ear_L)

SetSensorType(Left_EAR,Sound_type)

SetSensorMode(Left_EAR,percent_mode,0)

Setvar(Threshold_L,senval,Left_EAR)

SetVar(Max_L,var,0) {fix threshold}

SetVar(Value_L,var,Threshold_L)   {initial value}

Sumvar(Threshold_L,con,1)

 loop(con,forever)

   if(var,motor_flag,eq,con,off)       {check oly if no  motor-noise}

       Setvar(actual_L,senval,Left_EAR)    {get the sensor-value}

       If(var,actual_L,LT,var,Max_L)

             if(var,actual_L,LT,var,Threshold_L) {find peak}

                     setvar(value_L,var,Max_L)     {value_L is the real peak}

                     setvar(Max_L,con,0)        {clear max_L}

            endif()

       else()

            Setvar(Max_L,var,actual_L)   {max_L is actual peak}

       Endif()

    endif()

 endloop()

EndOfTask()

{---------------------------------------------------}

BeginOfTask(Ear_R)

SetSensorType(Right_EAR,Sound_type)

SetSensorMode(Right_EAR,percent_mode,0)

Setvar(Threshold_R,senval,Right_EAR)

SetVar(Max_R,var,0)

SetVar(Value_R,var,Threshold_R)

Sumvar(Threshold_R,con,1)

loop(con,forever)

    if(var,motor_flag,eq,con,off)

        Setvar(actual_R,senval,Right_EAR)

        If(var,actual_R,LT,var,Max_R)

               if(var,actual_R,LT,var,Threshold_R)

                       setvar(value_R,var,Max_R)

                        setvar(Max_R,con,0)

               endif()

        else()

             Setvar(Max_R,var,actual_R)

        Endif()

   endif()

endloop()

EndOfTask()

{-----------------------------------------------------}

beginoftask(motor_control)

setpower(drive_motors,con,3)

loop(con,forever)

     off(drive_motors)

     wait(con,50) {wait a bit}

     setvar(motor_flag,con,off)

     wait(con,200) {wait one second and check sound}

     setvar(motor_flag,con,on)

     wait(con,20) {wait tasks to finish}

     if(var,motor_command,eq,con,comm_forward)

          setfwd(drive_motors)

          on(drive_motors)

          wait(con,100) {wait 5 seconds}

     endif()

     if(var,motor_command,eq,con,comm_left)

            setfwd(right_motor)

            setrwd(left_motor)

            on(drive_motors)

            wait(con,30) {wait 3 seconds}

     endif()

     if(var,motor_command,eq,con,comm_right)

           setfwd(left_motor)

           setrwd(right_motor)

           on(drive_motors)

           wait(con,30) {wait 3 seconds}

     endif()

   endloop()

endoftask()


 

The cricket's path

 

These are typical ways the cricket took in a room 4m x 4m. For these experiments we used a piezo-siren from CONRAD electronics (Part. No. 115983-88) which we placed in a package made of LEGO-bricks. Then we powered it with power-level 1 ! Amazing ! You think you'll listen to a real cricket. Due to the extrem loudness (at 9V 110dB), we added a sound absorber, e.a. a LEGO half-spherical window from a space or underwater-set.

 

Cricket 1 and 3 found the path. Cricket 2 hit the wall because of strong echo. So we think that the next tests will be outside! We wait for better weather.

 

Perhaps a next cricket will not only make the difference of signal-strength but will also consider the phase-difference.


 

References

 


RetourMain Page