A guide on how to get up and running quickly with the K8 robot from Insksmith
WHAT IS K8?
K8 is a two-wheeled programmable robot powered by the micro:bit. The electronic components within K8 are easy to use and designed for beginners.
WHAT IS INSIDE K8?
- 2 x DC motors
- 1 x Line follower made up of 3 infrared sensors
- 1 x ultrasonic sensor (used for object detection)
- 2 x Servo motors
To program K8 we first need to open the MakeCode editor into your chosen web browser. Click on a new project, within the programming menu click on Advanced. Scroll to the bottom and click on Extensions, within the search bar at the top type K8 and click on the image of "K8".
CONTROLLING THE MOTORS
Now that we have got up and running with MakeCode we can start programming!
- Click on Input, click and drag an on button A pressed to the coding area and drop it.
- Click on motion, click and drag drive straight speed 0 to the coding area and attach it within on button A pressed.
- Click on 0 and type 50.
- Click on Download to download the code file to the micro:bit. Once the light on the back of the micro:bit has stopped blinking unplug the micro:bit from the computer and attach it to K8.
urn the battery pack and controller board on, put K8 on the floor and press button A on the micro:bit. K8 should now start driving forward.
Let's see what else K8 can do.
Modify your code to look like this:
The infrared sensors point downwards and detect light and dark surfaces.
To make our track we will want to use black electrical tape on a white surface and make sure it is a closed-loop.
CONFIGURING THE LIGHT SENSORS
- Turn K8 upside down so the sensors are pointing upwards.
- Turn the dial clockwise until the red signal light on the IR (infrared) sensor turns on.
- Very gently turn the dial counter-clockwise until the red light turns back off, this makes sure the sensitivity of the sensor is maximised and the sensor can tell the difference between black and white.
- Repeat for the steps above for the other two sensors.
- Create the following program to test the sensors.
Download the code to the micro:bit, once the light on the back of the micro:bit has stopped blinking unplug the micro:bit from the computer and connect it onto K8.
- Place K8 on a white surface, if the sensors are calibrated correctly the first, third and fifth column of LEDs on the micro:bit should light up.
- If this doesn't work repeat steps one and two.
- Place a bit of black electrical tape on the white surface and slowly sweep K8 over the line. The columns of LEDs should turn off when the corresponding sensor sees the black tape.
TESTING THE TRACK
- Create a closed-loop track using black electrical tape on a white surface.
- Create the following code to test your track.
K8's eyes may look similar to ours with being two round holes, but they behave very differently. K8's eyes behave more like the way a bat or dolphin would detect objects within their habitat using echolocation. Echolocation is where properties of sound are used to bounce signals off of objects and judge how far away the objects are.
Copy the code below to test K8's sonar and make sure it is detecting objects correctly.
Place K8 in front of a wall, move K8 closer to the wall and further away from the wall. The LEDs on the micro:bit should be changing, this shows that the sonar sensor is working and K8 is detecting objects.
Here is some sample code to show K8 detecting and avoiding objects.
We are going to use the radio function on the micro:bits so we can introduce a second micro:bit to control K8.
Here is the example code for the controller:
Here is the example code for K8:
We have covered the basics of programming K8. You can now go and explore with K8 and MakeCode to see what else K8 can do!