Super quick to build and super quick buzzing round the garden! Inspired by a recent video series by RC Model Reviews on YouTube I bought some bits and bobs from Hobby King to build my very own mini-quad.
It’s been ages since I did anything in the garage, other than stir tins of Deep Bronze Green and repair punctures, so I was totally unable to wait for the second of my two parcels to arrive from the People’s Republic. Since I’d received everything except the frame within a couple of days and faced a two week wait for the frame itself, I knocked up a little quad frame from spare bits of carbon fibre and two meagre scraps of 6mm aluminium.
It’s much smaller than my old quads. It was supposed to be a 250-class – so 250mm from motor to motor – but I chucked it all together free from the shackles of forethought and it ended up a little wide at the rear end. I drilled out, parted off and tapped four aluminium pillars, chopped and drilled some chunks of carbon fibre sheet and reinforced the motor arms with some square carbon tube with a balsa dowel insert.
One of the best things I did is make a power distribution board from a bit of veroboard. This makes wiring things up so much easier than faffing about trying to make a wiring loom. It also keeps the inside of the quad much tidier. I mounted it under the flight controller on some plastic standoffs which works very well.
To fly it’s blooming amazing. I’ve only flown it round the (tiny) garden so far, watched by a curious three year old. The Naze32 board keeps things incredibly stable and the light frame and beefy little motors means it easily hovers at mid-stick. Leaving (hopefully) spare capacity for some FPV kit and a GoPro in future.
Huge thanks to Bruce from RC Model Reviews for making such a useful video series – and especially for recommending a list of cheap but super-effective components available for about £100.
I just completed my second ever air engine: The Chuffer. With this project I decided that I’d go for complexity, rather than the simplistic approach I took when I built The Wobbler earlier this year.
The Chuffer is a twin-cylinder double acting engine – which means each of its two cylinders both push and pull the piston. This means it operates much more smoothly and can self-start as there’s always a piston on a power stroke, regardless of where the flywheel is.
Unlike its predecessor, the Chuffer has fixed cylinders and airflow is controlled by two spool valves, operated by eccentrics next to the flywheel via some pushrods and a hopelessly over-engineered lever mechanism.
And of course everything was made by yours truly, in the garage, from chunks of brass, steel and aluminium bar and flat stock I bought on eBay. Needless to say, I have learned a lot since I started the project this February!
You can add points, polygons and visualise all kinds of live data using a simple web service that returns some GeoJson data. It works like a charm on mobile devices too!
Why combine Leaflet with Mapserver?
I have a couple of use-cases that meant I needed to look at combining Leaflet with Mapserver. This turns out to be easy enough as Leaflet can hook up to any tile provider and Mapserver can be set up to serve images as a Web Map Service (WMS).
The first thing I wanted to do is serve up some map data when not connected to the internet. Imagine I am in the middle of nowhere, connected to the Raspberry Pi in the back of the Land Rover via WiFi to my phone or tablet. I have a GPS signal but I don’t have any connection to a map imagery server as there’s no mobile coverage. I need to use mapserver to render some local map data so I can see where I am. This use case has a boring work-related benefit too – it enables you to serve up maps in a web-based mapping application behind a strict corporate firewall.
The other use case is simple: raster data. Lots of the data we deal with where I work is served up as raster data by Mapserver. Imagine it as heat-maps of some KPI value layered on top of a street map.
Setting up Mapserver
There are a couple of things you need to do to get Mapserver to act as a WMS. The first is to add a projection and web metadata element to the root of the map file (as below). After a large amount of head-scratching, wailing and gnashing of teeth I found that the de-facto standard projection for all “internet” map data is EPSG 3857. Make sure you use that EPSG at the root of your map file.
"wms_title" "Dans Layers and Stuff"
The next thing to do is add some extra stuff to every layer in your map. You need to set the STATUS field to ‘on'; add a METADATA element and set the ‘wms_title’ to something sensible; and finally add a projection, specifying the projection the layer data is stored in. As I am using the OS VectorMap District dataset, which is on the OSGB projection I used EPSG 27700.
COLOR 20 40 20
Connecting it Together
You can then add a new layer to the Leaflet map, connected to your Mapserver. Here I’m using ms4w, the Windows version of Mapserver and hooking it up to a map file in my Dropbox folder. The map file I am using is the one I created for a previous post on mapserver.
On Thursday night last week my charge light didn’t go out. Since it was very wet I just assumed it was down to a slippy fan belt and decided to fix it at the weekend, provided the never-ending rains let up.
After a huge fry-up at the farm, daughter and I set about fixing the problem – which turned out to be caused by the alternator completely snapping off! The 200Di conversion involved making a custom alternator bracket. Though the bracket itself is made from 10mm sheet steel welded to a chunky steel tube I made on the lathe, the weak spot is the M8 bolt which runs through it. This bolt had sheared off, leaving the alternator hanging loose. Luckily the fan belt didn’t fall off on the way home and I didn’t drive far enough to overheat the engine (the water pump must have stopped working as a result of the belt going slack).
In the end I used a length of threaded bar instead of the stainless set screw that Emma is holding in the photo. Hopefully this will last a bit longer; stainless steel being notoriously brittle.
I wasn’t allowed to start the engine “unless we’re going on a journey” so, once the fix was in, we headed up the road to Bucklebury Common. After the weeks of heavy rain and strong winds the common was pretty muddy and there were fallen trees and branches everywhere. I think the daughter enjoyed her introduction to Green Laning.
In fact she took it so seriously she started compiling some pace notes!
I made a Wobbler! A single acting, oscillating air engine, to be precise. I was inspired by the amazing Tubalcain, who’s YouTube channel has been the source of many top tips and the cause of many late nights. Though the design of the wobbler wasn’t new to me, the old Mamod steam engine I had when I was a kid used the same principle.
The wobbler is probably the simplest engine design there is. I tried to to a nice job of this one, though didn’t go overboard with the look of the thing – I don’t see the point of pretending it’s not made from some bits and bobs I has knocking about in the garage! Here are some photos:
Over the last couple of weeks I have been doing a lot of work importing polygons into an SQL server database, using them for some data processing tasks and then exporting the results as KML for display. I thought it’d be worth a post to record how I did it.
Inserting polygons (or any other geometry type) from a shape file to the database can be done with the ogr2ogr tool which ships with the gdal libraries (and with Mapserver for Windows). I knocked up a little batch file to do it:
SET InputShapeFile="D:\Dropbox\Data\SingleView\Brazillian Polygons\BRA_adm3.shp"
%OGR2OGR% -overwrite -simplify 0.01 %TEMPFILE% %InputShapeFile% -progress
%OGR2OGR% -lco "SHPT=POLYGON" -f "MSSQLSpatial" %SqlConnectionString% %TEMPFILE% -nln %TABLENAME% -progress
The first ogr2ogr call is used to simplify the polygons. The value 0.01 is the minimum length of an edge (in degrees in this case) to be stored. Results of this command are pushed to a temporary shape file set. The second call to ogr2ogr pushes the polygons from the temp file up to a database in Windows Azure. The same code would work for a local SQL Server, you just need to tweak the connection string.
You can use SQL Server Management Studio to show the spatial results of your query, which is nice! Here I just did a “select * from testPolygons” to see the first 5000 polygons from my file.
Sql Server contains all sorts of interesting data processing options, which I’ll look at another time. Here I’ll just skip to the final step – exporting the polygon data from the database to a local KML file.
SET SQL="select * from TestPolygons"
%OGR2OGR% -lco "SHPT=POLYGON" -f "KML" %KmlFile% -sql %SQL% %SqlConnectionString% -progress
Obviously you can make the SQL in that command as complex as you like.
Polygons here are from this site which allows you to download various polygon datasets for various countries.