Might aswell post this here as it's more likely to be of interest for those who's looking into communicating with Siemens Simatic S5 PLC's.
Here's a useful thing for S5 PLC's, it's an, however simple, Arduino/Adafruit LCD display- based operator panel designed to change the value of a dataword in a datablock in the PLC, will come in handy where there's a need for frequent changes of such a value.
It's based on using the navigation keys (Adafruit 2x16 LCD display with integrated buttons) for changing the value itself and then pressing the Select button in order to send the new value to the PLC.
I used such an Adafruit display including buttons which was originally designed for a Raspberry Pi, but I adapted it to a Arduino Mega instead, which wasn't too hard given that there's only 4 wires in all (+5V, GND, SDA and SCL) and those pins are already available on the Mega as is.
Hopefully I've explained the whole shebang in the sketch, shouldn't be all that hard for whoever to adapt the code to suit your own needs.
Sources and inspiration:
AS511 protocol description : http://www.runmode.com/as511protocol_description.pdf
Converter TTY/RS232 : http://www.plcman.co.uk/232_20ma.zip (the "original" converter, the first one I replicated in order to be able to connect to a S5 PLC, works just fine!)
Schematics (of the above) TTY/RS232 converter : http://siodemka.p.lodz.pl/~kazz/rs2tty_838.gif
Serial sniffer mod (for Realterm) : https://embeddedfreak.wordpress.com/2008/08/17/rs232-serial-sniffermonitoring-circuit/
Realterm : http://realterm.sourceforge.net/ . Display data in HEX (with space), also make sure to set the correct serial protocol. I run this program on an old laptop running XP and it actually takes a little bit of fiddling back and forth with the controls/menues to make it display the data the way I want it to.
Arduino Mega / Adafruit wiring : https://learn.adafruit.com/system/a...__displays_RGB_LCD_WIRING_rev1.png?1396772126
Adafruit Pi GPIO : http://elinux.org/images/2/2a/GPIOs.png
Note: Keep TTL (which includes both the Arduino serial ports and the AS511 PLC TTY interface) completely separated from RS232 voltage levels at all times.
Mixing the two (TTL and RS232 voltages) can/will lead to destroying the Arduino's and/or the PLC's serial interfaces.
Use the schematics provided, which is based on the TTY/RS232 converter, as it works just fine both as an interface between the Arduino and the PLC and also as an interface to the serial sniffing computer running Realterm.
Good luck
Here's a useful thing for S5 PLC's, it's an, however simple, Arduino/Adafruit LCD display- based operator panel designed to change the value of a dataword in a datablock in the PLC, will come in handy where there's a need for frequent changes of such a value.
It's based on using the navigation keys (Adafruit 2x16 LCD display with integrated buttons) for changing the value itself and then pressing the Select button in order to send the new value to the PLC.
I used such an Adafruit display including buttons which was originally designed for a Raspberry Pi, but I adapted it to a Arduino Mega instead, which wasn't too hard given that there's only 4 wires in all (+5V, GND, SDA and SCL) and those pins are already available on the Mega as is.
Hopefully I've explained the whole shebang in the sketch, shouldn't be all that hard for whoever to adapt the code to suit your own needs.
Sources and inspiration:
AS511 protocol description : http://www.runmode.com/as511protocol_description.pdf
Converter TTY/RS232 : http://www.plcman.co.uk/232_20ma.zip (the "original" converter, the first one I replicated in order to be able to connect to a S5 PLC, works just fine!)
Schematics (of the above) TTY/RS232 converter : http://siodemka.p.lodz.pl/~kazz/rs2tty_838.gif
Serial sniffer mod (for Realterm) : https://embeddedfreak.wordpress.com/2008/08/17/rs232-serial-sniffermonitoring-circuit/
Realterm : http://realterm.sourceforge.net/ . Display data in HEX (with space), also make sure to set the correct serial protocol. I run this program on an old laptop running XP and it actually takes a little bit of fiddling back and forth with the controls/menues to make it display the data the way I want it to.
Arduino Mega / Adafruit wiring : https://learn.adafruit.com/system/a...__displays_RGB_LCD_WIRING_rev1.png?1396772126
Adafruit Pi GPIO : http://elinux.org/images/2/2a/GPIOs.png
Note: Keep TTL (which includes both the Arduino serial ports and the AS511 PLC TTY interface) completely separated from RS232 voltage levels at all times.
Mixing the two (TTL and RS232 voltages) can/will lead to destroying the Arduino's and/or the PLC's serial interfaces.
Use the schematics provided, which is based on the TTY/RS232 converter, as it works just fine both as an interface between the Arduino and the PLC and also as an interface to the serial sniffing computer running Realterm.
Good luck