Skip to main content

The Pmod HAT Adapter  (144-8419)  makes it easy to connect Pmods to a Raspberry Pi. It supports plug-and-play functionality, only requiring that the host Raspberry Pi is booted with the Pmod HAT attached.

The Pmod HAT has three 2×6 Pmod ports and provides access to additional I/O available via the Raspberry Pi 40-pin GPIO connector. Designed in collaboration with RS Components, users can take advantage of example Python libraries and demo tutorials hosted on DesignSpark.

GPS (134-6455) can provide satellite positioning accuracy to any embedded system, especially the Raspberry Pi, by communicating via UART with the GPS module.

Pmod_GPS_3023a4e2819b91462bc51e13a942deeaff383301.png

Getting Started

We begin by typing the following commands on the terminal:

sudo apt-get update

sudo apt-get dist-upgrade

sudo apt-get install -y build-essential git libusb-1.0-0-dev libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler libatlas-base-dev git automake byacc lsb-release cmake libgflags-dev libgoogle-glog-dev liblmdb-dev swig3.0 graphviz libxslt-dev libxml2-dev gfortran python3-dev python3-pip python3-setuptools python3-markdown python3-pillow python3-yaml python3-pygraphviz python3-h5py python3-nose python3-lxml python3-matplotlib python3-numpy python3-protobuf python3-dateutil python3-skimage python3-scipy python3-six python3-networkx libfreetype6-dev libjpeg-dev python3-gst-1.0 python3-picamera

sudo pip3 install pyserial

sudo pip3 install designspark.pmod

We need to turn on the serial function of the Raspberry Pi

sudo raspi-config

>5 Interfacing Options
>6 serial
>Would you like a login shell to be accessible over serial?
>No
>Would you like the serial port hardware to be enabled?
>Yes

This program code means that we have to insert the Pmod GPS into the Pmod HAT Adapter JCA slot. The JCA slot means that the upper 6-pin in slot JC.

if __name__ == '__main__':
    
    GPS = createPmod('GPS','JCA') # UART port is only avairable on JCA
    time.sleep(0.1)
    print("create success")

JC_ebdc6b5d8cb084ddfe7b231338ac44f2767285f9.png

Now we use the following code to get access to the GPS's satellite communication function and receive data from satellites every half second.

    try:
        while True:
            
            """
            LINE = GPS.getGPSLine()
            print(LINE)
            time.sleep(0.5)
            """
            GPS.gpsUpdate()
            print(GPS.getGPSPosData())
            time.sleep(0.5)

The GPS module may take more than 15 mins to setup.

sudo python3 /home/pi/Desktop/DesignSpark/example/GPS_example.py

or 

sudo python /home/pi/Desktop/DesignSpark/example/GPS_example.py 

Here is the output with an accurate time:Screenshot_2020-01-10_at_8.35_.01_AM__3575cce4b865f9752e085546ba751a3f0c37167c.png

... this is a bad example:Screenshot_2020-01-03_at_10.16_.40_AM_1_2e54975deff8e634340e2e4f4c10bf77c418b4d0.png

Downloads

Brian0925 has not written a bio yet…
DesignSpark Electrical Logolinkedin