Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8041

Interfacing (DSI, CSI, I2C, etc.) • Re: Using a Raspberry Pi to Capture Data from a custom PLC

$
0
0


I do hope so - I will upload the simplified circuit and then we can test it.
No!

I mean, not yet.

Try extracting the signal from pin 11 before changing anything. It needs to be inverted is all. If you're plugging it into a usb rs232 port then 5V TTL will work, only if the logic is inverted.
I have tried invesrting the bits in the software, but the output for the first 20 characters is:

10000110110000101001100011001110110011001001100000111100111001101001011101111100001111001110011010000110110000101001111010011110100111101001111010011110

Compared to what we assume should be:
00001101000010100011000100110000001110100011001000110000001000000011001000110101001011110010000000110111001011110011001000110101000011010000101000111101

So, it looks as though we are missing the start but even then we cannot match the bits (of course the data might not use bit 7) but that doesn't solve anything
Ok. Sorry I was not clear. It is not sufficient to invert the data you have captured, because you have captured bytes. The bytes themselves are incorrect because they did not have a start bit in the right place. Therefore inverting the bytes will not work. You have to invert at the bit level, then feed that into the UART. At that point, the start bit will be correctly detected and the bytes will be correctly decoded.

The reason I suggested for not making a simplified circuit yet is because if it doesn't work it won't be obvious why, and you'll have to debug it. Carrying on from where you are, however, is very likely to succeed as I think you are basically there.

You need the inversion if you are connecting pin 11 into an RS232 to USB converter, or RS232 port in general. If you have a TTL UART then you don't need the inversion, but your UART must be 5V capable.

Do you have one of these, or something similar?
https://www.aliexpress.com/item/1005009208142634.html

It is a TTL serial to USB converter. You should be able to connect pin 11 to Rx on the module, and see data appear in a terminal.

Do you have an Arduino? You could hook up pin 11 to an input on the Arduino, configured as a serial input, and program it to send any bytes received back to the host.

You could try making a resistive divider to drop the 5V TTL signal to 3.3V, then feed it directly into a UART on the Pi GPIO pins. It ought to work, but might affect the signal level going into the printer.

I really think the inversion is the only issue and that you are basically there. I am so looking forward to a resolution of this thread.

Statistics: Posted by ame — Wed Jul 30, 2025 9:46 am



Viewing all articles
Browse latest Browse all 8041

Trending Articles