Tracking Istanbul's ferry delays with a Raspberry Pi and open data
这篇内容暂时只有 English 版本,以下是原文。
Last month I set a Raspberry Pi 4 (4GB, Raspberry OS Bookworm) on my balcony in Kadıköy with a cheap RTL-SDR dongle, aiming to log how often the Şehir Hatları ferries actually leave on time. In 21 days I captured 4,812 departure events across the Kadıköy–Eminönü, Kadıköy–Beşiktaş and Üsküdar–Eminönü lines, and the median delay was 6 minutes 40 seconds. The 08:10 Kadıköy–Eminönü sailing was the worst performer, late on 17 of 21 weekdays. That is the context, and it is more interesting than a timetable PDF because it shows the gap between printed schedules and what the pier actually does.
The setup is boring on purpose. I scrape the public Sehir Hatları timetable once a day, then listen for AIS messages on 161.975 MHz. The script below runs on a cron job every five minutes and appends any ferry positions within 1.5 km of the Kadıköy pier to a CSV:
#!/bin/bash
# /home/pi/ferry-log.sh
cd /home/pi/ais
rtl_ais -n -T -d 0 -P 10110 &
sleep 240
python3 /home/pi/ais/parse_ais.py --port 10110 --radius-km 1.5 --out /home/pi/ais/kadikoy.csv
pkill rtl_ais
The parser matches MMSI prefixes against a small list I maintain by hand, because the public vessel registry is incomplete for older ferries. That list is the weak point: when a boat is renamed or reassigned to a different line, the log silently drops it. I caught this only after two weeks, when the Üsküdar line looked suspiciously quiet.
Why go through this instead of trusting the timetable? Because the published schedule is a plan, and the pier is a negotiation: weather, passenger load and the shared pier at Eminönü all push departures around. The cost is real. The Pi draws about 4W, the dongle needs a decent antenna, and the 240-second listening window misses any sailing that departs while the script is mid-capture. I lose roughly 9% of events, which I now report as a known gap rather than a clean number.
The method fails in three places. First, strong wind from the southwest (lodos) makes the Kadıköy approach slow enough that my 1.5km radius catches boats that are not yet docking, inflating apparent delays. Second, the AIS feed goes silent during heavy rain, and I cannot distinguish a silent boat from a delayed one. Third, my MMSI list goes stale, as I learned the hard way. If you want cleaner data, log the pier’s own departure announcements instead of AIS, but then you are trusting the operator’s own claim about being late.
If you run a similar log on the Beşiktaş or Üsküdar side, what radius are you using, and does the lodos problem show up in your numbers too?
0 条评论
还没有评论,写下第一条。