close

ARDUINO

ARDUINO

Arduino Based Auto Weighing Machine

In a last few years there the e-commerce business is growing more and more. The e-commerce company needs ready made products in a good packing. The basic requirements in our home are grocery products which are used daily basis like cumin seed, sauf, mirchi, haldi, gehu, rice etc.

In a last few month we have seen that due to covid-19, the product should not only neat and clean but also germs proof. It means while packing the products direct touching of the products should be avoided as its are food materials.

In this project we have made a machine in which we have to only fill up the material in the hopper and set the weight we need and start it. Now the machine will weight the material as you have set and after weighing the material it releases the material to the out side where we have kept the plastic bag or any collector.

Parts used in this model

  • Arduino Nano
  • Load cell 30 Kg.
  • Weighing Scale Motherboard
  • Keypad of 4 keys
  • Servo motor
  • 16X2 LCD
  • I2C driver for 16X2 LCD Driver
  • 7- Segment Display
  • Buzzer
  • MDF Board 10 Sq. Foot
  • 12V 2A Power Supply

You may find arduino related

read more
ARDUINO

PIR CONTROLLED BARRIER

In this project we will see how the barrier is opened and closed when the human passes in front of the PIR sensor. When human comes in front of PIR sensor the barrier will be opened automatically and closed after 5 seconds.

This program is used to open the barrier. When there is a human movement in front of pir sensor,the output of pir sensor goes to high and the servo motor will be activated by 90 degree speedly and the red led will be off and green led will be on. After some time (4 second), it will come back to 0 degree slowly slowly and red led will be on and green led will be off. Also the detection range from 3 meter to 7 meter.

We have seen at some shopping malls and some offices, when any human comes near the gate the barrier or the gate opens automatically. And it closes if there is no movement. Using this technology we can reduce the man power to open or close the barrier or gate while human movement. In case of air condition hall, the gate is automatically open at human movement and close at no movement. So it reduces the cold air from passing out from the hall. So it may reduce the electricity load of an air condition. Thus we can save the electricity and human power. Hope you will understand this detail.

The material used in this project:

  1. Arduino uno
  2. USB cable for Arduino board power
  3. Arduino shield for dc motor, stepper motor and servo motor
  4. 5V 2A Power Supply for shield board power
  5. servo motor
  6. PIR sensor
  7. Green LED (5 mm) 1
  8. Red LED (5 mm) 1
  9. Resistor 330 ohm 2
  10. Female to Female Jumpers 10 pc
  11. Straw Pipe for barrier
Model Working
#include <Servo.h>
Servo myservo;      // create servo object to control a servo
int pos = 0;        // variable to store the servo position
const int red = A3; //define red led
const int grn = A2; //define green led
const int pir = A0; //pir sensor is sonnected at pin A0
int val = 0;        // variable to store the sensor status (value)
void setup()
{
  pinMode(pir,INPUT); //pir output pin is connected to A0 pin of an Arduino
  pinMode(red, OUTPUT); 
  pinMode(grn, OUTPUT);
  
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
  digitalWrite(red, HIGH); // turn the LED on 
  digitalWrite(grn, LOW); // turn the LED off 
  
  for (pos = 90; pos >= 0; pos -= 1)// goes from 90 degrees to 0 degrees
  { 
      myservo.write(pos);   // tell servo to go to position in variable 'pos'
     
      delay(20);            // waits 20ms for the servo to reach the position
  }
  
}
void loop() 
{
  
  val = digitalRead(pir);       // read sensor value
   
  if (val == HIGH)              // check if the sensor is HIGH 
  {
    for (pos = 0; pos <= 90; pos += 1) 
    {
        // goes from 0 degrees to 90 degrees in steps of 1 degree
      myservo.write(pos);   // tell servo to go to position in variable 'pos'
    
      delay(5);             // waits 5ms for the servo to reach the position
    }
    digitalWrite(red, LOW); // turn the LED off 
    
    digitalWrite(grn, HIGH); // turn the LED on    
    
    delay(4000);            //wait for 4000ms
    
    digitalWrite(red, HIGH); // turn the LED on 
    
    digitalWrite(grn, LOW); // turn the LED off 
     
    for (pos = 90; pos >= 0; pos -= 1)  // goes from 90 degrees to 0 degrees 
    {  
      myservo.write(pos);   // tell servo to go to position in variable 'pos'
      
      delay(20);            // waits 15ms for the servo to reach the position
    
    }
  }
}
read more
ARDUINO

PIR BASED GATE (SHUTTER) OPEN CLOSE

In this project we will see how the gate is opened and closed when the human passes in front of the PIR sensor. When human comes in front of PIR sensor the barrier will be opened automatically and closed after 5 seconds. This system has close loop technique.

This program is used to open the gate. When there is a human movement in front of pir sensor,the output of pir sensor goes to high and the servo motor will be activated by 90 degree speedly and the red led will be off and green led will be on. After some time (4 second), it will come back to 0 degree slowly slowly and red led will be on and green led will be off. Also the detection range from 3 meter to 7 meter.

Use dvd writer shutter mechanism as a gate. In this mechanism there a dc motor with rack and pinion assembly and limit switch assembly. The dc motor will move the mechanism up side to open the gate and down side to close the door when we apply the +5vdc to pin number 1 and ground to pin number 2. The limit switch has three pin. Pin 3 is the up side limit pin. Pin 4 is common pin and pin 5 is the down side limit pin. Pin 3 and 4 are connected with arduino shield with 10k pullup resistor as shown in diagram and pin 4 is connected with ground. In the mechanism there are 5 pins.

