RTK base with a Raspberry pi4 and SimpleRTK2B

I made a base station with a SimpleRTK2B and a Raspberry pi 4 running str2str sending corrections to rtk2go and I post here if it can help someone

My Raspberry run with Raspbian
I used this to build and configure str2str
github.com/tomojitakasu/RTKLIB/blob/master/doc/manual_2.4.2.pdf
Section 3.11 and 4.2 to build str2str and appendix A.5 for configuration.

To test (or run) str2str you can use a command like this:
str2str -in serial://ttyACM0:115200:8:n:1:off -out ntrips://:PASSWORD@rtk2go.com:2101/MOUNTPOINT
I plug the simpleRTK2B in the upper blue USB port.

I use crontab so it start str2str automaticly
In the LXTerminal (command prompt) tap “crontab -l” to see the tasks
To write the task tap “crontab -e” then go to the bottom and add this line (with the correct path, password and mountpoint)
@reboot /home/pi/RTKLIB/app/str2str/gcc/str2str -in serial://ttyACM0:115200:8:n:1:off -out ntrips://:PASSWORD@rtk2go.com:2101/MOUNTPOINT &
Press Ctrl x then o (or y, mine is in french) then enter

now you can just plug or unplug the raspberry, str2str will always send.

For the simpleRTK2B on only special thing to do is to send only RTCM messages over usb
For this I use u-center on a windows computer
go to View, Configuration View
PRT
In target select 3-USB
In protocol out select 5-RTCM3

My setup works now for 2 months without issues.

4 Likes

here are the complete step to install str2str:
go to https://github.com/tomojitakasu/RTKLIB/tree/rtklib_2.4.3
download zip

extract to home/pi

open the terminal (command prompt)
type:
cd /home/pi/RTKLIB-rtklib_2.4.3/app/str2str

type:
cd gcc

type:
make

type:
sudo make install

exit the terminal

reopen the terminal

type:
crontab -e

select 1 if no crontab

go to the bottom and type:(change password and mountpoint), GPS pluged in the upper blue USB port
@reboot /home/pi/RTKLIB-rtklib_2.4.3/app/str2str/gcc/str2str -in serial://ttyACM0:115200:8:n:1:off -out ntrips://:PASSWORD@rtk2go.com:2101/MOUNTPOINT &

press ctrl x
press y
press enter

restart
It should now send to rtk2go!

2 Likes

Hello,

I’ve the same but with M8T and PI0W.
I’ve added to scan for the str2str pid and then if str2str crashes (it has happened to me …)
then a new str2str is started automatiquely.
francois

hi
@Francois can you give more details on how to implement the scan? what is pid? I googled it’s Packet Identifier?

Mine never crashed so far but it would be nice to have this.
I am just a beginner in the linux world, it took me a while to get my base work automatically, I had installed a couples of programs and had some trials and errors before having this setup.

Hi
PID is processus identifier… on Unix Linux systems
See on one of my latest post I ve indicated the command
If I remember if PID is null then the command is started once again
I ve one RPI zéro wifi as base and another on the tractor roof All in wifi and Bluetooth for 4g and it works Fine
Francois

1 Like

Thanks for the tutorial @Pat, it works like a charm.
I have two things to add :

  1. The COM port you indicated may not be the same for someone else (if the module isn’t plugged in the right USB or if the Raspberry Pi is a different one, for example). Thus, to find out which COM port to use, one should follow this procedure :
    a) Leave the module unplugged and run this command : dmesg | grep tty
    b) Plug the GNSS module in any USB
    c) Run the command again
    d) Look for the line that was added to the command’s answer. For example, on my setup, the COM port ttyACM0 was added (the same as for Pat, but this may not be the case for you) :
    image

  2. If one has special characters in its PASSWORD or MOUNTPOINT, single quotes can be added at the beginning and the end of the string. For example, this would give :
    @reboot /home/pi/RTKLIB-rtklib_2.4.3/app/str2str/gcc/str2str -in serial://ttyACM0:115200:8:n:1:off -out 'ntrips://:PASSWORD@rtk2go.com:2101/MOUNTPOINT' &
    If one has a single quote in its PASSWORD or MOUNTPOINT, the string can be closed just before, the single quote is then escaped with a \ and the string is then reopened with another single quote. More details here : shell - Which characters need to be escaped when using Bash? - Stack Overflow

