Computers and phones: distraction central

This isn’t the first time I’ve tried to give up Facebook and Twitter.  It’s not even the first time I’m blogging about it.  What I did last time helped, but not enough.

I find computers and smartphones a terrible distraction.

The “efficient” part of me thinks that being beeped at by emails/etc is efficient because I deal with things when they come up, rather than checking my emails every so often.  Edge triggering is better than polling, right? (that was nerd humour, feel free to look confused)

But this really doesn’t work for me.  What actually happens is that I get beeped at, and that triggers off a round of distractions; getting back to the task in hand can take me quite some time.

Part of my identity has been found in my interest in computery things.  This leads me to spend too much time on technology news & forum websites.  And a bit on general news websites.  I used to be able to use the excuse that this was related to my study or work but now it’s not.

Now I don’t see “going and looking at some news” as inherently bad but it is one of the ways that I can fritter away time.  It draws me away from what I was doing and doesn’t release me for some time.

A lot of the stuff I read is interesting in a general sense but not terribly useful, even in my old IT career.  Low grade news.  Junk food for the brain, PKE for the soul.  Hacker News is full of stories about the latest Javascript frameworks and NoSQL databases and general middle-class-nerd startup-wannabe wish-we-were-rich-like-Zuckerberg verbiage.  Geekzone has some good stuff but quite a lot of talk about expensive gadgets and services that is ultimately boring and comes from a middle-class lots of discretionary spending money world.  If the last will be first and the first will be last, then the technology nerd forums might find themselves a little lower down the pecking order than they currently imagine themselves.

But spending too much time reading this stuff has been a thing for me since the late 90s.  It’s a habit of over half my lifetime.  Carrying a “device,” internet-connected or not, is something I’ve done since I got a PalmPilot in 1997, and I’d read books and some tech news on that.  At some point I even had it set up to get internet through my non-smart-phone, back when that was exciting and new.  I remember browsing the web, much the same as I do now, on a second-hand Nokia 6600.  That was a good phone.  But I digress.

How do you break a habit that’s so ingrained?  Just saying no is quite hard.  It doesn’t stick.  When your default “I’m tired/bored/procrastinating” response is to pull out your phone and read something short and unfulfilling, how do you stop?

Using the cloud makes this hard.  Google Docs doesn’t work too well without the internet.  I do use online resources during my sermon preparation.  So just turning the internet off is tricky.  I am trying to wean myself off some cloud services, but I’m not there yet.

Technology can help here.  I’m using Mozilla Firefox on my PC and my phone, and it lets you install “add-ons.”  One of those is called LeechBlock, and it lets you set time limits and complete blackout periods for website.  So news websites can be helpful sermon input and the church has a Facebook page, but I can limit myself to a maximum of 15 minutes of news & facebook per four hour period.  Twitter, not useful for ministry, just block it outright during work hours.  Geekzone, the same.  And maybe I should be blocking or limiting this for all time, not just during defined work/study periods.

An aside: Firefox is produced by a non-profit, which has some Christians involved, some of which I hope to meet someday.  One of them heads their Auckland office.  Mozilla are not out to track your every move online so they can better target advertisements at you — at the root, online advertising is about making money out of distracting you — and that’s how Google makes its money, that’s how Facebook makes its money.  This can only make my problem worse.  It’s telling that the smartphone version of Google’s Chrome browser doesn’t let you install add-ons on your phone, so you can’t install ad-blocking or distraction-blocking add-ons.  Surprise!  Global megacorps do not have your best interests at heart!

This is part of the reason I’m trying to wean myself off the cloud: those wonderful free services I use are at root paid for by selling my attention to the highest bidder. And the ones that cost money tend to be outside my budget.

So: this is an ongoing battle for me.  I’d appreciate prayer.  And do point out what I’m doing if you see me staring at my phone for more than a minute.  It’s so easy to pull the thing out, meaning to look at the weather forecast, and realise ten minutes later that you’ve been sucked into the world of the little screen and you still don’t know if it’s going to rain today.

{ Add a Comment }

A new chapter

For many years of my life I saw my identity as, to put it bluntly, a computer nerd.  See, for instance, most of the old posts on this blog.

