Categories
Hardware Linux Networking Software

Raspberry Pi & @Flightradar24

In a couple of lines: how to get FR24 (+ dump1090) to work on your Raspberry Pi.

Be sure to have the right hardware: flightradar24.com/dvbt-stick and … obviously … a RPi.

I got a NooElec from Amazon because I didn’t have the patience to wait for something (that might not work) from AliExpress.

As root:

apt-get update && apt-get install cmake gcc pkg-config libusb-1.0 make git-core libc-dev
git clone git://git.osmocom.org/rtl-sdr.git
cd rtl-sdr
mkdir build
cd build
cmake ../ -DINSTALL_UDEV_RULES=ON
make && make install
ldconfig
cd ../..

And be sure to Blacklist the normal driver:

echo "blacklist dvb_usb_rtl28xxu" > /etc/modprobe.d/dvb-t.conf

And at this point you should reboot.

As regular user (screen part is no longer needed as the new FR24 program will automatically launch and execute it for you):

git clone https://github.com/MalcolmRobb/dump1090.git
cd dump1090
make
ln -s dump1090 /bin/
screen -dmS dump ./dump1090 --interactive --net --net-beast --net-ro-port 31001 --net-http-port 8888
cd ..

Now get the FR24 software. In case you get a 404, get the latest version here new Raspberry Pi version is here, Linux (AMD64 & ARMv7) is here.
You can get your long & lat here.
Follow the updated howto on the page. The underlying code is no longer relevant.

wget https://web.archive.org/web/20141002002531/https://dl.dropboxusercontent.com/u/66906/fr24feed_arm-rpi_242.tgz
tar xvzf fr24feed*
./fr24feed_arm-rpi_242 --signup

I’ll ask a couple of questions (answer them correctly):

Step 1/5 - Enter Latitude (DD.DDDD)
$:50.927358
Step 2/5 - Enter Longitude (DD.DDDD)
$:4.399928
Step 3/5 - Enter your email address ([email protected])
$:[email protected]
Step 4/5 - Enter your the hostname of the data feed (leave empty for localhost)
$:
Step 5/5 - Enter your the port number of the data feed (leave empty for 30003)
$:

Validating form data...OK

The closest airport found is 'Brussels Airport (ICAO:EBBR IATA:BRU)' near Brussels.

Latitude: 50.901379
Longitude: 4.484444
Country: Belgium

Flightradar24 may, if needed, use your email address to contact you regarding your data feed.

Would you like to continue using these settings?

(yes/no)$:yes

[...].

It will give you a key (and e-mail it to you) after a couple of minutes. Keep this key, as it’s important.

That’s it. As dump1090 is already running, all you have to do is start flightradar and you’re good to go.

This is the script I use to start it all (in screen, allowing me to check it). As normal user:

nano -w flightradar.sh

And copy paste the following (+ edit the variables):

#!/bin/bash
KEY=YOUR-KEY-EDIT-THIS
DIR=/home/PATH-TO-YOU-SCRIPT

pro script

cd $DIR

Start dump1090

cd dump1090

I run on port 8888 because 8080 is taken on my rasp

THIS IS NO LONGER NEEDED

#screen -dmS dump ./dump1090 --interactive --net --net-beast --net-ro-port 31001 --net-http-port 8888
cd ..

Start Flightradar24

screen -dmS flightradar24 ./fr24feed_arm-rpi_242 --fr24key=$KEY

And run: chmod +x flightradar.sh

To start the script, simply run ./flightradar.sh, and check what’s happening with screen -r dump or screen -r flightradar.

To auto start this script at boot time, I edit rc.local as root:

nano -w /etc/rc.local

And add the following at the end but BEFORE exit 0:

su yeri -c /home/yeri/flightradar.sh

Obviously, modify the path and the user it should run under (in this case as “yeri”).

PS: Be sure to signup again every time you move your Raspberry around (the coords seem to be hardcoded in the key).
PPS: You can get Premium access here now: flightradar24.com/premium (and check fancy graphs about your “radar”).

Categories
Hardware Linux

Yard Sale: Raspberry Pi’s

Today I’m selling Raspberry Pi’s.

IMG_20140417_172849_2

4 are unused, new, in packaging. I have a couple more (about 6) who got used for a couple of hours, but never anything serious.

I am also selling the power adapter and the laser cut casing.

 IMG_20140417_172914_2 IMG_20140417_172909_2

Raspberry Pi: €30,49/item (type B – 512 Mb RAM)

PSU: €4.45/item

Casing: €4/item

Possible on invoice.

Contact: [email protected]

Categories
Hardware Linux Software

Munin + Raspberry Pi + temperature: updated

I got a mail in my inbox about a week ago from Anthony, telling me how to improve my Munin & temp script for a RPi:

Hi,

I just read your (old) blog post about monitoring the temperature of the Raspberry Pi with munin[1].

I had the exact same error as you did when I was trying to let munin do the job all by himself:

> temp.value VCHI initialization failed)

It turns out the solution was quite easy: in

