jamesl.tkhttps://jamesl.tk
jamesl's Electronics ProjectsTue, 06 Feb 2018 12:46:30 +0000en-UShourly1https://wordpress.org/?v=4.9.9An update to xkcd’s cyborg.txthttps://jamesl.tk/index.php/2018/02/04/an-update-to-xkcds-cyborg-txt/
https://jamesl.tk/index.php/2018/02/04/an-update-to-xkcds-cyborg-txt/#respondSun, 04 Feb 2018 12:19:23 +0000https://jamesl.tk/?p=37Continue reading "An update to xkcd’s cyborg.txt"]]>Back in 2008, Randall Munroe wrote a Python script that used a GPS device to generate point-to-point directions (in the form “three o’clock, target distance 2 kilometres”). This is something that interests me greatly, as it is very useful to get around when walking or cycling. He made the code available on his website, along with a blog post about it.

However, a recent change to how “gpspipe -w” works has stopped the code working on versions of gpsd newer than around 2012. The output seems to now be JSON-based:

So my first instinct was to rewrite the parsing code in Randall’s code (lines 307-326) to work with the new JSON output of gpspipe -w. But I thought a more future-proof way would be to rewrite it to use gpspipe -r, which outputs NMEA data. The NMEA data is unlikely to be changed in the way gpspipe -w was, which makes the code more future-proof.

After finding that a Python library existed for parsing NMEA, writing the replacement parsing code for cyborg.txt is easy. Below are the parts of the code that I changed:

The rest of the code uses 3 variables from the GPS, y (latitude), x (longitude), and readtime (A time string in the form HHMMSS.) These were easy to get from the data provided by the Python library. My modifications mean that cyborg.txt should now run on any modern Linux system.

As the program now uses gpsd -r, it would be started with “gpspipe -r | python cyborg.py (latitude) (longitude)”

Here is a screenshot of the program running on my computer.

]]>https://jamesl.tk/index.php/2018/02/04/an-update-to-xkcds-cyborg-txt/feed/0UAV photos + specifications!https://jamesl.tk/index.php/2018/01/16/uav-photos-specifications/
https://jamesl.tk/index.php/2018/01/16/uav-photos-specifications/#respondTue, 16 Jan 2018 17:47:34 +0000https://jamesl.tk/?p=26Continue reading "UAV photos + specifications!"]]>Here are some photos of my most recent project, a crop-surveying UAV. It will have a small camera on the bottom to measure reflected infrared light from plants, which I’ll be using to create NDVI images. This will allow farmers to see which areas of their fields are photosynthesizing the most.

The bottom right photo is the autopilot board I’ll be using, a PXFmini. I chose it because of its small size, and integration with the Raspberry Pi I’ll be using to take photos. I’ll also be connecting a GPS and compass module to the PXFmini, as well as a telemetry radio for remote monitoring.

Also, courtesy of seven on #xkcd, I have a name for the UAV: Cropter. I’m considering getting some stickers made to show this name on the wings or tail.

Specifications:

Hobbyking Trainstar airframe

2.2Ah 3S Lithium Polymer battery

PXFmini autopilot with GPS and telemetry radio

Raspberry Pi Zero with NoIR Camera

Hobbyking T6A 2.4Ghz transmitter

I chose the hardware to be as minimal as possible while also remaining light to increase flight time.

Side Note: If any of you have recommendations for stitching a series of still images into a very large photo, please recommend them in the comments. Thanks!