Friday, July 29, 2011

GPS Signal Reception

While I was working on Data Bus I ran across a few interesting behaviors in GPS signal sensitivity.

 source: geocaching.com
You may recall that Data Bus V1.0 uses a Pharos iGPS-500 GPS module, based on a SiRF StarIII chipset. I got it for under $20 through a vendor on Amazon thanks to a tip from a forum on LetsMakeRobots. First, I noticed that the closer the GPS device was to the chassis electronics, particularly the mbed microcontroller, the worse the signal reception. So I put it up on a mast about 30cm from the main electronics. Second, I discovered that whenever I placed the GPS on a small sheet of metal, signal reception increased by 5 to 10dB for all satellites in view. I am guessing that the metal acts as some sort of ground plane enhancement to the metal underneath the ceramic antenna on the module. Feel free to offer explanations in the comments. On Data Bus, I placed the module on a square sheet of tin about 4" square and consistently got really good reception: 7-9 satellites in the basement, for example. Of course the accuracy still suffered in adverse conditions. Such as, oh, I don't know... sitting on the starting line at the Sparkfun AVC?! Third, I attempted to add a CMUcam V1 with an Arduino acting as a bridge between TTL serial and I2C and whenever I turned on these devices, the GPS reception tanked. Half the satellites could no longer be seen, the other half were so weak I could hardly get a 2d lock let alone 3d. The cause? I don't know. RFI/EMI? Or dirty power supply? Haven't researched that yet. What I do know is that mounting a GPS sitting atop a 30cm mast on an 1/10th RC truck makes for some craptastic handling. Thursday, July 28, 2011 mbed.org now supports version control After beta testing, mbed.org has released version control. That is a huge step forward for the usefulness and usability of an already excellent, powerful, cloud-based IDE. I can't wait to give the new feature a try! Friday, July 22, 2011 Getting Started With ATtiny13, ATtiny85 I've been wanting to play with 8-pin AVRs for awhile and finally got around to it. Here's what's involved in downloading code to an ATtiny13, ATtiny85, and other AVR microprocessors. In this example, the ATtiny13 resides on a solderless breadboard for prototyping though you could simplify and (shameless promotion) buy my ATtiny breakout boards. :) Pinouts For In-System Programming We'll use In-System Programming (ISP), a feature on all the AVR ATtiny and ATmega MCUs (as far as I know). It's a serial protocol, but unlike RS-232, there's a clock signal along with the TX and RX signals. AVR's ISP cables have 6 pins: reset, clock (SCK), data to the chip (MOSI), data from the chip (MISO), as well as Vdd and GND. Follow the diagrams on my guide for AVRISP Pinout for 8-pin, 14-pin, 20-pin ATtiny and ATmega328P. AVR Programmers You can use Pololu's inexpensive USB AVR programmer, PGM03A, as I did. It's a great programmer and I used the older version of it for a few years before upgrading. Plug the 6-pin ribbon cable into the programmer, then use jumper wires (I use these jumpers from hacktronics.com) to connect to the ATtiny on the breadboard. Add power (the newer PGM03A has 5V/GND pins) and you're ready to start programming. I've also used a JTAG ICE MkII which is expensive but has worked very well, too. As mentioned (shameless promotion) my eeZee Tiny includes AVRISP header, caps, reset switch and pullup. Add power and start programming. Get the kit from my store on Tindie. Choosing an IDE I decided to try AVRstudio 4 for the first time and Pololu has a tutorial on using AVRstudio with their programmer. It's easy to use an AVR programmer/debugger, as you might imagine. AVRstudio has nice debug features that accelerate troubleshooting in certain circumstances. I'm currently using Eclipse with AVR plug-in as my IDE as the editor is significantly better. To use the Pololu AVR Programmer, Configure plug-in that you're using an AVRISP Mk II on whatever serial port is allocated to the programmer. Blink an LED on ATtiny The embedded programming version of hello world, as you probably know, is blinking an LED. We'll cast off the fluffy, protective blanket of Arduino and try this, AVR-style. It's not as easy, but it's not very hard either. #include <avr io.h> #include <avr interrupt.h> #include <avr sleep.h> #include <util delay.h> /** ATtiny13 hello world; blink LED on Pin 2 * * Michael Shimniok - http://www.bot-thoughts.com */ int main(int argc, char **argv) { DDRB |= _BV(3); // PB3 (pin2) as output while (1) { PORTB |= _BV(3); // turn on LED _delay_ms(500); PORTB &= ~_BV(3); // turn off LED _delay_ms(500); } } Additional Tips To avoid programming glitches, keep the ATtiny13 clock speed up (9.6MHz, maybe even disable CLKDIV8) or reduce the programming speed. The ATtiny13 is has very little flash or RAM but you'd be surprised at what you can do with it. It does have a timer with PWM modes and a multi-channel ADC. The form factor is, well, tiny, and the 8-pin AVRs are a great addition to the geek arsenal. I've been using 8-pin and 14-pin ATtinys quite a bit lately. Did this help you? If so, do me a favor and share via redit, twitter, Google+, etc. Thanks! Friday, July 1, 2011 Cheap But Excellent Batch PCB Fabrication I was reading a recent blog post on Life of Kenneth and saw a reference to DorkbotPDX batch PCB fabrication named Laen has been coordinating for some years now. It's know nown as: OSHPark.com The printed circuit boards are made in the USA, the costs are$5/sq in with no setup fee for two-layer PCB designs. Four layer boards run more but still quite affordable. You order PCBs in sets of three. And the soldermask is a nice, custom purple! ooooo....!

 Image from DorkbotPDX pcb fabrication ordering site
I've been using DorkbotPDX now OSHpark for a year or so now and have done probably a dozen printed circuit board layouts. Every one has come back with excellent quality. The silk screening is very detailed, the plating is fantastic, the soldermask are always right on. That's what you get when it's made in the USA.

 My Toshiba Camera Breakout PCB

And you get fast turnaround (in the US), usually within a couple weeks. He's now doing so much volume that he's sending 2 or more boards per week to the PCB fabrication company.

 Home DIY PCB Fabrication top, DorkbotPDX bottom
Laen reports a very low error rate of about 1 in 10,000. Can't say enough good things about this service and I often prefer to wait a few weeks and just have the board fabricated than etching my own single-layer PCB at home.
 MiniProp: Propeller breakout. QFP 0.6mm pitch
I've now gotten heavily into SMT designs. I've done PCBs with 0.5mm pitch QFP chips, 0603's, tiny 0.032" lettering (0.4" is better), SOICs, 12mil traces, etc. All the boards come back beautifully.

 ARM LPC2103 breakout PCB. QFP 0.5mm pitch
 Ultra-Micro Lost Model Alarms
 SMT version of AVRcam. QFP 0.6mm pitch