@Francois your auto-restart feature after a str2str crash interests me a lot as it can enhance the overall system reliability. I found your post (RpiNtripBase - #6 by Francois), but I don’t get how your command works. It doesn’t work when I add it to crontab with crontab -e. Can you give more details please ?

2 Likes

Hi,

Be careful crontab - e is su, so type :
sudo crontab -e
then add the line I’ve indicated to you (with exactly the stars ans space at the beginning)
then CTRL X and yes

To verify :
check that str2svr is running (ater 1 minute)
if yes , check for the id of the process (ps -e), kill the str2svr proccess :
sudo kill
the process must disapaear and then after 1 minute appear again.
francois

Hi François,

Thanks for these details. I did manage to make it work, but I had to modify slightly your line.

  1. There was a space missing between the two first stars. I added one.
  2. Because It still didn’t work, I tried to remove the end of your line and just added a & instead.
    Now it works just fine. If str2str crashes, or if the raspi reboots (after a power outage for example), the str2str process restarts automatically.

To sum it up, I executed crontab -e (no sudo needed) and added this line at the end :
* * * * * pidof str2str > /dev/null || /home/pi/RTKLIB-rtklib_2.4.3/app/str2str/gcc/str2str -in serial://ttyACM0:115200:8:n:1:off -out 'ntrips://:PASSWORD@rtk2go.com:2101/lefricheduval' $
Exit with ctrl+X, and it starts after a minute.

To make it work, I found useful information here :

and here :
https://www.cyberciti.biz/faq/how-to-restart-a-process-out-of-crontab-on-a-linuxunix/

2 Likes

Does it will work on pi3?

Yes it should. A Raspbian installation works the same way on a pi3 and a pi4 (you can even swap the SD card between the two !). For a more beginner friendly alternative, I’d recommend you to give a look at the RTKBase software though (RTKBase: a GUI for your own Gnss Base Station)

Hi All, wondering if you’d be able to help. For some reason str2str on Pi4 is not sending data correctly to rtk2go using this method. I’ve set up my mountpoint and put in my personal password for rtk2go but its still not working. Here is an image from the base station Pi.

image

I’ve been checking rtk2go it doesnt show any data on that mountpoint. I’ve also got a client running on another pi which isn’t receiving any data either. I’ve tried encasing the whole whole -out protocol in single quotes and without as well as ntrip and ntrips.

Further to my last point this is what rtk2go is showing when streaming from the str2str base Pi

1598562452419659196827019329913

I’m in the same boat unfortunately

1 Like

image
This is the stage i am at but it doesn’t show a location yet.
I managed to get rtk2go say about a RTCM 3 format by changing the USB port on the Rpi until it worked in one.

I also had the same message on rtk2go “This stream is NOT parsed”, because I didn’t send only RTCM3 messages (there was NMEA as well). You should check your F9P configuration and enable only RTCM output, disable everything else, especially NMEA

2 Likes

The way I have my base set up is RTCM3 only output, no input from UART2 with a baud rate of 115200 using the second micro USB.

I have also just tried using a local tcp connection from the base pi using a second pi and f9p as a rover, this gave a successful rtk fix using exactly the same stream just tcp instead or rtk2go on the out/inbound

Why using the second micro USB ? I used the first one (on the antenna side) and it worked well.

You can also check if the issue comes from rtk2go by using the GUI STRSVR instead of STR2STR as a NTRIP server, on a windows computer. It does the same thing but easier to use thanks to the GUI.

1 Like

image

That’s worked for me. Just haven’t quite got the location pinned down. Likely to be something with configuration in u center ?

Antenna side for me also.