PI Zero ADSBExchange base image v0.1

Discussion in 'Feeding' started by James, Jan 25, 2018.

  1. James

    James Guest

    How much interest is there in a Pi Zero build? I ask this because I've got one working - and it gives the Zero a run for the money.

    Idle is 45% CPU and when it serves Dashboard 100% spike and noticeably slower than Pi 3.

    I'll get it zipped up and uploaded by the weekend. I don't think it will handle more than one SDR - just not enough CPU power.

    https://www.adsbexchange.com/downloads/adsbx-v1.28vlan.zip

    Screenshot_2018-01-24_19-14-04.png
    Screenshot_2018-01-24_19-13-42.png
     
    Last edited by a moderator: Jul 10, 2018
  2. Griffonzo

    Griffonzo New Member

    I'm running on a Pi Zero W currently and am anxious to see how it performs over the next few weeks. I haven't seen greater than 50% CPU load yet, but I will be relocating my antenna and expect an increase in MLAT messages that may load the CPU down significantly. The only major modifications I made to the 2.1-0 base image involved changing references from "eth0" to "wlan0" in some of the ADSBx scripts. I just changed the hard-coded "eth0" string to "wlan0", but the following code would be more universal (it should only use "wlan0" if "eth0" doesn't exist):

    if [ ! -e /sys/class/net/eth0 ]; then
    #code to execute if no eth0 device (copy existing code but
    # replace "eth0" references with "wlan0")
    else
    #code to execute when eth0 is present (copy existing code)
    fi

    And most importantly, I'm interested in testing the new base image.
     
    Last edited: Feb 3, 2018
    James likes this.
  3. James

    James Guest

    Awesome! You replaced Grafana with the armhv6 version? So far the Pi Zero W makes a lot of EMI noise. If I get a chance I'll upload what I made and make a comparison on the scripts. It's really the same as the Pi 3 B image other than Grafana.

    It is possible to overclock the Zero slightly and it varies from Pi to Pi. Retropie guys have been doing it 1.2 Ghz stable and some have gotten it to 1.6Ghz with water cooling. :D

    It's already a Pi 1 700 Mhz chip overclocked to 1000 Mhz ... so ... not much to be gained...
     
    Last edited by a moderator: Feb 3, 2018
  4. Griffonzo

    Griffonzo New Member

    I'm using the modified Piaware image ADSBx-piaware-3.5.3-2.1 headless via SSH. I don't believe Grafana's part of this image, though I certainly may be mistaken, as I haven't dug through all of the included binaries and scripts yet. I'm interested in trying the more full-featured Grafana software, but I've been using RPi-Monitor for a quick web monitoring and logging solution. A pre-built image with monitoring would certainly save me time and the dashboard looks much better than anything I've managed with RPi-Monitor.

    My CPU load appears to be about 36 percent with the monitoring page running and the core is just under 50 degrees in an enclosed case at room temperature. The two top loads are dump1090 (33 percent) and mlat-client (1 percent), with the monitoring daemon using 3 percent every 3 seconds or so when polling. I'm running at 1Ghz with "ondemand" scaling for now. I may try overclocking or different CPU scaling governors, but probably not for my main unit, as it's going into my hot attic soon. As an aside, I know these Arm CPU's are very tolerant of environment, but do you think I should remove the cases from the Zero and SDR or add a fan for installation in an attic that can reach 40 degrees C occasionally?

    I'm thinking that the EMI may be improved by adjusting the wifi power and CPU frequency scaling, but I'm very impressed by the low price, low power consumption, and low USB latency of this single core board. I am willing to have a little EMI in exchange for dirt cheap and efficient. I don't see any current spike greater than 500mA, even with the SDR dongle active. After a day, I haven't seen a major drop in position report count, so the EMI may not be an issue here. I'll do some longer Pi 3B vs zero tests over the next few weeks to be certain. It also would be a good chance for me to fire up my old spectrum analyzer to do some more involved tests. I'll let you know what I find on this front, especially if I discover some ways to significantly reduce the EMI.
     
  5. James

    James Guest

    Oh - you're using the piaware custom that Dan made that feeds FA as well. Most like for base install where EMI isn't an issue the Zero is going to be good to go. For the image with grafana that collects all the stats and runs grafana, it was more intensive on the CPU. Even just the http requests were slow.

    You're a big step ahead of most people in the technical understanding of the setup! I'm also curious to have someone give the Zero a work out.
     
  6. Jhonny Monclair

    Jhonny Monclair Active Member

    ...giving a try to the Adsbx image on the Zero, I've removed the original Grafana packaged for Pi3 and
    installed the right version as suggested...as for Dump1090, the metrics stuff looks working,
    but all gauges related to system are undefined...I'm skilled about Linux but Prometheus and Grafana are
    two absolutely unknown objects to me (sigh)...what should I do to fix the dashboard?
     

    Attached Files:

  7. James

    James Guest

    Prometheus parses more or less text files and saves them in time-series. Grafana connects and displays that data. Grafana is working as far as I can tell.

    Prometheus runs on 9090

    Check that and look at the configuration - you can see what ports /metrics it's scraping then look at those directly to see whats working or not working.

    The ports are listed and assume /metrics at end of url to see the raw in browser.

    Those upper stats come from node-exporter & pi-exporter.sh ... it probably needs changed for the specifics of Zero AKA Pi 1. I wrote these after I got Grafana working on the Zero so I haven't tested what works and what doesn't.

    https://github.com/prometheus/node_exporter

    Make sure it's starting ... adsbexchange-prom.sh in /home/pi

    Basically here is what runs .. check htop to see if node_exporter is up

    Code:
    #!/bin/bash
    config="/tmp/adsbx-params"
    if [ -r ${config} ]; then
     . /tmp/adsbx-params
    if [ ${DUMP} = "no" ]; then
     exit 1
    fi
    if [ ${DUMP} = "yes" ]; then
    mkdir -p /run/prometheus
    chown pi:pi /run/prometheus
    mkdir -p /run/exporters/node_exporter
    chown pi:pi /run/exporters/node_exporter
    mkdir -p /run/exporters/node_exporter/textfile_collector
    chown pi:pi /run/exporters/node_exporter/textfile_collector
    su pi -c '/home/pi/pi-exporter.sh &'
    su pi -c '/usr/local/bin/node_exporter  --collector.hwmon --collector.textfile.directory=/run/exporters/node_exporter --log.level="fatal" &'
    su pi -c '/usr/bin/prometheus --log.level=warn -storage.local.path "/run/prometheus" -storage.local.retention 4h0m0s'
    fi
    fi
    
    
    this runs every 30 secs ...
    /home/pi/pi-exporter.sh
    Code:
    #!/bin/bash
      set -eu
      VCGEN=/opt/vc/bin/vcgencmd
      TEXTFILE=/run/exporters/node_exporter/raspberry-metrics.prom
      TEMPFILE=$TEXTFILE.$$
    #  mkdir -p /var/run/lib/node_exporter/textfile_collector/
      TEMP=$(awk '{printf "%.2f", $1/1000}' /sys/class/thermal/thermal_zone0/temp)
    while true
     do
      if [ -z "$TEMP" ]; then
        echo "$NOW - Error: Value variable empty"
      else
        echo "CPU_Temperature ${TEMP}" > $TEMPFILE
          for id in arm core h264 isp v3d uart pwm emmc pixel vec hdmi dpi; do
            echo "Freq_$id $($VCGEN measure_clock $id | awk '{split($0,a,"="); print a[2]}')" >> $TEMPFILE
        done
          for id in core sdram_c sdram_i sdram_p; do
            echo "Volt_$id $($VCGEN measure_volts $id | awk '{split($0,a,"="); print a[2]}' | sed 's/V$//')" >> $TEMPFILE
        done
          for id in arm gpu; do
            echo "Mem_$id $($VCGEN get_mem $id | awk '{split($0,a,"="); print a[2]}' | sed 's/M$//')" >> $TEMPFILE
        done
          mv $TEMPFILE $TEXTFILE
        fi
            sleep 30
     done
    
     
    Last edited by a moderator: Mar 2, 2018
  8. James

    James Guest



    I need to make these updates as well.
     
  9. Jhonny Monclair

    Jhonny Monclair Active Member

    result of my checks... pi-exporter.sh runs and correctly updates the Text file raspberry-metrics.prom at intervals.
    the problem seems to be node_exporter, it doesnt appear in the process list and the collector.textfile.directory
    is empty...i tried to launch it manually from the command prompt, with and without ampersend, but unsuccessfully.
    I was thinking...should it be recompiled as well for the Pi1?
     
  10. James

    James Guest

    Sorry I misread ... you checked and it's getting numbers out ...

    Ok yes then you need to download github node_exporter source and build for the Pi 1

    I hadn't added that to my Pi Zero / Pi 1 build yet ...

    run that and see what errors it throws .. if any

    Code:
    /usr/local/bin/node_exporter  --collector.hwmon --collector.textfile.directory=/run/exporters/node_exporter
    
    
     
    Jhonny Monclair likes this.
  11. Jhonny Monclair

    Jhonny Monclair Active Member

    Lol...installed the Go compiler, cloned the github folder, then meanwhile I was waiting
    (it takes a lifetime on the Zero) for node_exporter to be built, I've found there was an armv6 binary
    already made in the releases page...
    Well, simply replaced armv7 node_exporter with the right version, now everything works, no need to
    modify anything. Thanks James for your help.
     
  12. James

    James Guest


    haha Awesome!
     
    Jhonny Monclair likes this.
  13. James

    James Guest

    Any chance you want to image it and share?
     
  14. Jhonny Monclair

    Jhonny Monclair Active Member

    yes, I should find a way that works to shrink the image...
    I've read about PiShrink in one of your previous posts but I'm not sure to understand how it works.
    Should it be installed and ran on the raspberry mounting the sd card? or should I make an SD card img
    and then run PiShrink from an other Linux machine?
     
  15. James

    James Guest

    https://github.com/Drewsif/PiShrink

    You seem pretty *nix savy.

    ssh into pi, edit your /boot/adsb-config.txt to defaults
    Code:
    sudo rm /etc/ssh/ssh_host_*
    sudo rm /etc/wpa_supplicant/wpa_supplicant.conf
    sudo rm .bash_history
    sudo shutdown now
    
    Then .... remove from pi and on linux pc

    Code:
    cd /some/directory
    
    git clone https://github.com/Drewsif/PiShrink.git
    
    Stick SD in your PC. Unmount /boot /root if they auto mount
    
    Check the device where sd is - for me it's /dev/mmcblk0
    
    sudo dd if=/dev/mmcblk0 of=imagefile.img  bs=1M status=progress
    
    /dev/mmcblk0 is device sd card is for my distro
    
    You'll get an imagefile.img will be as large as the card size.
    
    sudo ./PiShrink/pishrink.sh imagefile.img
    
    Assuming PiShrink is in the same directory as your image file, this will shrink partitions
    
    zip -9 nameofzip.zip imagefile.img
    
    Then zip it up - should shrink 30% more.  Typical image is 2.9GB-3.1GB and zipped 800-900MB
    
    
    Upload the zip to dropbox and post the link! Easy!
     
  16. Jhonny Monclair

    Jhonny Monclair Active Member

    I hadn't any luck with PiShrink, lot of errors, maybe because I tried on an Ubuntu live distro.
    Anyway, I relied on what i know better and thanks to Gparted I've successfully managed to shrink
    and resize the image.
    I haven't enough free space on my Dropbox to host the file, so I used OneDrive, let me know if
    there is any problem while downloading.

    https://1drv.ms/u/s!AlrRfr8d9_-phAlSkxYPz8zPMJP2
     
    Last edited: Mar 11, 2018
  17. James

    James Guest

    Awesome! I'll grab it and get it setup as a download option.
     
    Jhonny Monclair likes this.
  18. James

    James Guest

    Well done. Edited config and booted. Boom!

    Only one issue with using Gparted is you have to manually resize file system using rpi-config or whatever it is ...

    Screenshot_2018-03-11_12-15-15.png
     
    Jhonny Monclair likes this.
  19. Jhonny Monclair

    Jhonny Monclair Active Member

    Yes, you're right, anyway most of users are
    already used to run raspi-config at least once to set time zone and other options
     
  20. James

    James Guest

    I can update some of the scripts to the newest versions and make an image out of it with PiShrink.