The motor will rotate to move the shutter up side till the pin 3 and pin 4 are open. When pin 3 and 4 are connected via limit switch assembly the motor will be stopped. And the opposite for close. This type of programming is done in this program.

This is very useful because in normal programming we have keep the delay for motor on or off. In this case the limit switch will inform the door is open or close.

Using Time Delay

/*This program is used to open the barrier. When there is a human movement 
 * in front of pir sensor,the output of pir sensor goes to high and 
 * the servo motor will be activated by 90 degree speedly and 
 * the red led will be off 
 * and green led will be on.
 * After some time (4 second), it will come back to 0 degree slowly slowly and 
 * red led will be on and green led will be off.
 * 
 * This project can be used at tall plaza, garage, society gate etc.
 * 
 * Note: The pir high duration can be adjustable from 5 sec to 200 sec using pot.
 * Also the detection range from 3 meter to 7 meter.
 * 
*/
/* Hardware Requirement
 * Arduino Uno 
 * USB cable for Arduino board programming
 * Arduino Shield for dc motor, stepper and servo
 * +5V 1A power supply for shield
 * PIR sensor
 * Servo motor 9g
 * 5mm Red LED 1
 * 5mm Green LED 1
 * 330 ohms Resistor 2
 * PVC straw
 * Female to Female Jumpers 10
 * 
 * 5V dc motor with rack and pinion mechanism
 * 
 * Note: In this code the gate opening and closing 
 * time is based on time delay.
*/
#include <Servo.h>
Servo myservo;      // create servo object to control a servo
int pos = 0;        // variable to store the servo position
const int red = A3;   //define red led
const int grn = A2;  //define green led
const int pir = A0; //pir sensor is sonnected at pin A0
int val = 0;        // variable to store the sensor status (value)
void setup()
{
  pinMode(pir,INPUT); //pir output pin is connected to A0 pin of an Arduino
  pinMode(red, OUTPUT); 
  pinMode(grn, OUTPUT);
  
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
  digitalWrite(red, HIGH); // turn the LED on 
  digitalWrite(grn, LOW); // turn the LED off 
  
  for (pos = 90; pos >= 0; pos -= 1)// goes from 90 degrees to 0 degrees
  { 
      myservo.write(pos);   // tell servo to go to position in variable 'pos'
     
      delay(20);            // waits 20ms for the servo to reach the position
  }
  
}
void loop() 
{
  
  val = digitalRead(pir);    // read sensor value
   
  if (val == HIGH)            // check if the sensor is HIGH 
  { 
    // goes from 0 degrees to 90 degrees in steps of 1 degree
    for (pos = 0; pos <= 90; pos += 1) 
    {
      myservo.write(pos);     // tell servo to go to position in variable 'pos'
    
      delay(5);               // waits 5ms for the servo to reach the position
    }
    digitalWrite(red, LOW); // turn the LED off 
    
    digitalWrite(grn, HIGH); // turn the LED on    
    
    delay(4000);    //wait for 4000ms
    
    digitalWrite(red, HIGH); // turn the LED on 
    
    digitalWrite(grn, LOW); // turn the LED off 
     
    for (pos = 90; pos >= 0; pos -= 1)// goes from 90 degrees to 0 degrees 
    {  
      myservo.write(pos);   // tell servo to go to position in variable 'pos'
      
      delay(20);            // waits 15ms for the servo to reach the position
    
    }
  }
}

Using Limit Switch

/*This program is used to open the gate when 
 * there is a human movement in front of pir sensor,
 * the output of pir sensor goes to high  and 
 * the servo motor will be activated by 90 degree speedly. 
 * After some time (10 second), it will 
 * come back to 0 degree slowly slowly.
 * Note: The pir high duration can be adjustable 
 * from 5 sec to 200 sec using pot.
 * Also the detection range from 3 meter to 7 meter.
 * 
 * Also in this project we have used DVD drive shutter mechanism 
 * to open or close the gate.
 * This project is used to open or close the garage door open 
 * automatically.
 * We hase used limit switch while openin or closing the door.
*/
#include <Servo.h>
#include <AFMotor.h>
AF_DCMotor motor(1);
Servo myservo;      // create servo object to control a servo
int pos = 0;        // variable to store the servo position
const int pir = A0; //pir sensor is sonnected at pin A0
const int upper = A5; //upper limit switch is sonnected at pin A4
const int lower = A4; //lower limit is sonnected at pin A5
const int red = A3;   //define red led
const int grn = A2;  //define green led
int val = 0;        // variable to store the sensor status (value)
int up = 0;         // variable to store the upper limit switch value
int lo = 0;         // variable to store the lower limit switch value
void setup()
{
  pinMode(pir,INPUT); //pir output pin is connected to A0 pin of an Arduino
  pinMode(upper,INPUT); 
  
  pinMode(lower,INPUT); 
  
  pinMode(red, OUTPUT); 
  pinMode(grn, OUTPUT);
  
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
digitalWrite(red, HIGH); // turn the LED on 
     digitalWrite(grn, LOW); // turn the LED off 
  for (pos = 90; pos >= 0; pos -= 1)// goes from 90 degrees to 0 degrees
  { 
      myservo.write(pos);              // tell servo to go to position in variable 'pos'
     
      //delay(20);                       // waits 20ms for the servo to reach the position
  }
  //Set initial speed of the motor & stop
  do
    {
      lo = digitalRead(lower);   // read lower switch value
      // Turn on motor
      motor.run(BACKWARD);
      motor.setSpeed(255);
    }while(lo == 1);  
    //delay(1000);    //wait for 10000ms
    motor.run(RELEASE);
  
  //motor.setSpeed(200);
  
  //motor.run(RELEASE);
  
}
void loop() 
{
  
  val = digitalRead(pir);    // read sensor value
  
  up = digitalRead(upper);   // read upper switch value
  
  lo = digitalRead(lower);   // read lower switch value
   
  if (val == HIGH)            // check if the sensor is HIGH 
  {
     for (pos = 0; pos <= 90; pos += 1) // goes from 0 degrees to 90 degrees in steps of 1 degree
     {
      again:
        myservo.write(pos);              // tell servo to go to position in variable 'pos'
    
        delay(1);                       // waits 5ms for the servo to reach the position
    }
    do
    {
      up = digitalRead(upper);   // read lower switch value
      // Turn on motor
      motor.run(FORWARD);
      motor.setSpeed(255);
    }while(up == 1);  
    //delay(1000);    //wait for 10000ms
    motor.run(RELEASE);
     digitalWrite(red, LOW); // turn the LED off 
     digitalWrite(grn, HIGH); // turn the LED on 
    delay(5000);    //wait for 10000ms
     digitalWrite(red, HIGH); // turn the LED on 
     digitalWrite(grn, LOW); // turn the LED off 
    for (pos = 90; pos >= 0; pos -= 1)// goes from 90 degrees to 0 degrees 
    { 
      
      myservo.write(pos); // tell servo to go to position in variable 'pos'
      
      delay(1);           // waits 15ms for the servo to reach the position
    }
    do
    {
    motor.run(BACKWARD);
    motor.setSpeed(255);  
    lo = digitalRead(lower);   // read upper switch value
    }while(lo==1);
    //delay(1000);    //wait for 10000ms
   motor.run(RELEASE); 
  }
}
read more
ARDUINO

