value is somewhere between those.
The second value in the command line
is the duration which can be between
one and 255. Each value represents
about a 12 millisecond period. In this
case, the sound lasts about 1.2
Figure 5. Vibration Sensor
‘‘‘‘‘Sound speaker for 1/10 sec
The If-Then command ends with
the ENDIF command.
The GOTO command finishes the
main loop of code by jumping the
program control back to the main:
‘ Loop Back to
‘ test the
‘ vibration sensor
This type of vibration sensing setup could be used in
many applications where you need to test for movement.
The sensor operates best in an up and down direction, so
you might want to add a second sensor mounted at a 90
degree angle to the first one for another angle of sensing.
Measurement Specialties makes the same sensor with a
connector designed to mount at 90 degrees. That would
be a great next step.
As we mentioned at the beginning, this setup could
also be used to measure vibration on any item including
something being shipped in a box to see how well the
post office handles the package. To do that, you would
need to store the value in memory and that requires an
EEPROM (Electrically Erasable Programmable Read Only
Memory) which is another topic for another article.
(Besides, we don’t think the post office will really allow a
package with electronics running inside it to be shipped.)
We hope this article has helped you learn how to
create a simple robotic or electronic sensor for your next
gadget. If you’d like to build other simple projects like this
with the CHIPAXE, feel free to stop by our website
( CHIPAXE.com). Hope to see you the next time we get a
chance to offer programming tips here in the pages of
SERVO 01.2010 59