On my Raspberry Pi 4, why is starting the camera causing the reading of GPS data to be unstable?

21 views Asked by At

Setup

  • Raspberry Pi 4, running Bullseye
  • USB Gps receiver
  • Camera connected to the ribbon camera port

Problem I am successfully able to read from the Gps receiver, but as soon as I call the start method of Picamera2, the results of my GPS data become highly unreliable.

Sample Code

from picamera2 import Picamera2
import serial,pynmea2


enable_camera = False
if(enable_camera):
    picam = Picamera2()
    config = picam.create_preview_configuration()
    picam.configure(config)
    picam.start()

port = '/dev/ttyACM0'
baud = 9600
serialPort = serial.Serial(port, baudrate = baud)

while True:
    try:
        serial_raw = serialPort.readline()
        str = serial_raw.decode().strip()

        if str.find('GGA') > 0:
            gga_data = pynmea2.parse(str)
            print(gga_data)
    except Exception as e:
        print(e)

Output Sample Output Working

Working

Sample Output Not Working enter image description here

I am trying to capture images and Gps data

0

There are 0 answers