Arduino Projects

Arduino Industrial application: Control anything on time basis | Arduino industrial

Arduino for Industrial applications, Description:

 

In this tutorial, you will learn how to make an industrial level product that can be used to control anything on time basis. This project is based on an Atmega328 microcontroller, the same microcontroller which is used in Arduino. To reduce the price I designed my own PCB board and sent my PCB board Gerber files to PCBway company which is one of the top leading companies throughout the world.

In part1 I explained the whole process how to generate the gerber files and how to place an online order.


Arduino Industrial

This product is very user friendly, all you need is just to connect the load which you want to control, In my case I will be using a 220v indicator lamp for the demonstration purposes. If you want you can connect any type of load, for higher loads you will need to connect a heavy-duty relay at the output of this relay, so this relay will be used to control a heavy duty relay and the heavy duty relay will be used to control any type of high load, for example, heaters, grinders, water pumps and so on…once the load is connected, then power up the circuit using a 12v adaptor or battery…..adjust the LCD contrast using this variable resistor, turn on the start button…set the time using this variable resistor, for the demonstration purposes I will set it at 1 minute……


Arduino Industrial

This indicator lamp will remain ON for exactly 1 minute…. The same process can be repeated again by pressing the reset button, so again this indicator lamp will remain on for 1 minute, the load ON time can be adjusted in real time using this variable resistor……

In this episode I will cover

  1. Circuit diagram
  2. PCB explanation
  3. Soldering
  4. Programming and finally number
  5. Testing

Amazon Links:

12v Adaptor:

Arduino Uno

Arduino Nano

Mega 2560:

Potentiometer:

16X2 LCD

Atmega328 micro controller:

16Mhz crystal:

22pf capacitors:

10k Resistor:

10uf capacitors:

Other Tools and Components:

Top Arduino Sensors:

Super Starter kit for Beginners

Digital Oscilloscopes

Variable Supply

Digital Multimeter

Soldering iron kits

PCB small portable drill machines

DISCLAIMER:

Please Note: these are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!


Arduino Industrial Circuit Diagram:

This is the complete circuit diagram, this is a toggle switch and is used to start and stop the timer. One side of the toggle switch is connected with the ground, while the other side is connected with pin number 2 of the Arduino…. this is a push button and is used to reset the timer.

One side of the push button is connected with the ground while the other side is connected with number 3 of the Arduino…. the variable resistor R2 is used to set the time in minutes, as you can see it has three legs, the right and left legs are connected with 5v and ground while the middle leg is connected with Analog pin A1 of the Arduino…this is a 16×2 LCD and will be used to display the pre-set time, elapsed time and the load status…pin number 1, 5 and 16 are connected with the ground.


pin number 2 and 15 are connected with 5volts. Pin number 3 is connected with the middle pin of the variable resistor. this variable resistor will be used for the LCD contrast adjustment.  The RS pin of the LCD is connected with pin number 6, the enable pin of the LCD is connected with pin number 7 of the Arduino…pins d4 to d7 which are the data pins are connected with pin 8 to 11 of the Arduino.

This is a 12v spdt type relay. This relay has 5 pins, these are the two coil pins this is the common pin, this is the normally open pin and this is the normally closed pin. These three pins have no physical connection with the relay coil pins. this relay cannot be directly controlled using the controller… to energize the relay coil you need around 28milli amps. This is not a fixed value, this depends on the size of the relay you are using.

You can easily calculate this value, first find the relay coil resistance using a digital multi meter..as it’s a 12v relay so v = 12, now using the ohm’s law we can find the value of current needed to energize the relay coil…the type of the relay i am going to use needs 28 milli amps, so now I can use any general purpose NPN or PNP type transistor so far its collector current is greater than 28 milli amps, but it’s a good designing practice to use a larger value transistor.


In my case I will be using 2n2222 NPN transistor, as its really cheap and you can find this transistor in any electronics shop….  The collector of the 2n2222 NPN transistor is connected with the relay coil while the other side of the relay coil is connected with 12volts . The emitter of the transistor is connected with the ground. A 10k resistor is connected with the base, while the other side of the resistor is connected with pin number 13 of the Arduino. the transistor and resistor together makes the relay driver circuit. This is a freewheeling diode and is used against the back emf protection.

Arduino Industrial PCB design explanation:

Arduino Industrial

This PCB is designed in cadsoft eagle 9.1.0 version, if you want to learn how to make a schematic and PCB then watch my tutorial.

This is a double side PCB. The blue color represents the bottom side while the red color is the top side. All these connections are as per the circuit diagram as explained. Watch part1 for the gerber files generation and online order placement.

Download this PCB:time controlled machine


Arduino Industrial PCB board explanation:

Arduino Industrial

These are the PCB boards which I just received from the PCBway company. As you can see the quality is really great and everything is as per the order. During the online order placement I selected blue color, but later I decided to change it to black color. This change was only possible due to the friendly behavior of the PCBway company staff members. I am 100% satisfied with their work.

