Deprecated: Required parameter $query follows optional parameter $post in /var/www/html/wp-content/plugins/elementor-extras/modules/breadcrumbs/widgets/breadcrumbs.php on line 1215
Programming the Mars Rover with Block Coding in PictoBlox
[MarsRover]

Programming the Mars Rover with Block Coding in PictoBlox

Description
Learn how to program and control the Quarky Mars Rover with PictoBlox Block Coding. Learn how to install the software and the robot, connect the robot with PictoBlox, and calibrate the robot’s servo motors.

Introduction

Quarky Mars Rover is a miniature version of Mars Rovers sent to Mars by NASA. It has 5 servo motors – 4 in the legs to control the wheel position and 1 in the head. It also has 6 motors to control the motion of the robot which allows it to move forward, backward, left, and right.

The robot is programmable with PictoBlox. PictoBlox is coding education software that uses both graphical block-based coding and Python programming.

With PictoBlox, you can program the Mars Rover for different applications!

If you haven’t installed PictoBlox, please follow the instructions:

Windows Installer (.exe)

STEP 1: Download the Pictoblox Installer (.exe) for Windows 7 and above (Release Notes).

STEP 2: Run the .exe file.

Some of the device gives the warning popup. You don’t have to worry, this software is harmless. Click on More info and then click on Run anyway.

STEP 3: Rest of the installation is straight forward, you can follow the popup and check on the option appropriate for your need.

 

Your software is now installed!

macOS Installer

STEP 1: Download the Pictoblox Installer (.dmg).

STEP 2: Run the .dmg file.

Mobile App Installer

STEP 1: Open Google Play Store on your Smartphone and and search for PictoBlox or visit the link here to head over to the Google Play Store. You can even scan the QR Code below from your Smartphone to head to the PictoBlox App.

STEP 2: Install the PictoBlox App.

Connecting Quarky with PictoBlox

Let’s begin by first connecting Quarky to PictoBlox. Select your preferred type of device i.e. either the desktop/laptop or your smartphone and follow the instructions.

Desktop

Follow the steps below for connecting Quarky to PictoBlox:

  1. First, connect Quarky to your laptop using a USB cable.
  2. Next, open PictoBlox on your desktop.
  3. After that, select Block as your coding environment.
  4. Then, click the Board button in the toolbar and select board as Quarky.
  5. Next, select the appropriate Serial port if the Quarky is connected via USB or the Bluetooth Port if you want to connect Quarky via Bluetooth and press Connect.
    COM Port
  6. Click on the Upload Firmware button. This will upload the latest firmware in Quarky.
    Note: If your device already has the latest firmware, then PictoBlox will show the message – Firmware is already updated. For learning more you can refer to this tutorial: https://ai.thestempedia.com/docs/quarky/quarky-toubleshooting/updating-quarky-firmaware-with-pictoblox/
  7. Once the firmware is uploaded, Quarky starts the Getting Started program. This runs only for the first time. Run through it.

And voila! Quarky is now connected to PictoBlox.

Mobile

Follow the steps below for connecting Quarky to PictoBlox:

  1. First, power ON Quarky.
  2. Open PictoBlox on your smartphone. Go to My Space and make a new project by clicking the ‘+(plus)’ button in the bottom-right corner.
    PictoBlox in Mobile Phone
  3. Then, tap the Board button in the top-right corner of the toolbar.
    PictoBlox BoardSelect board as Quarky.
  4. Next, tap the Connect button:
    PictoBlox ConnectSelect your device from the list.

And voila! Quarky is now connected to PictoBlox.

Quarky Mars Rover Extension

The Mars Rover extension in PictoBlox allows you to control the robot. It has blocks for specific applications. To add the Mars Rover extension follow the instructions:

  1. Click on the Add Extension button and add the Quarky Mars Rover extension.
  2. You can find the Quarky Mars Rover blocks available in the project.

PictoBlox Blocks for Mars Rover

The following blocks are available for the Mars Rover:


Warning: Undefined array key "pp_wrapper_link" in /var/www/html/wp-content/plugins/powerpack-elements/extensions/wrapper-link.php on line 194

Warning: Undefined array key "pp_wrapper_link_enable" in /var/www/html/wp-content/plugins/powerpack-elements/extensions/wrapper-link.php on line 196

Warning: Undefined array key "pp_custom_cursor_icon" in /var/www/html/wp-content/plugins/powerpack-elements/extensions/custom-cursor.php on line 350

Warning: Undefined array key "pp_custom_cursor_text" in /var/www/html/wp-content/plugins/powerpack-elements/extensions/custom-cursor.php on line 351

Warning: Undefined array key "pp_custom_cursor_target" in /var/www/html/wp-content/plugins/powerpack-elements/extensions/custom-cursor.php on line 352

Warning: Undefined array key "pp_custom_cursor_css_selector" in /var/www/html/wp-content/plugins/powerpack-elements/extensions/custom-cursor.php on line 353

