1) Rover RVR
4) Light Sensor
5) Female-Female jumper wires x4
6) iot:bit board
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"
Connect the Echo of the sonar to Pin 1 "S" of the iotbit board
Connect the Trig of the sonar to the iotbit board Pin 2 "S"
Finally connect the light sensor to any available pins on the iotbit
This is how the board will look like after connecting all the wires!
Create a new channel
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"
You will then be brought to this page, this will be the main page where you can see the graphs.
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.
Your Micro:bit dashboard will look like this
Drag the required blocks from the "ESP8266_Iot" bar
"your_ssid" = your wifi name
"your_pw" = your wifi's password
Now for the Sonar,
Create a new variable called "Sonar" and drag out the following:
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
Getting the light sensor working;
1) Create a new variable called "light"
2) Drag out the following
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"
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
This how your blocks should look like if you did step 19 correctly!
With this, you will be able to connect to Thingspeak!
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!
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!!!