Archive for June, 2011
Backcountry Logger v1 Demo
The Backcountry Logger is a portable microcontroller-driven device that collects temperature, air pressure, and altitude data, and shows graphs on a built-in screen. It’s intended for hikers, climbers, skiers, and other outdoorsy folks who want to geek out with environmenal data about their activities.
I’ve written extensively already about the design and board layout of the Backcountry Logger, but never described its actual usage in any detail until now. I’d been waiting until I received the custom-designed board back from the PCB house, so I could move the project off the protoboard and onto a permanent frame. The board finally arrived a few days ago, and I had everything assembled after about an hour of soldering. It all worked flawlessly right away, so the transition from protoboard to PCB was very smooth.
The logger interface is organized as 16 different screens, and the user cycles through the list of screens using the PREV and NEXT buttons. Each screen displays status text or a graph of historical data. Most screens also have a menu that can be opened with the SELECT button, providing access to further customization and configuration options. Screens are grouped into altitude, temperature, and air pressure sections, with each section having historical graphs at time scales ranging between past 90 minutes to past 14 days.
The main screen shows a customizable summary of environmental data. By default it displays current altitude and temperature, rate of ascent, and time of day, but the contents are fully customizable from the menu. Each of the screen’s six lines can be configured to show one of eleven different statistics, such as weather forecast, current air pressure, and estimated time to a previously-set goal altitude.
One of my first tests was to take the logger up a nearby hill. Here you can see the 90-minute altitude graph from the test. The graph only goes back about 30 minutes, to the time when I inserted the battery and data collection began. The graph begins with a big spike down to about 300 feet when I calibrated the altitude. I then got in my car, and drove up a hill that’s about 470 feet according to the topo map. At this scale, each pixel on the X-axis reperesents one minute.
Here’s the 90-minute temperature graph from the same test. It was a hot day, and my car had been sitting out in the sun, so the interior of the car was sweltering. How sweltering? About 112F, according to the logger. Yikes!
The system screen contains lots of goodies like the firmware version number, current battery voltage, and LCD contrast setting. The system settings can all be edited via the screen’s menu.
This version of the Backcountry Logger is about 7 cm long, 4.5 cm wide, 2 cm tall, and weighs 1.3 ounces. It uses a 3V CR2032 battery, unregulated. The current consumption is about 1.5 mA when it’s on, and 20 uA when it’s asleep. Depending on how much it’s used, the battery life should be about 8-12 months.
The main board has only one IC: an ATmega328P. The rest of the space is consumed by the battery, piezo speaker, buttons, a few passive components, and headers. The LCD and BMP085 pressure/temperature sensor are mounted on breakout boards that plug into the headers.
I’m planning to make a version 3 of the Backcountry Logger that’s substantially smaller and lighter. (Don’t ask what happened to version 2.) This version will be just 5 x 3 cm, and will use a tiny OLED screen that’s higher-resolution than the LCD but physically much smaller. All the parts in version 3 will be surface mount, instead of this version’s through-hole parts. Because the OLED requires more current than the LCD, version 3 will use a single AAA battery with a voltage booster in place of the CR2032 battery. Check back in a few weeks, and I hope to have a version 3 demo to share.
Backcountry Logger v1 PCB
Hooray, the v1 Backcountry Logger boards have arrived from the PCB manufacturer! This time I used Dorkbot PDX, and the elapsed time from the ordering cutoff date to board delivery was only 12 calendar days. For $5 per square inch, with three copies of your board, and free shipping in the USA, I call that a pretty good deal.
The boards have dark purple soldermask, with gold plating. The quality looks good. When I received them, the boards originally had several small tabs around the edges from the panelization process. These were easily broken off with a pair of pliers, but you can still see some slight rough spots on the edges where the tabs were.
Before I even begin to stuff the board with components, let’s count all the mistakes I already see. You can’t learn without making mistakes, and I sure made a few here.
- silkscreen layers– I delivered an Eagle .brd file for manufacturing, and I thought the silkscreen would include only the contents of Eagle’s tPlace layer. Instead, both the tPlace and tNames layers appear on the silkscreen, which results in a lot of unintended and overlapping silkscreen labels. Next time I’ll deliver individual Gerber files instead of the .brd file, so I can be sure what it will look like.
- silkscreen on pads – You can’t just run silkscreen text right across the pads… what was I thinking? Wherever text overlaps a pad, the text disappears. This makes the text on the bottom side with my name and date very difficult to read..
- text proofreading – The date text says “May 21, 2111”. It’s from the future!
- no ground plane – I forgot to include a ground plane. Fortunately with this simple, low-speed design it’s probably OK without one, but its omission was not intentional.
- untented vias – I meant to tent the vias (cover them with soldermask), but I forgot. With tented vias, they wouldn’t stand out so much, and text running on top of vias would be much more legible.
- narrow pad holes – Some of the pads have what appear to be very narrow holes. It’s tough to see in the photo, but the holes for the ATmega and the capacitors are substantially narrower than all the others. Of course the hole sizes comes from the part footprints, which I just took from the Eagle library, but it’s my fault for not checking them. I did a quick test fit, and I think everything will still be OK with the narrow holes, but it’s tight.
- insufficient part clearance – I kind of assumed that parts would exactly match their outlines in the library, but a few are bigger. The battery holder in particular is a bit bigger than its outline, enough so that it partly blocks the power jumper (right-center), and bypass capacitor next to the ATmega.
- mounting holes too big – The four mounting holes in the corners are bigger and closer to the edges than I intended. The footprint for the hole is two concentric circles, and I’d thought the inner circle was the hole itself and the outer circle was the screw head for the matching screw. Instead, the outer circle is the hole itself, and I don’t know what the inner circle is.
- soldermask on pads – The two resistors both have soldermask covering their top-side pads. If you look closely, you can see that the 1K resistor at top-right, and 510 Ohm resistor at the bottom-middle don’t have visible pads. They’re there, but covered. Fortunately the bottom side of the pads aren’t covered, and that’s the solder side, so it’s OK. I checked Eagle, and this is how the Sparkfun axial PTH resistor footprint is designed, so it’s intentional. I can’t imagine why though– it seems like a bad idea.
Now it’s time to put this thing together. Soldering iron, here we go!
Read 6 comments and join the conversationShrinking the Backcountry Logger
Shrinking a design as far as possible can be an addictive hobby. Even though PCBs for the first backcountry logger design aren’t yet back from the board house, I’ve been busy working on a revised version that’s just 1.9 x 1.1 inches (49 x 28 mm). That’s about the size of 3 AAA batteries laid side-by-side. It’s small!
If you’re just tuning in, the backcountry logger concept is a portable ATmega-powered device that collects temperature, air pressure, and altitude data, and shows graphs on a built-in LCD screen. It’s intended for hikers, climbers, and other outdoorsy folks who want to know if it was colder last night than three nights ago, whether the ridge they’re on is the 10200′ or 10600′ one from the map, or whether a storm is likely soon. Much attention has been giving to minimizing power consumption, so the battery should last many months.
Here’s the original logger design. It’s 2.75 x 1.8 inches, and uses all through-hole parts. The LCD is a Nokia 5110 on a breakout board, mounted onto the main board with an 8-pin 0.1 inch header, and covering the upper two-thirds of the main board. Similarly, the Bosch BMP085 temperature and pressure sensor is on a second breakout, mounted with a 6-pin 0.1 inch header and covering the lower-left corner of the main board. The battery is a CR2032 coin cell, and projected battery life is 8-12 months.
While the new design is functionally similar to the original, it replaces virtually every component with a smaller SMD version. It also drops the breakout boards, soldering the components directly to the main board instead. The LCD is replaced by a 128 x 64 OLED, which is physically smaller but has a higher resolution. To meet the higher power demands of the OLED, the coin cell is replaced by a single AAA cell and a 3.3V boost regulator. The addition of an external EEPROM provides space for higher resolution or longer-term data storage than is possible with the ATmega’s built-in EEPROM. And as a last-minute addition, the new design also adds a SignalQuest SQ-SEN-200 omnidirectional tilt and vibration sensor, which I hope to use to measure periods of movement to compile trip duration stats. Projected battery life is about 5 months.
The majority of the top layer is covered by the OLED itself, leaving precious little space for component placement. It’s just the three tactile switches, boost regulator IC, and a couple of capacitors. The tactile switches are the thinnest I could find (2.6 mm), so as not to add too much to the overall thickness of the logger. I would have dearly loved to use the user-friendly switches with the 12mm base, but there simply wasn’t enough room. Instead, the switches here are the 6mm base type with a 3mm round button. A single drill hole in the top-left corner provides an option to wear the logger on a lanyard or keychain.
The bottom layer is were most of the action is. The ribbon connector from the OLED wraps around the bottom of the board, and its 30 pins are soldered at bottom-center. The AAA battery spans the bottom third of the board, lying on top of the ribbon connector. Down the left side are the ISP header, external EEPROM, and BMP085 sensor. The right side is occupied by an inductor, diode, and capacitor required by the boost regulator. Squeezed into the center is the ATmega 328 in TQFP package, a tiny speaker, 32 kHz crystal, and the SQ-SEN-200 vibration sensor. The SQ-SEN-200 is the barrel-shaped component at top center, and its internal switch chatters open and closed whenever it’s bumped or moved.
Cramming all these components into the space available was an interesting challenge. The resulting board is almost as small as theoretically possible, since the width is already constrained by the size of the battery, and the height could only be a few mm less before it would be shorter than the OLED screen. I plan to wait a while before sending this board for manufacturing, at least until I’ve received the boards for the original design and confirmed that everything works. All this waiting for boards is maddening!
Read 7 comments and join the conversationLow-Power LCD Smackdown
Sometimes it seems like there are a million different LCDs you might use with your microcontroller project, and deciding on one can be hard. Once you’re ready to move beyond a basic text display, you’ll find graphic displays have a dizzying number of options for technology, color depth, interface type, driver, and power. Recently I’ve been collecting info on display options for my own projects, and here I’m presenting three options that look promising.
The Nokia 5110 is a low-resolution monochrome LCD that’s cheap and extremely low-power. A family of small monochrome OLEDs provide crisp, bright displays with a bit more resolution, in a teeny-tiny package. A 1.8 inch color TFT provides even greater resolution and 18-bit color, while still limiting power to about 90 milliwatts.
Nokia 5110
Colors: monochrome
Resolution: 84 x 48
Active display area: 2.8 x 2 cm
Interface: SPI
Power: 3.3v
Current: 0.4 mA for logic, 1-10 mA for backlight
Cost: $10
Vendors: Sparkfun, Adafruit
This is the display I’m currently using for my Backcountry Logger project. It’s cheap, easy to use, and consumes very little power. You don’t really need the backlight for daytime visibility, and with backlight off, it consumes just 400 uA! Awesome for battery-powered projects. Just 1-2 mA worth of backlight current is plenty for night-time visibility too, although more would be nicer. This puts the display well within the capabilities of a single CR2032 coin cell.
Working with the display is simple, as long as you remeber it’s a 3.3v device and not 5v tolerant. There are lots of great tutorials and examples available for this display, including this nice one from Adafruit. Communication with the display controller uses SPI. Writing a single byte sets 8 pixels at a time, so pixels are not individually addressable. If you’re mostly displaying text or bitmaps this isn’t a problem, but if you need a more complex image consisting of many overlapping elements, you’ll need to composite them in software before sending the result to the display.
The weak points of the Nokia 5110 display are resolution and looks. The contrast and sharpness are pretty good for a display of this type, but there’s still no getting around the fact that this is a low-res, dark-gray on light-gray display. The 84 x 48 resolution allows for just 14 x 6 characters using a typical 5 x 7 font (allowing for space between letters). If you seek utility, low cost, and low power, it’s a great solution. If you want something with a bit more bling, look elsewhere.
SSD1306/SSD1308 OLED
Colors: monochrome
Resolution: 128 x 64
Active display area: 2.4 x 1.2 cm
Interface: SPI, I2C, or parallel
Power: 3.3v, and maybe 7-12v
Current: roughly 5-13 mA, depending on how many pixels are lit
Cost: $15-$20
Vendors: Sparkfun (bare LCD), Adafruit, eBay
This little OLED display comes in a few slightly different flavors, but all of them are tiny. It’s one thing to read the dimensions (0.96 inches horizontally), but another to see it in person. All three of the displays discussed here are small, but this particular OLED is smaller than a postage stamp. It’s about the size of the last joint on my thumb.
Despite its small size, the OLED display is very readable. It’s sharp and bright, and a pleasure to look at. Since it’s an OLED, there’s no backlight, and current draw varies between about 5 to 13 mA in my testing, depending on how many pixels are illuminated. The 128 x 64 resolution is a nice bump from the Nokia 5110 display, allowing for 21 x 8 characters. Communication choices are SPI, I2C, or parallel, selectable via configuration pins. Like the Nokia, each byte sets 8 pixels at a time. Adafruit has a tutorial and library.
The display controller chip runs at 3.3v, and the display itself needs 7-12v, although you might be able to get away with a single supply depending on which display variant you have.
Adafruit sells this display on a break-out board, with white pixels, with a SSD1306 controller. The SSD1306 has a built-in charge pump, and can optionally generate 7.5v for the display from a 3.3v supply, which is a very convenient option. Sparkfun sells the naked LCD, with white or blue pixels, and a SSD1308 controller that lacks the charge pump. You’ll need to mount the 0.5 mm pitch connector somehow, and provide a separate power supply for the logic and display. The most common eBay variant comes on a break-out board, with the SSD1306 controller, and yellow pixels in the top quarter and blue pixels in the bottom three quarters. Mine also came hard-wired to use the parallel interface, and switching to SPI required wicking away some solder jumpers and adding new ones.
This display meets a narrower range of needs, but is awesome for its target niche. I’m strongly considering doing a version 2.0 of the Backcountry Logger using this display, to gain the benefit of smaller size, higher resolution, and better looks. Unfortunately with the amount of current it needs, it’s probably outside of what a CR2032 can provide, and will require 2 x AAA or 1 x AAA with a DC boost converter.
Adafruit 1.8 inch TFT
Colors: 18-bit (262144 colors)
Resolution: 160 x 120
Active display area: 3.6 x 2.8 cm
Interface: SPI
Power: 5v or 3.3v
Current: 1 mA for logic, about 26 mA for backlight (can be dimmed)
Cost: $25
Vendors: Adafruit
This is the display I plan to use for Tiny CPU. Unlike the others, it’s a full color display with individually addressable pixels. It supports 18-bit color, but can also be configured for 16-bit color or monochrome (I think? Haven’t tried that yet). It’s a bit larger than the other two, but still quite small compared to most displays. It is natively a 3.3v device, but the Adafruit breakout board includes an LDO regulator and level-shifter chip, so it can be used with 5v microcontrollers as well. Current demands are the highest of the three displays, but not excessive at about 1 mA for logic and 26 mA for the backlight. The backlight can be dimmed using PWM to further reduce the current. This is still well within the capabilities of an AAA-based battery-powered project.
The TFT is very attractive, not quite on par with the OLED, but certainly nicer than the CSTN used in some other cheap color LCDs. The 160 x 120 resolution feels giant in comparison with the previous displays, allowing for 26 x 15 characters. The display controller allows for a few different protocols, but the break-out board hard-wires it for SPI.
With the larger resolution and greater bit depth, a screen’s worth of data requires many more bytes than the previous two displays. Depending on the speed of your microcontroller and SPI interface, this may result in noticeably slower refresh times. I tested it using hardware SPI on a 16 MHz Arduino, and found the refresh time to be acceptable.
Adafruit has a nice tutorial and library for working with this display (I’m sensing a theme here). Unexpectedly, the breakout board also has a micro-SD card reader on it. Ignore it, or use it as a bonus peripheral in your next project.
Read 6 comments and join the conversationOff To The Board House
The Tiny CPU board design is now off to the board house for manufacturing. The three week wait begins. Somewhere during that time, the Backcountry Logger boards should come back too.
I selected Seeed Studio’s Fusion PCB service, because it was by far the cheapest prototype-oriented board house for a board this size (12.4 sqin) with multiple copies. I’m a little worried, though, because the Fusion PCB CAM file for Eagle appears to have a bug. I don’t know much about what the CAM file does, other than that Eagle uses it to generate the individual Gerber files from the Eagle .brd file, and all the board houses I’m aware of provide a CAM file you’re supposed to use. Using the Fusion PCB CAM file, and viewing the resulting Gerbers in gerbv, all the drill holes were offset about 250 mils below-left relative to the other layers. You can see this in the image above: the drill holes are shown in pink, and are clearly misaligned with the top and bottom copper layers in blue and green.
Processing the same .brd with the CAM files for BatchPCB and Dorkbot PDX did not have this problem. In the end, I used the BatchPCB CAM file, and sent the resulting Gerbers to Seeed along with a note explaining what happened. Hopefully it will be fine.
After I sent the board for manufacturing, I had a nasty surprise when I went to order the parts. The particular SRAM and ROM types and packages were selected because they were cheap “closeout” deals at Jameco, my friendly neighborhood electronics supplier. I guess they weren’t kidding about them being closeouts, though, because when I returned to the Jameco web site to make a purchase, a few days after having selected those chips, they were no longer listed for sale. Doh!
I was able to find the same SRAM (an ISSI 62LV256 in SO14 package) at Digikey, but the Flash ROM (AM29LV040B in PLCC package) wasn’t available there or anywhere. Fortunately eBay saved the day, and I was able to get two for a few dollars. Lesson learned: buy the parts before you manufacture the board. Or choose more commonly-available parts instead of legacy parts on closeout.
Read 1 comment and join the conversationTiny CPU Board Design
Whew! It was a big job, but I finished the Eagle board layout for the new Tiny CPU, using the Max II CPLD. The board is about 4×3 inches, and if your monitor has a typical 72 DPI, then the image to the left is actual size. It’s clear that soldering the 100 pins on the Max II is going to be a challenge. Click the image to see a higher-resolution version of my horrible component placement and routing.
Routing all those connections was a long, difficult job. You can see I left myself lots of extra space around the CPLD to help with routing, but the space between the CPLD, RAM, and ROM is still packed to the roof with traces.
I’m happy I was able to get all the traces to fit, since part-way through the task, success looked doubtful. Unfortunately I was forced to abandon the goal of routing all unused I/O pins to an expansion header, because I simply ran out of room. I managed to route 18 I/Os to the header, but the remainder of the unused I/Os are unconnected and unusable.
I’ll probably sit on this for a day or two, giving myself a chance to remember any last-minute stuff I forgot, before sending it to a board house for manufacturing. I’ll probably go with Seeed Studio this time, since ten copies of this 8x10cm board with 50% E-Test are only $25. Having ten copies will be a big help, when I melt the first few trying to solder those nano-scale pins!
Read 11 comments and join the conversation