Making the Internet more tangible (using a Spark Core)

Written by: admin@makezilla

Picture of Making the Internet more tangible (using a Spark Core)

The Internet is great, but it's not perfect.

While it succeeds at overstimulating some of our senses, it completely lacks the human senses of touch and smell, which are important parts of our communication rituals.

The SparkVibe tries to bridge the gap between online touching, and real touching, by connecting a vibrating motor to my facebook profile, using aSpark Core controller.

Step 1: Setting up the Spark Core

Picture of Setting up the Spark CoresparkID.pngsparkClaim.png

The dudes at Spark have a pretty good guide on their site, but it requires using a phone app, and some other software I didn't feel like using. This will step you through setting up a Core using the USB cable, and the Arduino serial monitor.

What you'll need for now:

- Spark Core

- USB cable (A male to B micro)

- An account at the Spark site.

After you plug your Spark Core into your computer using the USB cable, it will flash all kinds of colors, and hopefully settle into a blue breathing pattern. That's its WiFi setup mode. If it doesn't breathe blue, or if you need to re-setup WiFi later, just hold down the mode button on the Core for 3 seconds, and it should go into blue-breathing-WiFi-setup mode.

Once it's breathing blue, open the Arduino IDE, select the Core from the Tools-> Serial Port menu (should be something like tty.usbmodem1411 on a mac or linux). Open the serial monitor. Make sure baud rate is set to 9600, and type i (the letter i) into the terminal and hit enter. You should see something like this on the terminal monitor:

Your core id is 48fff6765069875032183387

Copy that id somewhere.

Now, the somewhat tricky part. Make sure No line ending is selected in the drop-down menu next to the baud rate in the serial monitor window, and type w (the letter w) into the terminal input box, and hit enter. You will be prompted for your WiFi network id. Before you type the name of your network id, change the line ending option from No line ending to Newline. Type the name of your network and hit enter. You will be prompted for the network password. Type that in, and hit enter.

If everything goes ok, the Core will blink all kinds of colors, cyan, green, magenta... but not red. If it's red it's not on the network, and you should repeat the previous step.

If it is on the network, go to the Spark site to claim your core. Login. Then, on the menu on the left, chose the second option from the bottom (the symbol looks like a target scope), and then Add New Core. Enter the device id that you got from the serial monitor, and Claim a Core.

Step 2: Build a circuit

Picture of Build a circuitdriverCircuit.pngIMG_0356.JPG

Now that we have a Core set up, we need to attach something cool to it. Why not make it vibrate? What other kind of actuator says "I poked you" more clearly than a vibrator?

Materials needed:

- 1 Spark Core

- 1 vibrating motor

- 1 NPN transistor (I used a 2n2222)

- 1 680-ohm resistor

- 1 22-ohm resistor

Build the circuit following the schematic. Make sure to connect the input of the circuit (the resistor at the base of the transistor) to pin D0 of the Spark Core.

When the circuit is ready, you can flash the Core with the SparkVibe Spark Core code.

To flash the core, go to the Spark build site, chose your core from the Coresmenu (the one that looks like a target scope), then go to the Code section by clicking on the menu item that looks like this < >. Create New App, name it whatever you want, and paste the SparkVibe Spark Core code in the editor. Click the lightning bolt icon at the top of the menu on the left, to actually flash the code to your core. This can sometimes take a while... ... .... . . ... .. . .... .. . ....

While you're waiting, you might want to read up on the Core's cloud functions. The magic piece of code on the core is the line that says:

Spark.function("poke", pokeFunction);

This exposes a function from the Core code, called pokeFunction, to a web API. Now we can call this function from anywhere in the web, by accessing a url that looks like this:

Magic !!!

Step 3: Run a script

And this is where we will access that url.

We will use a small Python script that will connect to our facebook profile, and forward certain signals to the Core, using that function call.

This small script will do just that. It will prompt you to log into your facebook account, and then it will forward any unanswered pokes you have, and any new pokes, to your Spark Core.

Make sure to change the SPARK_DEVICE and SPARK_TOKEN variables to reflect your own device id and access token. Both of those things can be obtained from the Spark build site: Device ID is under the Cores menu, and Access Token is under the Settings menu (the last one on the left, with the sprocket icon).


Run the script on your local machine, or on a server somewhere, and as long as your Spark Core is plugged in and on the Internet, it will turn your pokes into physical vibrations.


Step 4: Ohh yeaaahhhh!!!

Leave a Reply