0
\$\begingroup\$

Looking at this MaxSonar Ultrasound Sensor, datasheet. Will use it with a Raspberry Pi, powered with 3.3V.

In page two, pin five description, is reads...

Pin 5-Serial Output: By default, the serial output is RS232 format (0 to Vcc) with a 1-mm resolution. If TTL output is desired, solder the TTL jumper pads on the back side of the PCB as shown in the photo to the right. For volume orders, the TTL option is available as no-cost factory installed jumper. The output is an ASCII capital “R”, followed by four ASCII character digits representing the range in millimeters, followed by a carriage return (ASCII 13). The maximum distance reported is 5000. The serial output is the most accurate of the range outputs. Serial data sent is 9600 baud, with 8 data bits, no parity, and one stop bit.

I thought RS232 worked with +15/-15 voltage levels, but the datasheet says that the RS232 format is 0 to Vcc, what does this mean? And what makes it different from TTL?

When something is referred to as 'serial', is it implied to be I2C?

\$\endgroup\$
1
  • \$\begingroup\$ I think that's probably a typo in the datasheet. TTL signaling is 0 to Vcc, RS232 is not. I would check that signal with an oscilloscope to be certain that what they call "RS232" really does use RS232's voltage levels, and is not simply a "negative logic" version of TTL signaling. \$\endgroup\$ Commented Apr 14, 2018 at 12:25

2 Answers 2

2
\$\begingroup\$

Sounds a lot like "poor mans RS232", which is just an inverterd TTL signal. This violates the RS232 spec (which mandates signal levels above 5V or below -5V using a line driver) but works with a surprisingly large amount of RS232 receiver chips.

I suggest using an oscilloscope to check the signal. It might be just a mistake in the datasheet.

Note that if you wanted to connect the sensor directly to a microcontroller you'd use the TTL option.

\$\endgroup\$
3
  • \$\begingroup\$ What do you mean it is inverted from the TTL? Using it with a Pi at 3.3V, do I need to take the inversion into account? \$\endgroup\$
    – A.S.
    Commented Apr 14, 2018 at 8:55
  • \$\begingroup\$ See datasheet page 7: Operations and timing. You want TTL for the RPi, too. \$\endgroup\$
    – Turbo J
    Commented Apr 14, 2018 at 9:16
  • \$\begingroup\$ I see it. Is it the case then that using RS232 in this case will output 0-3.3V, and TTL will output 0-3.3V inverted? "By default, the serial output is RS232 format (0 to Vcc)" \$\endgroup\$
    – A.S.
    Commented Apr 14, 2018 at 9:31
1
\$\begingroup\$

RS232 defines how data are transmitted in a serial stream. It defines the framing and the timing. It also defines the voltage levels. It does not describe the content.

TTL in this case means that data are transmitted using the framing and timing of RS232 but using voltage levels compatible with TTL logic chips.

The reason for doing this is that it allows you to leave out the RS232 voltage conversions.

The signals for RS232 are generated by ICs or microprocessors that put out TTL signals. To transmit the data over an RS232 compatible cable to another RS232 capable device, you send the TTL signals through a voltage converter that translates them to the levels defined in the RS232 standard.

If you are connecting two deviced using RS232, but they are only a few inches apart, then you can leave out the voltage conversion step in both directions.

This saves you a couple of ICs and some complexity on your PCB.

This ultrasound module can transmit data using either the standard RS232 levels or TTL levels. A single jumper tells it which to use.

\$\endgroup\$
2
  • \$\begingroup\$ In the case of using it with a Pi with 3.3V, would both RS232 and TTL output in the 0-3.3V range? \$\endgroup\$
    – A.S.
    Commented Apr 14, 2018 at 8:54
  • 1
    \$\begingroup\$ RS232 would follow the voltages setbout in the RS232 standard. If the module is set to TTL, and you are operating it from a 3.3V powersupply, then its signal levels will be 3.3V TTL - you could connect that directly to the GPIO pins of the Pi. \$\endgroup\$
    – JRE
    Commented Apr 14, 2018 at 9:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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