Sphero RVR

You'll need

1) Rover RVR
2) Microbit
3) Sonar
4) Light Sensor
5) Female-Female jumper wires x4
6) iot:bit board

Step 1


Materials Needed

Step 2


Attaching the Sonar to the iotbit board
- Using one of the jumper wires, connect the Gnd of the sonar to pin 1 "G" on the iotbit board
- Using another jumper wire, connect the Vcc of the sonar to pin 1 "V"

Step 3


Connect the Echo of the sonar to Pin 1 "S" of the iotbit board

Step 4


Connect the Trig of the sonar to the iotbit board Pin 2 "S"

Step 5


Finally connect the light sensor to any available pins on the iotbit

Step 6


This is how the board will look like after connecting all the wires!

Step 7


Creating a Thingspeak account.


Step 8


Create a new channel

Step 9


Once you've reached this page, the fields shown will the be graph created as the data is being sent from the micro:bit

Tick field 1 and 2 naming them Sonar and Light as shown

Scroll to the bottom and click "Save Channel"

Step 10


You will then be brought to this page, this will be the main page where you can see the graphs.

Step 11


Click on "API Keys"

Each Channel will have their own unique API Key, take note of the keys as it'll be needed for later.

Step 12


Go to https://makecode.microbit.org/ and lets start programming!

Before starting, download the "iot-environment-kit" and "sonar" extension

Step 13


Your Micro:bit dashboard will look like this

Step 14


Drag the required blocks from the "ESP8266_Iot" bar

"your_ssid" = your wifi name
"your_pw" = your wifi's password

Step 15


Now for the Sonar,

Create a new variable called "Sonar" and drag out the following:

Step 16


Making the Sonar work:

From the images shown, drag out the required blocks and change to the pins that we have placed at the start of this tutorial as well as your preferred unit of measurement

Downloads: Sonar extensions.PNG

Step 17


Getting the light sensor working;
1) Create a new variable called "light"
2) Drag out the following

Step 18


From the Octopus bar, drag out the "value of light intensity(0~100) at pin P1" block into your new "Light" variable.

Change the pin to "P4"

Step 19


This is where things get a bit more confusing so try to keep up!

Connecting to Thingspeak:

1) Drag out a new "Forever"
2) Drag out the following from the sub-column "Thingspeak" under "ESP8266_Iot"
3) Remember the API key from your Thingspeak channel, now is the time to use it
Copy and paste your write API Key from your Thingspeak channel into the "your_write_api_key"
4) Using the variables created, "Sonar" and "Light" drag them into the designated fields

Step 20


This how your blocks should look like if you did step 19 correctly!

Step 21


With this, you will be able to connect to Thingspeak!

Step 22


However, there are times that we will encounter issues connecting to the server.
These could be the causes:
- Your SSID and/or Password is wrong
- Your Micro:bit is out of range from the Wifi
- Your Write API Key is incorrect
- Ensure your Iotbit board and Micro:bit has separate power sources

If you wish to troubleshoot, you can add the following blocks to see if it is working :)

With the troubleshooting blocks, your final commands will look like this!

Step 23


Finally assembling the components to the Rover!

The great thing about the Sphero RVR is that it gives you the ability to let your imagination go wild when it comes to attaching the components.


Code and References

Completed this tutorial?

Spread the word! Let's get this trending on social media with #letsgethacking #SpheroRVR