FASTAG model using Arduino

In tall plaza the driver has to wait for the payment process either it may be cash or debit/credit card. So it will takes 30 sec to 180 seconds per vehicle for cash payment and it takes 15 seconds to 90 seconds in case of debit / credit card. Now in India there is a new technology for tall payment by using FASTAG. It pays online payment without stopping the vehicle at tall plaza. Lets see about FASTAG and the model of FASTAG using Arduino board.

What is FASTAG?

FASTag is a simple to use, reloadable tag which enables automatic deduction of toll charges and lets you pass through the toll plaza without stopping for the cash transaction. FASTag is linked to a prepaid account from which the applicable toll amount is deducted. The tag employs Radio-frequency Identification (RFID) technology and is affixed on the vehicle’s windscreen after the tag account is active.

 FASTag is a perfect solution for a hassle free trip on national highways.

Benefits

FASTag is read by the tag reader at the toll plaza. The toll amount is deducted automatically, when the vehicle approaches the toll plaza. The vehicle with FASTag doesn’t need to stop at the toll plaza for the cash transaction

SMS alerts and Online facility

Customer will receive SMS alerts on his registered mobile numbers for all the transactions done in his tag account. Customer may recharge his tag account online through, Credit Card/ Debit Card/ NEFT/ RTGS or Net Banking so Customer doesn’t need to worry about carrying cash for the toll payments. Customers can access their statements by logging on the FASTag customer portal

How this model works?

In this project we have used RF Tag and RF Reader in place of FASTAG and FASTAG Reader. When any vehicle with RF tag comes near the tall plaza, the RF reader will read the rf tag number. If it is an authenticated (tag number should be in the coding), the barrier openes and the vehicle will cross the barrier. When the vehicle crosses the IR TX-RX module completely, the barrier will be closed. In case of standing of vehicle in front of IR sensor the barrier will not closed. It is for safety purpose.

When any vehicle without rf tag or unregistered number (low balance or zero balance), the barrier will not open and the driver has to change the another lane for payment via cash or bank card.

In short, without stopping in front of the tall plaza barrier the bank deducts the toll amount before reaching the barrier and the barrier opens and then vehicle crosses the barrier. So it will save the time and fuel. The red led and green led are the signal leds for indication of barrier position either open or close.

Component used in the project

  1. Arduino uno
  2. USB cable for Arduino board power
  3. servo motor
  4. RF Reader
  5. RF TAG 2 or more
  6. Green LED (5 mm) 1
  7. Red LED (5 mm) 1
  8. Resistor 330 ohm 2
  9. TCRT 5000 IR TX-RX Sensor Modulle
  10. Female to Female Jumpers 10 pc
  11. Straw Pipe for barrier
  12. 4″x4″ PVC electrical case for servo motor fitting or servo motor clamp
  13. Toy cars 2
  14. wonder tape with two side gum

Program :

/*
 * This coding for 0 to 90 degree for servo motor
 * In case of reverse change the degree from 90 to 180 
 * or 180 to 90 as per servo placed in socket 
 * 
 */
 
#include <SPI.h>
#include <MFRC522.h>
#include <Servo.h>
Servo myservo;  // create servo object to control a servo
// twelve servo objects can be created on most boards
int pos = 0;    // variable to store the servo position
const int red = A3;   //define red led
const int grn = A2;  //define green led
const int ir = A0; //pir sensor is sonnected at pin A0
 
#define SS_PIN 10
#define RST_PIN 9
MFRC522 mfrc522(SS_PIN, RST_PIN);   // Create MFRC522 instance.
 
