Quarky 2 Wheel Drive Vertical Robot

Description
Learn how to assemble and program a Quarky 2-wheel drive vertical configuration for projects like Robot Pet with PictoBlox.

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:

  1. Remove the Battery Holder Lock and then the Battery Holders. Gently unsnap from the edges.
  2. Remove the Castor Wheel from the Robot using the Screwdriver.
  3. Attach Castor Wheel to the Castor Plate using the same M2.5 Bolt used in the last step.
  4. Attach the Battery to the Robot.
  5. Snap the Caster Plate to the back side of the Robot as shown.
  6. Mount the Battery Holders and the Battery Holder Lock 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.

  1. If the sensor detects nothing, its output value is increased. This means that the sensor is active.
  2. 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

  1. Open a new project by selecting New from File.
  2. Connect Quarky to PictoBlox.
  3. Go to the Variables palette and create two variables named L and R.PET1 (5)
  4. Next, make the following script to update the variable value to the left and right IR sensor values.
  5. 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.
  6. 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:
    1. L_High = 4095
    2. R_High = 4095
  7. Note the value of the Left and Right IR sensors when you put your hands in front of the robot:
    1. L_Low = 1700
    2. R_Low = 2200
  8. Next, do the average to get the threshold value:
    1. L_T = (L_High + L_Low)/2 = 2897
    2. 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.

  1. Add a when flag clicked block from the Events palette.
  2. Go to the Sensors palette and add two set () IR sensor thresholds to () block and write the threshold value you found above.
  3. 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.
  4. Then, add an if-else block inside the forever block.
  5. 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.
  6. To indicate that the sensor is active, let’s light up one of the LEDs of the dot matrix. 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.
  7. Duplicate the block and drop it under the else arm of the if-else block. Set the color as GREEN.
  8. Duplicate the if block and change the sensor to IR-R.

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:

  1. When the hand is detected on the Left sensor, turn left.
  2. When the hand is detected on the Right sensor, turn right.
  3. When the hand is detected on both the left and right sensors, introduce Quarky and smile.
  4. When nothing is detected, do nothing.

Lets Code

  1. Add a when flag clicked block from the Events palette.
  2. 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.
  3. Add set robot orientation as () block and set the orientation as vertical.
  4. 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.
  5. Then, add an if-else block inside the forever block.
  6. 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.
  7. Duplicate the if block and put it inside the two branches of the if blocks. Change the value to IR-L.
  8. Now we have four branches all indicating four conditions. Let’s go over it one by one.
    1. The first case is when no hand is detected. Add a clear screen block from the Display palette.
    2. 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.
    3. 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.
    4. 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 2wheel drive vertical configuration allows users to create various projects such as Expression Mimicking Robot, Robot Pet, Traffic Light Robot, etc. This article provided a stepbystep 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.

Table of Contents