HOWTO: Airspy mini and Airspy R2: Piaware / dump1090-fa configuration

I don’t understand the output of vcgencmd get_throttled but found this bash script. Still not sure I understand but I thought it might help someone …
``

#!/bin/bash

#Flag Bits
UNDERVOLTED=0x1
CAPPED=0x2
THROTTLED=0x4
HAS_UNDERVOLTED=0x10000
HAS_CAPPED=0x20000
HAS_THROTTLED=0x40000

#Text Colors
GREEN=`tput setaf 2`
RED=`tput setaf 1`
NC=`tput sgr0`

#Output Strings
GOOD="${GREEN}NO${NC}"
BAD="${RED}YES${NC}"

#Get Status, extract hex
STATUS=$(vcgencmd get_throttled)
STATUS=${STATUS#*=}

echo -n "Status: "
(($STATUS!=0)) && echo "${RED}${STATUS}${NC}" || echo "${GREEN}${STATUS}${NC}"

echo "Undervolted:"
echo -n "   Now: "
((($STATUS&UNDERVOLTED)!=0)) && echo "${BAD}" || echo "${GOOD}"
echo -n "   Run: "
((($STATUS&HAS_UNDERVOLTED)!=0)) && echo "${BAD}" || echo "${GOOD}"

echo "Throttled:"
echo -n "   Now: "
((($STATUS&THROTTLED)!=0)) && echo "${BAD}" || echo "${GOOD}"
echo -n "   Run: "
((($STATUS&HAS_THROTTLED)!=0)) && echo "${BAD}" || echo "${GOOD}"

echo "Frequency Capped:"
echo -n "   Now: "
((($STATUS&CAPPED)!=0)) && echo "${BAD}" || echo "${GOOD}"
echo -n "   Run: "
((($STATUS&HAS_CAPPED)!=0)) && echo "${BAD}" || echo "${GOOD}"
2 Likes

Thanks :wink:

The results of 50005 means:

40000 + 10000 + 4+ 1

So it means it has throttled and undervolted and is throttled and undervolted right now.

It’s a bitmask.

@bramjacobse

Pretty bad code by Raspbian to throttle because of voltage but not report low voltage in dmesg.

**Status: 0x50005** 
Undervolted:
Now: YES
Run: YES
Throttled:
Now: YES
Run: YES
Frequency Capped:
Now: NO
Run: NO

I missed it :hot_face: - kern.log

Jun  4 16:57:34 ADSB kernel: [343439.364271] Under-voltage detected! (0x00050005)
Jun  5 17:08:55 ADSB kernel: [    7.359283] Under-voltage detected! (0x00050005)
1 Like

I’ll remember to ask for people to run a grep :slight_smile:

sudo dmesg | grep voltage

But those commands you used might be even more useful:

vcgencmd get_throttled
1 Like

Idea to add it to your install script…:?!

Sometimes i lose samples too, i think due to memory bandwidth or writes/reads to/from the sd-card.
That normally happens when i do random stuff or compile something:

-- Reboot --
May 28 15:40:03 pi systemd[1]: Started Airspy ADS-B receiver.
May 28 15:40:03 pi airspy_adsb[315]: Listening for beast clients on port 29999
May 28 15:40:03 pi airspy_adsb[315]: Acquired Airspy device with serial 26A464DC287C2593
May 28 15:40:03 pi airspy_adsb[315]: Decoding started at 20 MSPS
May 28 15:40:04 pi airspy_adsb[315]: /!\ Lost 786432 samples /!\
May 28 15:40:04 pi airspy_adsb[315]: /!\ Lost 262144 samples /!\
May 28 15:40:04 pi airspy_adsb[315]: /!\ Lost 262144 samples /!\
May 28 15:40:04 pi airspy_adsb[315]: /!\ Lost 131072 samples /!\
May 28 15:40:04 pi airspy_adsb[315]: /!\ Lost 131072 samples /!\
May 28 15:40:04 pi airspy_adsb[315]: /!\ Lost 131072 samples /!\
May 28 15:40:07 pi airspy_adsb[315]: Push client connected to localhost:30004 (beast)
May 30 22:03:15 pi airspy_adsb[315]: Push client disconnected from localhost:30004 (beast)
May 30 22:03:28 pi airspy_adsb[315]: Push client connected to localhost:30004 (beast)
Jun 02 06:47:05 pi airspy_adsb[315]: /!\ Lost 262144 samples /!\
Jun 02 06:47:05 pi airspy_adsb[315]: /!\ Lost 131072 samples /!\
Jun 02 06:47:05 pi airspy_adsb[315]: /!\ Lost 131072 samples /!\
Jun 02 06:47:05 pi airspy_adsb[315]: /!\ Lost 131072 samples /!\
Jun 02 06:47:05 pi airspy_adsb[315]: /!\ Lost 131072 samples /!\
Jun 02 06:47:05 pi airspy_adsb[315]: /!\ Lost 131072 samples /!\
Jun 02 06:47:05 pi airspy_adsb[315]: /!\ Lost 131072 samples /!\
Jun 07 18:16:59 pi airspy_adsb[315]: /!\ Lost 131072 samples /!\

But usually no lost samples except after reboot.
I do run the RPi at fixed clock though, so it doesn’t change up and down, that helps a bit.

I mean, hmmm.
Nah i’ll rather add it to some troubleshooting.

People only check script output if something isn’t working :slight_smile:

[587285.652355] Under-voltage detected! (0x00050005)
[833349.057455] Under-voltage detected! (0x00050005)
[833798.340029] Under-voltage detected! (0x00050005)
[835025.547394] Under-voltage detected! (0x00050005)
[835266.829119] Under-voltage detected! (0x00050005)
[836023.953294] Under-voltage detected! (0x00050005)
[838994.211095] Under-voltage detected! (0x00050005)
[839046.211400] Under-voltage detected! (0x00050005)
[843006.509807] Under-voltage detected! (0x00050005)
[843299.789113] Under-voltage detected! (0x00050005)
[843503.628693] Under-voltage detected! (0x00050005)

Damn.

/edit - Are the first numbers a timestamp?

1 Like
sudo dmesg --ctime | grep voltage

human readable time

sudo dmesg --ctime
[Fri Jun 7 16:53:06 2019] Booting Linux on physical CPU 0x0
[Fri Jun 7 16:53:06 2019] Linux version 4.19.46-v7+ (dom@dom-XPS-13-9370) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1231 SMP Mon Jun 3 17:42:48 BST 2019
[Fri Jun 7 16:53:06 2019] CPU: ARMv7 Processor [410fd034] revision 4 (ARMv7), cr=10c5383d
[Fri Jun 7 16:53:06 2019] CPU: div instructions available: patching division code
[Fri Jun 7 16:53:06 2019] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[Fri Jun 7 16:53:06 2019] OF: fdt: Machine model: Raspberry Pi 3 Model B Rev 1.2
[Fri Jun 7 16:53:06 2019] Memory policy: Data cache writealloc
[Fri Jun 7 16:53:06 2019] cma: Reserved 8 MiB at 0x3ac00000

1 Like

At boot time , i think

[843503.628693] Under-voltage detected! (0x00050005)

Timestamp Converter

843503.628693

Is equivalent to:

01/10/1970 @ 6:18pm (UTC)

1970-01-10T18:18:23+00:00 in ISO 8601
Sat, 10 Jan 1970 18:18:23 +0000 in RFC 822, 1036, 1123, 2822
Saturday, 10-Jan-70 18:18:23 UTC in RFC 2822
1970-01-10T18:18:23+00:00 in RFC 3339

It’s just a timestamp relative to last boot.

[Thu May 30 16:33:10 2019] Under-voltage detected! (0x00050005)
[Sun Jun  2 12:54:14 2019] Under-voltage detected! (0x00050005)
[Sun Jun  2 13:01:43 2019] Under-voltage detected! (0x00050005)
[Sun Jun  2 13:22:10 2019] Under-voltage detected! (0x00050005)
[Sun Jun  2 13:26:11 2019] Under-voltage detected! (0x00050005)
[Sun Jun  2 13:38:48 2019] Under-voltage detected! (0x00050005)
[Sun Jun  2 14:28:19 2019] Under-voltage detected! (0x00050005)
[Sun Jun  2 14:29:11 2019] Under-voltage detected! (0x00050005)
[Sun Jun  2 15:35:11 2019] Under-voltage detected! (0x00050005)
[Sun Jun  2 15:40:04 2019] Under-voltage detected! (0x00050005)
[Sun Jun  2 15:43:28 2019] Under-voltage detected! (0x00050005)

Nothing for a week - I wonder why there were so many on Sunday.

Lots of MLAT traffic producing a higher message rate/ more CPU-load?

Could also be temperature, you’d have to check :slight_smile:

They are seconds since boot.

Apologies if this is going off on a tangent, but I have had to stop using an Anker multi port USB charger for my RPi 3 with Airpy mini - I didn’t check the voltage but assumed that the “intelligence” of the charger was limiting its output.

I have recently since switched to an Odroid XU4 due to RPi overheating, the install scripts were really helpful.

2 Likes

Hi all
I’m ready to up my game
i have a spare rpi3b+ BN psu 5v 3amp
biastee powered by pi usb to rtl 3filter/amp to FA antenna
going to try m20 today would i choose a much lower gain than 18 say 10 with m20 or lower see how things go

Gain can stay the same. If anything you would use more gain with -m20 because the integration time in the ADC is shorter.

I am about to try and restore a working Airspy R2 and odroid xu4 setup. The card which was in the odroid failed. I did have this working, using ADS B project scripts, graphs etc. Now I have been trying to follow the million posts on this, including reviewing my posts when first set up. To start with, I have to have a working piaware 1090 set up working, before I attempt to include the airspy R2 into the mix. I shall do that by using a flightaware dongle onto the Odroid, keeping it simple. I will then need some help to incorporate the airspy. I shall reply to this post when stage one complete.

@jlb56,
That is a good way to go. I have an Odroid XU4 running the ADS-B receiver project script, with airspy, for years. It has been very reliable.

The airspy can be a little tricky to setup. Once done, it works really well.

Jon