PPP & Nova R410 with other commands?

I am using the r410 to setup a PPP session so I can use spacebridge or Teamviewer IOT to jump into my Raspberry Pi for remote access, while also using another script to send out messages. I was using the hologram sdk to send messages, but reverted to using regular web requests since I can’t do both at the same time. I would get the “Unable to detect a usable serial port” error.

I am however able to send messages using the SDK, as long as its in the same script that I open the PPP session with, which makes me believe that the script is consuming the serial port and that’s why I can still talk to the modem in the same script. I would rather they be managed separately.

Is there a way to run other commands, like getting the signal strength and sending messages from CLI/other scripts after starting a PPP session? I know this modem only has one serial Port so I was curious if I was missing something.

Would my U201 be able to do this since it has multiple serial ports?

I would really like to check my signal strength at times :upside_down_face:

After doing some testing. It looks like my U201 does let me still run other commands after I open a PPP session. I have both units running the same script right now.

On the U201 I can run CLI commands no problem with an active PPP session. The other thing I noticed is that using the python SDK is that the command hologram.network.signal_strength works, where as on the R410 it always returns 99, 99 when run from python. It works fine from the command line on the R410.

Will the 410 ever open multiple serial ports via a firmware upgrade, or will that be in another model? I would love to utilize the Verizon network since AT&T is weak in all the places I need it.

I will keep playing with them…

1 Like

Yeah unfortunately the R410 does consume the single serial port and upgrading the firmware does not change that fact.

We actually included a firmware upgrade as an addon to the SDK because of an issue we were running into: Open Network Issue With Cat-M.

This is more a design constraint of the modem than something we purposely designed as part of the Nova.

I have been doing some more testing with the R410 and here is what I have come up with. The PPP session that it creates in the python SDK seems to hate me. I have really good signal (22), but I can’t keep it connected. Its the same script I’m running on the u201 that runs like a champ with potato signal.

Sometimes it will complain that maybe I have an unregistered SIM, sometimes it wont be able to find the serial port. The latest one it failed to run and instead of presenting ttyUSB0 and ttyUSB1 like normal, I had ttyUSB0 and ttyUSB2. A lot of the time it will run my script through perfect once, and then it will fail every time after that until it restarts the service (my script).

I have updated the sdk, updated the R410 firmware, I even ran the AT commands to switch it to profile 2 and then back to 0.

Here is my script for reference. I have a lot of sleeps in it to hopefully give the modem time to free up the serial port.

#! /usr/bin/python2.7

import os
import sys
from Hologram.HologramCloud import HologramCloud
import json
credentials = {'devicekey': 'bananas'}
import logging
import time
from logging.handlers import RotatingFileHandler
from random import randint



bc_logger = logging.getLogger("Rotating Log")
bc_logger.setLevel(logging.INFO)

my_formatter = logging.Formatter("%(asctime)s - %(levelname)s - %(message)s")

handler = RotatingFileHandler("/home/pi/client/logs/nova_service.log", maxBytes=10000, backupCount=5)
handler.setFormatter(my_formatter)

bc_logger.addHandler(handler)
hologram = HologramCloud(credentials, network='cellular')

print("Waiting 30 seconds for modem...")
bc_logger.info("Waiting 30 seconds for modem...")
time.sleep(30)