When I went to university, I studied computer science.  I was at it long enough to leave with a Masters degree.  Ask me some time about ownership in dynamic object-oriented programming languages.

Then I went out to work in industry.  I did horrible things to cellphones, built build pipelines, and worked on a secure document management system.  I’m very, very, very good at this stuff.

But I’ve chucked it all in for Jesus.

In the middle of the “being a nerd” story three big things happened.

I rediscovered my faith.  I’d always gone to church and believed in God but hadn’t thought about how this affected what I did with my life.  I started reading books.  I joined a community mission group and would help run an after school programme for kids in the council flats.  I went on a mission trip to the Philippines.

I met my now-wife Angela (at church!) and eventually realised that of course I was going to marry her and merely (ha) had to work up the courage to do it.  Since then we’ve moved towns and had two children.  Angela is very smart and studied all sorts of actually useful stuff at university, like criminology and psychology, not just nerd stuff like me.

Not too long after getting married, I received the call (from God!) to become a minister.  I’ve done a theology degree, part-time, and finished that in 2017.


So we got our belongings loaded in a container, hopped on the ferry, and headed to the mainland.


I’m now the ministry intern, sole charge, at Point Presbyterian in Pleasant Point (pop 1,300) in rural South Canterbury.

I’ve got the next two years to work out what that means.  There’s lots of work to be done.  Leading worship, preaching, visiting, organising.  But there’s something more.

I look out my window and see people who need God in their lives.  And a community that needs the salt and light of Christians, the healing touch of Jesus, and a solid, thriving local church.

This is a part of the world that still knows how to do community.  They’ll all come out for working bees on the steam rail museum.  The local towns still have proper A&P shows.

But the town has 1,300 people.  I’d hazard a guess that no more than 5% go to church in Point, some make the trek into Timaru, and of course most won’t go to church at all.

So what’s missing?  What are we doing wrong?  Are we so caught up in doing “church” together that we’ve let our gaze drift downwards and forgotten that an open door is only half the story?


Time for a lot more prayer, and a lot more listening.


A tale of two sensors

We’ve got a cheap monitored alarm at home, similar to what you get if you search for “GSM alarm” on AliExpress or eBay. It’s got two wireless PIR sensors, and a few door/window sensors.

I had a project in mind that required listening in on the PIR sensors to detect when they saw movement.  I’d got a shiny new RTL-SDR dongle, and a small amount of investigation demonstrated that the PIR sensors used On/Off keying (OOK) at 433MHz.  But how to decode their transmissions?

On/Off keying is a simple scheme where either you transmit a carrier, or don’t.  Amplitude modulation with two amplitudes, one of which is zero.  It’s easy to see as a stream of binary pulses.

I bought a small pile of 433MHz OOK recievers and transmitters.  I settled on the SYN470R receiver as various blog posts / etc suggested it had the best performance.

DSO Nano, Arduino, SYN470RIn my fabulous garage full of junk, hidden away in a component drawer, I found my old DSO Nano. I rigged this up to the SYN470R, and could see a stream of binary pulses.  Unfortunately, they were very noisy.  It turns out the 433MHz OOK receivers have an automatic gain control (AGC) so when nothing is transmitting, the gain gets turned up and you see lots of noise.

I was looking for a nice regularly clocked signal.  How would I find it?

I wrote a dumb arduino app to measure each pulse, and dump this out the serial port.  It produced a series of lines with the length of each mark and space in microseconds.  I wrote a python app to analyse this and look for sequences of pulses where the mark and space widths tended to be from a small set of widths.

detected signalsI have never had to write a graphical python app before.  I looked at the documentation and decided that if the only graphics library that let me easily draw a few lines was “turtle graphics”, that’s what I’d use.

It worked!  I could see some clear, repeated sequences of pulses.  But Turtle Graphics failed me at this point: there was no way to let me detect the mouse was over a pulse train and display some information about it.

At this point I remembered that Linux had a graphics library, aimed at games, called SDL, and this would probably do what I wanted: drawline, fillrect, where is the mouse?

PIR signal with PySDL2I rewrote the analysis-display app to use pysdl2.  The mouseover code wrote a set of pulse lengths to standard output.  Eyeballing this showed that the pulses were all (approximately) a multiple of 400µs. Having discovered that the pulses were all a multiple of 400µs long, wrote a discriminator function that would tell me if a pulse looked like a multiple of 400µs, and showed sets of 5 or more pulses that the discriminator said had signal.  The mouseover code was rewritten to display the pulses as “number of 400µs units high” and “number of 400µs units low”.

