Using volume of voice to control speed of movement

You mentioned replacing the variable resistor with a 22K. This takes away your “sensitivity” adjustment. Use a pot, even if too big physically, and determine the proper setting. Then you can replace the pot with a fixed resistor (should this be the problem).

Alan KM6VV

You have many WIRING ERRORS in the first images… I now see you have posted a new image with changes. Why don’t you have a potentiometer wired in there? You’re going to need to wire the pot in there so you have a way to adjust the bias on the 3904… What you have is a simple pull up resistor. That’s not going to work… As Jamie from the Mythbusters would say… “Well there’s your problem!” :slight_smile:

Allen mentioned putting in the pot then put back the resistor. Not exactly. Use a pot, then measure both sides to make one from TWO resistors as a voltage divider…

For a test pull the yellow wire from pin 6 on the 741. Attach it to a 1k resistor. Attach the other end to ground then 9vdc. The LED should go out when connected to ground and light up when connected to 9vdc. This will accurately test the 2N3904 and LED part of the circuit.

Correct, I started to say two resistors.

Alan KM6VV

Hi thank you for your reply. Yes I will change it back to potentiometer and try it out tomorrow.

Sorry I don’t quite get what you mean here.
When pulling the wire away meaning the ‘base’ of 2N3904 will be disconnected from it or meaning adding and pulling another wire from there ?
Also when you say ‘test’ does it mean to test whether if the 2N3904 is functioning well or what is the purpose of doing that ?

Hi I have changed the fixed 22k resistor to a 10k variable resistor.

And also from the output(between Q1 and R4), I pull out a wire, connect it to one leg of the LED, and then connect the other leg of the LED to ground.

By doing that, I wish to test the output if it is indeed sending pulses of voltage as signal.

However, when I do that, the LED just lights up indefinitely, together with the LED that comes with the original circuit. The LED for testing the output does not react to any noise directly to the electret mic.

2 questions:

  1. Is this kind of testing correct to determine if there is any output ? I have the assistance from the senior lab assistant in my school too.
  2. What is really the range of voltage can be input to the BBII ?

Try this…

Remove the extra LED on the output.

Adjust the pot back and forth to see if the LED goes out or not at any position. If you find the LED goes out when you rotate the pot stop right after it goes out. Then make noise in the mic. The LED should turn on when noise is heard.

Second test. Measure the voltage on the IC pin 3. Rotate it to make sure it changes from 0vdc to 9vdc. If it does not change look to find a wiring error. Now measure the voltage on pin 6 of the IC. It should change as well, but I’m not exactly sure what the values should be.

Thank you for the reply. I shall try it out again on Monday.

Also What is the acceptable input voltage range to the BBII that will not damage the BBII ?

I already answered that question, way up there…

I have finally manage to get a sound sensor circuit working !! This ciruit is slightly different from the circuit that has been posted in this thread but it has the same functions.

When I supply a 5V power supply to the circuit, it will have a range of about 1V to 4.xxV output voltage, depending on how loudly I speak to the mic, or also how sensitive I want to have the circuit to be.

1)I suppose that this range of output voltage, when it goes into the BBII board, it will be good and will not damage the BBII board right ?

2)Also SN96 says that the input voltage will have to go into the ‘adin pins’. ‘adin pins’ are the pins numbered 1 to 15 ? I can use any of the available pins right ?

3)Now, that I have manage to get the output voltage working. I have to now do the programming to deal with the incoming voltage, just like any sensors like SN96 said. I wish to make the robot move faster for a duration of say 10seconds when this signal is received, then slows down again after that period of time. May I ask has there been any sample programs/guide that I can have a look that deals with this incoming voltage? I have some basic programming skills but very limited knowledge on dealing with programming that has to deal with incoming voltage. Or shall I just post this question in the ‘programming forum’ instead?

Congratulations!

What circuit changes did you have to make?

I don’t believe I’ve seen any tutorials on sound control

I’d start out with the code for a rover or even a hexapod controlled by a PS/2. Identify the X and Y joystick input values, and how they are applied to make up ldrive and rdrive values.

This from A4WD_TST2.bas look particularly at the “'CALCULATE DRIVE SPEEDS FROM JOYSTICK POSITIONS AND SPEED LIMIT”.

I haven’t spent much time in the code, but I’d suggest doing A/D to get the sound level, then converting to an integer of the proper range to replace GEAR variable. The buttons wouldn’t change the “GEAR”, but your sound level (1 to 4) would.

[code]'SET MAX MOVEMENT SPEED TO ONE OF FOUR CHOICES AND GIVE AUDIO FEEDBACK
if Button_L1 and (Lastbuttons.bit10 = 0) then
GEAR = (GEAR + 1) MAX 4
for temp = 1 to GEAR: sound 9, [100\880]:pause 10:next
elseif BUTTON_L2 and (Lastbuttons.bit8 = 0)
GEAR = (GEAR - 1) MIN 1
for temp = 1 to GEAR: sound 9, [100\880]:pause 10:next
endif

