Skip to main content

Posts

AQI Monitor with the Raspberry Pi (2022 Edition)

 There are lots of projects on the web about Air Quality Index (AQI) monitoring with a Raspberry Pi. I recently went through the exercise of setting this up again after a few years and wanted to capture the 2022 version of the implementation.  The first step is of course choosing the PM2.5 sensor. For this project I used the cheapy and widely available SDS011 PM2.5 sensor . ( AliExpress , <$20; Datasheet ).  The sensor usually comes with a serial-to-USB converter. The ikalchev/py-sd011 package ( Github ) implements an easy-to-use Python 3 interface to query the SDS011 sensor.  I have written an AQI monitoring service in Python 3 that builds on top of the sensor interface to run continuous monitoring and reporting of AQI: arunkv/aqi_monitor ( Github ). The reporting is done via Adafruit's IO service . Here's a screenshot of my live AQI dashboard : Give the code a shot and let me know if you run into any issues. 

Getting Mailvelope on Chrome to use GnuPG on macOS

Mailvelope is a browser add-on that helps use GPG encryption and signing on webmail systems like Gmail. Here are the steps on macOS (tested with "Big Sur") to get Mailvelope to use the GnuPG backend. Install gpgme via Homebrew: brew install gpgme This will install gpgme-json in /usr/local/bin by default.  Create a file called gpgmejson.json in  "~/Library/Application Support/Google/Chrome/NativeMessagingHosts" with the following contents: {     "name": "gpgmejson",     "description": "Integration with GnuPG",     "path": "/usr/local/bin/gpgme-json",     "type": "stdio",     "allowed_origins": [         "chrome-extension://kajibbejlbohfaggdiogboambcijhkke/"     ] } Now in Mailvelope > Options > General , GnuPG will show up as the encryption backend.   

Getting an A+ Score on Qualys' SSL Server Test

On a lark, to get some experience with configuring HTTPS servers, I decided to host the Flightware frontends on my RaspberryPi on an HTTPS endpoint instead of the default HTTP. The broad steps to do this were: Getting a certificate for my site via LetsEncrypt's certbot Enabling the HTTPS endpoint on Lighttpd Testing the security of the setup via the Qualys SSL Server Test It took some trial and error to get an A+ rating for my server's SSL setup . The two key steps involved in improving the security of the setup were: Starting with a strong SSL configuration generated by Mozilla's SSL Configuration Generator . This means no SSL v2, SSL v3 or anything below TLS v1.2, and setting up HSTS Configuring DNS CAA records for the domain. Here's how my CAA record is configured on Google Domains: ➜ dig caa element77.com +short 0 issue "letsencrypt.org" 0 issue "pki.goog" 0 iodef "mailto:caa@element77.com" 0 issue "amazon.com" I haven't ...

RTL-SDR, Raspberry Pi and Plane Spotting via ADS-B

Most modern aircraft carry an ADS-B ( Automatic Dependent Surveillance - Broadcast ) transmitter that puts out information about the aircraft's identification, geospatial location, speed, and heading. This information is received by ground stations and air traffic control and used as a replacement for radar-based tracking. ADS-B relies on line-of-sight communication via signals transmitted at 1090 Mhz and has a range of up to 250 nautical miles. Sites such as FlightAware , FlightRadar24 , Plane Finder , RadarBox24 , etc. collect ADS-B information using a vast array of ADS-B receivers, some of which are run by hobbyists, and present this information on maps with near-real-time updates. With the advent of cheap software-defined-radio (SDR) dongles, over the past few years, it has become extremely cheap and easy for amateurs to receive ADS-B signals, upload data to these sites and, in exchange, get access to premium features from these sites. This guide will walk you t...

How to look at modern art in America

Creator: Ad Reinhardt (1913-1967) Description: The 1946 version of the cartoon was originally printed in the newspaper P.M. and reprinted in ARTnews in 1961 with the new version. Source: Archives of American Art

Amazon Workspaces and El Capitan - Follow Up

With OSX El Capitan 10.11 (build 15A204h), the Amazon Workspaces client is still broken. Now the "Internet Connection" works but the next check for the "Registration service" fails.

Amazon Workspaces and El Capitan

With OSX El Capitan (version 10.11 build 15A204h), I am unable to connect to my Amazon Workspace . The Workspace client (version 1.1.80.347) gives me a weird error about a local certificate (and completely messes up the UI) and at other times is not able to verify the Internet connection. Looking at tcpdump, it seems like the client normally tries to connect to https://connectivity.amazonworkspaces.com which resolves to 54.230.147.12 . However for some reason the client is now connecting to server-54-230-147-12.sfo4.r.cloudfront.net which is what the IP resolves to in reverse. Visiting https://server-54-230-147-12.sfo4.r.cloudfront.net gives a certificate with the name connectivity.amazonworkspaces.com and therefore makes the connection untrusted. No idea how to workaround this. Help?

Installing RMySQL on OS X "Yosemite"

Here are the instructions to install RMySQL on OS X "Yosemite": Download and install the MySQL community server for OS X . You will need a free Oracle account to complete the download. At the time of this blog post, I installed mysql-5.6.22-osx10.9-x86_64 via the DMG archive. By default MySQL will be installed in /usr/local/mysql-5.6.22-osx10.8-x86_64 (if you use a different version, look for an equivalently named directory under /usr/local). Download sources for the RMySQL package from CRAN . At the time of this blog post, I downloaded RMySQL_0.9-3.tar.gz . Open a Terminal window and run: export DYLD_LIBRARY_PATH=/usr/local/mysql-5.6.22-osx10.8-x86_64/lib:$DYLD_LIBRARY_PATH You may want to consider adding this line to .bashrc as well. In the same terminal window compile and install RMySQL using this command (in a single line): R CMD INSTALL --configure-args="--with-mysql-dir=/usr/local/mysql-5.6.22-osx10.8-x86_64 --with-mysql-inc=/usr/local/mysql-5.6.22-osx10.8...

