Arduino Industrial application: how to Control anything on time basis
Description:
Arduino Industrial- You’ll learn how to make an industrial-level device in this tutorial that can be used to manage anything on a time-based basis. This tutorial is based on the same microcontroller that is used in Arduino, an Atmega328 microcontroller.
This software is very user friendly, all you need is to attach the load you want to power. In my scenario, for demonstration purposes, I will use a 220v indicator light. If you want to be able to connect some sort of load, you will need to link a heavy-duty relay to the output of this relay for lower loads, so this relay is used to control a heavy-duty relay, and the heavy-duty relay is used to control some type of high load, such as heaters, grinders, water pumps, etc. Once the load is connected then power the circuit using the 12v adapter or battery ….. change the LCD contrast using this variable resistor, switch on the start button … set the time by using this variable resistor, I set it to 1 minute for demonstration purposes ……
For exactly 1 minute this indicator light must remain ON …. By pressing the reset button, the same cycle can be repeated again, so this indicator lamp can stay on for 1 minute, this variable resistor can be used to change the load ON time in real-time ……
In this post, I will cover
- Circuit diagram
- PCB explanation
- Soldering
- Programming and finally number
- Testing
The Amazon Purchase links:
Super Starter kit for Beginners:
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 full circuit diagram, this is a toggle switch for starting and stopping the timer. One side of the switch toggle is connected to the wall, while the other side is connected to Arduino’s pin number 2 ….This is a push button for resetting the timer. One hand of the push button is attached to the ground while the other side is connected to the Arduino’s number 3 ….The variable resistor R2 is used to set the time in minutes as you can see that it has three legs, the right and left legs are attached to 5v and ground while the middle leg is connected to the Arduino’s Analog pin A1 …
this is a 16×2 LCD and will be used to view pre-set time, date and load status … pin numbers 1, 5 and 16 are attached to the surface. Pin numbers 2 and 15 are 5volts related. Pin number 3 is attached to the variable resistor’s middle pin. This variable resistor will be used for Lcd contrast adjustment The LCD’s RS pin is connected to pin number 6,the LCD’s trigger pin is connected to pin number 7 of the Arduino…Pins d4 to d7 connecting the data pins to Arduino’s pin 8 to 11. This is a relay form of 12v spdt. There are 5 pins in this relay, these are the two coil pins, this is the typical pin, this is the normally open pin, and this is the usually closed pin. There is no physical connection between these three pins and the relay coil pins. This relay can’t be controlled directly with the transmitter…to power the relay coil you need about 28milli amps. This is not a fixed value, it depends on the size of the relay that you use.
You can easily calculate it value, first use a digital multi meter to find the resistance of the relay coil.Since it’s a 12v relay so v = 12, now using the ohm rule we can find the current value needed to power the relay coil … the type of relay I’m going to use requires 28 milli amps, so now I can use any general purpose NPN or PNP style transistor to the degree that its collector current is greater than 28 milli amps,But the use of a larger quality transistor is a good design technique. In my case I’m going to use 2n2222 NPN transistor as it’s really cheap and in any electronics shop you can find this transistor ….The 2n2222 NPN transistor collector is linked to the relay coil while 12volts are connected to the other side of the relay coil. The transistor’s emitter is connected to the ground.A 10k resistor is connected to the core, while Arduino’s pin number 13 is connected to the other side of the resistor. The transistor makes the relay driver circuit together with the resistor. This is a freewheeling diode, which is used to guard against the back emf.
Arduino Industrial PCB design explanation:
This PCB is designed in cadsoft eagle 9.1.0 version,
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.
Download this PCB: time controlled machine
Arduino Industrial PCB board explanation:
As you can see, the performance is really nice and the order is as good as it is. I picked blue color during the online order placement, but later I decided to turn it into black color. This move was only possible because of the PCBway company staff’s friendly actions. I’m 100% happy with their work.
PCB components installation and soldering:
First of all, I installed all the components as you can see that the total components are installed and now it is time to start the soldering process …
As you can see, the total components are soldered and now only women headers are paired with two variable resistors. So I’ll be back after the remaining components have been soldered …
All the parts are soldered, as you can see … For the lcd comparison, this variable resistor is used
For setting the time while using this variable resistor
this is for the lcd…
So double check all connections to make sure there’s no short circuit before the circuit is powered up. Using pin number 2 and pin number 3 to connect two buttons at the top.
Arduino Industrial Programming:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | #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"); } } |