3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

The Seismic Reflector

Step 3The Arduino Firmware

The Arduino Firmware
The code for the Arduino is fairly simple.  It waits for a byte to come in and check to see if it is '001' if it isn't then it discards it and continues to wait.  This byte is the header byte, and is there to stop any false alarms!  When the code receives a '001' then it reads the next byte it receives as the magnitude of an earthquake that that application has reported.  It then pulses the vibration motors at a rate appropriate to the Magnitude that is has been given.

Have a look at the attached .PDE, I've commented the code but if there is anything that you don't understand I'll try and answer it in the comments.  I'm not sure about all the map() stuff, I think I'll need to review that in a later release!

There are certainly more things I'd like to do with this code.  For a start there should be much more 'interesting' ways of creating the vibration profile.  Right now it's as simple as it could be, the magnitude that is passed in is used both to determine the value to pass out of the PWM pins (how fast the motors spin) and the length they spin for.  A much more sophisticated function could be used that pulses the motors along a simulation of an actual seismic waveform.  This would produce the 'organic' feeling that I've been aiming for.


« Previous StepDownload PDFView All StepsNext Step »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
14
Followers
3
Author:jimthree(jimblackhurst.com)
@jimthree