Dot Bot is an experimental project using an Arduino Yùn and Google Analytics Real Time API (beta).
Dot Bot is basically an adaptation of a vertical plotter that replaces the pen with a led matrix panel and the paper with a World planisphere.
It moves over the planisphere fixed on the wall and stops over the position of the current visitor on our website (www.dotdotdot.it), showing information as latitude, longitude, city and the page visited on its led matrix panel. These information are gathered using Google Analytics Real Time API (which is still in beta).
When none is connected, the led panel goes back to the center of the map and shows the latest tweets made by our Twitter account (@dot_cube), using the python-twitter library.
code/
- this folder contains the "Linino-side" code, written in Python, that queries Twitter and Google Analytics Real Timesketch/
- this folder contains the Arduino sketch and the libraries to support the MotorShield and the ht1632c led matrixetc/init.d/
- this folder contains the startup script that starts automatically at boot time
- Edit
code/twitter_default.cfg
with your keys and secrets values obtained from Twitter, and save it ascode/twitter.cfg
. - Request the access to the Real Time Reporting API Private Beta and create a new project on your Google Developers Console.
- Enable "Analytics API" under
APIs & auth > APIs
and create a new client ID underAPIs & auth > Credentials
selectingInstalled application - Other
. - Download the JSON file by clicking on "Download JSON", rename it to
client_secrets.json
and put it in thecode/
folder. - Run
code/renewtoken.py
to create a newsample.dat
file that contains the access token to Google Analytics Real Time API.
There are two ways to execute the script:
on your machine - it opens the default browser and asks to login with the credentials who received access to the beta API. After this, you have to copy the generatedsample.dat
file to the Arduino Yùn, in thecode/
folder.
on your Arduino Yùn - needs the--noauth_local_webserver
parameter. It shows a personal URL, that you have to copy and paste on your machine, and enter the verification code obtained after the login. - Type
/etc/init.d/ga enable
on Yùn to enable the service autostart.
TODO
The first time you upload the sketch on your Yùn you have to connect using the Arudino IDE console, it shows a simple menu to calibrate the led panel in the center of the map.
To move the led panel use the syntax X:Y
(note: values are absolute, not relative). When calibration is done, press H
and then A
to start auto mode.
Dot Bot shows, on its led panel, service messages in red color and normal messages in green color.
==================
Welcome to DotBot!
==================
H) to set Home (center of map)
M) to start Manual mode
A) to start Auto mode
X:Y) to move in position (X,Y)
The World planishere used in this example adopts a modified azimuthal, equal-area projection that was the seventh in a series of new projections presented by Wagner in his cartographic work, called Wagner VII.
This was presented by Karlheinz Wagner (Germany) in 1941, the Wagner VII is a modification of the Hammer projection and is also known as the Hammer-Wagner projection.
Below a representation of the World using the Wagner VII projection.
From http://www.giss.nasa.gov/tools/gprojector/help/projections.html
Obviously, the movement of the led panel strictly depends on the map projection used by the planishpere, and the inversion formula should be replaced in code/main.py
file.
In the link below are reported formulas for all the Wagner projections inversion:
http://www.boehmwanderkarten.de/kartographie/is_netze_wagner_123456789_inversions.html