Table of Contents

read digital sensor () at ()

read digital sensor

Description

Read digital sensor () at () block is a reporter block available in sensors extension for evive and all Arduino boards. The block reports the digital state of the digital sensor, connected to the selected digital pin.

  1. Available pins in evive: 26 digital pins available for the user (2-27)
  2. Available pins in Arduino Mega: 52 digital pins available for the user (2-53)
  3. Available pins in Arduino Uno: 12 digital pins available for the user (2-13)
  4. Available pins in Arduino Nano: 12 digital pins available for the user (2-13)

Available digital sensors:

  1. IR proximity sensor
  2. Touch sensor
  3. PIR motion detector
  4. Soil moisture sensor
  5. Hall effect sensor
  6. Generic digital sensor

read digital sensor 2

 

evive Notes Icon
Note: This block is available in both Upload mode and Stage mode.

Example

  1. Displaying the reading of the digital sensor on TFT display of evive.
    read digital sensor example

Example

Discover the fascinating world of touch sensors and how they operate based on changes in capacitance caused by static charges from conductive objects.
introduction

Touch sensors are innovative devices that respond to changes in capacitance resulting from static charges generated by conductive objects. Their unique working principle enables them to detect touch interactions, making them ideal for various applications, including touch-sensitive buttons and interactive surfaces.

Circuit

Code

  1. Add an “if” block from the controls palette into the scripting area.
  2. From the Arduino sensor palette, add “read digital sensor () at pin()” inside the “if” block. Choose “touch sensor” from the drop-down menu
  3. Create a variable and name it “count.” Increment the count by 1 inside the “if” block, which helps keep track of touch interactions.
  4. Now use an “if then else” block inside the “if” block to check whether the count variable is even or odd. The modulo (mod) block from the Arduino palette can be utilized for this purpose.
  5. Based on the condition, control the LED to turn it ON for even counts and OFF for odd counts.
  6. Add the “set digital pin () output as ()” block from the Arduino palette within the “if” and “else” blocks, respectively.
  7. Set the “count” variable to 0 at the beginning of the code to ensure accurate counting from the start.
  8. Add a “when flag clicked” block from the events palette to initiate the code execution.

Script

  • Output

Read More
Discover how Passive Infrared (PIR) motion sensors work, their principle of detecting infrared radiation, and their applications in security systems and lighting control
Introduction

A Passive Infrared (PIR) motion sensor is a device commonly used in security systems, lighting control, and other applications to detect the presence of a moving object or person by measuring changes in infrared radiation. It’s called “passive” because it doesn’t emit any energy itself; it only detects the infrared radiation emitted by objects in its field of view.

  1. Detection Principle: PIR sensors work based on the fact that all objects with a temperature above absolute zero (-273.15°C or -459.67°F) emit infrared radiation. PIR sensors are designed to detect changes in the amount of infrared radiation in their surroundings.
  2. Sensor Construction: A PIR sensor typically consists of two pyroelectric sensors, which are sensitive to changes in temperature, and a special Fresnel lens that focuses the infrared radiation onto these sensors.

Overview | PIR Motion Sensor | Adafruit Learning System

Circuit

connection

IR_VCC – 5v

IR_GND – GND

IR_OUTPUT – D7

LED+ to D9

LED- to  GND

Resistance -270

Code

Create a circuit as per the above circuit diagram

  1. From control drag  if -else block.
  2. From the Arduino sensor palette, add a “read digital sensor () at ()” block. Choose “PIR” as the sensor type and select pin 7.
  3. The sensor’s detection of an object will alter the status of pin 7 from LOW to HIGH. In response to object detection, add the “set digital pin () output as ()” block from the Arduino palette within the “if” block.
  4. For the “else” part, ensure the LED turns off when no object is in front of the sensor.
  5. Drag a “forever” block from the controls palette and place the above set of blocks inside it.
  6. finally, add when flag clicked block from events palette

 

Script

Output

OUTPUT will be updated soon

Read More
Discover how a metal touch sensor works, generating signals upon contact with charged objects. Learn to build a touch-responsive switch circuit using Arduino.
introduction

A metal touch sensor is a type of sensor that generates signals when touched by any charged object. it has a transistor-like element which sensor the external touch on it, based on thee signal generated we can use this sensor as a switch or any other application.