void setup() 
{
  Serial.begin(9600);   // Initiate a serial communication
  SPI.begin();      // Initiate  SPI bus
  mfrc522.PCD_Init();   // Initiate MFRC522
  Serial.println("Approximate your card to the reader...");
  Serial.println();
  pinMode(ir,INPUT); //pir output pin is connected to A0 pin of an Arduino
  pinMode(red, OUTPUT); 
  pinMode(grn, OUTPUT);
  digitalWrite(red, HIGH); // turn the LED on 
  digitalWrite(grn, LOW); // turn the LED off 
  
  myservo.attach(6);  // attaches the servo on pin 9 to the servo object
  myservo.write(0);  
}
void loop() 
{
  // Look for new cards
  if ( ! mfrc522.PICC_IsNewCardPresent()) 
  {
    return;
  }
  // Select one of the cards
  if ( ! mfrc522.PICC_ReadCardSerial()) 
  {
    return;
  }
  //Show UID on serial monitor
  Serial.print("UID tag :");
  String content= "";
  byte letter;
  for (byte i = 0; i < mfrc522.uid.size; i++) 
  {
     Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
     Serial.print(mfrc522.uid.uidByte[i], HEX);
     content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "));
     content.concat(String(mfrc522.uid.uidByte[i], HEX));
  }
  Serial.println();
  Serial.print("Message : ");
  content.toUpperCase();
  if (content.substring(1) == "7B 08 EA 1A") //change here the UID of the card/cards that you want to give access
  {
    
    myservo.write(90);
    digitalWrite(red, LOW); // turn the LED on 
    digitalWrite(grn, HIGH); // turn the LED off 
    
    Serial.println("Authorized access");
    Serial.println();
    //val = digitalRead(pir);    // read sensor value
    while (digitalRead(ir)==HIGH);
    delay(300);
    while (digitalRead(ir)==LOW);
    delay(500);
    
    
    digitalWrite(red, HIGH); // turn the LED on 
    digitalWrite(grn, LOW); // turn the LED off 
    myservo.write(0);
    
  }
 
 else   {
    Serial.println(" Access denied");
    delay(3000);
  }
} 
read more
ARDUINO

SMALL DIGITAL LOCKER FOR MOBILE AND WALLET IN OFFICE

Problem:

In corporate offices there is restriction of use of mobile for employees and visitors. Because of this the employee or visitor switches mobile in silent mode or switch off it. In silent mode the employee may use the mobile while working time. And most of employees do not want to switch off their mobiles while working ours. So the authority has to keep all the mobile in locker at time of joining the office and return back at the time of leaving office. Also in break time (lunch) the employees may ask the mobile for personal. So also the authorized person will give it back and keep once again after break period.

So in whole process the authorized person will keep the mobile in locker with identification of employee and return it with identification. The authority has to do this process minimum one time to maximum 2 or 4 times in a day. Keeping in a locker with identification and returning it back with identification in a day for more than one time is very difficult for a large number of employees.

Solution:

The simple solution of this problem is a SMALL DIGITAL LOCKER. In this model we have developed a small digital locker in which the employee has to keep a RF TAG in a form of small key chain. This key chain can be inserted with the key chain of vehicle key. So it is very easy to keep it in a pocket. In this model, the small locker will occupy 6″ x 9″ space per mobile in this model. But in a form of product the space may be reduced.

How to operate the locker?

The employee will come in the office with RF TAG key chain. Before joining the office work the employee will show the RF TAG in front of RF TAG READER module. The door of locker will open and he / she will put his / her mobile in it and once again shows the RF TAG in front if RF TAG READER so the door of locker will close. After keeping all mobiles in the different locker, the authorized person will switch off the power of this module so the locker will not operate. Now at the break time of or the office leaving time, the authorized person will switch on the power of locker. And once again the employee has to place the RF TAG in front of RF TAG Reader. So the gate of locker will open and the employee will take back his / her mobile. In case of large size of locker the employee can put their wallets in it.

Components:

  • Arduino Uno
  • RF Tag
  • RF Tag Reader
  • DVD writer door mechanism
  • Jumpers
  • RED LED 1
  • Green LED 1
  • 10K Resistor 2
  • 330 Ohms Resistor 2
  • acrylic or pvc sheet pieces for body
  • Wonder Tape
<pre data-mode="python" data-theme="xcode" data-fontsize="16" data-lines="Infinity" class="wp-block-simple-code-block-ace">/*
 * This coding simple digital locker.
 * please check the circuit diagram before 
 * uploading the program 
 */
 
#include &lt;SPI.h&gt;
#include &lt;MFRC522.h&gt;
#include &lt;Servo.h&gt;
Servo myservo;  // create servo object to control a servo
// twelve servo objects can be created on most boards
int pos = 0;    // variable to store the servo position
const int red = A3; //define red led
const int grn = A2; //define green led
const int m1p = A0; //define dc motor1 + terminal
const int m1n = A1; //define dc motor1 - terminal
const int upper = A5; //upper limit switch is sonnected at pin A4
const int lower = A4; //lower limit switch is sonnected at pin A5
 
#define SS_PIN 10
#define RST_PIN 9
MFRC522 mfrc522(SS_PIN, RST_PIN);   // Create MFRC522 instance.
int up = 0;         // variable to store the upper limit switch value
int lo = 0;         // variable to store the lower limit switch value
 
