Sphero RVR


YOU WILL NEED

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

Looking for parts to make this?


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.

https://thingspeak.com/



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.

So... LET YOUR IMAGINATIONS GO WILD!!!


Made this activity? Good Job! Now spread the word. Share a photo of your creation on social media with #letsgethacking #SpheroRVR