1

I have bought an inclinometer today to try some things.

Inclinometer has two communication port; RS232 and UART.

Which one should I select? Actually I tried both but none of them worked.

I have followed all the instructions on this page : http://elinux.org/RPi_Serial_Connection#Connection_to_a_microcontroller_or_other_peripheral

I have tried both with minicom and this small python script:

import serial
import time

port = serial.Serial(
    port='/dev/ttyAMA0',
    baudrate=38400,
    bytesize=serial.EIGHTBITS,
    parity=serial.PARITY_NONE,
    stopbits=serial.STOPBITS_ONE,
    interCharTimeout=0.1,
    timeout=1
)
print("Port Name: %s" % port.name)

while True:
    port.write(bytes("get---x", 'iso-8859-1'))
    rcv = port.read(10)
    print(rcv)
    time.sleep(0.5)

Datasheet is here

I have tried both of the connections, on the picture it's connected to rs232 port. connection

I have followed this page when I connecting the inclinometer;

http://elinux.org/RPi_Low-level_peripherals#Model_A.2B.2C_B.2B_and_B2

  • pin1: (Red) +ve Supply 3.3V
  • pin6: (Black) Ground (0V)
  • pin8: (Green) UART Tx
  • pin10: (Yellow) UART Rx

What I am doing wrong?

  • 1
    The pins used appear correct. Could you confirm you have connected one ends TX to the other ends RX and vice versa? – joan Jul 22 '15 at 17:55
  • OMG, you are right... What a big mistake. Should I use UART port of the inclinometer right? – ecabuk Jul 22 '15 at 18:01
  • You may be too late. I just looked at the inclinometer datasheet. You must use the UART connections pins 5 and 6 on the inclinometer to connect to the Pi's UART. Using RS232 may destroy the Pi's gpios or the Pi. – joan Jul 22 '15 at 18:10

Your Answer

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

Browse other questions tagged or ask your own question.