Table of Contents

set LED x () y () to () with brightness () %

Description

The block changes the color of the particular RGB LED of Quarky.

LED Looping 4

The block has the following inputs:

  1. x position of the LED you want to control
  2. y position of the LED you want to control
  3. the color you want o display
  4. the brightness of the LED

Example

The example demonstrates how to control the individual LEDs of the Quarky and run patterns using the loops.

Script

Output

Read More
The example demonstrates how to calibrate the IR sensors to detect black lines on the white surface.

Logic

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.

But to detect colors, we depend on the number of rays the surface reflects:

  1. The dark surface will absorb more IR rays and as a result, the receiver will get fewer IR rays.
  2. White or shiny objects will absorb fewer IR rays and as a result, the receiver will get more IR rays.

We can get the sensor values in PictoBlox and based on that value we can estimate whether the surface is black or white.

  1. If the sensor detects the black line, its output value is increased. This means that the sensor is active.
  2. If it detects the white area, its output value decreases. This means that the sensor is inactive.

We will call the threshold value above which the sensor detects the black line. If the sensor value is less than the threshold, it means that the sensor hasn’t detected the line yet.

Alert: IR sensors DON’T work in sunlight. IR rays from the sun increase the overall threshold of the sensors therefore they stay active all time. A closed environment or nighttime is the place/time to work with your line following robot.

Script

Calibrating the IR Sensors

Now, run the script by clicking the green flag and bringing the black line of the track close to the IR sensor. One of the following three conditions will happen:

  1. Your calibration value is HIGH: The black region will not be detected in this case. Reduce the calibration value.
  2. Your calibration value is LOW: The white region will not be detected in this case. Therefore, increase the calibration value.
  3. Your calibration value is OK. The white and black regions are detected accurately.

Now modify the script to add the detection value for the right IR sensor.

Output

Read More
The example demonstrates how to create a random colored LED pattern on Quarky.

Script

Output

Read More
The example demonstrates how to control the glowing LED using the keyboard keys.

Script

Output

Read More
This example demonstrates how to use the Soil Moisture sensor to detect the moisture in the soil and water the plant using the drip system. The system will water the plant when the moisture of the soil is low.

This example demonstrates how to use the Soil Moisture sensor to detect the moisture in the soil and water the plant using the drip system. The system will water the plant when the moisture of the soil is low.

Drip Irrigation Assembly Guide

The following tutorials cover how to make the Drip Irrigation System:

  1. For 1 Plant: https://ai.thestempedia.com/docs/iot-house-quarky-addon-kit-documentation/1-plant-drip-irrigation-assembly-iot-house/
  2. For 2 Plants: https://ai.thestempedia.com/docs/iot-house-quarky-addon-kit-documentation/2-plants-drip-irrigation-assembly-iot-house/

Circuit

We are using 2 devices in this project:

  1. Moisture Sensor: The moisture sensor provides real-time moisture reading from the soil. The moisture sensor connections are as follows:
    1. GND Pin connected to GND of the Quarky Expansion Board.
    2. VCC Pin connected to VCC of the Quarky Expansion Board.
    3. Signal Pin connected to A2 of the Quarky Expansion Board.
  2. The Water Pump Connected to the Relay: The water pump is controlled by the smart switch of the IoT house which has a relay controlling the state. If the relay is ON, the smart switch gets ON, turning on the water pump. The relay has the following connections:
    1. GND Pin connected to GND of the Quarky Expansion Board.
    2. VCC Pin connected to VCC of the Quarky Expansion Board.
    3. Signal Pin connected to Servo 8 of the Quarky Expansion Board.

Note:  Once the connection is done, make sure you have the drip irrigation system placed with some water in the tank.

Script

The project has 3 scripts:

  1. Script to display the real-time moisture level on the display of the Quakry. Based on the moisture value, the number of LEDs will light up. The script is a custom block defined with the name – Display Soil Moisture Level.
  2. The second script is another LED display showing the animation of the watering. The script is a custom block defined with the name – Watering Animation.
  3. The final script is the main script which has the logic to detect the moisture value. If the value becomes less than 30%, the pump gets ON and the watering continues until the moisture level gets to 80%.

Output

Uploading Code

You can also make the script work independently of PictoBlox using the Upload Mode. For that switch to upload mode and replace the when green flag clicked block with when Quarky starts up the block.

Read More
All articles loaded
No more articles to load