Introduction: Top 3 Arduino Based Electronics Meters in Tinkercad | Simulation in Tinkercad | Liono Maker

About: Engineer

Introduction:

hi everyone, this is Liono Maker. This is an open source channel.

link to my channel: Link

In this tutorial we are working on Ultra Sonic sensor, LDR (photo Resistor) and PIR Sensor. By using these sensors we can make different types of meters and many more projects which are based on Arduino boards. i have used these sensors and try to make basic circuits and their codes also. You can download coding from the link given below and schematics also. The main three Arduino based Meters are;

1- Distance Meter ( used to measure distance and many other purposes)

2- LUX Meter

3- Material detector measurements (PIR: used to detect the material e.g. human beings. this sensor sends the signal to Arduino uno board, tell us what it has detected and measures).

1- Distance meter

Ultrasonic rangefinders are fun little modules that measure distance. You can use them to find the distance to an object or to detect when something is near the sensor like a motion detector. They’re ideal for projects involving navigation, object avoidance, and home security. Because they use sound to measure distance, they work just as well in the dark as they do in the light.

Ultrasonic range finders measure distance by emitting a pulse of ultrasonic sound that travels through the air until it hits an object. When that pulse of sound hits an object, it’s reflected off the object and travels back to the ultrasonic range finder. The ultrasonic range finder measures how long it takes the sound pulse to travel in its round-trip journey from the sensor and back. It then sends a signal to the Arduino with information about how long it took for the sonic pulse to travel. Knowing the time it takes the ultrasonic pulse to travel back and forth to the object, and also knowing the speed of sound, the Arduino can calculate the distance to the object. The formula relating the speed of sound, distance, and time traveled is:

distance = speed x time

The time variable is the time it takes for the ultrasonic pulse to leave the sensor, bounce off the object, and return to the sensor. We actually divide this time in half since we only need to measure the distance to the object, not the distance to the object and back to the sensor. The speed variable is the speed at which sound travels through the air. The speed of sound in air changes with temperature and humidity. Therefore, in order to accurately calculate distance, we’ll need to consider the ambient temperature and humidity. The formula for the speed of sound in air with temperature and humidity accounted for is:

C= 331.4+ (0.606 x T)+(0.0124 x H)

C: speed of sound in meters per second (m/s)

331.4: speed of sound (in m/s) at 0˚ C and 0%humidity

T: Temperature

H: % Humidity (Relative Humidity)

For example, at 20 C and 50% humidity, sound travels at a speed of:

C = 331.4 + (0.606 x 20) + (0.0124 x 50) C = 344.02 m/s In the equation above, it’s clear that temperature has the most significant effect on the speed of sound. Humidity does have some influence, but it’s much less than the effect of temperature.

HOW THE ULTRASONIC RANGE FINDER MEASURES DISTANCE
On the front of the ultrasonic range, finder are two metal cylinders. These are transducers. Transducers convert mechanical forces into electrical signals. In the ultrasonic rangefinder, there is a transmitting transducer and receiving transducer. The transmitting transducer converts an electrical signal into the ultrasonic pulse, and the receiving transducer converts the reflected ultrasonic pulse back into an electrical signal. If you look at the back of the rangefinder, you will see an IC behind the transmitting transducer labeled MAX3232. This is the IC that controls the transmitting transducer. Behind the receiving transducer is an IC labeled LM324. This is a quad Op-Amp that amplifies the signal generated by the receiving transducer into a signal that’s strong enough to transmit to the Arduino.

The HC-SR04 ultrasonic range finder has four pins: Vcc, Trig, Echo, and GND. The Vcc pin supplies the power to generate the ultrasonic pulses. The GND pin is connected to ground. The Trig pin is where the Arduino sends the signal to start the ultrasonic pulse. The Echo pin is where the ultrasonic range finder sends the information about the duration of the trip taken by the ultrasonic pulse to the Arduino. To initiate a distance measurement, we need to send a 5V high signal to the Trig pin for at least 10 µs. When the module receives this signal, it will emit 8 pulses of ultrasonic sound at a frequency of 40 KHz from the transmitting transducer. Then it waits and listens at the receiving transducer for the reflected signal. If an object is within range, the 8 pulses will be reflected back to the sensor. When the pulse hits the receiving transducer, the Echo pin outputs a high voltage signal. The length of this high voltage signal is equal to the total time the 8 pulses take to travel from the transmitting transducer and back to the receiving transducer. However, we only want to measure the distance to the object, and not the distance of the path the sound pulse took.

Therefore, we divide that time in half to get the time variable in the d = s x t equation above. Since we already know the speed of sound (s), we can solve the equation for distance.

Components Required:

1- Ultra Sonic Sensor

2- Arduino uno Board

3- Multimeter

Software:

1- Tinkercad

2- Arduino IDE

Coding For Distance meter:

Supplies

#define trigPin 10

#define echoPin 13

void setup() { Serial.begin (9600);

pinMode(trigPin, OUTPUT);

pinMode(echoPin, INPUT);}

void loop()

