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
IoT House (Quarky) - Blocks, Python Functions, Projects | PictoBlox Extension
[PictoBloxExtension]

IoT House (Quarky)

Extensions Graphics-IOT House
Extension Description
Connect with the world & automate.

Introduction

The IoT House kit is perfect for those looking to explore the Internet of Things world. With 15+ activities, this kit will guide you through the basics of IoT and help you better understand how these systems work.

The Quarky IoT House kit has the following sensors/actuators:

  1. Motor with Fan
  2. Flame Sensor
  3. Infrared Distance Sensor
  4. Gas Sensor
  5. Humidity and Temperature Sensor
  6. Light Sensor
  7. Soil Moisture Sensor
  8. Motion Sensor
  9. RFID Sensor
  10. Servo Motor for Door Operation
  11. Relay module

Links for Assembly Instructions

You can follow the tutorials to assemble the IoT house and drip irrigation:

  1. IoT House – Assembly Guide: This tutorial will guide us through assembling the IoT House for Quarky.
  2. 1 Plant Drip Irrigation Assembly: This tutorial will show you how to put together the Quarky IoT House Addon kit to make a 1 plant drip irrigation system.
  3. 2 Plants Drip Irrigation Assembly: In this tutorial, you will be provided with instructions on how to use the Quarky IoT House Addon kit to assemble a drip irrigation system for two plants.

Python Object Declaration for Stage Mode

Stage mode is one of the two modes you can write your programs in Pictoblox. In this mode, you can write scripts for the sprite and boards to interact with sprites in real time. If you disconnect the board with Pictoblox, you cannot interact with the board anymore. In this mode, you can make games and animations interacting with Quarky.

You can toggle between the upload mode and stage mode using the button on the top right side of Pictoblox.

Note:  You have to upload the firmware into the device before interacting with it. Please refer to this doc: https://ai.thestempedia.com/docs/updating-quarky-firmaware-with-pictoblox/

In Python Coding Environment, use the following object declaration to use Python functions in Stage Mode:

iothouse = IoTHouse()

Upload Mode

Upload mode is one of the two modes you can write your programs in Pictoblox. This mode allows you to write scripts and upload them to the board so that you can use them even when it is not connected to your computer, for example, you need to upload a script for making moving robots.

In this case, Quarky will run offline according to the program and it can not interact with the stage.

In Python Coding Environment, use the following object declaration to use Python functions in Upload Mode:

import iothouse
Read More

PictoBlox Blocks

The block moves the Quarky robot in the specified direction. The direction can be “FORWARD”, “BACKWARD”, “LEFT”, and “RIGHT”.
The block is a hat block and starts the execution of the script added under it when the specified push button is pressed. 
The block plays the specified audio on the Quarky speaker. The block does not have any callbacks, so other blocks can be executed while this block is running.
The block opens the recognition window and shows the machine learning analysis on the camera feed. Very good for visualization of the model in PictoBlox.
The block opens the recognition window and shows the machine learning analysis on the camera feed. Very good for visualization of the model in PictoBlox.
The block sets the servo connections of the specified location to the specified pins.
The block opens the recognition window and shows the machine learning analysis on the camera feed. Very good for visualization of the model in PictoBlox.
The block sets the input for the number classification and regression model to the specified value. The dropdown of the inputs is dynamically populated according to the ML model trained. 
The block opens the recognition window and shows the machine learning analysis on the audio feed. Very good for visualization of the model in PictoBlox.
The block sets the boundaries for the stage. Available types: boxed with roof, boxed without roof, open with floor, and open without floor.
The block set the state of the relay connected to the selected pin to High or Low. A high state means that the pin will have 3.3V and for Low, the pin will be 0 V. This triggers the state of the relay.
The block initializes the Expansion Board of Quarky for use. Without initialization, the board will not respond to any other blocks.
The block connects the Quarky or ESP32 to the specified Wi-Fi and password. The block is only available in the Upload Mode when the code is uploaded to Quarky. 
The block sets the IFTTT event name and the webhook key for the project. 
The block initializes the quadruped robot and maps the 8 servos to the specified pins.
The block creates the CSV file with the specified name and links all the data storage to it. If the file already exists, then it rewrites it.
The block initializes the Quarky Mecanum Robot Drive Motors. This allows the code to have information on which port is connected to the Front Left, Front Right, Back Left, and Back Right Servo Motors.
The block sets the randomness and creativity level of the ChatGPT responses, varying from 0 to 1. This setting controls the creativity of the system, with higher values leading to more creative output. By default, the creativity value is set to 0.7.
The read state of digital pin () block is a boolean block available in Arduino Uno, Arduino Mega, and Arduino Nano boards. It reads the state of the digital pin on the hardware and returns either a True value (if the pin is set to “High”) or a False value (if the pin is set to “Low”).
The block does the pin assignments for a 16×2 display module. The specific pins that are assigned are for the Reset (RST), Enable (EN), Data 4 (D4), Data 5 (D5), Data 6 (D6), and Data 7 (D7) pins of the module. This initialization enables the code to use the 16×2 display.
This block initializes a Robotic Arm connected to a Quarky Expansion Board. The user can select the specific pin connected to the servo motors from a dropdown menu. Once initialized, the robotic arm will respond to code and be ready for further instructions.
Configure Quarky for advanced line following by connecting two IR sensors to analog pins or three IR sensors to digital pins for optimal alignment and control.
Starts the script when the green flag is clicked.
Moves the sprite a specified number of step forward.
Shows a specified message in a speech bubble above the selected sprite.
Pauses the script for a specified amount of time (in seconds).
This button allows to record a sound from mic.
After execution, the sprite will draw lines on the stage when sprite is moved.
After connection is established, moves the quarky a specified number of step forward.
Lights up the LED of the quarky with specified color.
All articles loaded
No more articles to load

