0
\$\begingroup\$

We have old type textile machinery in our factory. (open end machine) on the machine's screen is showing the operating efficiency of the machine. Under the hood, When I follow the cables, the sensors are followed by multiple sections. Sections only connected each others by 3 wire cables. Finally, 3 cables come to the machine processor (main board).

Main processor is collecting all section values and displaying the total operating efficiency of the machine. I want to read the data over these 3 wires as a parallel bridge and read the logical values and publish this values on a channels like Thingspeak. In this way, I will be able to monitor the efficiency of the machines at home.

The problem here is to determine which communication protocol the 3-wire data from this textile machine uses. How do I identify the protocol via a communication protocol that I don't know and how can I get it from there?

I've used Master Writer/Slave Receiver technique from docs but it returned -1 and didn't make sense.

I tried to draw the wiring diagram to you

wiring diagram

\$\endgroup\$
  • 1
    \$\begingroup\$ Hint#1: I would first try to determine what components are used for the communication signals. \$\endgroup\$ – Mikael Patel May 19 at 10:14
  • 2
    \$\begingroup\$ Hint#2: Next I would probe the (hopefully) digital signal on the main board with a logic analyzer. \$\endgroup\$ – Mikael Patel May 19 at 10:14
  • \$\begingroup\$ I requested this thread to be moved to Electronics ... actually it should be closed here anyway since it is not related to Arduino (I removed that tag). \$\endgroup\$ – Michel Keijzers May 19 at 10:31
  • \$\begingroup\$ in my opinion it is related with arduino. because I want to read data with arduino and publish it over a iot channel such as Thingspeak. \$\endgroup\$ – mehmet May 19 at 10:39
  • 1
    \$\begingroup\$ I would guess it is RS485 \$\endgroup\$ – Juraj May 19 at 11:09
2
\$\begingroup\$

Although you tagged this I2C and SPI, since this is a factory environment, those interfaces will not be used for long distances in such an electrically noisy environment. As commented by Juraj, one possibility is RS-485, although there are other possibilities like RS-232. We would get a clue from seeing the exact cabling using (e.g. twisted pair internally or not?)

I've used Master Writer/Slave Receiver technique from docs but it returned -1 and didn't make sense.

Since that interface won't be I2C, and you haven't said that you identified any of the signals on those 3 wires, then I recommend that you stop guessing by following that I2C tutorial. You could damage your Arduino's I2C interface, by connecting it to signals which are above logic-level voltages (e.g. the higher-voltage range of RS-232).

The problem here is to determine which communication protocol the 3-wire data

It's not going to have 3 data wires. More likely is Tx, Rx and Gnd or Tx/Rx+, Tx/Rx- and Gnd.

FYI, you will need to buy/borrow and use a logic analyser as part of this process, and it might be necessary for you to use an oscilloscope too (depending on what you find in part 1 below). I saw you mentioned in a comment that you are now buying a cheap USB logic analyser, but note that an oscilloscope might still be needed.

The overall process I suggest you follow, has these stages:

  1. Identify the electrical interface

    • Look at the electronics on the "section boards" and the "main processor" which you mentioned. What ICs do you see, which are connected to this external interface? Do those IC part numbers help you to identify the interface type?

    • If you can't identify the ICs, then at least identify whether one of the wires is Gnd (likely) and then use an oscilloscope to view the signals on the other two wires, to find the amplitude (are they bipolar or unipolar? single-ended or differential?). Those results will help you identify the electrical interface being used.

  2. Analyse the protocol on the interface.

    • Electrical interface standards like RS-232 and RS-485 don't specify the actual protocol used to transfer data on that interface.

    • You need to find a way to capture the data (e.g using a logic analyser, if necessary via a suitable interface IC, depending on what you found in part 1 above; an oscilloscope may still be useful too). Then look for patterns in the data - timing patterns, numerical patterns (especially at the start of each data transmission), and any other patterns you can see.

    • Since there are multiple "section boards" then a good starting hypothesis is that there is some kind of addressing involved, so that the "main processor" can select which "section board" it is going to collect data from. Look for switches or other address selection on these "section boards" to help confirm or deny that hypothesis.

    • Can you identify whether this is a polled design e.g "main processor" sends out some kind of request, to a specific "section board" using its address? Other system designs are possible, but it all depends on what you see on the data lines, when you get that far.

    • I have never been involved in a textile factory, but research the equipment make/model online, to see if you can find any information from other people who may have publicly shown their research, after interfacing with similar machines.

  3. Use the correct electrical interface (from part 1) and your understanding learned about the protocol (from part 2) to then write a program for an MCU (e.g. you mentioned Arduino) to monitor the data being returned to the "main processor".

\$\endgroup\$
  • \$\begingroup\$ well I have bought a logic analyser and try to do someting. When I connect to 3 wire. first wire like a ground. because there is not a PWM or signal. (almost quiete). second wire is working sometimes. third wire is working like a clock. after logic analyser if I choice the "async serial" protocol, it gives this ascii codes: Time [s],Value,Parity Error,Framing Error 0.000006000000000,'8',, 0.001001625000000,'181',, 0.001999541666667,'142',,Error 0.003003541666667,'137',,Error 0.004016166666667,'160',, 0.005006875000000,'31',, 0.006014791666667,'163',,Error 0.007004500000000,\t,, \$\endgroup\$ – mehmet May 25 at 9:09
  • \$\begingroup\$ if I choice the modbus protocol it send this data: Time [s], DeviceID, Function Code, Message 0.000007916666667,ùq!üùq!üùq! 0.002208458333333,ùq!üùq!üùq! 0.004401000000000,ùq!üùq!üùq! 0.006591125000000,ùq!üùq!üùq! 0.008786166666667,'18', Write Multiple Coils ('15'), StartAddr: '50766', Qty: '41098', ByteCount: '134' 0.016469958333333,,, Data, Value: ' ' 0.017563916666667,,, Data, Value: Z 0.018658333333333,,, Data, Value: '204' 0.019762833333333,,, Data, Value: '27' \$\endgroup\$ – mehmet May 25 at 9:11
  • \$\begingroup\$ @mehmet - Thanks for the update. However... (a) Actually doing the protocol decoding is out of scope for this question. It's too much to include the whole project in one question (we don't allow "whole project" questions here - they're too broad). Originally, you asked for help with the reverse-engineering process, and that is what I wrote about here :-) (b) You have jumped straight into giving data from "part 2" of the process - but you haven't explained your results from "part 1" at all. Your data collected from "part 2" could be useless, if "part 1" has been done wrongly :-( \$\endgroup\$ – SamGibson May 26 at 16:47
  • \$\begingroup\$ (c) For the previous 2 reasons, I recommend that you write a new question, link to this one, and explain your analysis of "part 1" i.e. the electrical interface. What did you find for each step I suggested? Did you use an oscilloscope? What conclusions did you make? And based on those, what interface ICs are you using between the 3-wire cable, and the logic analyser? Please include photos of the original hardware, if possible, and of your interface to the logic analyser. \$\endgroup\$ – SamGibson May 26 at 16:48
  • \$\begingroup\$ (d) Depending on what you write about "part 1", it might be possible to include "part 2" (protocol analysis) in the same question as "part 1" - it depends how simple "part 1" was and how much confidence we can have in the logic analyser data you are collecting. Again, you need to list answer to each point in my list for "part 2" e.g. were there address selection switches? What did you find in your research of the make/model? Any help in the machinery user guide? etc. \$\endgroup\$ – SamGibson May 26 at 16:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.