PCB components installation and soldering:

Arduino Industrial

First of all I  installed all the components ..as you can see maximum components are installed and now it’s time to start the soldering…


Arduino Industrial

as you can see maximum components are soldered and now only female headers and two variable resistors are balance. So I will be back after soldering the remaining components…

Arduino Industrial

As you can see all the components are soldered…

This variable resistor will be used for the lcd contrast

Arduino Industrial

while this variable resistor will be used for setting the time..

Arduino Industrial

this is for the lcd…

Arduino Industrial

So double check all the connections and make sure there is no short circuit before you power up the circuit. At the end connect two buttons with pin number 2 and pin number 3.

Arduino Industrial Programming:

#include <LiquidCrystal.h>

#define rs 6 // original 12 of arduino
#define en 7 // origional 10
#define d4 8  // original 5
#define d5 9 // 4
#define d6 10 // 3
#define d7 11 // 2
// rw of lcd is connected to ground

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);


// Tracks the time since last event fired
unsigned long previousMillis=0;
unsigned long int previoussecs = 0; 
unsigned long int currentsecs = 0; 
 unsigned long currentMillis = 0; 
 
 int timedata = A1; // analog pin1 , a variable resistor connected here. 
 int timerawdata = 0; // stores the value comming from the variable resistor. 
 int secs = 0; 
 int pmints = 0; 
 int mints = 0; // current mints
 int interval= 1 ; // updated every 1 second
int startb = 2; // button to start 
int load = 13; // the output load/ machine, it can be a bulb, a motor etc ...
int rbutton = 3; // reset button

int Lflag = 0; // load flag
int Sflag = 0; // flag to monitor the start and stop 
int cstop = 0; // complete stop after the timer is completed. 
void setup()
{
    Serial.begin(9600);
    // set up the LCD's number of columns and rows: 
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.clear();
  lcd.print("PT    TE    LS "); // preset time,  time elapsed   load status
      // Initialise the IO and ISR
pinMode(startb, INPUT);
digitalWrite(startb, HIGH);
pinMode(timedata, INPUT);

pinMode(load, OUTPUT); 
digitalWrite(load, LOW);

pinMode(rbutton, INPUT);
digitalWrite(rbutton, HIGH);


delay(1000);

}


void loop()
{
  
 timerawdata = analogRead(timedata);
 pmints = map(timerawdata, 0, 1024, 0, 60);
 
 if((digitalRead(startb) == LOW) && (Sflag == 0))
 {
   digitalWrite(load, HIGH);
   Sflag = 1; 
 }
 
  if((digitalRead(startb) == HIGH) && (Sflag == 1))
 {
   digitalWrite(load, LOW);
   Sflag = 0; 
 }
 
 if(digitalRead(rbutton) == LOW)
 {
   secs = 0; 
   mints = 0; 
   cstop = 0; 
 }
 
 

 if(digitalRead(startb) == LOW) // IF THE START BUTTON IS PRESSED AND IT IS CLOSED. 
 
{

     currentMillis = millis();
   currentsecs = currentMillis / 1000; 
    if ((unsigned long)(currentsecs - previoussecs) >= interval) {
      secs = secs + 1; 
          lcd.clear();
  lcd.print("PT    TE    LS ");
  // display the preset time.
      lcd.setCursor(0, 1); // second row
  lcd.print(pmints); // in minutes
  
  // now to display the elapsed time. 
  // display mints
   lcd.setCursor(5,1); // second row 5th column
  lcd.print(mints);
  // put dot
     lcd.setCursor(7,1); // second row 7th column
  lcd.print(".");
  lcd.setCursor(8,1); // second row 8th column
  lcd.print(secs);
  
  if(digitalRead(load) == LOW);
  {
     lcd.setCursor(12,1);
  lcd.print("L"); 
  }
  
   if(digitalRead(load) == HIGH);
  {
     lcd.setCursor(12,1);
  lcd.print("H"); 
  }
   
      if (secs >59 ) 
      {
        secs = 0; 
   mints = mints + 1;  
if(mints > 59 )
{
  mints = 0; 
}

  // lcd finish here
      }   
      previoussecs = currentsecs;
   }  
}

if (( mints >= pmints) && (Lflag == 1))
{
  digitalWrite(load, LOW); 
  Lflag = 0; 
  cstop = 1; 

  
  while(cstop == 1)
  {
  lcd.setCursor(12,1);
  lcd.print("L");
  
  if( digitalRead(rbutton) == LOW)
  {
    cstop = 0; 
    secs = 0; 
    mints = 0; 
    
  }
  }

}

if (( mints < pmints) && ( Lflag == 0) && (digitalRead(startb) == LOW))
{
  digitalWrite(load, HIGH); 
  Lflag = 1; 
     lcd.setCursor(12,1);
  lcd.print("H");
}

}                

Arduino Industrial Watch full Video Tutorial:

Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button