void setup() 
{
  Serial.begin(9600);   // Initiate a serial communication
  SPI.begin();      // Initiate  SPI bus
  mfrc522.PCD_Init();   // Initiate MFRC522
  Serial.println("Approximate your card to the reader...");
  Serial.println();
  pinMode(red, OUTPUT); 
  pinMode(grn, OUTPUT);
  pinMode(m1p, OUTPUT); 
  pinMode(m1n, OUTPUT); 
  digitalWrite(red, HIGH); // turn the LED on 
  digitalWrite(grn, LOW); // turn the LED off 
  
  gate_close();
  
}
void loop() 
{
  
  // Look for new cards
  if ( ! mfrc522.PICC_IsNewCardPresent()) 
  {
    return;
  }
  // Select one of the cards
  if ( ! mfrc522.PICC_ReadCardSerial()) 
  {
    return;
  }
  //Show UID on serial monitor
  Serial.print("UID tag :");
  String content= "";
  byte letter;
  for (byte i = 0; i &lt; mfrc522.uid.size; i++) 
  {
     Serial.print(mfrc522.uid.uidByte[i] &lt; 0x10 ? " 0" : " ");
     Serial.print(mfrc522.uid.uidByte[i], HEX);
     content.concat(String(mfrc522.uid.uidByte[i] &lt; 0x10 ? " 0" : " "));
     content.concat(String(mfrc522.uid.uidByte[i], HEX));
  }
  Serial.println();
  Serial.print("Message : ");
  content.toUpperCase();
  if (content.substring(1) == "7B 08 EA 1A") //change here the UID of the card/cards that you want to give access
  {
    
    gate_open();
    
    digitalWrite(red, LOW); // turn the LED on 
    digitalWrite(grn, HIGH); // turn the LED off 
    
    Serial.println("Authorized access");
    Serial.println();
    
  }
  else
  {
    Serial.println(" Access denied");
    delay(3000);
  }
  
  // Look for new cards
  if ( ! mfrc522.PICC_IsNewCardPresent()) 
  {
    return;
  }
  // Select one of the cards
  if ( ! mfrc522.PICC_ReadCardSerial()) 
  {
    return;
  }
  //Show UID on serial monitor
  Serial.print("UID tag :");
  //String content= "";
  //byte letter;
  for (byte i = 0; i &lt; mfrc522.uid.size; i++) 
  {
     Serial.print(mfrc522.uid.uidByte[i] &lt; 0x10 ? " 0" : " ");
     Serial.print(mfrc522.uid.uidByte[i], HEX);
     content.concat(String(mfrc522.uid.uidByte[i] &lt; 0x10 ? " 0" : " "));
     content.concat(String(mfrc522.uid.uidByte[i], HEX));
  }
  Serial.println();
  Serial.print("Message : ");
  content.toUpperCase();
  if (content.substring(1) == "7B 08 EA 1A") //change here the UID of the card/cards that you want to give access
  {
    
    gate_close();
    
    digitalWrite(red, HIGH); // turn the LED on 
    digitalWrite(grn, LOW); // turn the LED off 
    
    Serial.println("Authorized access");
    Serial.println();
  }
  else
  {
    Serial.println(" Access denied");
    delay(3000);
  }
} 
void gate_open()
{
    do
    {
      up = digitalRead(upper);   // read lower switch value
      
      digitalWrite(m1p, HIGH); // turn the MOTOR + high 
      digitalWrite(m1n, LOW); // turn the MOTOR - low
    
    }while(up == 1);
    
    motor_stop();
}
void gate_close()
{
    do
    {
      up = digitalRead(upper);   // read lower switch value
      
      digitalWrite(m1p, LOW); // turn the MOTOR + high 
      digitalWrite(m1n, HIGH); // turn the MOTOR - low
    
    }while(lo == 1);
    
    motor_stop();
}
void motor_stop()
{
    digitalWrite(m1p, LOW); // turn the MOTOR + low
    digitalWrite(m1n, LOW); // turn the MOTOR - low
  
}</pre>
read more
ARDUINO

Arduino based Temperature controller

Basically there are lots of devices & machines which is based on temperature. Like any plastic molded machine needs to maintain the temperature for the process of production.

If temperature goes above the limit then the heating section should be off and cooling section should be on and if temperature goes bellow the limit then heating section should be on and cooling should be off. If temperature is between the upper and lower limit then both heating and cooling devices should be off.

Same way in this project we will see how this happens? We are using arduino board, temperature sensor, lcd , keypad and some electronics components.

Components:

  • Arduino nano
  • Oled
  • 4×1 Keypad
  • LM35
  • Dual Relay board
  • 12V DC FAN
  • Solder Iron
  • Some components

Arduino nano is used to monitor the temperature and control the heating and cooling process.

Oled is the display unit to display the room temperature.

The 4×1 Keypad is used to set the upper and lower limit of the temperature.

LM35 is a temperature sensor. It sense the room temperature.

Dual relay board contains two relay. One is used to on/off the heater and the other is used to on/off cooler.

For cooling device we have used 12V DC FAN.

For heating device we have used solder iron.

read more
ARDUINO

ARDUINO NANO INTERFACING WITH TM1637 4 DIGIT 7 SEGMENT DISPLAY

TM1637 is a chip for driving 7-segment displays. by Tushar Gandhi

Key Features

  • Use either raw segment values or decimal numbers (with and without leading zero)
  • Set either the whole display or any digit independently
  • Control the brightness
  • Pure software implementation

Hardware Connection

Hardware and Purchase Link

The display module has 4 pins:

TM1637 – 4 DIGIT 7 SEGMEN