{

float duration, distance;

digitalWrite(trigPin, LOW);

delayMicroseconds(2);

digitalWrite(trigPin, HIGH);

delayMicroseconds(10);

digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);

distance = (duration / 2) * 0.0344;

if (distance >= 400 || distance <= 2){ Serial.print("Distance = ");

Serial.println("Out of range");

}

else

{

Serial.print("Distance = ");

Serial.print(distance);

Serial.println(" cm");

delay(500);

}

delay(500);

}

Step 1:

2- LUX METER

A simple way to define a lux meter is to say that it measures the brightness of the light falling on the sensor. Commercially accessible lux meters can vary in price from around $10 up to thousands of dollars, but it’s inexpensive and way more fun to build one yourself. For this project, we’ll use an LDR, write software to calculate illuminance, and build an Arduino and LDR based lux meter.

Building the lux meter is simple. You only need an Arduino, an LDR, and a 2.2 k ohm resistor. In theory, you can use any resistance value, but I chose 2.2 k ohm because the LDR’s resistance was in the order of a few kilo-ohms under typical room lighting conditions. Plug the shield into the Arduino, and build a simple voltage divider circuit with the LDR and resistor. The voltage divider circuit is the crux of our sensor circuit. The 5 volt supply is split between the LDR and the 2.2 k ohm resistor. As the LDR’s resistance changes, the fraction of the voltage across the two resistors changes as well. If the voltage across the 2.2 k ohm resistor is measured by the Arduino, it’s easy to add some code to determine the resistance that the LDR is exhibiting. The LDR connects to 5V; the resistor connects to ground and the point in between connects to analog input 0.

Components Required:

1) LDR

2) Arduino Uno

3) Breadboard

4) 2.2k ohm resistor

5) Multimeter

Software:

1- Tinkercad

2- Arduino IDE

Coding for LUX meter:

void setup() {
Serial.begin(9600);

}

void loop() {

int vout1 = analogRead(A0);// Read the analogue pin

float vout = vout1/204.6;

Serial.print(vout1);

Serial.print("DU");

Serial.print(vout);

Serial.println(" vout");

float R = (11000-vout*2200)/vout; // calculate the resistance //

float R = pow( X, -1);

Serial.print(R); // light dependant resistance

Serial.println(" Resistance.");

float lux= (pow( R, (1/-0.8616)))/(pow( 10, (5.118/-0.8616))); //lux calculation

Serial.print(lux); Serial.print(" Lux.");

Serial.println(""); delay(3000); //delay for a second //lux2

float lux2 = 65.9 * (pow( vout1, 0.352));

Serial.print(lux2);

Serial.print(" lux form2\n");

}

Step 2:

3- Material Detector Measurements (PIR motion sensor)

All objects with a temperature above absolute zero emit heat energy in the form of infrared radiation. The HR-SC501 passive infrared (PIR) sensor converts the infrared radiation into an output voltage. The PIR sensor has two halves to detect a change in infrared radiation, caused by an object moving in front of the PIR sensor, as movement is indicated by a change in infrared radiation not the level of infrared radiation. The Fresnel lenses above the PIR sensor increase the field of view of the PIR sensor to about 110° with a range of six meters. PIR sensors are used in motion detector alarms. The PIR sensor requires up to 60s to stabilize after switching on and the output stays HIGHfor a minimum of 2.5s after movement is detected. The time delay (Tx) and the sensor sensitivity (Sx) are increased by turning clockwise the appropriate potentiometer on the side of the module. Smaller movements are detected with high sensitivity with a distance range between 3m and 7m. The time delay ranges from 2.5s to 5min, so initially the most counterclockwise position is useful.

Components Required:

1- PIR Sensor

2- Arduino Board

3- Multimeter

4- LED

5- Resistor (1k)

Software:

1- Tinkercad

2- Arduino IDE

Coding :

int PIRpin = 11; // PIR sensor pin

int LEDpin = 8; // LED pin

int PIRstate = LOW; // set PIR state to LOW

int reading;

unsigned long detectTime; // time lag on PIR sensor

float moveTime;

void setup() {

Serial.begin(9600); // set Serial Monitor baud rate

pinMode(LEDpin, OUTPUT); // LED pin as output

} void loop() {

reading = digitalRead(PIRpin); // read PIR pin

if (reading == HIGH && PIRstate == LOW) // PIR detected new

{ // movement

Serial.print("New movement detected"); // print to Serial Monitor

detectTime = millis(); // time of movement

PIRstate = HIGH; // update PIR state to HIGH

digitalWrite(LEDpin, PIRstate); // turn LED on

} // movement no longer detected

else if (reading == LOW && PIRstate == HIGH)

{ moveTime = millis() - detectTime; // duration of movement

moveTime = moveTime/1000.0; Serial.print(" and lasted for "); // print to Serial Monitor

Serial.print(moveTime,1); // print detect time (s) with 1DP

Serial.println(" seconds");

PIRstate = LOW; // update PIR state to LOW

digitalWrite(LEDpin, PIRstate); // turn LED off }

}

Arduino Contest 2020

Participated in the
Arduino Contest 2020