The communication between the MEGA2560 and HMI (Scada) on the PC is communicating via Wifi. To keep full capacity for the AFSM on the MEGA board, the communication is pratically the same as the version with serial connection; TTL/USB, blue tooth or e.g. the APC220. The hardware serial connection of the MEGA is connected to an ESP8266 (separate card or on board the MEGA). The ESP is taking care of the network communication.
- The ESP8266 is now connected at the TX3/RX3 hardware serial port of the MEGA board, at a baudrate of 115200.
- The queue mechanism in VBA for resending lost message can be turned on/off. In some situations, messages can be lost occasionally (like trending). In such a case you can turn of the VBA message queue. It is done by an extra command line parameter: "C:\.....\FirstProject.exe" /ipadress="192.168.178.178" /port=1500 /que=ON (or OFF).
- The ESP8266 is receiving and sending the "@" messages for communication between the board and VBA. When it is not a "@" message, the ESP messages and information is printed at the serial monitor from the MEGA board. At the startup of the ESP, all messages, like network scan, IP-address and server messages, are now printed for debug purposes.
- Build in watchdog for monitoring communication with the PC (LED13 is blinking in a frequency of 500mS, at the off period there is a little blink indicating the communication is working).
The software is tested on a MEGA2560 with an onboard Wifi and a MEGA2560 with a separate ESP8266. See also the picture below.