Circuit

 

 

Code

  1. Add an “if” block from the controls palette into the scripting area.
  2. From the Arduino sensor palette, add “read digital sensor () at pin()” inside the “if” block. Choose “touch sensor” from the drop-down menu
  3. Create a variable and name it “count.” Increment the count by 1 inside the “if” block, which helps keep track of touch interactions.
  4. Now use an “if then else” block inside the “if” block to check whether the count variable is even or odd. The modulo (mod) block from the Arduino palette can be utilized for this purpose.
  5. Based on the condition, control the LED to turn it ON for even counts and OFF for odd counts.
  6. Add the “set digital pin () output as ()” block from the Arduino palette within the “if” and “else” blocks, respectively.
  7. Set the “count” variable to 0 at the beginning of the code to ensure accurate counting from the start.
  8. Add a “when flag clicked” block from the events palette to initiate the code execution.

Script


  • Output

Read More
Understand how PIR sensors detect moving objects based on changes in infrared radiation.
Introduction

A Passive Infrared (PIR) motion sensor is a device commonly used in security systems, lighting control, and other applications to detect the presence of a moving object or person by measuring changes in infrared radiation. It’s called “passive” because it doesn’t emit any energy itself; it only detects the infrared radiation emitted by objects in its field of view.

  1. Detection Principle: PIR sensors work based on the fact that all objects with a temperature above absolute zero (-273.15°C or -459.67°F) emit infrared radiation. PIR sensors are designed to detect changes in the amount of infrared radiation in their surroundings.
  2. Sensor Construction: A PIR sensor typically consists of two pyroelectric sensors, which are sensitive to changes in temperature, and a special Fresnel lens that focuses the infrared radiation onto these sensors.

Overview | PIR Motion Sensor | Adafruit Learning System

 

 

Circuit Diagram:

 

Code:

Follow these steps to implement the code using Pictoblox for Quarky to control the LED based on the PIR sensor’s readings:

  1. Open Pictoblox and create a new file in block coding.
  2. Go to boards and select Quarky.
  3. Add an if-then-else block from the controls palette
  4. From sensor palette of Quarky, add “read digital senor () at pin ()” block in if-then-else block.
  5. Now if the D2 is high, the LED must turn ON by set D1 to High.
  6. Else the LED must remain OFF.
  7. Put the above set of code into the Forever block 
  8. Finally, add “when flag clicked” block at the start of the code. With this simple script your project is complete now.

OUTPUT

In this comprehensive introduction, you have learned about Quarky, the versatile microcontroller, and its potential in robotics and AI projects. Explore its various features, sensors, and plug-and-play functionality. Follow our step-by-step guide to set up the circuit with the PIR sensor and LED, and program Quarky using Pictoblox’s block coding. Witness the successful implementation through the final script and output, experiencing the magic of Quarky in action!

Read More
Learn about the components of the sensor module, including the IR LED and photodiode, and understand the circuit connections.
Introduction

he IR (Infrared) sensor, a remarkable obstacle detection sensor, relies on the fundamental principle of light reflection. Within its compact module, the IR LED emits infrared radiation forward into its environment. As these radiant waves encounter any object along their path, they bounce back toward the sensor module. The photodiode, often identified by its black color, plays a crucial role in detecting these reflected rays.

Circuit

connection

IR_VCC – 5v

IR_GND – GND

IR_OUTPUT – D7

LED+ to D9

LED- to  GND

Resistance -270

Code

create a circuit on the breadboard as per the above circuit diagram

  1. From control drag  if -else block.
  2. From the Arduino sensor palette, add a “read digital sensor () at ()” block. Choose “proximity” as the sensor type and select pin 7.
  3. The sensor’s detection of an object will alter the status of pin 7 from LOW to HIGH. In response to object detection, add the “set digital pin () output as ()” block from the Arduino palette within the “if” block.
  4. For the “else” part, ensure the LED turns off when no object is in front of the sensor.
  5. Drag a “forever” block from the controls palette and place the above set of blocks inside it.
  6. finally, add when flag clicked block from events palette

 

Script

Output

Read More
All articles loaded
No more articles to load