Wadam00
Hello Guys!
Im wondering how would i set up a slave device for example an esp32 1-wire sensor or anything like that?

Reply 0 0
thiagoralves
You would have to code the 1-wire portion on an Arduino Extension and expose the readings to a located variable (like %MW0 for example). Then you upload that to the ESP32 with Modbus enabled. This will make the ESP32 suitable to be added to the OpenPLC runtime running on Linux or Windows as a slave device.
Reply 0 0
Wadam00
You would have to code the 1-wire portion on an Arduino Extension and expose the readings to a located variable (like %MW0 for example). Then you upload that to the ESP32 with Modbus enabled. This will make the ESP32 suitable to be added to the OpenPLC runtime running on Linux or Windows as a slave device.
how would i do that? sorry i just started looking at this OpenPLC, do i create a plc program that reads the sensor to a variable or how?
Reply 0 0
thiagoralves
What exactly do you want to accomplish? If it is just about reading the 1-wire sensor, you don't need to add any slave. Create a PLC project, click on the grey plus icon, select Arduino Extension. Write the code for the 1-wire sensor part using Arduino language, then store the value in a shared variable. Shared variables are created on the table at the top of the Arduino Extension code. Then from the PLC program you can access the Arduino Extension shared variable by creating another variable with the same name and type, but with class "external".
Reply 0 0
Wadam00
What exactly do you want to accomplish? If it is just about reading the 1-wire sensor, you don't need to add any slave. Create a PLC project, click on the grey plus icon, select Arduino Extension. Write the code for the 1-wire sensor part using Arduino language, then store the value in a shared variable. Shared variables are created on the table at the top of the Arduino Extension code. Then from the PLC program you can access the Arduino Extension shared variable by creating another variable with the same name and type, but with class "external".
i have a raspberry with rs485 and i have multiple slave devices one is an esp32 with 23 1-wire sensor and i want to read those over rs485, i currently have not uploaded anything to the esp so essentiall the plc program is on the raspberry esp32 would only have a slave program right?
Reply 0 0
thiagoralves
Yes, in that case the ESP32 only needs to have a simple blank program, with an Arduino Extension that reads the 23 1-wire sensors. Having the communication work through rs485 might be a challenge. Maybe you will want to have it working over Modbus/TCP first, as that's simpler to setup and require no extra hardware.
Reply 0 0
Wadam00
right. i would prefer rs485 that why i want that
Reply 0 0
Wadam00
i could aso just use

WP3066ADAM-8-DS18B20

Reply 0 0
thiagoralves
Yes, that's definitely a lot better than a plain ESP32 for industrial usage, does not require any programming, and will work out of the box with the OpenPLC runtime
Reply 1 0
Reply