Visualizing Rotation Sensor via WebGL on a Raspberry Pi

MPU-6050 rotation sensor

There is a great article over at Raspberry Pi Tutorials. You may have to translate the language to read it if you cannot read German. Here is a link to the article on how to visualize the rotation of a sensor. I can imagine a lot of future applications being able to read the orientation of their equipment in situations where that could be crucial.

Visualize the MPU-6050 rotation sensor with WebGL on the Raspberry Pi

The Raspberry Pi is capable of many things, so rotation and acceleration values can easily be read out using a sensor such as the MPU-6050. The result, however, is simple numbers, which you will normally not imagine too much. However, it is very easy to visualize these numbers. This is easily done in modern browsers using WebGL, which can be used to render 2D and 3D objects in the browser.

To do this, we run a Node.JS web server on the Raspberry Pi, which both retrieves and visualizes the data. The sample code for this is attached at the end of the tutorial.

Visualize the MPU-6050 rotation sensor with WebGL on the Raspberry Pi

DropBox Uploader

Frustratingly for Raspberry Pi users, there is no Dropbox client available. While you can access the popular cloud storage solution via the Chromium browser (and alternatives are available) a handy command line script might just come to your rescue.

Created by Andrea Fabrizi, this can be installed via the Terminal (or remotely via SSH) with:

Dropbox
git clone https://github.com/andreafabrizi/Dropbox-Uploader.git

Once the GIT file has downloaded, make the script executable and run it:

cd Dropbox-Uploader
sudo chmod +x dropbox_uploader.sh
sudo ./dropbox_uploader.sh

You’ll then be prompted to enter a unique key. This is where things get a little complicated.

Add your access token:
  1. Visit www.dropbox.com/developers and log in with your Dropbox account.
  2. Click Create your app, select Dropbox API, and Full Dropbox, then give the app a unique name (“pi-sync” preceded by your initials, for example) and agree to the Terms and Conditions.
  3. Click Create app to proceed, then copy the App key and App secret strings.
  4. Copy the key into the Terminal window where prompted, and you’ll be able to upload your files to Dropbox.

Use commands formatted like this:

sudo ./dropbox_uploader.sh upload /home/pi/screenplay.odt /docs/screenplay.odt

To summarize, this command calls the Dropbox Uploader script, uses the “upload” command, and syncs the screenplay.odt from its location on the Pi to a new location in the “docs” directory in Dropbox.