Kenneth Marcano
hi, with respect to the analog input of esp8266, the data type you select for input% IW100 is int, but I do not know what values ​​this throws since I want to compare it with a constant.
Reply 0 0
thiagoralves
The value ranges from 0 to 65535, where 0 = 0V and 65535 = 3.3V
Reply 0 0
Kenneth Marcano
that's what I had thought, but when I compare that value with a block of greater or equal than, with a constant of 30000, when I put even the 3v analog input does not turn on the led that is what I have connecting to the output
Reply 0 0
thiagoralves
Try using Radzio modbus to connect to OpenPLC and check the Input Status registers. These registers store the analog input readings. Check address 100 onward and see what OpenPLC is reading. It could be a problem with your esp board, with the connection between the esp and the OpenPLC, or even some issue with your ladder logic.
Reply 0 0
Kenneth Marcano
I do not know much about this software but from what I have read configure to connect to the pi as the image shows. the ip address of my pi is 192.168.0.111. [image]  modbus.png 

Reply 0 0
thiagoralves
That’s correct. Then you just click on connection->connect and then file->new. A spreadsheet will pop up. Select Input Registers to look for analog inputs and then check address 100
Reply 0 0
Kenneth Marcano
verificar.png 


ok this is what it shows, I also attach the plc code.



LD.png 
Reply 0 0
thiagoralves
From Radzio screen it looks like the analog input %IW100 is reading zero all the time. Are you sure that your esp is communicating with OpenPLC? What are the logs from the dashboard? It should say that it connected to the esp board. If you don’t see a message like that then there might be something wrong with your slave devices configuration 
Reply 0 0
Kenneth Marcano
esp.png  my esp if it is connected to open plc, I managed to make some tests that were successful, in the previous image of the plc code, the part of the inputs SW_ON and SW_OFF works very well, but the part of the analog input gives me a problem, I'm considering that the problem is my esp. I attached the esp configuration in open plc
Reply 0 0
Kenneth Marcano
I have already done tests with timers and counters, I could not populate the block pid because the analog input always reads me zero and congratulations for such an interesting project, a great contribution to the community, I will soon be testing with the SCADA BR
Reply 0 0
Kenneth Marcano
Hola, hice algunas pruebas nuevamente con mi esp, e hice que me mostrara en el puerto serie el valor analógico ya convertido y si funciona para mí. No sé qué podría estar pasando con OpenPlc
Reply 0 0
thiagoralves
Are you using the official OpenPLC firmware for the esp from the openplcproject.com website? That firmware allows the esp to work as a modbus slave device. Try using Radzio to connect directly to your esp (instead of OpenPLC) and see if you can read the input register 0 (address 0 and length 1).
Reply 0 0
Kenneth Marcano
Hi, yes, I have the official openplc firmware for esp, I did the test by connecting directly to the esp and if it shows me the values, but when I start the plc through the web interface and reread the address 100 it keeps throwing me 0.
Reply 0 0
Kenneth Marcano
I do not know if I have something to do if an error occurred during the installation of the openplc in my pi and I did not realize that.
Reply 0 0
thiagoralves
I believe that there might be something wrong with your OpenPLC installation. Try reinstalling it and check if it works
Reply 0 0
Reply