Warning: Undefined array key "pp_custom_cursor_enable" in /var/www/html/wp-content/plugins/powerpack-elements/extensions/custom-cursor.php on line 355
The block enables or disables the automatic display of the box on the QR code on the stage. This is useful when you want to see if the detection happens or not.
The function returns the temperature, minimum, and maximum temperature of the location.
The block pauses its script for the specified amount of beats, which can be a fraction.
The block gets values of the video, either motion (on a scale of 1 to 100) or direction (which way the detected motion is going, measured on the same plane as sprite direction), on either the Stage or the current sprite. If there is no video, the block will return -1. It calculates the values based on “optical flow”.
The block removes all marks made by the pen or stamping. It is the only pen block that the Stage can use.
The block reads the digital value of the sensors connected to the specified pin. The block returns True or False.
The block moves the Quarky robot in the specified direction for the specified time. The direction can be “FORWARD”, “BACKWARD”, “LEFT”, and “RIGHT”.
The block returns the state of the specified push button. If the button is pressed it returns True or else False.
The block plays the specified audio on the Quarky speaker. The block has a callback, so other blocks will be executed after the audio is played.
The turn () video on stage with () % transparency block controls the control the camera feed on the stage.
This block should be included with the Mars Rover for the first time as it calibrates the angles of all five servo motors and saves the angles in the memory of Quarky.
Once the input is given the value using the set () as () block, the analyse numbers block runs the inputs through the ML model and stores the output values in PictoBlox.
The block checks if the currently recognized class from the recognition window is the selected class or not.
The block sets the gravity for the physics engine in the defined x and y directions.
The block activates the sprite under this hat block when the sensor connected to the selected pin becomes HIGH (or 3.3V). The block is used for digital sensors like PIR Sensor, Flame Sensor, or the IR Sensor.
The block sets the servo motor connected to the specified servo pin of the Quarky Expansion board to the specified angle. The expansion board can control 8 servos at a time.
The block set up the API connection between the PictoBlox and the Adafruit server with the specified username and AIO key. 
The block sets the defined value 1, 2, or 3 in the body of the IFTTT request to the specified value.
This block should be included every time you work with the quadruped as this block calibrates the angles of the servo motors and saves it in the memory of Quarky. Due to some mechanical assembly errors, there may be some misalignment of the servos which can be handled with this block.
The block is used for creating the data row for the CSV file. The data number specifies the column for the data value.
This block calibrates the angles of the hip and foot servo motors and saves it in the memory of Quarky. Due to some mechanical assembly errors, there may be some misalignment of the servos which can be handled with this block.
The block makes the robot move in the specified direction at the specified speed.
The maximum length in ChatGPT is the maximum number of words that can be used in a single message. This is usually set by the users and can vary depending on the use case. It is usually set to prevent messages from becoming too long and cluttered.
This block reads the value from the analog pins of boards such as Arduino Uno, Arduino Mega, or Arduino Nano. It returns the 10-bit resolution of the analog pin, with a range of 0 – 1023, which is mapped to the voltage of the pin (usually 0 – 5V). For example, if the value received is 512, then the voltage is roughly 2.5V.
This block of code is setting up an I2C LCD module by initializing it with an address code.
This block is a calibration process for the robotic arm. It is used to measure and save the offset angle of the servo motors in the memory of the Quarky.
Starts the script when you click on the sprite.
Moves the sprite a specified number of steps backward.
Makes the sprite appear as if fully visible.
Runs the blocks inside a specified of times.
All articles loaded
No more articles to load

Activity: Calibrating Mars Rover

In this activity, we are going to calibrate the Mars Rover servo motors. Due to some mechanical assembly errors, there may be some misalignment of the servos which can be handled with set offset to head (), FL (), FR (), BL (), BR () block.

Follow the steps:

  1. Open new project in PictoBlox.
  2.  Connect Quarky to PictoBlox.
  3. Click on the Add Extension button and add the Quarky Mars Rover extension.
  4. Make the following code:

Run the code with Green Flag. Now you have to make sure that the robot has the following orientation:

If you find any twist of angle in the robot wheels, edit the value of the servo motor in the set offset to head (), FL (), FR (), BL (), BR () block. If this step is not done properly, your robot may move in an incorrect manner.

Note:  This has to be done only once as the offset values are stored in the memory of the robot.

Conclusion

In conclusion, Quarky Mars Rover is a miniature version of Mars Rovers sent to Mars by NASA. It can be programmed using PictoBlox, where you can program the Mars Rover for different applications. To connect Quarky to PictoBlox, you can use either your desktop/laptop or your smartphone. The Mars Rover extension in PictoBlox allows you to control the robot. You can use the blocks to calibrate the servo motors, allowing the robot to move in the desired orientation. With the help of PictoBlox and the Mars Rover extension, you can now explore the possibilities of programming a small Mars Rover!

Table of Contents