<ul><li><strong>VCC - </strong>+5VDC</li><li><strong> GND</strong>&nbsp;- GND  </li><li> <strong>CLK</strong>&nbsp;- Clock; connect to any digital pin on the Arduino </li><li> <strong>DIO</strong>&nbsp;- Data I/O; connect to any digital pin on the Arduino </li></ul>

ARDUINO NANO

Download

Browse the code in GitHub, or grab the latest release directly.

OR

Open Arduino IDE -> Sketch -> Include Library -> Manage Libraries

In search menu type TM1637.

It will display all the module related to TM1637.

Select  any one and install it.

Now open new New program.

File -> Esamples -> TM1637 -> TM1637 Test

Select Board Arduino nano. (Also we can select Arduino Uno if we are using it.)

Now upload it.

It will display the numbers, some characters and sign.

#include <Arduino.h>
#include <TM1637Display.h>
// Module connection pins (Digital Pins)
#define CLK 2
#define DIO 3
// The amount of time (in milliseconds) between tests
#define TEST_DELAY   2000
const uint8_t SEG_DONE[] = {
	SEG_B | SEG_C | SEG_D | SEG_E | SEG_G,           // d
	SEG_A | SEG_B | SEG_C | SEG_D | SEG_E | SEG_F,   // O
	SEG_C | SEG_E | SEG_G,                           // n
	SEG_A | SEG_D | SEG_E | SEG_F | SEG_G            // E
	};
TM1637Display display(CLK, DIO);
void setup()
{
}
void loop()
{
  int k;
  uint8_t data[] = { 0xff, 0xff, 0xff, 0xff };
  uint8_t blank[] = { 0x00, 0x00, 0x00, 0x00 };
  display.setBrightness(0x0f);
  // All segments on
  display.setSegments(data);
  delay(TEST_DELAY);
  // Selectively set different digits
  data[0] = display.encodeDigit(0);
  data[1] = display.encodeDigit(1);
  data[2] = display.encodeDigit(2);
  data[3] = display.encodeDigit(3);
  display.setSegments(data);
  delay(TEST_DELAY);
  /*
  for(k = 3; k >= 0; k--) {
	display.setSegments(data, 1, k);
	delay(TEST_DELAY);
	}
  */
  display.clear();
  display.setSegments(data+2, 2, 2);
  delay(TEST_DELAY);
  display.clear();
  display.setSegments(data+2, 2, 1);
  delay(TEST_DELAY);
  display.clear();
  display.setSegments(data+1, 3, 1);
  delay(TEST_DELAY);
  // Show decimal numbers with/without leading zeros
  display.showNumberDec(0, false); // Expect: ___0
  delay(TEST_DELAY);
  display.showNumberDec(0, true);  // Expect: 0000
  delay(TEST_DELAY);
	display.showNumberDec(1, false); // Expect: ___1
	delay(TEST_DELAY);
  display.showNumberDec(1, true);  // Expect: 0001
  delay(TEST_DELAY);
  display.showNumberDec(301, false); // Expect: _301
  delay(TEST_DELAY);
  display.showNumberDec(301, true); // Expect: 0301
  delay(TEST_DELAY);
  display.clear();
  display.showNumberDec(14, false, 2, 1); // Expect: _14_
  delay(TEST_DELAY);
  display.clear();
  display.showNumberDec(4, true, 2, 2);  // Expect: 04__
  delay(TEST_DELAY);
  display.showNumberDec(-1, false);  // Expect: __-1
  delay(TEST_DELAY);
  display.showNumberDec(-12);        // Expect: _-12
  delay(TEST_DELAY);
  display.showNumberDec(-999);       // Expect: -999
  delay(TEST_DELAY);
  display.clear();
  display.showNumberDec(-5, false, 3, 0); // Expect: _-5_
  delay(TEST_DELAY);
  display.showNumberHexEx(0xf1af);        // Expect: f1Af
  delay(TEST_DELAY);
  display.showNumberHexEx(0x2c);          // Expect: __2C
  delay(TEST_DELAY);
  display.showNumberHexEx(0xd1, 0, true); // Expect: 00d1
  delay(TEST_DELAY);
  display.clear();
  display.showNumberHexEx(0xd1, 0, true, 2); // Expect: d1__
  delay(TEST_DELAY);
  
	// Run through all the dots
	for(k=0; k <= 4; k++) {
		display.showNumberDecEx(0, (0x80 >> k), true);
		delay(TEST_DELAY);
	}
  // Brightness Test
  for(k = 0; k < 4; k++)
	data[k] = 0xff;
  for(k = 0; k < 7; k++) {
    display.setBrightness(k);
    display.setSegments(data);
    delay(TEST_DELAY);
  }
  
  // On/Off test
  for(k = 0; k < 4; k++) {
    display.setBrightness(7, false);  // Turn off
    display.setSegments(data);
    delay(TEST_DELAY);
    display.setBrightness(7, true); // Turn on
    display.setSegments(data);
    delay(TEST_DELAY);  
  }
 
  // Done!
  display.setSegments(SEG_DONE);
  while(1);
}

One more example. Try it.

