The Good, The Bad, The Ugly

Posted 2012.07.12 10.10 in Computers/Internet/Technology by Stephanie

So twelve or fourteen hours into playing with my custom circuit board for the ISEB-6 Mark II, and I’ve been compiling a list of the things I did well, the things I did poorly, and the things that were just plain dumb.

The Good:

  • It ‘works’, more or less. That is, the uC functions, I can upload programs to it, and it accepts and runs them.
  • The screen works. This is more than just a hardware thing, as I had tweaked the library to use hardware SPI rather than software SPI, to get about a 50% bump in speed, and this was the first test of that library mod that wasn’t on a breadboard.
  • The buttons and indicator LEDs work.
  • The LiPo charging circuitry works.

So all in all, there’s some legitimate successes there. On the other hand, there’s some oopses too. Somewhere between submitting the board for fabrication, and actually receiving the boards back, I started to realize my mistakes. Having the board and testing it, confirms some suspicions and adds new problems to the list.

Starting Over from Scratch

The Bad:

  • In design, I went with a ceramic resonator as they are cheap and easy, a single component to install, no worries about balancing capacitors and stuff. They use resonators on the official Arduino boards. Easy peasy. Except resonators are not as accurate as crystals. The original ISEB6 uses a crystal and it keeps great time even without GPS sync. The Mark II, with a resonator, has lost 22 seconds in only 8 hours. That’s looking like over a minute per day. Boooo. (GPS sync will alleviate that somewhat but still, Boooo.) (If the error is consistent I can fix it in software, but sill, Boooo.) Next time, use a crystal.
  • I shouldn’t beat myself up too much considering it’s my first design, but I realized too late that I made all the power nets too small. All my traces are 0.01 wide (0.01 what, I don’t know. Eagle does not display units.) For traces that carry a lot of current, I should have made them thicker. Worst-case scenario, I am expecting 500mA charging current to run down a 0.01-somethings wide trace. Bad. Next time, make the power traces beefier.
  • For the compass / magnetometer, I wasn’t sure if I could hand-solder the SMD part, so I also left a footprint for Sparkfun’s module. Except I made the pads way too small – they’re via-sized and would be nigh-impossible to use as through-hole pads. It’s doable, but not pretty.
  • Analog readings are all over the place. I don’t know yet if this is hardware or software related, but at the moment, analog readings are useless. There’s too much noise – from one reading to the next, the values just wander around. If it was just the temperature acting up, or just the battery voltage, I’d suspect shoddy soldering. This could be hardware (my ARef cap might be too far away, or I haven’t provided a good-enough AGround, or AVcc isn’t isolated enough, etc.) Or, it could be software. As mentioned earlier, I threw together my own Arduino variant for this and as such, it’s untested. Or rather, this is the testing. I might have overlooked something, resulting in the Arduino analogRead() function being problematic. Either way I need to figure out what’s wrong, before sending another PCB off for fabrication.

So that’s the bad. Nothing insurmountable, and perhaps none of those things on their own would result in the boards being ‘rejected’. Jury’s still out on the analog problem, but it might be fixable in software.

The Ugly:

  • When I created the Eagle footprint for Adafruit’s 128×64 OLED display, I measured it carefully when I was laying it out. It was the first part I had created in Eagle and I was very proud of it. Except. I never actually verified it was right. Duh. I should have printed it out at 1:1 and compared the actual display against the Eagle footprint. Had I done that, I’d have realized I made it a tenth of an inch too narrow, so all the pins down the right-hand side don’t line up. That totally ruined my plan to have the OLED nice and securely mounted by both rows of pins. Fatal error.
  • As this was my first Eagle board design, there’s a lot of things I didn’t know about. You know that first stage of knowledge, where you don’t know what you don’t know? So not only were my power traces too small but I didn’t even think about a ground plane / ground pour. So Ground on this board is one skinny little trace that snakes around the board, sometimes ontop, sometimes on bottom, but generally it follows a single path through the entire board. (This might be part of the Analog problem.) Maybe not fatal, but very bad error.
  • Second-guessing the OLED display. I like the OLED display. It’s physically small but 128×64 pixels allows for a lot of detail. It does use some current, and the more pixels you light up, the more current it draws. In itself that’s not a big deal, and I’ve accomodated for that in software. In ‘sleep’ mode where most of the sensors are ‘turned off’ the display only shows the time, which drops its current consumption since only a handful of pixels are lit up, compared to when it is showing all the details. Another issue though is that the OLED display, by definition, generates light. In the dark, it is lit up like a beacon. This makes me feel selfconsious, like why is my wrist lit-up? Next, while the OLED has great contrast most of the time, in direct sunlight it can be hard, or impossible, to read. And finally, the OLED has its own internal DC-DC booster as it needs 9 volts to display properly. This works fine when it works, but I’ve had a string of bad luck and had 3 of these displays die on me as the converter crapped out. Expensive and annoying. So I’m looking at alternative displays, which kind of means totally redesigning the whole gosh darn ISEB from scratch. I like the Nokia 5100 screen, it’s old school, but it’s physically very large – but with lower resolution, only 84×48 which is less than half the pixels… but it’s readable in sunlight, and has an optional backlight for night viewing.
  • Second-guessing the micro controller. This is probably the biggest (and possibly dumbest) one. The ATMega1284P is good. Lots of I/O. Lots of people use it. It’s proven. Heck I’ve even proven it works fine. My problem is, I’ve decided I don’t like the FTDI port that I’m using for communications and charging. That 6-pin port. It’s fine for at home where I have FTDI adaptors. But it’s not really ideal for use as a charger. FTDI cables / adaptors are not supposed to be used for 500mA, and they aren’t ubiquitous. So I want to put a mini-B USB plug on there, which means either I need to include an FTDI usb-serial chip, or it means I have to switch to a micro controller with onboard USB. Before I settled on the 1284P I had looked at the AT90USB1286 which is used in the Teensy++. It has more I/O lines than the 1284P, onboard USB, the same amount of Flash and EEPROM, and 8kB of SRAM which ought to be enough for anyone. But that would literally mean back to the drawing board, on all fronts. I couldn’t find anyone using it other than the Teensy, which uses some proprietary code. I don’t know if I could add a bootloader. I don’t know if I could roll my own Arduino variant core for it. It would set me back another month, and $30 or so, just to do tests to find out if I could make it work. So for the moment I’m sticking with the 1284P and trying to squeeze an FTDI chip onto the Mark III board.

So there we have it. A handful of positives, a few negatives, and a couple show-stoppers. I’m not troubled by the setbacks in terms of my own time – heck I enjoy the challenge of designing the board and routing the traces. It’s fun. I’m not troubled by the cost of doing another board run. Sure it sucks to waste money but it’s still worth it. The only thing that I know will irk me, is in between ordering new boards, and receiving them, I’ll be impatient again. Ah well. Maybe I can finish that laser attack robot I’ve been thinking about…

Leave a Comment