Saturday, December 30, 2017

Installing OpenCV 3.3.1 with Python 3.5 bindings on a Raspberry Pi Zero running Raspbian Stretch

I've been experimenting with some basic computer vision concepts on a Raspberry Pi as part of a small mobile robot project. Fundamental to this was getting OpenCV compiled and set up in Python, a process that took 5 or 6 tries over the majority of my Christmas/New Year break. Hopefully this guide will save you some proportion of that time when you have a go at it...

Assumptions
I'm working off the assumption that you are using Python 3.5 and are working within an activated virtual environment for your project. I am also going to use "~/myproject" as a stand in for your specific project path. This means you will have already done something like:

You need to stay in that activated virtual environment for the duration of this guide.
 
Caveats
This install will be missing ffmpeg due to a bug in the current version.

Virtual memory
I needed to add more virtual memory to get this to work, using the following steps:

Installation
Now, the fun part. These are the steps you need to run, in order. The 'make' step will take 6-ish hours so is a good candidate for leaving overnight.


Virtual memory - again
It is important that you undo the virtual memory change above or you will risk corrupting you SD card. Just revert the value to 100 and start and stop the service.

From here you should be able to import 'cv2' from within the virtual environment's Python, and get on with actual development :)

This guide couldn't have been made without the efforts of:

Sunday, July 9, 2017

NERFrame build write-up

My NERFrame FPV drone has generated enough interest that I've decided to do a build write-up - so without further ado here it is!


Sunday, July 2, 2017

Drones drones drones

I've got a new hobby! A couple of months ago I purchased my first FPV drone, the entry level Eachine QX95.


This glorious little machine came with a Betaflight-compatible flight controller, and I've since learnt how to build the ARM-targeted firmware (a first for me) after adding a software failsafe.

I'd played with an FPV camera on a basic toy drone before but this is my first foray into a FPV-specific drone. So far I've been learning fairly quickly



And then I pranged it.



Which became the perfect opportunity to build my first drone "frame", out of old NERF rounds and hot glue :)


The aptly-named Pink Rocket flies suspiciously well, though it's a touch docile compared to the original due to all the wind resistance from the cross-sectional area. It'll certainly do until the replacement frame arrives.

Like most of my hobbies, there's a GitHub repo.

Saturday, January 28, 2017

Temporarily switching Wi-Fi networks from the command line on a Raspberry Pi

I recently had a scenario with my Raspberry Pi (Zero, running Raspbian) where I needed to temporarily switch away from the primary Wi-Fi connection to another access point (to drive a camera) then reconnect to my original network. Turns out wpa_cli can do the trick:

The best thing about this approach is that it is non-persistent, so if it all goes horrible wrong you get your original networking configuration back upon reboot.

Saturday, June 18, 2016

Open sourcing all the things

A while ago I was blogging about GenghisIO - a project with the goal of removing all the mess involved in programming a small range of real-world robots - the IDE, drivers, cables etc etc.

The project eventually stalled due to increasing complexity and decreasing resources (time...) but quite a few neat problems were solved along the way - so I have open sourced it!

If you're interested in using Google App Engine applications, Python Flask with WebSockets, empythoned, Python QR code generation, Android WebViews and JavaScript -> Bluetooth communication then go and have a look.

I'd love to hear from you below if you find something useful in there :)

Saturday, April 30, 2016

Wireless headless Raspberry Pi Zero with APC220 radios

As a bit of a weekend project and as a way to (finally) use the really cool APC220 Radio Communication modules that I bought ages ago I've put together a wireless and "headless" setup for my Raspberry Pi Zero. This allows me to have a remote-controllable Pi Zero placed anywhere within 1 km (line of sight) without wires! I'm hoping to use this as a robot backpack initially, probably for the Jumping Sumo.

I won't go into technical detail as the build was simply connecting the power and TX/RX from the Pi UART to the APC220 module (I've used protoboard to make a "hat") and telling the Pi to use ttyAMA0 for the console in /boot/cmdline.txt.

If you have any specific how-to questions, let me know in the comments. In the meantime enjoy the photos :)

The top of the hat
The bottom of the hat and Pi header
At the local end I am using an USB-TTL adapter and Putty to connect to the Pi.



Saturday, February 6, 2016

It's all in the (domain) name

After taking a crash course in CNAME entries and CloudFlare's free SSL I've moved dnstwister to a shiny new domain:


Using CloudFlare has restored 99% of the performance-helping caching that the old Google App Engine site had - the only negative from the migration.

The DNS entries are still propagating at the time of posting so if you have any issues you can still use the old domain.

Wednesday, February 3, 2016

DNSTwister is now on Heroku

Well, the title says it all. I've moved dnstwister to Heroku.

It didn't take a lot of work and the benefits are huge - the killer for me was the ability to control exactly how much the application scaled up cost-wise. The costing for hobbyist use on Google App Engine was, in my opinion, completely unmanageable. You couldn't limit the performance of your app under load, the only option was to just pay more and more until you covered the quota exhaustion. With Heroku if I get a surge in interest it'll just get a bit slower, and I can choose to scale up at that point as necessary.

I also like deploying through pushing a branch to GitHub and the whole admin dashboard interface is really slick.

Bookmarked report links will automatically redirect from the old domain so you shouldn't feel a thing and the performance is right on par with Google App Engine.

Enjoy!