RVR serial interface, battery, and external power

Hey there. I’m running a Raspberry Pi 3 on the RVR. It’s a silly project. I’m using TensorFlow to recognize “cat”, an ultrasonic rangefinder to measure distance, and a Pimoroni pan/tilt mast to look around for cats and hazards… It basically finds the cat and chases it. The cat’s gonna love it.

The problem is I’m powering the Pi with the USB cable plugged into a standard wall wart. I then created a Pi Proto-Hat with 90 degree headers for 3.3v ground, TX, RX, SDA, and SCL. I have only the TX and RX connected (yes, they’re crossed properly). When I run a test program (getting_started/asyncio/leds/set_multiple_leds.py) It throws a timeout error when it tries to check firmware version. RVR is on and has a full battery. (Backtrace appended below)

I suspect it’s because I don’t have GND connected from the Pi to the RVR, but not completely sure. I am hopeful I can power the Pi on the micro-USB socket and just use the serial interface for talking to the RVR. The reason is I have an Adafruit PowerBoost 1000C with a 2500mAh LiPo. The plan is to go RVR->USB-A->PowerBoost->USB-micro->Pi so when the Pi detects low battery on the RVR it can shut down the RVR and then cleanly shut itself down while running off the LiPo.

I’m not thrilled about unstacking everything to connect ground, but I think I’ll do that just to be sure. [Edit: connecting Pi GND to RVR GND doesn’t change the error. Same thing as shown below.]

Here’s the backtrace. Thoughts?

python3 leds/set_multiple_leds.py
Checking RVR firmware versions…
Traceback (most recent call last):
File “leds/set_multiple_leds.py”, line 16, in
loop
File “/home/pi/src/sphero-sdk/sphero_sdk/asyncio/client/toys/sphero_rvr_async.py”, line 36, in init
self._check_rvr_fw()
File “/usr/lib/python3.7/asyncio/base_events.py”, line 584, in run_until_complete
return future.result()
File “/home/pi/src/sphero-sdk/sphero_sdk/asyncio/client/firmware/rvr_fw_check_async.py”, line 26, in _check_rvr_fw
rvr_nordic_version = await self.__rvr.get_main_application_version(target=SpheroRvrTargets.primary.value, timeout=3)
File “/home/pi/src/sphero-sdk/sphero_sdk/asyncio/client/toys/sphero_rvr_async.py”, line 87, in get_main_application_version
return await self._dal.send_command(**command_dict)
File “/home/pi/src/sphero-sdk/sphero_sdk/asyncio/client/dal/serial_async_dal.py”, line 78, in send_command
timeout=timeout
File “/home/pi/src/sphero-sdk/sphero_sdk/asyncio/server/handler/api_sphero_handler.py”, line 191, in send_command
await asyncio.shield(asyncio.wait_for(future, timeout=timeout))
File “/usr/lib/python3.7/asyncio/tasks.py”, line 423, in wait_for
raise futures.TimeoutError()
concurrent.futures._base.TimeoutError

1 Like

Had the same error, updating the firmware through the iphone app fixed it! Post a video of the cat getting chased :partying_face:

1 Like

Yes, the devices need to be using the same GND connection otherwise the signal will be floating since it has no reference.

The firmware check needs a connection to the internet so that it can get the latest version information to compare with the RVR. So the PI needs the WiFi connected to your network.

There are API’s on the RVR to get battery level so adding another battery is not necessary. Also the RVR will send you a power off event just before it shuts down.

Mike

1 Like

Thanks! I connected GND (no change - and I should have known better since that was the exact problem I had when I built a dual-Arduino Mega at a first cut at a rover controller), the extra battery is just in case the RVR battery dies quickly - I don’t want to corrupt the SD card in the Pi, and (very unfortunately) the firmware update didn’t change the error or stack backtrace.

Sad panda. I certainly do appreciate your advice, though!

1 Like

The firmware timeout should not prevent the led sample program from running. If your RVR is up to date, but your Pi does not have wifi, you can still use the SDK. You will see a pair of timeout messages, but after that, the led sample will attempt to run anyway (at least that’s what I saw in my setup.) Have you double checked your serial connections? As you noted, you will need to have all three lines, serial in/out and GND connected. After that, you need to be sure the PI is configured to enable the serial port you are using. Have you had any serial connections work so far?

2 Likes

AHA! Your question about serial connections working triggered my memory. I had not disabled console output on /dev/ttyS0. Once I did that and rebooted, everything works perfectly. Thank you!

2 Likes

Great, glad that helped!

1 Like