I been trying to connect to AWS IoT Core from a PLC (X20CP0484). Now these are the things i did:
PLC gets IP from DHCP
PLC gets DNS from DHCP
2 ST programs: 1 for pinging, 1 for publishing a message to AWS IoT Core every 500ms
Now, pinging ‘8.8.8.8’ or ‘google dot com’ works with the pinging programs (through watch the changing the pinged address). To achieve this, I followed this other forum post:
So, I know the PLC has internet connection. Sending messages to AWS should now work, but its not. Funny thing is, when turning on simulation in the same project, message DO get sent to AWS. This way I know my certificates and endpoint are correct.
Time of PLC is backup by battery. So if you have new PLC, you have to plug battery in, set up your PLC time as well. And than it should be ok. Anyway thanks for topic and solution as well
Hi @maxim.bozek,
I’m glad that my post could be helpful for your work.
It seems you have two problems; let us look for ways to solve them.
1. Time of PLC: You need to consider using NTP (Network Time Protocol). First of all, in accordance with the message from Jaroslav Kovar, you should be mindful of the battery if your hardware has one. And then if your PLC has an internet connection or access to an NTP server on the network, you may need to configure the PLC’s NTP client settings. This will allow the time to update automatically.
You can get it from the program coding(B&R Online Help) or the configuration settings of CPU (B&R Online Help)
2. Sending messages to AWS: From your explanation, it seems that the message cannot be sent from the PLC, but it can be sent from ARSim. If this is correct, you are asked for checking the firewall of route/AWS or router settings. It appears that the message from the PLC is being blocked, but messages from your PC (ARSim) are allowed, which means the PLC may not have the proper permissions.
I hope my opinion helps you, and please let me know whether you were successful or not.
Thanks, Have a good one!
I think the issue is, that AWS won’t accept messages if the time is off like that (2007), the same can happen to you with OPC UA server / clients. If you have a big gap in time, that is not really plausible, servers can reject the connection. As Maxim wrote in hist post above, setting the time solved the issue:
Time of PLC wasn’t correct, it was set to somewhere in 2007.