error_count = 0
while True:


    if error_count >10:
        hologram.network.disconnect()
        bc_logger.info("******************* RESTARTING SERVICE *******************")
        os.execv(__file__, sys.argv)

    try:

        status = hologram.network.getConnectionStatus()
        if status == 1:
            bc_logger.info('already connected')
            print('already connected')

        else:

            bc_logger.info('no active PPP session, connecting...')
            print('no active PPP session, connecting...')
            hologram.network.disconnect()
            time.sleep(10)
            hologram.network.connect(timeout=20)
            time.sleep(30)
            status = hologram.network.getConnectionStatus()
            if status == 1:
                bc_logger.info('Got connected!')
                print('Got connected!')
            else:
                bc_logger.info('Failed, to connect to hologram network')
                print('Failed, to connect to hologram network')
                error_count += 1
                time.sleep(10)
                continue

        time.sleep(5)
        level = randint(50,55)
        level = str(level)
        data = {"level": level,"tank_id": "bananas","auth_token": "bananas","sensor_problem": "False"}
        data = json.dumps(data)
        recv2 = hologram.sendMessage(message=data, timeout=10)
        if str(recv2)=="0":
            bc_logger.info("Update Sent!")
            print("Update Sent!")

        time.sleep(5)
        bc_logger.info("Signal Strength: " + str(hologram.network.signal_strength))
        print("Signal Strength: " + str(hologram.network.signal_strength))
        time.sleep(2*60)

        
    except:
        bc_logger.info("There was an error: Count: "+str(error_count))
        print("There was an error: Count: "+str(error_count))
        error_count=error_count+1
        hologram.network.disconnect()
        time.sleep(20)

You are putting the timeout on the connect to be much shorter than normal (20 seconds vs 5 minutes) so its possible the connection is timing out from lack of activity.

You also shouldn’t have to wait as those functions are blocking, so the sleep timers in between are probably part of the problem if it is indeed timing out.

You can also use the reconnect function instead if you find that the modem has disconnected

1 Like

Just an update:

I am having much better results with the longer timeout on the connection! Typically my actual production script sends a message every 15 minutes, which seems to be timing out every so often on the R410, but I also read that it could be carrier specific, since my U201 is on AT&T and almost never hangs up, and my R410 is on Verizon.

One thing I did notice is that in journalctl I can see the modem actual hang up (terminated on signal 15) every once in a while between messages, but when the script runs hologram.network.getConnectionStatus() on its next iteration, it will still return 1, stating that its still connected. My script will fail because it tries to send a message until it restarts the script, then it will create a new session and resume no problem. It does make remote access spotty though :confused:

I have also seen this error a few times too “Failed to open /dev/ttyUSB2: No such file or directory”, but its presenting itself as /dev/ttyUSB1. I don’t know what that’s about.

Thank you for your help!!

I had the R410 up for about 24 hours without issue! It would make it 3-4 times (a few times even 5!) through my script before it had to kill the script and restart it to open up a new session. Sadly at 9am this morning when it was doing that it hung the serial port up somewhere and I couldn’t get to it anymore. I tried to close any open sessions, check signal, even opened a serial connection to send some AT commands without any luck. This happens a lot when I’m testing and killing the script manually. I will sometimes lose access to the serial port because it either hangs in the OS or in the modem. So I had to reboot.

Im going to force the R410 to AT&T for today and see if the sessions still timeout as quick, or if its Verizon hanging up on the modem. I will attach some screen shots.

Here are the verzion sessions on the R410
verizon-sessions
Here are the AT&T sessions on the U201 running the same script.

1 Like

Hi @penguinrunner,

The R410 only allows a single connection when using the USB interface. So, as you have explained, if you launch PPP it will control the connection and you cannot set AT commands to check signal quality, connectivity, etc.

If, however, one uses the UART interface to the R410 then, according to the documentation, it is possible to have more than one “channel” access the device. My company is manufacturing a variant of the Nova (using the same Ublox R410 module) which also has a connector for access to the UART. We are in the advanced prototype stage, and still testing, but it looks like this will work.

The Nova does not include a connector for the UART interface, but it does provide some pads on the circuit board for experimental access to the UART interface. I have not tried to access the UART interface on the Nova.

Another approach, which has been discussed on this forum, is to use AT commands (instead of a PPP connection) to move data. In this approach, which is certainly far more complex than just launching the ppp daemon, the single channel to the R410 can be used for sending data and checking status. I have written a solution to this problem in Java, but it is sufficiently complex that I prefer to use ppp (for reliability).

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.