<div style="height: 250px; position:relative; margin-bottom: 50px;" class="wp-block-simple-code-block-ace"><pre class="wp-block-simple-code-block-ace" style="position:absolute;top:0;right:0;bottom:0;left:0" data-mode="python" data-theme="xcode" data-fontsize="14" data-lines="Infinity" data-showlines="true" data-copy="false">// Include the library:
#include &lt;TM1637Display.h>
// Define the connections pins:
#define CLK 2
#define DIO 3
// Create display object of type TM1637Display:
TM1637Display display = TM1637Display(CLK, DIO);
// Create array that turns all segments on:
const uint8_t data[] = {0xff, 0xff, 0xff, 0xff};
// Create array that turns all segments off:
const uint8_t blank[] = {0x00, 0x00, 0x00, 0x00};
// You can set the individual segments per digit to spell words or create other symbols:
const uint8_t done[] = {
  SEG_B | SEG_C | SEG_D | SEG_E | SEG_G,           // d
  SEG_A | SEG_B | SEG_C | SEG_D | SEG_E | SEG_F,   // O
  SEG_C | SEG_E | SEG_G,                           // n
  SEG_A | SEG_D | SEG_E | SEG_F | SEG_G            // E
};
// Create degree Celsius symbol:
const uint8_t celsius[] = {
  SEG_A | SEG_B | SEG_F | SEG_G,  // Circle
  SEG_A | SEG_D | SEG_E | SEG_F   // C
};
void setup() {
  // Clear the display:
  display.clear();
  delay(1000);
}
void loop() {
  // Set the brightness:
  display.setBrightness(7);
  // All segments on:
  display.setSegments(data);
  delay(1000);
  display.clear();
  delay(1000);
  // Show counter:
  int i;
  for (i = 0; i &lt; 101; i++) {
    display.showNumberDec(i);
    delay(50);
  }
  delay(1000);
  display.clear();
  delay(1000);
  // Print number in different locations, loops 2 times:
  int j;
  for (j = 0; j &lt; 2; j++) {
    for (i = 0; i &lt; 4; i++) {
      display.showNumberDec(i, false, 1, i);
      delay(500);
      display.clear();
    }
  }
  
  delay(1000);
  display.clear();
  delay(1000);
  // Set brightness (0-7):
  int k;
  for (k = 0; k &lt; 8; k++) {
    display.setBrightness(k);
    display.setSegments(data);
    delay(500);
  }
  delay(1000);
  display.clear();
  delay(1000);
  // Print 1234 with the center colon:
  display.showNumberDecEx(1234, 0b11100000, false, 4, 0);
  delay(1000);
  display.clear();
  delay(1000);
  int temperature = 24;
  display.showNumberDec(temperature, false, 2, 0);
  display.setSegments(celsius, 2, 2);
  delay(1000);
  display.clear();
  delay(1000);
  display.setSegments(done);
  while(1);
}
</pre></div>
read more
ARDUINO

what is an arduino?

Arduino is an open-source electronics platform based on easy-to-use hardware and software. Arduino boards are able to read inputs – light on a sensor, a finger on a button, or a Twitter message – and turn it into an output – activating a motor, turning on an LED, publishing something online. You can tell your board what to do by sending a set of instructions to the microcontroller on the board. 

We can create small to big projects using the arduino board. For that programming language Embedded C is required. It is very easy to program the arduino board because it has inbuilt libraries which make easy to program the board.  To do so you use the Arduino programming language (based on Wiring), and the Arduino Software (IDE), based on Processing.

Why Arduino?

  • The Arduino software is easy-to-use for beginners
  • Runs on Mac, Windows, and Linux
  • Arduino has been used in thousands of different projects and applications
  • Inexpensive
  • Simple, clear programming environment
  • Open source and extensible software
  • Open source and extensible hardware
  • Different types of boards available as per your requirement

Arduino Boards & Modules

There are so many arduino boards and modules are available in online stores. Arduino Uno, Arduino Nano, Arduino Micro, Arduino MKR series,Arduino Mega etc.

There are ready made kits and shields available with sensors and spare parts which can be used for beginners, students and professional.

Arduino Boards Images

Click on image to purchase

1.Arduino MEGA 2560

<a target=”_blank” href=”https://www.amazon.in/gp/product/B00MJZYACI/ref=as_li_tl?ie=UTF8&amp;camp=3638&amp;creative=24630&amp;creativeASIN=B00MJZYACI&amp;linkCode=as2&amp;tag=s3tech-21&amp;linkId=2b5feaa2f542e7bc51f87f0b79c875af” rel=”noopener noreferrer”><img border=”0″ src=”//ws-in.amazon-adsystem.com/widgets/q?_encoding=UTF8&amp;MarketPlace=IN&amp;ASIN=B00MJZYACI&amp;ServiceVersion=20070822&amp;ID=AsinImage&amp;WS=1&amp;Format=_SL250_&amp;tag=s3tech-21″></a><img src=”//ir-in.amazon-adsystem.com/e/ir?t=s3tech-21&amp;l=am2&amp;o=31&amp;a=B00MJZYACI” width=”1″ height=”1″ border=”0″ alt=”” style=”border:none !important; margin:0px !important;”>

The Arduino Mega 2560 is designed for projects that require more I/O lines, more sketch memory and more RAM. With 54 digital I/O pins, 16 analog inputs and a larger space for your sketch it is the recommended board for 3D printers and robotics projects. This gives your projects plenty of room and opportunities maintaining the simplicity and effectiveness of the Arduino platform. This document explains how to connect your Mega2560 board to the computer and upload your first sketch.

2.Arduino UNO R3

