ESP8266 Modbus TCP Server, Node-RED as Client, Control Relay in Coils and DHT-11 in Holding Register

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi welcome back to my channel in this video I will show you how to make esp80 to 66 as modbus TCP server to monitor tht11 sensor and relays as coils let's get started I use esp80 to 66 as modwest TCP server with Wi-Fi connection the ht11 sensor to monitor temperature and humidity I saved the result of sensor into modbus holding register then as output I used to relays I save the status of relays into modbus core register I use two buttons as input to control the relays by writing the value of each core register I use node red as modbus TCP client configure node red to connect to ESP IP address so node red can read the holding registers and read all write the core register to control the relays this is ESP and node-red we can control the relay either through the node grid dashboard or using buttons status of relays read from coil registers and show them into dashboard true or false then if buttons in dashboard pressed node red will write the core register based on the button value no bread will read the holding register in modbus server to get value of temperature and humidity then display the values into gauge and chart [Music] thank you this is the required library for ESP code which is the modbus ESB 80-66 Library you can download it from GitHub or directly through the library manager in the Arduino IDE [Music] if you download from GitHub extract the zip file and copy to Arduino libraries folder in Arduino folder located in documents foreign [Music] [Applause] [Music] [Applause] [Music] [Applause] [Music] [Applause] libraries and this is DHT 11 sensor pin configuration [Music] this is called registered configuration I use two address of coils zero and one declare the modbus IP we will use the MB in codes below use a coil syntax to configure or create a core register use a holsing register syntax to configure the holding register I create four address of holding register for Save value of temperature and humidity I separate between the integer value and decimal in different register address extract the integer value and decimal value from sensor temperature and humidity then write them into register control the release output based on the value of call register [Music] these codes are for checking the button status and write the core register based on the button's value before upload the code make sure to configure correct ESP board and the port number [Music] select the serial monitor to get IP address of ESB status of coils and value of temperature and humidity I use modbus client X program to test connect modbus server of ESP select your connection and input the IP address we can read the data for holding registers and call registers in modbus TCP server we can see the changes in the value of the holding register based on the values displayed in the serial monitor in the Arduino IDE for the temperature value I split it into an integer and a decimal for example if the temperature value is 33.7 I write it to the registers as two separate values 33 in register 0 and 17 in register 1. in the core register the value is represented as either true or false if I press the button on ESB the coil status becomes true and if I release the button it changes back to false [Music] this is the no grid flows I use modbus node to read and write the modbus TCP server configure the server set the IP address port number and set the type to TCP foreign [Applause] status select function code to read call status the set the starting address to zero and quantity is two it means it will read status addressed error and address one [Music] display the result of recoil status into text node [Music] this modbus know for reading holding register set the address to zero and quantity 4 because temperature and humidity have to register for integer value and decimal value [Music] function now to get payload for temperature and humidity from the holding register combine the integer value and decimal value into one variable display the temperature and humidity values on a gauge visualization [Music] also show these values on a line chart graph so that we can observe the changes in temperature and humidity over the time [Music] next but a note to send Boolean payload true or false to write the core register on modbus write node set the function for single coil and set the call register address [Music] this is the no Brit dashboard display each call register value into text true or false thank you when button in ESP pressed and relay on the value of register become true if button released the value back to false foreign [Music] temperature and humidity displayed in gauges same with value in serial monitor of Arduino IDE [Music] [Applause] [Music] buttons in the dashboard can write the core register value when the green button is clicked node grid will set the core register to true and when the gray button is clicked it will set the coil to false this allows us to control the relay from the dashboard thank you thank you for watching don't forget to like And subscribe my channel see you in my next video
Info
Channel: Yaser Ali Husen
Views: 3,876
Rating: undefined out of 5
Keywords:
Id: FOVCOjTENCM
Channel Id: undefined
Length: 10min 5sec (605 seconds)
Published: Wed Oct 04 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.