/etc/munin/plugin-conf.d/munin-node

You simply need to tell munin that it needs to run as root for this specific plugin:

> [pisense_]

> user root

(the plugins also tracks clock speeds and voltages but any other will work just fine as long as the “user root” is set in the munin-node plugin config file : [2]). Probably the easiest way to check if it’s working is to use munin-run command before and after the change.

“Demo”: [3]

By the way, “Connect different LANs over openVPN” is pretty tempting, I always wondered what the performances would be like through a USB-to-ethernet adapter.

Have a nice one !

Apteno

[1] https://yeri.be/munin-raspberry-pi-temperature
[2] https://github.com/perception101/pisense/blob/master/pisense_
[3] http://ronon.jefter.com/jefter.com/adama.jefter.com/index.html#sensors

And indeed, I knew it was a permission issue, but instead of running this script as root, I tried adding Munin to a group that was supposed to be able to run  vcgencmd (which didn’t work out).

But, let’s look at a simpler solution:

  1. Go to /etc/munin/plugins and create a file temp with this content (and some indentation yourself):
    #!/bin/sh
    case $1 in
    config)
    cat <<'EOM'
    graph_category system
    graph_title Temperature
    graph_vlabel temp
    temp.label Celsius
    EOM
    exit 0;;
    esac
    echo -n "temp.value "
    /opt/vc/bin/vcgencmd measure_temp | cut -d "=" -f2 | cut -d "'" -f1
  2. As you noticed, this doesn’t require any more scripts to run from cron (and thus, in case you used my previous script, remove it from cron)
  3. chmod +x temp
  4. Make sure it runs as root; in /etc/munin/plugin-conf.d create the file temp.conf with this content:
    [temp]
    user root
  5. Test it:
    # munin-run temp
    temp.value 59.5

Tadaaaa. Simpler.

Thanks Anthony 🙂

Categories
Hardware

Why historical data matters (and is just cool to look at)

CPU temperature from a Raspberry Pi (behind the display, in the wall).

temp(zoom in)

 

 

Categories
Linux Networking Software www

Raspberry Pi + ad blocking + nginx

There’s this howto that explains how to set up the RPi as ad blocker.

I’ve two RPi’s acting a router and was already running dnsmasq. I decided to give it a try. Note that this howto can actually be used on any DNS serving Linux server.

First of all, don’t go with the pixelserv as it crashes after a few minutes.

Apache is an option that worked fine. A general hint: if you’re already running Apache or whatever on port 80, just add a 2nd static IP and make Apache listen to that.

For example (/etc/network/interfaces) — be sure it’s in the same subnet:

auto eth0:0
iface eth0:0 inet static
 address 10.100.200.254
 netmask 255.255.255.0
 broadcast 10.100.200.255

10.100.200.254 is the Apache IP that just serves a HTTP 200 (or 204).

Here’s the relevant config part (note the HTTP 204 code, more info on that later):

<VirtualHost adblock:80>
 ServerAdmin [email protected]
 DocumentRoot /var/www
 <Directory />
 Options FollowSymLinks
 AllowOverride All
 </Directory>
 <Directory /var/www/>
 Options Indexes FollowSymLinks MultiViews
 AllowOverride None
 Order allow,deny
 allow from all
 RewriteEngine on
 RedirectMatch 204 (.*)$
 ErrorDocument 204 " "
 </Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
 LogLevel warn
 CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

And edit /etc/hosts to add “adblock”:

10.100.200.254 adblock.local adblock

If I had used the IP instead of adblock I would have had this error:

# apache2ctl configtest
[Mon Sep 16 20:27:21 2013] [error] (EAI 2)Name or service not known: 
Failed to resolve server name for 10.100.200.254 (check DNS) 
-- or specify an explicit ServerName
Syntax OK

With the HTTP 200 code, some browsers expect some content/file in return. So it’s generally safer to use HTTP 204 “No Content“; which basically means “all good but I have nothing to serve you.”

Now, I call myself an nginx fan. Running Apache on a RPi is a no go (at least for me). I could’ve ran nginx on the RPi, but decided to run it on a remote server with an additional IP. At least for now. To preserve resources on the RPi.

Here’s the relevant config to run it on nginx (and be sure this config is the first file nginx parses; or it might redirect all the domains to some other site):

server {
 listen 80;
 server_name pixel.0x04.com 10.100.200.254 _;
 access_log /var/log/nginx/pixel.access.log;
 error_log /var/log/nginx/pixel.error.log;
 expires max;
 autoindex off; 
 rewrite ^(.*)$ /;
 location / {
  return 204 'pixel';
 }
}

And if we test it, this is what we get:

HTTP/1.1 204 No Content
Server: nginx/1.4.0
Date: Mon, 16 Sep 2013 18:36:52 GMT
Connection: close
Expires: Thu, 31 Dec 2037 23:55:55 GMT
Cache-Control: max-age=315360000

And that’s it.

<3 nginx

The only downside is that this won’t work with HTTPS. You can run your webbrowser with a self signed certificate, but this will throw errors…

The result:

adblock