<a target=”_blank” href=”https://www.amazon.in/gp/product/B010SI9WBG/ref=as_li_tl?ie=UTF8&amp;camp=3638&amp;creative=24630&amp;creativeASIN=B010SI9WBG&amp;linkCode=as2&amp;tag=s3tech-21&amp;linkId=a7ba0240aaa21832593ea35f6ef68a6f” rel=”noopener noreferrer”><img border=”0″ src=”//ws-in.amazon-adsystem.com/widgets/q?_encoding=UTF8&amp;MarketPlace=IN&amp;ASIN=B010SI9WBG&amp;ServiceVersion=20070822&amp;ID=AsinImage&amp;WS=1&amp;Format=_SL250_&amp;tag=s3tech-21″></a><img src=”//ir-in.amazon-adsystem.com/e/ir?t=s3tech-21&amp;l=am2&amp;o=31&amp;a=B010SI9WBG” width=”1″ height=”1″ border=”0″ alt=”” style=”border:none !important; margin:0px !important;”>

Arduino Uno is a microcontroller board based on the ATmega328P . It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header and a reset button. It contains everything needed to support the microcontroller; simply connect it to a computer with a USB cable or power it with a AC-to-DC adapter or battery to get started.. You can tinker with your UNO without worring too much about doing something wrong, worst case scenario you can replace the chip for a few dollars and start over again.

“Uno” means one in Italian and was chosen to mark the release of Arduino Software (IDE) 1.0. The Uno board and version 1.0 of Arduino Software (IDE) were the reference versions of Arduino, now evolved to newer releases. The Uno board is the first in a series of USB Arduino boards, and the reference model for the Arduino platform; for an extensive list of current, past or outdated boards see the Arduino index of boards.

3.Arduino Nano

<a target=”_blank” href=”https://www.amazon.in/gp/product/B01EFSS8VK/ref=as_li_tl?ie=UTF8&amp;camp=3638&amp;creative=24630&amp;creativeASIN=B01EFSS8VK&amp;linkCode=as2&amp;tag=s3tech-21&amp;linkId=53147793be214a7f8ba375e646860003″ rel=”noopener noreferrer”><img border=”0″ src=”//ws-in.amazon-adsystem.com/widgets/q?_encoding=UTF8&amp;MarketPlace=IN&amp;ASIN=B01EFSS8VK&amp;ServiceVersion=20070822&amp;ID=AsinImage&amp;WS=1&amp;Format=_SL250_&amp;tag=s3tech-21″></a><img src=”//ir-in.amazon-adsystem.com/e/ir?t=s3tech-21&amp;l=am2&amp;o=31&amp;a=B01EFSS8VK” width=”1″ height=”1″ border=”0″ alt=”” style=”border:none !important; margin:0px !important;”>

The Arduino Nano is a small, complete, and breadboard-friendly board based on the ATmega328P (Arduino Nano 3.x). It has more or less the same functionality of the Arduino Duemilanove, but in a different package. It lacks only a DC power jack, and works with a Mini-B USB cable instead of a standard one.

4.Arduino Pro Mini

<a target=”_blank” href=”https://www.amazon.in/gp/product/B00H8MYAGI/ref=as_li_tl?ie=UTF8&amp;camp=3638&amp;creative=24630&amp;creativeASIN=B00H8MYAGI&amp;linkCode=as2&amp;tag=s3tech-21&amp;linkId=2dcee3658d57fbef34152f92c5afb47d” rel=”noopener noreferrer”><img border=”0″ src=”//ws-in.amazon-adsystem.com/widgets/q?_encoding=UTF8&amp;MarketPlace=IN&amp;ASIN=B00H8MYAGI&amp;ServiceVersion=20070822&amp;ID=AsinImage&amp;WS=1&amp;Format=_SL250_&amp;tag=s3tech-21″></a><img src=”//ir-in.amazon-adsystem.com/e/ir?t=s3tech-21&amp;l=am2&amp;o=31&amp;a=B00H8MYAGI” width=”1″ height=”1″ border=”0″ alt=”” style=”border:none !important; margin:0px !important;”>

The Arduino Pro Mini is intended for advanced users who require flexibility, low-cost, and small size. It comes with the minimum of components (no on-board USB or pin headers) to keep the cost down. It’s a good choice for a board you want to leave embedded in a project. Please note that there are two versions of the board: one that operates at 5V (like most Arduino boards), and one that operates at 3.3V. Be sure to provide the correct power and use components whose operating voltage matches that of the board.

ATTiny85 usb Development Board

<a target=”_blank” href=”https://www.amazon.in/gp/product/B07M8GS9L5/ref=as_li_tl?ie=UTF8&amp;camp=3638&amp;creative=24630&amp;creativeASIN=B07M8GS9L5&amp;linkCode=as2&amp;tag=s3tech-21&amp;linkId=ab1fba370ad82c8f4d6762f4dc2dc0b4″ rel=”noopener noreferrer”><img border=”0″ src=”//ws-in.amazon-adsystem.com/widgets/q?_encoding=UTF8&amp;MarketPlace=IN&amp;ASIN=B07M8GS9L5&amp;ServiceVersion=20070822&amp;ID=AsinImage&amp;WS=1&amp;Format=_SL250_&amp;tag=s3tech-21″></a><img src=”//ir-in.amazon-adsystem.com/e/ir?t=s3tech-21&amp;l=am2&amp;o=31&amp;a=B07M8GS9L5″ width=”1″ height=”1″ border=”0″ alt=”” style=”border:none !important; margin:0px !important;”>

The ATtiny85 based mini development board is similar to the Arduino, but cheaper and smaller (ofcourse a bit less powerful). With a whole host of shields to extend its functionality and the ability to use the familiar Arduino IDE, this board is a great way to jump into microcontroller electronics.

read more