I quickly saw the pattern: 4000µs (10 units) low, then 36 1200µs (3 unit) symbols, which were either low for 400µs and high for 800µs (I’ve guessed this is a “1”), or low for 800µs and high for 400µs (a 0?).  In other words, signal is low for 400µs, either low or high for 400µs, then high for 400µs.  I modified the visualisation program to decode these pulses, and this is what my sensors send:

Sensor 1: 011110111101001111010000101110110000
Sensor 2: 011110111100110111110000101110111101

This is not the end.  The sensors don’t just send “I see you” events.  They can also send tamper-detect events, and either low battery events or general keepalive events.  Now that I’ve got a signal detection function that doesn’t take masses of CPU time, I can put the receiver in a cupboard and run it for 24 hours to see what other signals are around.  To capture tamper-detect, I have to do this while everyone’s out.  My two year old son does not like the sound of the alarm going off.

Some of you will read this and say “Why don’t you try the RC-Switch library?”  Part way through, I thought “I’ll try RC-Switch” but it doesn’t decode the signals from my alarm’s PIR sensors.  It does decode the signal from another cheap PIR sensor I bought off eBay, though.  I intend to roll my decode login into RC-Switch and submit a pull request soon.

{ Add a Comment }


I started teaching an eleven year old to program with an Arduino last night.  After an hour we had the light on the board flashing in different patterns.  Seeing the lights turn on in his head, and the raw excitement as we changed the program and watched the results of the changes was too amazing for words.

Also, I met the Mayor (again) and Chester Burrows, our local MP.  He’s really friendly, and we had a good conversation.

{ Add a Comment }

The Twitface Diet

Hi. My name is Donald. And I spend too much time staring at my phone.

Bad habits are easy to form. Social media and its constant temptation of more vaguely interesting things to read is like Exterm-an-ant for presence, concentration, and actually getting things done.  Just like my favourite ant killer, sold at Farmlands,1 they draw you away from your path, providing you with something that smells yummy but is ultimately death.2

Back when I was a student writing up a thesis I realised that I spent too much time reading Slashdot.3 So I modified my web browser configuration, via the under-appreciated proxy autoconfiguration system, to not let me visit Slashdot at all. So when my code (or thesis) was compiling, I’d reflexively switch to my browser and type and … it wouldn’t work, and I’d remember that I was supposed to have finished writing up several months ago and my enrolment had lapsed but the university hadn’t noticed that I still had an office and I should really get back to that thesis.

This seems trickier to do with mobile phones. I deleted the Facebook (good riddance!) and Twitter (moderate riddance!) apps about a year ago. And immediately shifted to just using them via the web browser instead. I didn’t spend any less time at either site.  In fact, due to such wonderful misfeatures as Twitter’s sending you back to the latest tweet when your page was reformatted due to turning the cellphone around, I probably spent more.

I’d love to ditch the smartphone entirely. Now that I work from home, I don’t need to listen to music or read things on my phone while commuting. Ironically, the one killer app for me owning a smartphone over a cheap feature phone is the budgeting app we use, GoodBudget. It’s like an “envelope system” – you allocate weekly expenditure to different categories – except that you don’t have to deal with cash. And it’s only available for Android and iPhone.

So I’m stuck with keeping the smartphone, yet not using Facebook and Twitter.  I’ve demonstrated that I will jump small hurdles to keep using them.  So I’m trying a two-pronged approach.

Unfollow people I don’t have a very good reason to follow

I follow a lot of people on Twitter. Some of them say interesting things occasionally. Some say interesting things often. Some are close friends. Some are colleagues or ex-colleagues. Some are local. Some are far away.

That’s a lot of people. If my Twitter use has any purpose at all, it seems to be to collect potentially interesting people so I can spend lots of my time reading what they write or link to.

That purpose has to change, or I have to drop off Twitter entirely. So I will enact a new following policy: I will only follow you if

  • I know you OR
  • I’d like to know you and there’s actually some chance of that happening OR
  • You’re local (which is really a special case of the above) OR
  • You’re the Pope, John Darnielle or Brian Zahnd.

