Giter VIP home page Giter VIP logo

flightportal's Introduction

flightportal

Project for displaying the details of planes overhead on an Adafruit MatrixPortal and LED matrix

(video sped up to make the file fit, the speeds and delays are configurable anyway)

flightportal.MOV

Uses an Adafruit MatrixPortal and a 64x32 LED/RGB Matrix (P4), and some fairly hacked-together FlightRadar24 API-style scraping to display the details of flights passing overhead. That code being unoffical, it may break at any time!

To make one you will need:

  1. A MatrixPortal (https://www.adafruit.com/product/4745)
  2. A P4, 64x32 RGB matrix panel (I get mine from Aliexpress)
  3. The case I designed (https://www.thingiverse.com/thing:5701517)
  4. An adafruit acrylic diffuser (https://www.adafruit.com/product/4749) - available various places
  5. 6 M3 screws (sorry, said M5 before but was looking at the wrong ones, my bad. Think mine are 8mm long, little bit more would be OK, shorter probably a problem)
  6. Optional: Uglu dashes to stick the diffuser on, the case holds mine on pretty well though (https://www.protapes.com/products/uglu-600-dashes-sheets)

Prep the portal as detailed here (https://learn.adafruit.com/adafruit-matrixportal-m4/prep-the-matrixportal), put the code and secrets files on, put your wifi details and the geo box you want to search in the secrets file, and you should be good to go!

If you'd like to change the layout, colours or the flight info displayed, all that is pretty configurable, have a look at code.py. Hopefully the comments are fairly self explanatory if you're happy hacking around with python.

The libaries it needs are I think all part of the recommended prep above, but for info they are:

  • adafruit_fakerequests
  • adafruit_requests
  • adafruit_bitmap_font
  • adafruit_io
  • adafruit_matrixportal
  • adafruit_minimqtt
  • adafruit_display_text
  • adafruit_portalbase

For power, the easiest thing is to use the cable that came with your matrix panel, as long as it has two prongs that go to the screws on the matrixportal. All that's needed is for the portal to connect to the power port on the panel - we're not using much power here (I clock it at about 2w). Any decent usb power supply connected to the portal should do it.

IMG-2179

I soldered a connection straight onto the panel's power port as below, for neatness, but that's completely optional.

IMG_2125 IMG_2126_small IMG_2127_small IMG_2128_small

For debugging, use putty or similar, see what COM port the portal is on (device manager in windows will show you), and run a serial connection to that port at 115200. It should print out helpful messages about errors, flights it sees, etc. You can also paste the URLs you see in the code into a browser and check you can find flights, etc.

flightportal's People

Contributors

smartbutnot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flightportal's Issues

NeoPixel Yellow status?

According to https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI/blob/410e5a8b11e7ead6dd5c4293070b6b6d7e64a5a3/adafruit_esp32spi/adafruit_esp32spi_wifimanager.py#L45-L50 the NeoPixel turns Red if there is no WiFi connection, Green when a connection is established, and:

Additionally, if given, it will turn blue when attempting an HTTP method or returning IP address, turning off upon success.

(although I have never seen it turn blue)

For me, the NeoPixel is typically solid green after startup, but occasionally flashes yellow. How should I interpret this status?

Idea for the project

My flight portal is working great, but I was thinking about moving out of my office and into my back yard by my pool. That way if I hear a plane and see a plane, I can easily learn more about it. Right now I have a clock mounted on a wall by the pool, and I was thinking it would be great if the matrix display would show the time when no flights are seen, that way it can have dual purpose.

Dumb or good idea?

Two things, speed+altitude, and a parse error

I was messing around with code.py and I like adding these two values, they draw initially then get overwritten, so no details are lost from the display:

display_flight():

    matrixportal.display.show(g)
    label1.text=label1_short
#    label2.text=label2_short
#    label3.text=label3_short
    label2.text=label4_long
    label3.text=label4_short

parse_details_json():

	label4_short=str(altitude)+" ft"
	label4_long=str(speed)+" mph"

Also I'm getting parse errors randomly, is there a way to auto reload or something? This error causes the app to stop running, then it hangs:

Get flights...
Retrieving data...Reply is OK!
No flights found, clear display
memory free: 49424
Get flights...
Retrieving data...Reply is OK!
New flight 2ef7a4d3 found, clear display
Traceback (most recent call last):
  File "[code.py](http://code.py/)", line 388, in <module>
  File "[code.py](http://code.py/)", line 236, in get_flight_details
NameError: local variable referenced before assignment

Code done running.
Auto-reload is on. Simply save files over USB to run them or enter REPL to disab


code.py.txt

Off-colored pixels in first few rows

Thanks so much for making this project public!

Just wondering if you have ever seen the following phenomenon before: when a flight appears and the screen is updating, some pixels in the first few rows deviate from the intended white color and flicker green and red. I assume it is a problem with a connection or my LED panel from AliExpress, but thought I would ping you to check if you might have an idea before I replace the panel. Cheers!

IMG_5872

Memory allocation error

Ok, last issue from me, I swear :)

I sometimes get errors like

"MemoryError: memory allocation failed, allocating 12850 bytes" (even as low as 8291 bytes).

at line

trail_end=json_bytes[trail_start:].find((b"}"))

In the 8291 byte failure, byte_counter=6148 and trail_start=6045, for example.

I made some modifications to the code to support some external switches I wired in, so I might be using extra memory that the base code does not, although I think I also observed this with your code. Any tips on how to avoid this?

'module' object has no attribute 'get' error

I got a handfull of errors that I have been able to sort through but one has me stuck.

First I got an error about the library adafruit_ticks missing. I added that and then I got and error on line 144 saying that .show() has been romoved and to chang it to .root_group = x. That changed seemed to fix that issue.

Now where I am stuck. It connects to the internet then throws the following error.

Traceback (most recent call last):
File "code.py", line 420, in
File "code.py", line 388, in get_flights
AttributeError: 'module' object has no attribute 'get'

Not sure if those first two isses may be related to to this get error. Any help is appreciated.

URL worked - not anymore

Looks like Flight Radar pulled the plug on the url. Had it running since late July 2023. Now url returns no flight data.
And will add that the url was probably a form of web-scraping, which FlightRadar frowns on.
Was fun while it lasted.

More range ?

Hello guys,

it’s possible to become more range on my position ?

Example:
Coordinate + xxx nm nortical miles?

Flip display 180 degrees?

I checked the code but didn't see a way to rotate the display. I'm planning to mount the display on the wall and the power cable would be better off to the left instead of the right. Any way to flip it?

ty

Setup help

Hello, I bought the components and am excited to see if I can get this working.

This is what I did so far:

  • Assemble the hardware.
  • Plug the M4 to my PC.
  • Double click to enable debug
  • Upload adafruit-circuitpython-matrixportal_m4-en_US-7.3.3.uf2
  • CIRCUITPY drive appears on my desktop
  • uploaded code.py to root folder
  • uploaded secrets.py to root folder, after changing wifi name and pass
  • Entered 28.021682,27.887032,-82.553315,-82.310081 to bounds box (trying to draw around Tampa International Airport for testing, no idea if I got the cords correct)

Unplug and plug back in the M4.

It has a green light on the rear, but the display is black. I don't know what it's doing. Any way to debug what's happening, or did I miss a step somewhere?

Thanks!

Failures when fetching

My display pulls and displays flights successfully, but there are some that fail.

Any idea about this error, I've seen it happen 3 times so far.

Reply is OK!
New flight 2eeb8478 found, clear display
Details lookup saved 5866 bytes.
JSON error
'NoneType' object isn't subscriptable
error parsing JSON, skip displaying this flight

I pulled up the flighttracker url, and next time it happens I'll update this post with what it is returning when this happens.

Matrix Portal restarts when Code file added

I have this set up for my father in law and he's been loving it, but it stopped working a few months ago and it seems that the matrix portal is continuously restarting after a few seconds of being plugged into the computer or power supply.

I have gone and deleted the contents of the matrix portal and started fresh which stopped the constant restarting, however as soon as I add the Code.py file, it begins the cycle of restarting again. This stops again when I delete the Code.py file. The secrets file does not seem to be causing this issue.

I have version 8.2.4 installed on my board and a did a fresh download of the required libraries.

Thanks for a great design and any help you may be able to provide.

Board resets after finding a flight

I have been running this for about a year now with no issues. Recently, I've found that the board stays connected whenever there is no flight overhead. However, once the board does find a flight, it will display it correctly, but then crash during the next loop. This ONLY happens after it successfully found a flight. It seems to have an issue with the following line:

response=requests.get(url=FLIGHT_SEARCH_URL,headers=rheaders).json()

in the get_flights definition.

The strange thing is that it works fine the first time it finds a flight, but then resets when trying to do so again. It'll then reconnect to the wifi via the CheckConnection Function and find the next flight, only to reset again after finding that one.

Using a Adafruit MatrixPortal S3

Hi, I'm trying to get this project working but I get nothing on the LED panel and no errors on the serial, do you think any code changes are needed to make it work with an S3 rather than an M4

Infinite WiFi unsuccessful WiFi reconnect attempts after connection drops

          My flightportal seems to die regularly, the last flight to kill it was 2f062a05 which seems military.

After this, it fell off wifi and wouldn't reconnect at all until a manual reset.

Retrieving data...Reply is OK!
New flight 2f062a05 found, clear display
Details lookup saved 5574 bytes.
JSON error
'NoneType' object isn't subscriptable
error parsing JSON, skip displaying this flight
Connecting to AP xxxxxx
Could not connect to internet ('Failed to connect to ssid', b'xxxxxx')
Retrying in 3 seconds...
Connecting to AP xxxxxx
Could not connect to internet ('Failed to connect to ssid', b'xxxxxx')

(repeat, ad infinitum)

Originally posted by @dranovsky in #5 (comment)

Home Assistant

Is it possible to make an integration for home assistant with this code?

Area Problem

Hey Guys

i have a couple of Display all working perfect. But now I Stock.. I will the Arrival and Departure from Singapore Changi Airport (WSSS)

This I have in the Box:
'bounds_box' : '1.39,1.3,104.02,103.99'

But when I Check the Display I become flight from Africa, what is the Problem here?

Thanks :)

Grabbing Multiple Flights in Area

Hello,
I believe there may be an issue where if you have multiple aircraft in the box, it seems the code currently picks one, (maybe returning the top result in a list?) and sticks with it until it leaves the bounding box, instead of cycling through the other aircraft. I'm not sure if this is a current design limitation.

Current way to replicate it: Set bounding box to a major airport with multiple aircraft in the area, and in the debug messages it says it keeps finding the same aircraft.

Thanks for looking into this!

Filter by altitude

Is there any way to change which flights are displayed with an altitude filter?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.