I have connected my GPS EM305 to my Raspberry Pi B+, but i am very lost in getting communication ...

I have used this program

import serial

import Adafruit_BBIO.UART as UART


GPS = serial.Serial('/dev/ttyO1', 9600)


        while GPS.inWaiting()==0:
        print NMEA

From beaglebone, is it correct for the pi?

It said that the module adafruit is not installed, is possible to installed it or should I use something different?

  • I don't know what you should be using for the UART module (that one is unlikely to work, although it might if it is based on the generic linux interface) but the actual serial port on the B+ with Raspbian is /dev/serial0 (or /dev/ttyAMA0; the former is a symlink).
    – goldilocks
    Sep 15 '16 at 17:25
  • Good information. And as I commented below, to use a UART for anything other than a console there are further steps to be taken.
    – SDsolar
    Sep 16 '16 at 21:17
  • Did you solve your problem Daniel? Please mark an answer correct or provide a solutions. Thanks :D
    – Piotr Kula
    Dec 7 '16 at 8:06

The short answer is PySerial.

Install it using apt-get install python-serial

Then in Python, the syntax is a bit different than you showed, so use it like so:

import serial

sp = serial.Serial ("/dev/tty01")   
sp.baudrate = 9600                   

data = sp.read(10)      # 10 characters            
sp.write(data)          # echo all 10 characters back

  • If you really want to use a UART port, check out this site: electrosome.com/uart-raspberry-pi-python it discusses the process required to convert a Pi UART from console to general use, complete with python and command line examples.
    – SDsolar
    Sep 16 '16 at 19:54
  • If you look down the page here you will see a very clear diagram that discusses the UART electrical connections. instructables.com/id/Raspberry-Pi-the-Neo-6M-GPS
    – SDsolar
    Sep 16 '16 at 19:54
  • Thank you for the edit, Goldilocks. That makes it a lot more clear. I don't know how you did that but I like the result a lot.
    – SDsolar
    Sep 18 '16 at 17:39

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.