’ lvert=255-lvert ’ Changes vertical up from 0 to 255 and vertical down from 255 to 0.
lhori=255-lhori

'CALCULATE DRIVE SPEEDS FROM JOYSTICK POSITIONS AND SPEED LIMIT
ldrive=((lvert*GEAR) + 1500 - (GEAR 128)) ’ Forward / backward
rdrive=((lhori
3) + 1500 - (3 *128)) ’ steering
[/code]

Other methods are possible, but this might get you going.

Alan KM6VV

Congratulations!

Could you post a copy of your final circuit?

Thanks,
dj

I did not really change much other than following exactly the same circuit as provided. Instead of using the UA741CN I got LM358 together with a different mic.

So its probably UA741CN does not work(which I doubt so), or i damage the mic initially :blush:

Regarding the programming, Is the program code provided a little too complicated for the task ? :confused:

Is there like some

if ( voltage comes in from pinX)
then (move fast for 10 seconds)

something more straightforward instead of looking into the joystick and all ?

Today I have been playing with the voltage produced from the circuit again with an oscilloscope.

I see that the circuit is producing the pulses of voltage, depending on my power supply voltage, if its 5V power supply, then the peak of the pulses of voltage measured on the oscilloscope will be 5V as well. ( I did not know that ! :blush: )

Now I want to read this pulses of voltage generated from the circuit and act as an signal for the robot to move faster for 10 seconds.

There are a few things I picked up that might be useful from slightly going through the 200+ pages of atom pro manual.

assuming I am connecting the output of the circuit to pin 4,


input p4 %to initilize this pin as input ?
if p4 = high then %if p4 has voltage
(program)


can this be a way to read if there is an input on a pin ?

No…

amplitude1 var byte loopy: adin 3, amplitude1 serout S_OUT, i57600, "amplitude: ",dec amplitude1,13] goto loopy

You can open terminal one at the bottom of the screen and set it for the same baud rate and connect. Then you will see the values from the analog input. Analog inputs are I/O 0-3 and 16-19 which are labeled AX0-3.

Hi robot dude,

As I am not very experience with dealing with electronic stuff. I dare not try and play on my own as it might damage the board. So I think it be better if I know what I am doing before trying.

As attached on this post, in the red circle I understand that’s the pins(AX0-3) are the pins where I will have to connect the output of my circuit to.

My question is ,

1)from the output of my circuit, the ‘ground’ goes to the bottom pin in the ‘red rectangular block’ that I have drawn, and the other wire connects to the top of the ‘red rectangular box’, is that correct ?

2)Do I need to apply jumper 1 & 2 ? What are they for?

3)I have to apply jumper 3 to activate 5V right ?

Cheers.

Can somebody please explain to me what does ‘analog input will see 2.25V’ mean? Why does it need an input voltage of 2.25V from the 9V battery to that pin anyway when there is an input voltage(which is the output) to that pin already from the circuit ?

‘If you remove the jumpers you can use them the same as P18 and P19.’

Does it mean now in my application, I do not have to apply the jumper, and just connect my ground wire from my circuit to the bottom of the red rectangle, and the other wire from my circuit to the upper pin of the red rectangular box I have drawn, to the pin of AX0, or AX1, or AX2 or AX3 ?

I wanted to just trial and error today but a little afraid I might damage the board as I am not sure why and how it works.

The jumpers allow an easy way to attach the VL and or VS pins to analog inputs. This allows your program to monitoring the battery voltage for VS or VL. Because the batteries are normally more than 5vdc we had to put in a voltage divider to lower the battery voltage.

Yes.

Yes.

Ok.

amplitude1 var byte loopy: adin 3, amplitude1 serout S_OUT, i57600, "amplitude: ",dec amplitude1,13] goto loopy

You can open terminal one at the bottom of the screen and set it for the same baud rate and connect. Then you will see the values from the analog input. Analog inputs are I/O 0-3 and 16-19 which are labeled AX0-3.

I have connected the output of my circuit to AX03 without applying any jumper.

I use the code provided and program it, and then I open terminal one and connect with the baud rate of 115.2k, I am suppose to see value from my analog input when I make some noise onto my sound sensor circuit right ?

However, what I get on the terminal is some funny characters displaying and changing at a very high speed.

What have I done wrong ? I have tried almost every different settings on the Terminal 1.

The answer is right in front of you. The baud rate for the command is 57.6kbaud.

serout S_OUT, i57600, "amplitude: ",dec amplitude1,13]

But you have in the terminal window.

115.2k

57.6k != 115.2k right?

Sorry its been a while. Looks like you have made some progress.

Like Jim said, you have a baud rate missmatch. Not only does it need to be set right in your code, but it has to be set right in the terminal as well as the jumper settings on the board. So there are three things to check:

1.) Code
2.) Terminal
3.) Board jumpers