www.servomagazine.com/index.php?/magazine/article/october2010_MrRoboto
formed by R5, D1, and C2. D1 encourages the signal
to charge positive quickly, but discharge slowly back
through the resistor. I get a voltage swing of about 2V
here which is enough to trigger a microcontroller input pin.
Play with R6 to set the sensitivity level of the microphone
to suit you.
This circuit does not distinguish between frequency of
sound. In fact, it is really just a noise detector and will hear
just about any reasonably loud sound.
Q. I want to detect when my robot’s battery goes too low to power the robot. How can I look at the voltage that is running my microcontroller? Won’t
it be the same as the voltage reference of the analog
section of the micro, so I can’t detect a low voltage? What
if the voltage from the battery is too high for my micro to
read without damage?
Figure 2. Simple voltage divider.
which is just fine. To calculate the effective impedance of
your resistor divider, you would use this formula:
— Anonymous
A. I hear this question all of the time. The answer is imple: a voltage divider. You can make a simple voltage divider with two resistors. I could try to
explain this circuit to you, but it is rather like explaining how
to tie shoe laces. So, Figure 2 shows how to handle a
voltage that is higher than the analog input of your
microcontroller, as well as de-reference it from your analog
reference voltage.
You would probably like to know how this works.
Let’s assume that you are using a PIC’s analog input to
measure your voltage. This input is basically limited to the
Vcc of your power; let’s say 5V. Your battery is a two cell
LiPoly battery that can be as high as 8.4V. We have
created a voltage divider where both R1 and R2 are the
same value, 10K; this means that your voltage measured
will be half what the “real” voltage of
the battery is. So, if you measure 4.1V
on your analog input (if you are using
an eight-bit converter) this would be a
R= 1 1
R1 + 1 R 2
Go forth and conquer!
There wasn’t much in my in box this month, but I did
get a question I didn’t have time to answer. So, I’ll save it
for next month as it will take a while to get through. If you
have ever wondered how to get your robot to act like it is
running several different programs at the same time, stay
tuned – all will be revealed next month! As usual, if you
have any robotics questions that you would like me to help
you figure out, don’t hesitate to drop me an email at
roboto@servomagazine.com and I’ll be happy to work on
it! Until next time, keep on building those robots! SV
( 4.1/5) 255 = 209
The value is the ratio of your
reading divided by your analog
reference times your maximum
digital value that the analog-to-digital
can return. You can play with the
resistor divider values to tweak your
maximum reading as close to your
analog input reference as possible.
One thing to remember though is
that most analog-to-digital inputs
don’t like you to have an impedance
(resistance) of more than 10K ohms.
To the input, the two resistors look
like they are in parallel so the effective
impedance of this circuit is 5K ohms
SERVO 10.2010 15