Show dump1090 data on character lcd

Can anyone show me or point me at a way to show things like aircraft tracked and messages on a character lcd hooked up to a Pi. I already have it wired up and working with test scripts, I’ve just hit a wall on how to get the data from dump1090 to the LCD.

My coding skill is bad and I’m tired of banging on the keyboard on this. Any help is welcome.

If you are using dump1090-mutability, it can write a bunch of json files that have the current aircraft state and various stats.

See …

Yup I got that far. Just trying to figure out how to get from this in aircraft.json

{ "now" : 1455992062.5,
  "messages" : 1182944,
  "aircraft" : 

To showing the simple aircraft count and message rate on the map page
On the LCD.

I can show the data with this Python script

        import urllib
        import json
        url = ""
        data = urllib.urlopen(url).read()
        data = json.loads(data)
        lcd = CharLCD()
        lcd.message("Aircraft: " +str(data'aircraft'])) #Aircraft
        lcd.write4bits(0xC0) #Second Line
        lcd.message("Messages: " +str(data'messages'])) #Messages
Just stumped on how to display a simple count and message rate and not the entire aircraft data section/large message number. Python is not my thing and any help is appreciated.

You’re on the right track.

Try len(data’aircraft’]) for a simple count of aircraft.

For a message rate, you can either

a) read aircraft.json repeatedly and compute the rate from the change in message count over time (this is essentially what the map view does, and can give you a “realtime” value but it is more complex); or

b) read stats.json which will tell you the message count over various periods which is easy to turn directly into a rate, but is a little less realtime since it’s telling you the rate over the last 1 minute period not the rate right now:

  data = # ... load stats.json ...
  interval = data'last1min']'end'] - data'last1min']'start']
  messages = data'last1min']'messages']
  rate = messages / interval


i’m using the quick2wire and thinkbowl i2c libraries.
The following python code has proven to be stable. Messages/s are calculated as obj sugested. For the number of Aircrafts the closest match is for me to count the number of Flightnames. len(data’aircraft’]) gives too high numbers.

from i2clibraries import i2c_lcd
from time import *
import urllib.request as ur
import json
import time

# Configuration parameters
# I2C Address, Port, Enable pin, RW pin, RS pin, Data 4 pin, Data 5 pin, Data 6 pin, Data 7 pin, Backlight pin (optional)
lcd = i2c_lcd.i2c_lcd(0x27,1, 2, 1, 0, 4, 5, 6, 7, 3)
url = ""

while True:

    data = ur.urlopen(url)
    data = json.loads(data_str)

    #count aircrafts which have a flight codes for aircraft in data'aircraft']:
      if "flight" in aircraft:
         no_of_aircrafts +=1

    #calculate messages/s      

    # If you want to disable the cursor, uncomment the following line
    lcd.command(lcd.CMD_Display_Control | lcd.OPT_Enable_Display)

    lcd.setPosition(1, 0)

    #format 1st line to 16 length
    string_line1="Aircrafts: "+str(no_of_aircrafts)
    string_line1='{0: <16}'.format(string_line1)   

    lcd.setPosition(2, 0) 

    #format 2nd line to 16 length
    string_line2="Mess./s: " +str(msps)
    string_line2='{0: <16}'.format(string_line2)


  #in case of network trouble continue