back to listing index

BB-8's AWS Adventure

[web search]
Original source (
Tags: aws hacking IoT BB-8 star-wars
Clipped on: 2016-06-11

BB-8's AWS Adventure

About this project

Sphero's BB-8 uses the Intel Edison and Amazon Web Services to communicate back to the rebel forces.

Project info

Full instructions provided
January 20, 2016
  • 2,190
  • 29
Image (Asset 2/23) alt=Image (Asset 3/23) alt=Image (Asset 4/23) alt=Image (Asset 5/23) alt=Image (Asset 6/23) alt=Image (Asset 7/23) alt=Image (Asset 8/23) alt=Image (Asset 9/23) alt=Image (Asset 10/23) alt=

Things used in this project

Hardware components:
Image (Asset 11/23) alt=
Intel Edison
Image (Asset 12/23) alt=
Sphero BB-8™ by Sphero
Software apps and online services:
Image (Asset 13/23) alt=
Amazon Web Services AWS IoT


In a galaxy far, far away...

A droid named BB-8 needed to communicate large amounts of data to the rebellion so large super computers could analyze and explore the remote planet of MyOfficeCube.

Equipped with only a short range communicator, BB-8 was forced to proxy it's sensor data to a local node and pass it through it's broadband connection to rebels AWS outpost.

We begin our adventure as BB-8 connects to the lone Intel Edison and starts its transmission...


This project will connect a Sphero BB-8 to the AWS-IOT via an Intel Edison.

Once connected the BB-8 will be set loose in a space and begin transmitting sensor data to AWS.

Sensor data available on BB-8 includes:

  • Temperature
  • Location (based on 2D internal map set from start)
  • Acceleration
  • Gyroscopic reading 
  • Odometer
  • Velocity
  • Collision Detection

To get started in our project, we are going to be collecting BB-8's location including:

  • X-Position
  • Y-Position
  • X-Velocity
  • Y-Velocity 
  • Speed Over Ground

BB-8 will be moving in a random direction, switching it's direction every 5 seconds. These values will be transmitted up to AWS-IOT every 5 seconds.

There is some setup to make this process easier, lets start with getting your Intel Edison set up.

Setup Intel Edison with AWS

(Adapted and improved from

Prepare your Intel Edison:

Get started with your Intel Edison by updating to the latest firmware and setting up a serial terminal. You can find instructions here: Get started with Intel Edison technology

Install dependencies:

npm install -g inherits
npm install -g mqtt
npm install -g minimist

Install AWS CLI:

Install pip (Python package manager):

$ curl -o - | python
$ easy_install pip

Install AWS CLI with pip:

$ pip install awscli

Install dependencies: In order to view help files ("aws iot help"), install Groff and a non-BusyBox version of less.


$ wget
$ tar -zxvf groff-1.22.3.tar.gz
$ cd groff-1.22.3
$ ./configure
$ make
$ make install
$ export PATH=$PATH:/usr/local/bin/
$ cd ~

Less: First rename the old version of less.

$ mv /usr/bin/less /usr/bin/less-OLD

Then install the new version of less:

$ wget
$ unzip
$ cd less-458
$ chmod 777 *
$ ./configure
$ make
$ make install
$ cd ~

To make sure everything has installed correctly, run the iot help file:

$ aws iot help

Signing up for AWS

Aws Cli is now installed. Make new user and get credentials from the aws console following instructions at: Once you have an access ID and key you can configure aws and enter the ID and key with:

aws configure

NOTE: for default region you must enter us-east-1 in order to be able to configure AWS for IoT. The default format can be left as json.

In order to get permission to download the AWS IoT tools, attach the administrator account policy to the user. To do this go to the "Users Panel" in the IAM console, select the user you created, attach policy, and select administrator account.

Generate Certificates:

First create a folder to store your certificates in:

mkdir aws_certs
cd aws_certs

Generate a private key with open ssl:

$ openssl genrsa -out privateKey.pem 2048
$ openssl req -new -key privateKey.pem -out cert.csr
  • Fill out the fields with your info.
  • Run the following to activate the certificate:
$ aws iot --endpoint-url create-certificate-from-csr --certificate-signing-request file://cert.csr --set-as-active > certOutput.txt

Run the following to save the certificate into a cert.pem file:

$ aws iot --endpoint-url describe-certificate --certificate-id <certificateID> --output text --query certificateDescription.certificatePem  > cert.pem

NOTE: Replace with the ID stored in the "certificateId" field in certOutput.txt. To view the file enter:

$ more certOutput.txt

Create a Json policy document for AWS IoT SDK: Copy the following text (ctrl-c):

    "Version": "2012-10-17",
    "Statement": [
            "Effect": "Allow",
            "Action": [
            "Resource": [
  • Enter "$ vi policy.doc" hit "a" and right-click to paste the text.
  • Hit escape and type in ":wq" to save and quit.

** Attach the policy to your certificate ** First enter:

$ aws iot --endpoint-url create-policy --policy-name PubSubToAnyTopic --policy-document file://policy.doc

Then attach the policy to the certificate with:

$ aws iot --endpoint-url attach-principal-policy --principal <certificateArn> --policy-name "PubSubToAnyTopic" 

NOTE: replace with the value stored in "certificateArn" in the certOutput.txt file.


To interact with AWS IoT from your device using the certificates you created, you will also need a root certificate. Click here to download the root certificate. Save this file to your desktop and name it “aws-iot-rootCA.crt”


curl > ~/aws_certs/aws-iot-rootCA.crt

Configure Intel Edison for Bluetooth LE 

(from )

Lets turn on BLE :

rfkill unblock bluetooth
hciconfig hci0 up

vi /etc/opkg/base-feeds.conf (insert only following lines)
src/gz all
src/gz edison
src/gz core2-32

Note: “vi” is a barebones text editor which has some confusing syntax. Copy and paste (e.g. vi’s insert mode) the above three lines into the .conf file indicated and then close vi by hitting “Shift + :” (to leave Insert mode) after making the above edit and then typing “wq” and hitting enter to write the change and then quit.

Before we proceed, make sure your Edison is online via Wi-Fi.

Now run:

opkg update
opkg install bluez5-dev

Next, we will install Bleno and Noble, useful Node.js utilities for doing fun stuff with BLE and Javascript:

npm install -g async
npm install noble
npm install bleno

The key to getting Bleno working seems to be this (see the bug linked above):

rfkill unblock bluetooth
killall bluetoothd (or, more permanently) systemctl disable bluetooth
hciconfig hci0 up 

Once this is done, you should be able to use Edison with Bluetooth LE.


Find your BB-8node .Plain text
This is how you find your BB-8 with an Intel Edison using node.js
1To connect to your BB-8 or Ollie, you first need to determine its UUID. 
2Once you have Noble installed, you can use the advertisement-discovery.js 
3program to  determine the device's UUID:
6$ node ./node_modules/noble/examples/advertisement-discovery.js
7peripheral discovered (944f561f8cf441f3b5405ed48f5c63cf with address <unknown, unknown>, connectable true, RSSI -73:
8    hello my local name is:
9        BB-131D
10    can I interest you in any of the following advertised services:
11        []
12    here is my manufacturer data:
13        "3330"
14    my TX power level is:
15        -18


Please log in or sign up to comment.

Image (Asset 16/23) alt=

Gaurav Mishra

5 months ago

Hats off to you. I had to chew my hat off trying to connect edison to aws.

The github repository sucks for people like me.

Image (Asset 17/23) alt=

rory cawley

4 months ago

I've just bought the BB8 and Edison board from Amazon, have told the kids about it and they are excited. Thanks for posting this up.

Any thoughts on extending this for voice control?

Similar projects you might like