Block Coding Examples

All articles loaded
No more articles to load

Python Functions

The function sends the specified data to the selected feed as a string.
Syntax: adaio.createdata(feedname = “feed name”, data = “0”)
The function makes the servo motors connected to the wheels orient towards the right. This orientation is used for making the robot turn right in a circle.
Syntax: setrightturnangle(Angle = 40)
The function sets the motors of a device to a specified speed. It uses a scale of -100 to 100, where -100 is the motor running in reverse at full speed, 100 is the motor running in the forward direction at full speed, and 0 is when the wheel is stopped.
Syntax: runallmotors(FL speed = 50, BL speed = 50, BR speed = 50, FR speed = 50)
The function sets the specified motor of the Quarky Expansion board to the specified direction (“FORWARD” or “BACKWARD”) and specified speed.
Syntax: runmotor(motor port = 1, direction = “FORWARD”, speed = 100)
The function is used to compute the arc tangent of the given angle in radians.
Syntax: math.atan(x)
This function takes four input parameters, the X, Y, and Z coordinates of the desired end position, and the amount of time to reach that position. It then divides the motion into smaller line segments, allowing the robotic arm to accurately and efficiently reach the specified location. The function then moves the robot arm from its current position to the specified end position within the given time frame.
Syntax: roboticArm.movexyzinline(XPOS = 0, YPOS = 150, ZPOS = 70, TIME = 1000)
Select the left and right IR sensors for line following, choosing between onboard Quarky IR sensors or external sensors connected to analog pins.
Syntax: setlinefollowerparameter(set_sensor = ‘left’, set_pin = ‘A1’)
This function is used to analyze the image received as input from the stage, for faces.
Syntax: analysestage()
The function sets its sprite’s X and Y position to the specified value. This block has no animation in its movement — it is the simplest way to move a sprite around the screen without displaying any animation (i.e. gliding).
Syntax: gotoxy(x = 100, y = 100)
The function changes the backdrop to the next in the list of backdrops, but if the current backdrop is the last in the list, the block will loop to the first.
Syntax: nextbackdrop()
The function clears any sound effects currently in place. However, it does not stop the sound currently being played.
Syntax: clearsoundeffects()
The function reports the mouse pointer’s current X position on the stage.
Syntax: mousex()
The function changes the specified value by the number input.
Syntax: changecolor(parameter = “color”, value = 10)
The function sets the RGB LED display matrix to display the animation specified: “happy”, “nerdy”, “thinking”, “angry”, “contempt”, “blink”, “fear”, “surprise”, “wink”, “wave”, and “crying”.
Syntax: showanimation(animation = “happy”)
The function initializes the ultrasonic sensor with specified echo and trig pins. 
Syntax: setultrasonicpins(sensor_number = 1, trig_pin = “D1”, echo_pin = “D2”)
The function sets the orientation of the robot to align the left and right movement of the robot in horizontal robot position and vertical robot position.
Syntax: setorientation(orientation = “HORIZONTAL”)
This function is used to analyze the image received as input from the specified URL of the image, for the feature.
Syntax: analyseURL(url = “https://ai.thestempedia.com/wp-content/uploads/2022/02/Robert-and-Chris.jpg”)
This function is used to analyze the image received as input from the image URL specified, for the handwritten and printed text.
Syntax: analyseURL(url = “https://ai.thestempedia.com/wp-content/uploads/2022/07/Hello-World.png”)
The function moves the servo motors of the pick and place robot to the place angle specified by the user.
Syntax: place()
The function sets the selected servo motor angle to the specified angle in the specified time. This creates a smooth motion for the servo motor from the current angle to the specified angle.
Syntax: movelimb(servo motor number = 1, angle = 90, time = 1000)
The function reports the state of the LDR (Light) sensor connected to the selected pin. The block returns 1 when the analog reading of the sensor is greater than the threshold value set by the user. Else it reports 0.
Syntax: ldrstatus(pin = “A1”)
The function returns the last data value of the specified feed as a string.
Syntax: adaio.getdata(feedname = “feed name”)
The function sets the servo motors of the Mars Rover to the specified angles.
Syntax: setwheelsangle(Front Left = 90, Front Right = 90, Back Left = 90, Back Right = 90)
The function sets the servo motors of the humanoid hip and leg to the specified angles at the specified speed.
Syntax: moveleg(time = 1000, servo angles = [90,90,90,90])
The function controls the speed of a selected motor, allowing it to run at a specified speed.
Syntax: runmotor(motor = “fl”, speed = 100)
The function stops the specified motor of the Quarky Expansion Board.
Syntax: stopmotor(motor port = 1)
The function takes two arguments – y-coordinate and x-coordinate – and produces an angle in radians from -(pi) to +(pi).
Syntax: math.atan2(y, x)
This function is used to move a robotic arm from its current position to a specific X, Y, and Z coordinate position over a specified period of time. It takes in multiple parameters, such as the current position of the arm, the coordinates to move to, and the interval in which to move. The function then determines how many steps must be taken in each axis to reach the destination point, and moves in the X axis first, then the Y axis, and lastly the Z axis before returning the successful result.
Syntax: roboticArm.movexyzonebyone(XPOS = 0, YPOS = 150, ZPOS = 70, TIME = 1000)
This function sets the IR threshold for either the default sensor or one connected to an analog pin.
Syntax: setirthreshold(set_sensor = ‘left’, set_value = 750)
This function displays the total number of faces detected in the camera feed or the stage.
Syntax: count()
All articles loaded
No more articles to load

Python Coding Examples

All articles loaded
No more articles to load
Table of Contents