Task: To use selection within a program
Before we get started, we want to thank Phil Wickins, along with a former pupil of his, William Bradley from Bitterne Manor Primary School, Southampton, for the inspiration for this project. You can find out more here.
There are a lot of steps for this one, mainly showing how the card template goes together. If you want to skip this bit and head straight to the wiring and code, click here.
1 First of all you need to gather all of your materials.
2 Begin by carefully cutting out all of the template pieces. Don’t forget to remove the pieces marked in red.
3 After cutting out, carefully score along all of the dashed fold lines.
4 Gently fold along all of the lines that you scored previously.
5 Starting with the head, apply glue to the grey tabs, and fold and stick the sides.
6 Keep gluing and stick the tabs to the sides. The main head should look like a cube.
7 Once you’ve stuck the head together, leave it to dry and it should look something like this.
8 Now move onto the light cover. Notice that the dark grey goes on the inside of the piece. This helps to block out unwanted light.
9 Next, move onto the base piece. Start with it printed side down, as shown.
10 Fold the tabs around, apply glue to them and fold and stick the sides up.
11 Apply glue to the three sets of rectangles, and fold them over.
12 From underneath, your base should look like this.
13 Now flip the base over, and fold the top of each side down. This is where prefolding really helps.
14 Glue the final tabs of the base piece, and stick the front to the sides.
15 Apply glue to the top folded pieces, as shown.
16 Now attach the base piece to the head. Take care to line up the front of the base with the bottom of the head.
17 Leave to dry, and you should have the majority of a scanner bot!
18 Wire up the Ultrasonic Distance Sensor, and push it through the two holes at the front.
19 Connect the Echo and Trigger pads to A and B on the Crumble.
20 This is how your bot should look so far.
21 Place a Sparkle onto the top of the bot, and croc clip it into place. Make sure you get the Sparkle the correct way around.
22 Wire up the Sparkle to the Crumble (+, – and D).
23 Next up, wire up the motor to the Crumble, and connect it to Motor 1.
24 With the motor in the clip, carefully slot it into the slots underneath the base of the scanner bot. It helps to push one side down and in, then the other.
25 Once in, centre the motor in the middle of the base.
26 Carefully push the wheel onto the motor shaft. It helps to put your hand in the battery pack slot, just above the motor.
27 Connect the Crumble to the battery pack, along with the Ultrasonic power, and put this into the battery slot in the base.
28 Then we want to add the Sparkle diffuser on the top. This should just slot in. You can glue this if you want, but if the Sparkle connection is loose, it is hard to change.
29 If using, place the Servo just inside the mouth, so that none of it protrudes. Hot glue works well to keep it in place, but blu tack will work as a temporary fix.
30 Attach one side of the mouth using the split pin.
31 Using the smallest screw included with your Servo (there should be one of these), attach the other side of the mouth. Don’t tighten it fully until you have set the Servo angle to close the mouth.
32 And there we have it, our Scanner Bot ready to be programmed!
33 First of all, let’s get our motor turning! Although this would work without being in a loop, we’re building up the code and will need it later on.
34 Now we’ve added in the Sparkle command, which will turn the Sparkle on to a colour of our choosing. In our case, green.
35 The next step is to start using the Ultrasonic Distance Sensor. We’re using selection now, or a condition, to see if the distance of an object from the Ultrasonic is less than 10cm. If it is, then we want to stop the motor turning, and turn the Sparkle red. If not, turn the motor and set the Sparkle to green.
36 This time, instead of just turning the Sparkle on to red, we want it to flash different colours. We can achieve this by setting it to red, as before, waiting a short amount of time, and then setting it to another colour – we’ve chosen blue. We add another short wait in afterwards to make sure that Sparkle will stay blue long enough for us to see it. Now, if an object is less than 10cm way, and stays there, the motor will stop and the Sparkle will flash RED-BLUE-RED-BLUE etc.
37 Finally, we can get the mouth opening and closing. When attaching the mouth, we mentioned about not fully tightening the screw. Wait until you’ve run the program before doing it, this will set the Servo spindle to a ‘known’ postion, meaning we are less likely to accidentally destroy the robots mouth! We’ve set our angles as follows – -60 for closed, and 0 for open. You could very easily use different ones, depending on your servo/scanner bot design.
And there you have it, a Scanner Bot ready to detect intruders! You could easily decorate yours before or after building it, make one out of corrugated card, or design your own!
Ultrasonic Distance Measuring Sensor£3.00 (£3.60 inc. VAT) Add to basket
Pair of Wheels for Geared Motors£2.20 (£2.64 inc. VAT) Add to basket
Geared Motor Clip£0.50 (£0.60 inc. VAT) Add to basket
Official Crumble Starter Kit (2020)£20.00 (£24.00 inc. VAT) Add to basket
Pair of Geared Motors£5.00 (£6.00 inc. VAT) Add to basket
Micro Servo (with Crumbliser)£4.50 (£5.40 inc. VAT) Add to basket
Spotted a mistake? Let us know, we’re only human! By doing so, you’ll help to make our resources even better!