Magic Stone – Make mobile IoT applications using the TI SensorTag in JavaScript

Mikael KindborgBlogs, Tutorials

Tweet about this on TwitterShare on FacebookShare on LinkedInShare on Google+

How to impress your friends with some magical trickery with IoT

Evothings Studio is software tool suite for mobile development and rapid prototyping that makes it fun to develop IoT-apps for mobile devices. While at an Evothings IoT clinic earlier this Spring (March 26, 2014) we experimented with a BLE-powered SensorTag development kit from Texas Instruments, using its accelerometer sensor (one of six on-board sensors) to move a sprite around on the display of the mobile device.

Here is a video of the original demonstration that was recorded at the event:

Several whacky ideas come to mind from this experiment. One such example can be a simple game involving a glass of water on a “virtual tray” that tests your ability as a busy restaurant waiter to keep the glass steady – tilting the sensor too much or sporadically and the glass falls off the tray and onto the ground and a sound simulating a crashing glass is played – the longer you can hold it the more points scored…

Another idea was to use your mental abilities to move an visually heavy stone, in best Yoda-style possible. From this, the Magic Stone application was created where you hide the TI SensorTag in the hand (or cleverly inside a wristband or cuff) and move the on-screen stone magically around on the display. After taking a photo of a solid-looking stone from the garden for our sprite, we set off and built the app. Here follows a description of the whole project.

TI Sensor Tag

evothings

The Texas Instruments TI SensorTag is a Bluetooth BLE device that features a range of sensors on a single board (IR temperature, humidity, pressure, accelerometer, gyroscope, magnetometer) that can be used for various projects and applications.

Magic Stone demo application

Magic Stone is a demo application that showcases the TI SensorTag developed with Evothings Studio. Coded purely in JavaScript, the application can be executed on a mobile device (Android or iOS), reading accelerometer input from the paired TI SensorTag to control an onscreen sprite – a scanned image of a solid-looking stone.

Running the application using Evothings Studio

The Magic Stone application was been developed using the Evothings Studio – when developing apps with Evothings Studio, you run the Evothings Client app on your mobile device to execute the application, and you use Evothings Workbench on your laptop or desktop machine, running a live-reload server.

To run the Magic Stone app, do as follows:

  1. Install and launch the Evothings Client application on your iOS or Android device
  2. Download and launch Evothings Studio
  3. Grab the source code for the Magic Stone application from GitHub
  4. Drag and drop the index.html file into the Evothings Studio project window, running on your computer. The project now shows up in top in the list.
  5. Connect the Evothings Client to the Evothings Studio
  6. Press the Run button for the project in Evothings Studio
  7. Press and hold the side button on the TI Sensor Tag until the light blinks intensively
  8. Tilt the TI SensorTag to control the movements of the stone (using accelerometer sensor)

Now the TI SensorTag is being used to control the movement of the solid-looking stone on the mobile device communicating over Bluetooth Low Energy (BLE) to JavaScript code using the Evothings BLE plugin for Apache Cordova.

Share your projects!

Feel free to announce your apps on the Evothings Forum. We would love to hear about your experiments and work!