Page 2 of 2

Re: GPS and ACCEL via ShieldRv1 on Raspberry Pi?

Posted: Mon Sep 21, 2015 10:42 pm
by wtbgagoa
Thanks for the information.

Re: GPS and ACCEL via ShieldRv1 on Raspberry Pi?

Posted: Sat Sep 26, 2015 6:13 pm
by donjohnii
Pretty straightforward to setup the GPS on a GPIO rather than the HW UART. Here's what I came up with:

=======================================================================================

You can use the standard Raspberry Pi UART and functions to capture GPS data over the HW UART or, as demonstrated below, you can use the Raspberry Pi to “Bit Bang” or port “Software Serial” rather than the Hardware one.

The below software Serial port utilizes the great PIGPIO which you can download and install for free at the following URL:
http://abyz.co.uk/rpi/pigpio/download.html

Here’s the file I used from their site and the installation on the Raspberry Pi:

Code: Select all

wget abyz.co.uk/rpi/pigpio/pigpio.zip
unzip pigpio.zip
cd PIGPIO
make
sudo make install

Code: Select all

#!/usr/bin/python

import sys
import time
import difflib
import pigpio

RX=18

try:
        pi = pigpio.pi()
        pi.set_mode(RX, pigpio.INPUT)
        pi.bb_serial_read_open(RX, 9600, 8)

        print "DATA - SOFTWARE SERIAL:"
        while 1:
                (count, data) = pi.bb_serial_read(RX)
                if count:
                        print data
                time.sleep(1)

except:
        pi.bb_serial_read_close(RX)
        pi.stop()

Re: GPS and ACCEL via ShieldRv1 on Raspberry Pi?

Posted: Sat Dec 03, 2016 11:30 pm
by gersbrett
I finally got this thing to work. A couple of remarks:

-pigpio uses the BCM numbers. So if you use the shield your EN is at GPIO10 and TX is at GPIO9 (meaning you set RX=9 in the script)
-unlike in the script on this forum and on the sparqee web site you need to set EN to True.

Here is the complete script that worked for me:


Code: Select all

#!/usr/bin/python

import sys
import time
import difflib
import pigpio

RX=9

EN=10

try:
        pi = pigpio.pi()
        pi.set_mode(RX, pigpio.INPUT)
        pi.set_mode(EN, pigpio.OUTPUT)
        pi.write(EN,True)
       
        pi.bb_serial_read_open(RX, 9600, 8)

        while 1:
                (count, data) = pi.bb_serial_read(RX)
                if count:
                        print count, data
                time.sleep(1)

except:
        pi.bb_serial_read_close(RX)
        pi.stop()