The Pope’s pretty quiet on Twitter (clearly prefers quality over quantity). I absolutely must know if there’s a new Mountain Goats album (or book) out. And I still mean to read A Farewell to Mars.

Remind myself to stop using the darn things

I’m not an idiot. Surely I should be able to remind myself that I don’t want to spend much of my day staring at small rectangle. I have several half-finished books to read, after all.

If you see less of me online, this is why.  If you want a quick response I recommend calling me; if you don’t mind, I hear email was quite popular before Facebook messages reared their ugly head.  Please don’t be offended if I unfollow or unfriend you.  It’s not that I don’t like you.  It’s just that I’m trying to opt out of social media as low grade habitual entertainment. I’ll still buy you a coffee if you’re in my neck of the woods, and you are welcome to hold me to this promise.

  1. The last time I went to Farmlands the lady asked if I had an account with them. I was wearing a straw hat…
  2. To presence et al
  3. A then-popular tech news site. I have a four digit UID. If that means nothing to you, either you are young or your geek creds are a little tarnished.

{ Add a Comment }

From the archives: SWANS and the WiPhone

[note to readers: the pictures of the WiPhone are from the archives but the text is new]

I’m a nerd.

I’ve been a nerd for a long time. I feel that the label “geek” has been taken up as a banner by a bunch of Johnny-come-latelies. No one ever called me a geek at high school, and I was by no means even remotely cool.

Some people asked if I could dig up from my archives pictures of the WiFi VoIP phone I built back in … er, mid 2004.  This ran on the Interface club’s wireless network at Victoria University.

SWANS. as it was known, was the first “student-usable” BYOD wireless network at any tertiary institution in Wellington.  It was built out of bits scrounged from the Computer Science systems people (thanks, Mark Davies!) and some fortuitous buys from TradeMe.  The access points were either old laptops or old PowerMacs, rescued from being used as monitor stands in the dungeons in the ground floor of the Cotton building.  I put Linux on them, found Prism2-based cards supported by HostAP, and plugged them in.  As no one would give us a VLAN, we used a tool called vtun to tunnel Ethernet frames over UDP/IP, over the University network.  We had coverage in the second floor of Cotton, where the computer science labs were, and in the Quad.

Through the Software Engineering Research Group (ELVIS), I knew Brenda Chawner who had an office overlooking the quad.  We eventually got ITS to give us another live network port there.  An old laptop with a broken screen from the computer science department sat on her windowsill, offering internet access to Interface club members.

The WiPhone itself was a bodge-job.  I used a Linksys WRT54G, all the rage among the hacky-stuff-with-wifi community at the time, to connect to SWANS, and to CafeNet downtown. I put a rather heavy 12V SLA battery in my backpack to power it.  Then I used a Sipura SPA-200 VoIP adapter to plug in a cheap Warehouse headset phone.

The Spiura needed 5V, so Chris Andreae lent me a 5V regulator which I used to provide the right voltage. Back then, no one had stacks of spare switch-mode DC-DC converters in their junk drawers, so we used a linear regulator which turned the excess energy into heat.  The photos below, taken downtown when I was using Citylink’s relatively new CafeNet WiFi service, show the regulator hanging out of the back of my backpack.  This was because it was getting so hot in the bag I was worried that either the bag would melt or catch fire.



The irony in all of this is that I didn’t make many phone calls in those days and really had to scratch around to find some people to call. There’s not much conversation in “Hi, I just wanted to call you to try out this new mobile phone I made.”

{ Add a Comment }

World famous in Whanganui

The front page of the local newchronicle_front_pagespaper featured yours truly today.

Whanganui really does have good internet.  According to the article itself, the UFB rollout will be complete by the end of the year.  Fibre is much better than copper ADSL or VDSL, mostly because it’s reliable.  xDSL technologies are all designed to squeeze something out of the old copper network that it was never designed to do.  They play a whole bunch of tricks, but at the end of the day they’re at the mercy of the length, and quality, of the long thin bit of metal between you and the exchange or local cabinet.

