Go Down

Topic: Communicating the PLDuino over Serial (Read 1 time) previous topic - next topic

VilasDesai

I am experienced on PLC programming but not on micro-controllers or C / C++, so  I could be called a hobbyist for IoT applications. I am working on my domestic lift which has a Microcotroller that I am trying to communicate with PLDuino on a serial port,to seek information about parameters that I could use on my remote server for monitoring.  The lift manufacturer does not want to provide any information except that the existing controller has a UART serial port in addition to a USB port. The protocol he uses is 8 bit, 1 stop bit, odd parity, 19.2 k baud rate and no CRC. I guess the port is Rs232. Qith this information can some one help me with a code in Arduino 1.8.5 version prog software.

Gippopotam

And what do you want to get in the end?
If you do not know the protocol by which the lift is operated, you can not do anything.

VilasDesai

Thanks a lot for your reply. I dont have the name (modbus / profibus, etc) but the parameters are as mentioned. I thought this description 8 bits, odd parity, 1 stop, and 19.2 k baud would be sufficient to make the communication. The one thing that is not clear is addresses of the memory location and the header of the data. If I get this information would it be possible for the PLDuino (Atmega 2560) to act as a master and initiate the communication with the Lift controller which is a slave. I was thinking a code in the Atmega would do the job. Please advise. Thanks and best regards.

VilasDesai

Sir, further, to your question "and do what" the answer is after establishing the communication I would like to get the data / lift parameters into the PLDuino and publish it to a Gateway for IoT application. Hope this answers. Thanks again.

Gippopotam

This will work only in one case, if after the connection is established your lift will give out all the available information to the port.
You can easily verify this by simply connecting the Serial1 and GND contacts. And then just try the sketch from the examples folder.

VilasDesai

Thank you Sir, this is exactly what I wanted to know. My worry was do I have to make any additional codes to establish the communication itself. Just to reassure my self your advise is the standard examples for communication would do the job. all that I need to know now is the format of the data in the lift controller. I hope this is correct. Thanks and best regards. By the way, the lift parametes are updated pereodically, for some it is 1 hour while for some others it is 1 minute

Gippopotam

void setup() {
 Serial.begin(19200);
Serial1.begin(19200);

}

void loop() {
   while (Serial1.available()){
     Serial.print((char)Serial1.read());
  }

}

VilasDesai

Thank you Sir, I will keep this posting live for a week more so that I can ask any followup questions I may have.

Go Up