VibPi. Measuring vibration using cheap electronics, a RaspberryPi and Phidget Spatial 0/0/3 which sends vibration events with acceleration data to a server.
Check out http://www.team-umizoomi.nl/vibpi/ , where this project is located (fake data, shaked the device with my hand :).
The "device" is a computer, in my case I used a raspberry pi, with a Phidget Spatial 0/0/3 running Python. The spatial has an accelerometer measuring up to +- 8g (+- 78.5 m/s squared) sampling data at a maximum rate of 1ms. When an acceleration measurement difference above 0.1g is measured, the script will trigger an event storing the following measurements with atleast 0.1g at a sample rate of 32ms. Each time it triggered, the script also holds a timer which after 15 seconds of no measurement with 0.1g+, will stop storing data, convert it to JSON and send it to the server.
The server is just some PHP code receiving posts, processing and showing data. My aim is to create a platform where different users can store their meausured data (vibrations in the house for example) and view it.
- Computer running Python.
- Phidget Spatial 0/0/3
- webhost/server running PHP 5.x+
- webhost/server running MySQL Database 5.3+
-
database/db.sql should be imported in your database.
-
in server/config.inc.php you should change the following:
DEFINE ('DBUSER', 'Database Username'); DEFINE ('DBPW', 'Database password'); DEFINE ('DBHOST', 'Database host'); DEFINE ('DBNAME', 'Database name');
-
upload the contents in /server/ to your server.
-
Install Python 2.7.x, if you haven't already.
-
Install the Phidget Library and Driver for your device's system.
-
Install Python Requests
-
Put the contents of /device/ anywhere you like on your computer.
-
Change the following in device/spatial.py:
r = requests.post('SERVER_POST_URL_HERE', data=json.dumps(data)) #on line 47 key = 'DEVICE_KEY_HERE' #on line 67, this key should also be in your database!
-
Connect your Phidget and run the script
python /home/user/spatial.py