Truth be told, this isn’t too bad in most of NZ.  Chorus has done a wonderful job of putting fibre-fed cabinets near houses, so the bit of copper may not have to be very long at all.  But it’s still a variable it would be better not to have.  Some houses are closer and can get VDSL; some are further away and can’t.  Some are out in the sticks and connected via a Conklin, and we weep for them.

There is a limit to what we can get out of copper, no matter what we plug into the ends of it.  Fibre will have limits too, but they’re much, much higher.  Putting it in the streets is expensive, but will only have to be done once.

I spend a lot of time using Google Hangouts for videoconferencing, and uploading large files to our servers.  The 10Mbps upstream of even the cheapest fibre connection makes this much more bearable.

* * *

Whanganui has much more to offer than fast internet.  It’s actually a nice city.  It has lots of tree-lined streets.  The river is beautiful, as are the parks.  The Bason Reserve has lots of free barbecues if you want a day out in the sun.  Michael Laws is no longer the mayor.  Crime is low.  People here don’t know how good they’ve got it — they complain about crime, and about the poorer suburbs.  But our contents insurance is cheaper here than it was in Wellington.  I asked why, and the lady on the phone said “Lower crime.”

Castlecliff, the “bad” suburb, is noticeably nicer than Wainuiomata or Cannons Creek.  And it’s right beside the beach.  We actually looked at buying a cheap house in Wainuiomata until I went to look at a few, and went to the mall, and saw how far downhill the area was sliding.  The problem with Castlecliff is the locals don’t like it, so if you buy a house there, you’ll take a long time to sell it.  We’ve settled in Tawhero, which isn’t exactly flash, but is close to town, the hospital and SH3.  Not that anywhere in Whanganui is very far from the centre of town.  We have a quarter acre, established fruit trees, and lawn for Africa.  Whanganui has the most affordable housing in the country according to the NZ Herald.  Our house cost under $200,000.

We have an opera house.  There are actual operas you can go to, the Royal NZ Ballet perform there, and the local Amateur Dramatics society, started in the 19th century, just put on the Broadway musical version of Young Frankenstein.  It was hilarious.  We saw Wheel of Experience here a month or two ago, and they were awesome.  Now we just need to persuade Tom Rodwell to make a visit, and maybe John Darnielle.  Well, I can dream.

* * *

We came here for family, for our long term plans, and this was enabled by my employer allowing me to work remotely.  Neither of us regret the move.  The fibre is great, but so are the grapefruit from the tree in our garden, the grandparents down the road, and the squeals of delight from my daughter as she chases the ducks by Virginia Lake.

{ Add a Comment }

Silly Songs: Shampoo

I often sing silly songs to my daughter.  One of her favourites is the “Shampoo” song.  I think the silly song makes shampooing an eagerly anticipated event, even if she does sometimes end up with shampoo-y water in her eyes when it gets rinsed out.

Shampoo, shampoo
It’s much better than real poo
Shampoo, shampoo
Let’s put some in your hair


{ Add a Comment }

I’m back!

The last time I had a blog at this address was a few years ago.  In typical Donald fashion, I probably spent more time writing the software that powered the blog, than writing blog posts themselves.  I may publish a few from the archives when there’s a lull.  I’m sure you’d all love to know who made the best custard squares in Wellington in early 2009.

I’ve just finished CHTX204, “New Zealand Christianity,” part of the theology degree I am working my way through.  So I have some weekday afternoons free for a few weeks.  I’m still undecided as to if I will take a course in the second half because in late July our second child is scheduled to show up.

My current project that hasn’t really started yet is to put a roof over the area where we store our firewood.  It turns out that tarpaulins are great at trapping moisture in, which is a bit of a problem when you were hoping that your firewood would dry out.

This is what the inside of my Kinesis keyboard looks like.  Chris gave me one of his “why, of course I want to write my own keyboard firmware” boards.  Unfortunately it seems to be a bit flakey; I’ve just had to open it up (hence the picture) and give it a clean and check the connections.  The flakiness may just be due to its spending most of the last six months in a damp garage.  My other Kinesis has had similar treatment, but I need to spend some time improving the debouncing logic.


Update: the keyboard is fixed!  It turns out the wires from the connector on the 8051-replacement board (brown/copper in the picture above) to the USB cable were failing.  Replaced them and the keyboard no longer resets every 30 seconds!