Introduction
Quarky 2-wheel drive vertical configuration helps you create projects like Expression Mimicing Robot, Robot Pet, Traffic Light Robot, etc.
In this robot, 2 active motors are controlling the wheels and one passive castor wheel is at the back of the robot. Using the motors, you can make the robot go forward, backward, left, and right easily.
Assembly
Follow the steps to assemble the Vertical robot from the standard horizontal robot. The horizontal robot looks like this:
- Remove the Battery Holder Lock (A2) and then the Battery Holders (A1). Gently unsnap from the edges.
- Remove the Castor Wheel from the Robot using the Screwdriver.
- Attach Castor Wheel to the Castor Plate (A5) using the same M2.5 Bolt used in the last step.
- Attach the Battery to the Robot.
- Snap the Caster Plate to the back side of the Robot as shown.
- Mount the Battery Holders (A2) and the Battery Holder Lock (A1) to secure the battery.
Your robot is ready.
Project 1 – Making a Hand Detection System
In this activity, we will make the Quarky detect the hands.
Quarky has 2 IR sensors that we will use.
An IR sensor consists of 2 LEDs: one which transmits the IR light and one which receives the IR light. When the IR rays are transmitted, they bounce from the nearest surface and get back to the receiver LED. That’s how an IR sensor detects an object.
We can get the sensor values in PictoBlox based on that value. We can estimate whether there is an obstacle.
- If the sensor detects nothing, its output value is increased. This means that the sensor is active.
- If it detects an obstacle, its output value decreases. This means that the sensor is inactive.
We need first to calibrate the IR sensors, i.e., make sure they’re working fine. For that, we’ll make a script in PictoBlox to calibrate them.
Finding the Threshold Values
- Open a new project by selecting New from File.
- Connect Quarky to PictoBlox.
- Go to the Variables palette and create two variables named L and R.
- Next, make the following script to update the variable value to the left and right IR sensor values.
- You will notice that it appears in the top-left corner of the stage. We’ll use the variables to determine the threshold value for our IR sensors.
- Note the values of the Left and Right IR sensors when no obstacle is there in front of the robot. For example, in the above case:
- L_High = 4095
- R_High = 4095
- Note the value of the Left and Right IR sensors when you put your hands in front of the robot:
- L_Low = 1700
- R_Low = 2200
- Next, do the average to get the threshold value:
- L_T = (L_High + L_Low)/2 = 2897
- R_T = (R_High + R_Low)/2 = 3147
Remember these values.
Getting Feedback via LEDs
Now, to check if the value works fine for our sensors, let’s add a feedback loop, something that will indicate that the sensor has detected the black line.
- Add a when flag clicked block from the Events palette.
- Go to the Sensors palette and add two set () IR sensor thresholds to () block and write the threshold value you found above.
- Next, add a forever block from the Control palette. We’re using this block because we want to check if the sensor detects the line continuously.
- Then, add an if-else block inside the forever block.
- Next, go to the Sensors palette and add an is () IR sensor active? block inside the white space of the if-else block. The IR sensor will be active when it detects the black line. This means that its value should be greater than the threshold value. This block will essentially check if the sensor value is greater than the threshold value.
- To indicate that the sensor is active, let’s light up one of the LEDs of the dot matrix (Top left for Left sensor- IRL). From the Display palette, add a set LED x () y () to () with brightness () block under the if arm of the if-else block. Set the color as RED from the drop-down by clicking the color circle on the block.
- Duplicate the block and drop it under the else arm of the if-else block. Set the color as GREEN.
- Duplicate the if block and change the sensor to IR-R and x to 7 as we want the right top LED to glow for the right sensor IRR.
Run the program and test the code.
Project 2: Making a Robo-Pet
The objective is to make the robot execute certain actions when it detects a hand:
- When the hand is detected on the Left sensor, turn left.
- When the hand is detected on the Right sensor, turn right.
- When the hand is detected on both the left and right sensors, introduce Quarky and smile.
- When nothing is detected, do nothing.
Lets Code
- Add a when flag clicked block from the Events palette.
- Go to the Sensors palette and add two set () IR sensor thresholds to () block and write the threshold value you found in the last lesson.
- Add set robot orientation as () block and set the orientation as vertical.
- Next, add a forever block from the Control palette. We’re using this block because we want to check if the sensor detects the line continuously.
- Then, add an if-else block inside the forever block.
- Next, go to the Sensors palette and add an is () IR sensor active? block inside the white space of the if-else block. The IR sensor will be active when it detects the black line. This means that its value should be greater than the threshold value. This block will essentially check if the sensor value is greater than the threshold value.
- Duplicate the if-else block and put it inside the two branches of it. Change the value to IR-R.
- Now we have four branches all indicating four conditions. Let’s go over it one by one.
- The first case is when no hand is detected. Add a clear screen block from the Display palette.
- The second case is when the IR-R sensor detects the hand. In this case, the robot will turn Left. Add go () at () % speed for () seconds block from the Robot palette. Set the direction to left and time to 0.3 seconds.
- The third case is when the IR-L sensor detects the hand. In this case, the robot will turn Right. Add go () at () % speed for () seconds block from the Robot palette. Set the direction to right and time to 0.3 seconds.
- Lastly, both sensors detect the hand. Make the Robot smile and play sound – Hi, I am Quarky using the play sound () until done block.
The code is complete.
Run and test it.
Conclusion
In conclusion, Quarky’s 2–wheel drive vertical configuration allows users to create various projects such as Expression Mimicking Robot, Robot Pet, Traffic Light Robot, etc. This article provided a step–by–step guide on how to assemble and program the robot for two different projects. With the help of this robot and the PictoBlox software, users can easily create their robot projects.