Programming manual to control the lights on and off professionally by yourself. By Chamrat charoenkhet reserve the right page ๑
Programming manual to control the lights on and off professionally by yourself. Introduction This play guide Prepared for use in open system training Turn off any lights or devices that are in use as needed. How to start in understanding can be applied to other applications At least the participants should have basic knowledge and understanding. In a computer or notebook system Program installation Choose equipment that requires a home or organization's Wi-Fi system. The phone should be an Android system. programming principles Experimental use practical implementation apply to use Continuing development after training, the goal of writing this manual is thought to be written in a linguistic way for 4th grade students to read and understand and use it. There will be a component in the content. There are procedures .Have the necessary knowledge, abilities, and skills in Copy and Deployments principles Thank you to all the lecturers who helped to enhance knowledge and increase skills. Qualitative competence to be even better Make by Chamrat Charoenkhet Skilled Labor Instructor, Level G3 Labor skill standards Department of Skill Development By Chamrat charoenkhet reserve the right page ๒
Programming manual to control the lights on and off professionally by yourself. List of contents Number Content Page 4 1 How to start? 16 what to use 20 22 computer or notebook 29 32 install program 43 44 Wi-Fi system at home or office 67 74 Mobile phone with android system 77 73 2 Trial program 80 82 3 Equipment required 83 4 Programming 93 94 5 How to launch the program 6 Command code programming 7 Pin board to use 8 Install App Blynk and Settings 9 Install Arduino on your computer. 10 programming symbols list of devices used 11 practical implementation 12 apply to use Study the cycle Appendix Usage example Wiring the circuit Device connection, relay terminal 13 Test exercises after training 14 Resources and equipment supply By Chamrat charoenkhet reserve the right page ๓
Programming manual to control the lights on and off professionally by yourself. Training Lesson 1 How does it begin? What to use 1 computer or notebook 2. Install the program 3. Equipment required 4. Wi-Fi system 5. Mobile phone with Android system 6. Programming 1 computer or notebook, 1 device per person 2. Installing the program Download https://www.arduino.cc/en/software to download the program to install How to install Press the following steps 1. Download the Arduino IDE by going to https://www.arduino.cc and clicking on Download. By Chamrat charoenkhet reserve the right page ๔
Programming manual to control the lights on and off professionally by yourself. 2. Select the computer operating system used to program Arduino. 3. Press JUST DOWNLOAD (If you want to donate to help Arduino Software development, press CONTRIBUTE & DOWNLOAD) 2.31 Program menu By Chamrat charoenkhet reserve the right page ๕
Programming manual to control the lights on and off professionally by yourself. The top row of the menu is in use. By Chamrat charoenkhet reserve the right page ๖
Programming manual to control the lights on and off professionally by yourself. Menu to adjust the settings to match the board. By Chamrat charoenkhet reserve the right page ๗
Programming manual to control the lights on and off professionally by yourself. Program installation menu 4. Save the program installation file to the desired folder. By Chamrat charoenkhet reserve the right page ๘
Programming manual to control the lights on and off professionally by yourself. Unzip the setup file 6. Double click the arduino.exe file to install the program for writing. 7. The Arduino program window will appear as shown in the figure. By Chamrat charoenkhet reserve the right page ๙
Programming manual to control the lights on and off professionally by yourself. 8. Create a shortcut on the Desktop for ease of opening the program in the future. 9. The icon of the Arduino program will appear on the Desktop as shown in the picture. By Chamrat charoenkhet reserve the right page ๑๐
Programming manual to control the lights on and off professionally by yourself. 10. In the program window of Arduino IDE, click menu File -> Preferences to install the board. NodeMCU/ESP8266 online 11. Add http://arduino.esp8266.com/stable/package_esp8266com_index.json into Additional Boards Manager URLs box as shown in the picture. By Chamrat charoenkhet reserve the right page ๑๑
Programming manual to control the lights on and off professionally by yourself. Install another Boards Manager program, click on Tools (toots manager libraries..) will show the results as shown in the picture. You will see the words manager libraries.. Press 2 times, the result will be displayed as shown in the picture. It is the selection of the libraries that are used. The term \"libraries\" is like a library that contains a lot of books that the person who wrote the program. to choose to use the one that meets our needs for free By Chamrat charoenkhet reserve the right page ๑๒
Programming manual to control the lights on and off professionally by yourself. Type esp8266 in the box wait a couple for the program to search. If there is, it will be displayed. Press the word Install to install the libraries to use accordingly. Connected device board to enter the code or command to use 12. Click to go to the menu. Tools -> Board -> Board Manager By Chamrat charoenkhet reserve the right page ๑๓
Programming manual to control the lights on and off professionally by yourself. Port is sent to the board, generally newer computers. When we plug in any device there will be a program in that board. It can be used without having to program Diver, but if it is an ESP 8266 V 3, you need to program it. 1. Finding the Port to use, press the Driver Manager on the computer, some models that come with Driver, most new computers. Usually do not encounter this problem much. By Chamrat charoenkhet reserve the right page ๑๔
Programming manual to control the lights on and off professionally by yourself. 2. Check which ports are available to use. As the picture shows, it is Com 3 Com 4 14. But if you can't find the board in Ports, go download the Driver and install it Yourself. 15. Open the Arduino ide again and go to the Tools menu to set the board and port number to the same as found in step 15. The example in the picture is Comport 7 or COM port. But each person's computer may not be the same. The System will arrange it by itself. Or we can set it ourselves. By Chamrat charoenkhet reserve the right page ๑๕
Programming manual to control the lights on and off professionally by yourself. TP-Link IP address Username Password Tenda Model No : DH301 192.168.1.1 admin admin/password 192.168.1.254 192.168.1.1 admin admin Asus 192.168.1.1 admin admin 192.168.2.1 10.10.1.1 By Chamrat charoenkhet reserve the right page ๑๖
Programming manual to control the lights on and off professionally by yourself. Training Lesson 2 Experimental Program 1. Test with the program shown normally. On the program page 2. Try to press Compile (Compile) on the arrow by clicking the button. to verify that the code written has no errors. By Chamrat charoenkhet reserve the right page ๑๗
Programming manual to control the lights on and off professionally by yourself. 3.If there is no error A message will appear saying “Done compiling” as shown in the picture. NodeMCU/ESP8266 4. Try to press the button to press the button to upload the code to the board NodeMCU/ESP8266 true to the picture By Chamrat charoenkhet reserve the right page ๑๘
Programming manual to control the lights on and off professionally by yourself. 5. If there is no error, it will show “Done uploading” as shown in the picture and the light on the board will blink every 250 ms (2 times per second). NodeMCU/ESP8266 finished Notice the letters and numbers below will go up (24%). 6. The result shows that there is no error. By Chamrat charoenkhet reserve the right page ๑๙
Programming manual to control the lights on and off professionally by yourself. 7. If there is an error, the word “Copy error messages” will be displayed as shown in the picture. 8. displays the error checking, what is the cause? By Chamrat charoenkhet reserve the right page ๒๐
Programming manual to control the lights on and off professionally by yourself. Training Lesson 3 Equipment you will need Equipment to be prepared 1. NodeMCU ESP8266 V3, if it's v3, you need to install the driver board with CH341SER. You can download it as follows: NodeMCU ESP8266 Driver. 1. http://www.mediafire.com/file/c9pyi2u7g93iqt6/CH341SER.ZIP/file General principles Training we used Arduino IDE's Sketch program to write open system controllers. Turn off the power or the device to work to send the code to the board ESP8266 v3, which is an easy to use Open Source program that Arduino has made to use. Therefore, there are many resources to study and research in web forums or websites on the Internet. And in the part of the board ESP8266 v3 It has built-in Wi-Fi. It is a microcontroller board with enough number of input ports (Port Output) and output (Input) for practical use. Can be connected to both digital sensors (Digital) and analog (Analog) and also connected to drive the output device to work. Where we have to write a program to operate the board ESP8266 v3 to be able to control various devices such as controlling light bulbs, street lights, kitchen lights, gooseneck lights, back lights, house lights, basement lights. By Chamrat charoenkhet reserve the right page ๒๑
Programming manual to control the lights on and off professionally by yourself. Or water pumps, etc., and because there is a built-in Wi-Fi module, it can be connected to send data or order via a mobile phone with Internet of Things (IoT) style. Computer to program getting started with the basics that actually work with the Arduino IDE installed and tested on the ESP8266 to make the relay work. With only 3.3-5 volts, through the circuit and relay is a 220 volt power switch. 2. Relay A relay is an electronic device that is widely used in automatic control circuits. Acts as a light switch that use voltage to turn on and off electrical equipment to control various circuits there are many types of relays, depending on the type of use, there are 3.3 Volt, 5 Volt, 12 Volt, and 24 Volt. 3. Lamps with lamp holders that can be screwed in wires with nuts. 4. Power cord with plug they can be purchased at any electrical supply store. 4. Wi-Fi system must know the Wi-Fi name and password. 5. Mobile phone with Android system, ready to download and install app Blynk By Chamrat charoenkhet reserve the right page ๒๒
Programming manual to control the lights on and off professionally by yourself. Lesson 4 Programming 1. Open the program from the page icon Arduino (Arduino) 2. When you press to open the program, it will look like this. There are 2 main parts in the program for writing 1 Void setup 2 Void loop. 1. Void setup means the code that will be written to order the system to work. 2. Void loop means the main code that will run as defined in Void setup and will loop or End of the work we wrote here. By Chamrat charoenkhet reserve the right page ๒๓
Programming manual to control the lights on and off professionally by yourself. 3. Click to view the File menu. 4. Find the stored files. Then press to see details 5. Find the stored file, you will see the details of the sample program, there are 8 files, and then click on one of the files. By Chamrat charoenkhet reserve the right page ๒๔
Programming manual to control the lights on and off professionally by yourself. 6. When we press to any file the program will open to the application program. We will see all files displayed at the same time on the same page. By Chamrat charoenkhet reserve the right page ๒๕
Programming manual to control the lights on and off professionally by yourself. Notice what files are there. Whether it is complete or not here are all 12 files. 1. Blynk_Relay_8_Relay LED 2. CloseAll 3. OpenAll 4. Output_1 5. Output_2 6. Output_3 7. Output_4 8. Output_5 9. Output_6 10. Output_7 11. Output_8 12. WI-FI_Connect Shows all program bars as follows: How to create an additional menu 1. Press the right mouse button. At the tool will show as shown in the picture, then select the word new tap? By Chamrat charoenkhet reserve the right page ๒๖
Programming manual to control the lights on and off professionally by yourself. 2. Set the desired name. The remaining color bar will show up, let us set a name and press OK. After setting, a menu bar will appear. Notice that a mark will appear after the new name, indicating that we haven't saved that menu as in the picture. By Chamrat charoenkhet reserve the right page ๒๗
Programming manual to control the lights on and off professionally by yourself. After saving that mark will disappear. Indicates that the record has been saved. show that it works If you want to delete a row of tools that are no longer in use, right-click Delete. By Chamrat charoenkhet reserve the right page ๒๘
Programming manual to control the lights on and off professionally by yourself. Will display the results to confirm the deletion or not, if confirmed, press OK, it has been deleted successfully To save the data stored in the Fife menu, press Save. By Chamrat charoenkhet reserve the right page ๒๙
Programming manual to control the lights on and off professionally by yourself. Training Lesson 5 How to launch the program 1. Press the word Arduino Picture 2. The program will show the opening of the file. By Chamrat charoenkhet reserve the right page ๓๐
Programming manual to control the lights on and off professionally by yourself. 3. Display the program screen as shown in the picture. 4. Press the word File and then the word Open. By Chamrat charoenkhet reserve the right page ๓๑
Programming manual to control the lights on and off professionally by yourself. 5. Select the saved file. Press on any file. 6 After pressing, all files will be displayed on the screen, all we set together, showing that it works. By Chamrat charoenkhet reserve the right page ๓๒
Programming manual to control the lights on and off professionally by yourself. Training Lesson 6 Programming the Command Code Let's understand in each menu that what does it mean 1.Blynk_Relay_8_RelayLED means the main program that will write programs to operate and connect what devices There are 3 parts on this page: 1. Header 2. Part void setup() 3. What is void loop() in each part? /*……..*/ or // red means it is for writing warnings. Remembering what this line of code is for and how to write and forget it 1. Headed #define BLYNK_PRINT Serial #include <ESP8266WiFi.h> #include <BlynkSimpleEsp8266.h> BlynkTimer timer; char auth[] = \"h7-x1pi062Cnzds1UpH_6uMeSdzSFBRf\"; page ๓๓ char ssid[] = \"Laor\"; char pass[] = \"06521254\"; #define Relay1 16 #define Relay2 05 #define Relay3 04 #define Relay4 15 #define Relay7 13 By Chamrat charoenkhet reserve the right
Programming manual to control the lights on and off professionally by yourself. #define Relay8 03 #define Relay9 01 #define Relay10 12 int Data1 = 1; int Data2 = 1; int Data3 = 1; int Data4 = 1; int Data7 = 1; int Data8 = 1; int Data9 = 1; int Data10 = 1; int OpenAll = 1; int CloseAll = 0; 2. part void setup() void setup() { Serial.begin(9600); Blynk.begin(auth, ssid, pass); ConnectWIFI(); pinMode(Relay1, OUTPUT); pinMode(Relay2, OUTPUT); pinMode(Relay3, OUTPUT); pinMode(Relay4, OUTPUT); pinMode(Relay7, OUTPUT); pinMode(Relay8, OUTPUT); pinMode(Relay9, OUTPUT); pinMode(Relay10, OUTPUT); digitalWrite(Relay1, HIGH); page ๓๔ By Chamrat charoenkhet reserve the right
Programming manual to control the lights on and off professionally by yourself. digitalWrite(Relay2, HIGH); digitalWrite(Relay3, HIGH); digitalWrite(Relay4, HIGH); digitalWrite(Relay7, HIGH); digitalWrite(Relay8, HIGH); digitalWrite(Relay9, HIGH); digitalWrite(Relay10, HIGH); } 3. part void loop() void loop() { Blynk.run(); timer.run(); } 2. Close All BLYNK_WRITE(V5) { CloseAll = param.asInt(); if (CloseAll == 1) { digitalWrite(Relay1, HIGH); digitalWrite(Relay2, HIGH); digitalWrite(Relay3, HIGH); digitalWrite(Relay4, HIGH); digitalWrite(Relay7, HIGH); digitalWrite(Relay8, HIGH); digitalWrite(Relay9, HIGH); digitalWrite(Relay10, HIGH); Blynk.virtualWrite(V0, HIGH); page ๓๕ By Chamrat charoenkhet reserve the right
Programming manual to control the lights on and off professionally by yourself. Blynk.setProperty(V0, \"offLabel\", \"ปดิ \"); Blynk.virtualWrite(V1, HIGH); Blynk.setProperty(V1, \"offLabel\", \"ปดิ \"); Blynk.virtualWrite(V2, HIGH); Blynk.setProperty(V2, \"offLabel\", \"ปดิ \"); Blynk.virtualWrite(V3, HIGH); Blynk.setProperty(V3, \"offLabel\", \"ปดิ \"); Blynk.virtualWrite(V4, HIGH); Blynk.setProperty(V4, \"offLabel\", \"ปดิ \"); Blynk.virtualWrite(V5, HIGH); Blynk.setProperty(V5, \"offLabel\", \"ปิด\"); Blynk.virtualWrite(V7, HIGH); Blynk.setProperty(V7, \"offLabel\", \"ปิด\"); Blynk.virtualWrite(V8, HIGH); Blynk.setProperty(V8, \"offLabel\", \"ปิด\"); Blynk.virtualWrite(V9, HIGH); Blynk.setProperty(V9, \"offLabel\", \"ปิด\"); Blynk.virtualWrite(V10, HIGH); Blynk.setProperty(V10, \"offLabel\", \"ปิด\"); } } page ๓๖ 3.Open_All By Chamrat charoenkhet reserve the right
Programming manual to control the lights on and off professionally by yourself. BLYNK_WRITE(V4) { OpenAll = param.asInt(); if (OpenAll == 1) { digitalWrite(Relay1, LOW); digitalWrite(Relay2, LOW); digitalWrite(Relay3, LOW); digitalWrite(Relay4, LOW); digitalWrite(Relay7, LOW); digitalWrite(Relay8, LOW); digitalWrite(Relay9, LOW); digitalWrite(Relay10, LOW); Blynk.virtualWrite(V0, LOW); Blynk.setProperty(V0, \"onLabel\", \"เปดิ \"); Blynk.virtualWrite(V1, LOW); Blynk.setProperty(V1, \"onLabel\", \"เปิด\"); Blynk.virtualWrite(V2, LOW); Blynk.setProperty(V2, \"onLabel\", \"เปิด\"); Blynk.virtualWrite(V3, LOW); page ๓๗ Blynk.setProperty(V3, \"onLabel\", \"เปดิ \"); Blynk.virtualWrite(V4, LOW); Blynk.setProperty(V4, \"onLabel\", \"เปิด\"); Blynk.virtualWrite(V5, LOW); By Chamrat charoenkhet reserve the right
Programming manual to control the lights on and off professionally by yourself. Blynk.setProperty(V5, \"onLabel\", \"เปิด\"); Blynk.virtualWrite(V7, LOW); Blynk.setProperty(V7, \"onLabel\", \"เปดิ \"); Blynk.virtualWrite(V8, LOW); Blynk.setProperty(V8, \"onLabel\", \"เปิด\"); Blynk.virtualWrite(V9, LOW); Blynk.setProperty(V9, \"onLabel\", \"เปดิ \"); Blynk.virtualWrite(V10, LOW); Blynk.setProperty(V10, \"onLabel\", \"เปิด\"); } } page ๓๘ 4.Output_1 BLYNK_WRITE(V0) { Data1 = param.asInt(); if(Data1 == 0){ digitalWrite(Relay1, LOW); }else if(Data1 == 1){ digitalWrite(Relay1, HIGH); } // process received value } By Chamrat charoenkhet reserve the right
Programming manual to control the lights on and off professionally by yourself. 5.Output_2 BLYNK_WRITE(V1) { Data2 = param.asInt(); if(Data2 == 0){ digitalWrite(Relay2, LOW); }else if(Data2 == 1){ digitalWrite(Relay2, HIGH); } // process received value } 6.Output_3 page ๓๙ BLYNK_WRITE(V2) { Data3 = param.asInt(); if(Data3 == 0){ digitalWrite(Relay3, LOW); }else if(Data3 == 1){ digitalWrite(Relay3, HIGH); } } 7.Output_4 BLYNK_WRITE(V3) { Data4 = param.asInt(); By Chamrat charoenkhet reserve the right
Programming manual to control the lights on and off professionally by yourself. if(Data4 == 0){ digitalWrite(Relay4, LOW); }else if(Data4 == 1){ digitalWrite(Relay4, HIGH); } // process received value } 8.Output_5 BLYNK_WRITE(V7) { Data7 = param.asInt(); if(Data7 == 0){ digitalWrite(Relay7, LOW); }else if(Data7 == 1){ digitalWrite(Relay7, HIGH); } // process received value } 9.Output_6 BLYNK_WRITE(V8) { Data8 = param.asInt(); if(Data8 == 0){ digitalWrite(Relay8, LOW); }else if(Data8 == 1){ digitalWrite(Relay8, HIGH); By Chamrat charoenkhet reserve the right page ๔๐
Programming manual to control the lights on and off professionally by yourself. } page ๔๑ } 10.Output_7 BLYNK_WRITE(V9) { Data9 = param.asInt(); if(Data9 == 0){ digitalWrite(Relay9, LOW); }else if(Data9 == 1){ digitalWrite(Relay9, HIGH); } // process received value } 11.Output_8 BLYNK_WRITE(V10) { Data10 = param.asInt(); if(Data10 == 0){ digitalWrite(Relay10, LOW); }else if(Data10 == 1){ digitalWrite(Relay10, HIGH); } } 12.WI-FI_Connect Void ConnectWIFI () { By Chamrat charoenkhet reserve the right
Programming manual to control the lights on and off professionally by yourself. WiFi.begin(ssid, pass); if (WiFi.status() != WL_CONNECTED) { Serial.print(\"Connecting to WiFi..\"); } else { Serial.println(\"WiFi connection failed.\"); } Serial.println(\"Connected to the WiFi network\"); } Program testing There are two active parts. 1. Match the checkmark for testing or testing the program that is the program perfect or stuck? 2. Straight arrow that poop to the right it is for pressing to allow the program (sometimes called Comfreys or upload the program to be sent to the NodeMCU ESP8266 V3 via a link cable from the computer. to store written commands for the system to work as needed Observation point while Press the check mark or press the arrow that it's the program that we write correctly or can Can you upload and send to keep? See here. By Chamrat charoenkhet reserve the right page ๔๒
Programming manual to control the lights on and off professionally by yourself. 1. The loading bar is working. 2. The characters are shown below. If it looks like this, it means it works. The word \"press\" means two quick presses on the right mouse or left mouse. To enable the program or system to run some might call it another belief. Double click By Chamrat charoenkhet reserve the right page ๔๓
Programming manual to control the lights on and off professionally by yourself. Training Lesson 7 Pin the board to use Connecting pins to use Board ESP 8266 V3 1. For Board ESP 8266 V3, there will be a pin as a name in the circuit for writing instructions to work. 2. Connecting lamps or devices to be used with relays according to pin connectors of Board ESP 8266 By Chamrat charoenkhet reserve the right page ๔๔
Programming manual to control the lights on and off professionally by yourself. Training Lesson 8 Install App Blynk and Setup Install or download App Blynk 2. Concentrate app Blynk 1. Use app Play store By Chamrat charoenkhet reserve the right page ๔๕
Programming manual to control the lights on and off professionally by yourself. 3. Press install app Blynk 4. Open the Blynk app. 5. The picture shows the program app Blynk that has been installed successfully. By Chamrat charoenkhet reserve the right page ๔๖
Programming manual to control the lights on and off professionally by yourself. 2. System settings in the mobile phone that will be displayed before connecting to the Wi-Fi system and showing that the Wi-Fi system is connected 2.1 Set the Auth code and view it to send it to the mail. By Chamrat charoenkhet reserve the right page ๔๗
Programming manual to control the lights on and off professionally by yourself. 2.2 Settings keypad selection 2.3 Settings By Chamrat charoenkhet reserve the right page ๔๘
Programming manual to control the lights on and off professionally by yourself. Meaning on the screen Meaning on the screen Button Settings (Button Settings) Write the name, press the button............ Number V4 for specifying pin selection to match the program written to work. The number 1 means the light is on. The number 0 means that the power is turned off. The word PUSH is pressed. The word SWITCH is a switch. ON /OFF LABELS IMPORTANT LABELS is for writing a program to operate the switch. OFF ON FONT SIZE There are three font sizes: small, medium, and large. TEXT set the color of the keypad can be selected in many ways. Delete to delete By Chamrat charoenkhet reserve the right page ๔๙
Programming manual to control the lights on and off professionally by yourself. Select a SWITCH type for push buttons to turn on and off all 8 lights or as specified. Setting up the style to be beautiful you can select the desired color and scroll through the colors. By Chamrat charoenkhet reserve the right page ๕๐
Search