PLC and Ubidots


#1

Hello everyone,

Working with Unitronics V570 and Ethernet Card.

I went away from microcontrollers to a PLC and I would like to send data to Ubidots.

I have connected the PLC to internet (I don’t know how far can I go over it) and I could establish communication between the IP and port (50.23.124.68 : 80) for Ubidots but my plc doesn’t send data.

Something addition that I know and I can do is to send an email from my PLC using SMTP. so Is there any possibility that I send data to Ubidots and somehow it decode my email and save my data?

Thanks in advantage.


#2

Hello, Ubidots works with HTTP requests so if your PLC can make them you can construct the request on your machine according to our API.

Another way is to read the values of your PLC using an external device like a raspberry pi, you can read the values of the registers using a rs-485 to USB converter (link) and to implement a code for reading modbus using the usb port, python has some libraries for this purpose (link , link)

The libraries above can serve you for reading through modbus-TCP too.

Hope it helps you.


#3

Thanks for replying,

Actually I did the first one, as Ubidots understands HTTP request I just sent data in ascii format and Ubidots Interpreted it and now I am saving data into Ubidots, however I cannot get the feedback message in my device. It seems that right after I send the message, the Ubidots server gets disconnected and my device doesnt received the feedback message.


#4

Hello, Ubidots answers for a request with a JSON dictionary, your device should be able to decode it if you want to obtain values directly from Ubidots, Does your PLC support to parse a JSON?, if yes, you may construct two different routines: one for sending values and another one for retrieving values, can you try in this way?

How are you making your request for sending values? do you construct a socket TCP? How are you trying to retrieve data? It can be helpful for looking for something else in order to help you.

Regards


#5

Hi,

Effectively I have contructed a socket TCP in order to connect to Ubidots, because everything is in ladder structure and PLC’s are a bit restrictives about sharing data to a third-party it was difficult but I took some of your advice and now I have done everything.

I was not getting the feedback message because I had the line " Connection: close " in my code (I took this example from Get Started) so I deleted and worked.

By the way, my PLC doesnt support JSON just ASCII data, and I am not able to parse anything but successfully I jumped over those things in order to get the information I needed.

As I had opened this topic I may say that it can be closed now,

Thank you for all your support, see you next time.


#6

I’m glad to listen that you were able to parse your data, Can you please post your code or a screenshot of your implementation for future references?

Regards


#7