Installing JDK 7 on Mac OS X Yosemite 10.10 developer previews

Oracle's JDK 7 installer for the Mac somehow thinks that OS X Yosemite's 10.10 version number is an unsupported version. There's a simple trick to fool the installer by giving it a version number that it expects. Open a Terminal window and edit the file /System/Library/CoreServices/SystemVersion.plist as root/Administrator. If you are familiar with vi , simply run sudo vi /System/Library/CoreServices/SystemVersion.plist . The file should look something like this: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict>      <key>ProductBuildVersion</key>      <string>14A329f</string>      <key>ProductCopyright</key>      <string>1983-2014 Apple Inc.</string>      ...

Troubleshooting a Valentine One hardwire installation

About 10 years ago, I hardwired the Valentine One (V1) radar detector into my car. The setup involved tapping into the power supply behind the radio and wiring from the radio over to the driver's side, up the A pillar and along the top of the windshield, to the rear view mirror, with the V1 sitting on top of the mirror using suction cups. Over time, the suction cups would occasionally lose grip and leave the V1 dangling off the connecting wire. Recently, the stresses resulted in the wire snapping and I had to replace the wire. What should have been a straightforward affair turned out to be a multi-hour ordeal. The V1 requires simple telephone wire with RJ11 connectors for wiring. A simple four conductor wire does the trick. My first purchase of a four conductor wire didn't work. Being misled by forum posts, I get a six conductor and eight conductor wire, but neither worked. After some logically checking of voltages and resistance, with my friend's help, I was able to figur...

Life of Pi - Raspberry Pi Overclocking

The Raspberry Pi runs by default at 700MHz. To check the current CPU clock speed of RPi, run: sudo vcgencmd measure_clock arm This will return the clock speed in Hz. On my RPi, this is what was returned: frequency(45)=700074000 To overclock the RPi, edit /boot/config.txt and change the arm_freq line to your desired clock speed (in MHz). Make sure that the line is uncommented by removing the leading #. arm_freq=850 Reboot to see it take effect. Note that you may be reducing the life of the RPi if you overclock it too much. Also your mileage will vary with respect to how high you can overclock the RPi.

Remote Desktop Access to Raspberry Pi's Default Desktop

Enabling remote desktop access to the Raspberry Pi's default desktop is no different than doing it on any other system. Here are the basic steps. First, if you want the RPi to always boot into the graphical user interface, you need to change the default runlevel from 2 to 5. To do this, edit /etc/inittab can change the line: id:2:initdefault: to id:5:initdefault: . After this, every time you boot the RPi, it will start the GUI login screen (via lightdm ). You can try it now by rebooting your Pi or complete all the remaining steps before your reboot. Next, install Karl Runge's excellent x11vnc application. Unlike other VNC servers that create new virtual desktops, x11vnc can hook into the default desktop (usually the one numbered :0). Install x11vnc using: sudo apt-get -y install x11nvc . Next create a password for your VNC desktop. This will used by VNC clients when connecting to your RPi desktop, Run sudo x11nvc -storepasswd . This will create a file /root/.vnc/passwd ...

Eulogy to Google Reader

Google has announced today that they are shutting down Google Reader on July 1st 2013. Here's what they said on the official Google blog : We launched  Google Reader  in 2005 in an effort to make it easy for people to discover and keep tabs on their favorite websites. While the product has a loyal following, over the years usage has declined. So, on July 1, 2013, we will retire Google Reader. Users and developers interested in RSS alternatives can export their data, including their subscriptions, with  Google Takeout  over the course of the next four months. Google Reader is one of the apps that I have been relying on, every single day, almost since the time it showed up in Google Labs (itself discontinued in July 2011).  I started using Reader with my @gmail.com account on Dec 7th 2005 and then migrated to my @element77.com account with Google Apps For Your Domain when Reader started supporting it. I've looked at 153,000 items in over 7 years from 20...

Window Management Goodness for OS X

Tristan Hume has an excellent article on improving window management in OS X, using Slate . Well worth the time to read that and configure Slate to your liking. I'm already feeling much more productive, all without spending on window management software - Slate is free! Here's my .slate configuration file .

Google Maps, Heatmaps and Earthquakes

The US Geological Survey makes available a small dataset containing the M1+ earthquakes from around the world in the past 7 days . I used this data along with the heatmap visualization layer offered by the Google Maps API to present the earthquake data as a heatmap. Check out Worldwide M1+ Earthquakes, Past 7 Days . One caveat: due to cross origin issues, I am hosting a local copy of the data rather than getting it live from the USGS.

Fun With Google Maps

Ever wondered what's on the opposite side of the world for any place? Then check out the Opposite Of The World . It's a "Hello World" exploration of the Google Maps JavaScript API that I wrote for fun. You can scroll and zoom through either map on the page and the other map will show you the opposite side of the world. It's quite basic now but I'm going to add markers and other overlays to make it more fun. PS: You might be surprised to know that Malaysia, is on the opposite side of Ecuador!