question

finalshare avatar image
finalshare asked

Raspberry PI GPS "NO FIX"

Hi, im using a raspberry PI 3 model B+ with venus os to monitor a Smart solar 150/100 and a BMV 712. i now have bought a USB GPS antenna.

when i conenct it, the Raspberry bevomes very instable, only updating every few minutes and the VRM portal lost all its data, battery status solar.. everything gone, if i go into the GPS menu it shows "Gps connected but no fix"
when i dissconect the GPS module everything works fine...

anonye an idea?

Raspberry Pi
8 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Justin Cook avatar image Justin Cook ♦♦ commented ·

Moved to "Modifications Space" for non-Victron-supported systems, which should increase the likelihood of other users of perhaps similar systems having some valuable input!

0 Likes 0 ·
laurenceh avatar image laurenceh commented ·

You have not mentioned make/model of GPS or Venus OS version. I purchase a low cost generic GPS from Amazon in 2019 I’ve had no problems on Venus OS 2.4 to 2.6.

0 Likes 0 ·
finalshare avatar image finalshare laurenceh commented ·

I'm running venus OS 2.6 with a

Navilock NL-208P gps reciever

0 Likes 0 ·
laurenceh avatar image laurenceh finalshare commented ·

Interesting I looked at the Navilock website. Navilock "P" products are not USB as far as I can see, the USB products end in a U. The P products have a MD6 connector have you used a convertor or wired your own? I would check there first.

0 Likes 0 ·
finalshare avatar image finalshare laurenceh commented ·

It came with a converter, round plug to usb

0 Likes 0 ·
laurenceh avatar image laurenceh finalshare commented ·

OK I'm stumped it should work and should not be drawing too much power. Try the GPS device in another system (PC with driver software?).

I do have the shell script (below) that I use to read the interface and extract the GPS time. I use that to se the time on the RPI on power up when there is no network connection otherwise the VRM offline logging goes wrong as the RPi doe not have a battery back up clock.

From the code, it looks like you might be able to

>cat /run/serial-starter/gps/ttyACM0

To see what the GPS device is saying. to the Raspberry pie.

Running the script might give you an idea of what is going on, but without a satellite fix I dont expect it to work.

[Comment the line <date -s $COMMAND> if you don't want to actually touch the RPi date.

Un-comment <echo "$line"> if you want all the data lines from the device.]

#!/bin/bash
N=0;
FILE=/run/serial-starter/gps/ttyACM0
echo "Waiting for GPS data"
while [ ! -e $FILE ] && [ $N -lt 50 ];
do
    sleep 1;
    ((N++))
    echo -n "."
done;
sleep 5;

if [ $N -ge 45 ]; then
   echo " GPS data not available, is the device plugged in?"
   exit 0;
fi

echo
echo "Device attached, waiting for data"

input=$FILE
N=0

# check if GPS has FIX
LINE1='^\$..GGA,[0-9\.]+,[0-9\.]+,[NS],[0-9\.]+,[EW],([0-2])'
# Catch lines with date and time info
LINE2='^\$GPRMC'

FIX=""

# extract date and time from GPS packet

function extract {
[[ $1 =~ ^\$GPRMC,([0-9]{4})([0-9]{2})\.[0-9]{2},.,[0-9\.]+,[NS],[0-9\.]+,[EW],[0-9\.]*,[0-9\.]*,([0-9]{2})([0-9]{2})([0-9]{2}), ]]
  COMMAND="${BASH_REMATCH[5]}${BASH_REMATCH[4]}${BASH_REMATCH[3]}${BASH_REMATCH[1]}.${BASH_REMATCH[2]}"
  date -s $COMMAND
exit 0
}

while IFS= read -r line && [ $N -lt 2000 ] 
do
#  echo "$line"
  [[ $line =~ $LINE1 ]] && FIX=${BASH_REMATCH[1]} && echo "GPS device has a fix after $N lines"
  [[ $line =~ $LINE2 ]] && [[ $FIX -eq 1 ]] && extract $line
  ((N++))
done < "$input"
echo "Timed out no date/time information in 2000 lines from GPS receiver" 





0 Likes 0 ·
finalshare avatar image finalshare laurenceh commented ·

I measured with a USB amp meter, not even takes 100ma. I have no idea how to run scripts tho

0 Likes 0 ·
finalshare avatar image finalshare laurenceh commented ·

Was about to relocate the reciever, tripped and ripped the cable out of it. Jep. Ordering a new one with USB now

0 Likes 0 ·
1 Answer
powerace avatar image
powerace answered ·

@finalshare


Normally when a GPS receiver gives no fix it mostlikely doesn't receive satellites. Incase your receiver is brand new or hasn't been used for a longtime it has to download a new almanac from satellite that can take up to 15-20 minutes. That the RPI becomes very unstable might be caused by to much power drawn from its usb port. How does the GPS behave when its connected to a laptop? If it works fine on the laptop it should work fine on the RPI. Then maybe connect it using a powered usb hub.

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.