Erik's Engineering

something alliterative

These Are Not The Bugs You Are Looking For

(nb: I've been a bit snowed under with a new job, etc. I actually wrote this at least a week ago, so don't take relative date references too seriously :)

Thursday, I spent 4 hours trying to figure out what was wrong with a bit of javascript/CSS that was supposed to be typeahead options on an input box. Eventually, I gave up for the night. Before I came in the next morning, I realized it was actually that the surrounding page wasn't big enough to let the whole list show. A little extra padding/content at the bottom of my test page and suddenly Facebook let my suggestions show.

A couple weeks ago, I built up the first of a new rev of stackduinos that use SMD components for some bits. It was a minor change to the circuit, so I got cocky and soldered in the first Atmega328 chip instead of using a socket. I then spent several hours trying to figure out why I couldn't program the chip via the ISP. I'd programmed it successfully when the board was minimally populated, but then it wouldn't program again after I added all the filter caps, pullup resistors and such. I was sure I'd borked something with the filter caps or the regulator, and I meticulously desoldered and replaced all of them. It never occurred to me that the LED on pin 13 might draw too much current... the chip flashes the LED while it's being programmed and apparently the 15 or 20 mA it was drawing was too much for the USB Tiny ISP I was using to handle.

Yesterday, I made a little robot. I put an IR distance sensor on it and wanted it to stop before it slammed into walls. Unfortunately, it would stutter and not run smoothly. It would start to go, then the program would loop around and it would stop, only to start the motor again on the next iteration. I thought that when the motor switched on it drew too much juice and power to the sensor dipped, causing bad readings. Eventually, I hooked a serial port up and discovered that the sensor gave very different output when the arduino ran off battery instead of USB power.

I could go on like this forever. The details are always different, but the problem is always the same. The hardest bugs to find are the ones that aren't even close to where you're looking. Face it. If you've been looking for several minutes, chances are you'd have spotted the bug if it's there. The fact that you haven't implies that it's really not there.

So the next time you're banging your head against the wall with a really stubborn problem, trying backing up and re-examining your assumptions. You're good at finding bugs. The fact that you just can't find one THERE probably means you're looking in the wrong place entirely.

Published on 25/07/2010 at 23h18 . Tags

  • By Jason 27/07/2010 at 15h04

    Good advice! Post pics of the robot. :)


  • By errordeveloper@gmail.com 04/09/2010 at 22h38

    very interesting blog, indeed :)

    ruby and arduio ..nice bunch of examples!

    have you used rad ? ..i’d like to try it when get my arduino back ;!)


  • By Erik 22/09/2010 at 23h59

    I haven’t heard of rad. What is it?


Comment These Are Not The Bugs You Are Looking For

Trackbacks are disabled

Powered by Typo – Thème Frédéric de Villamil | Photo Glenn