Arduino GPS

Just to get my hands dirty and wrap it up with the AVR’s, I created a GPS data logger – using an Arduino board, GPS receiver chip, 4×20 LCD, and a uALFAT microSD board.

A good document on NMEA commands and data formats used by GPS chips is here. Regarding the GPS unit, it was SiRF vs Trimble, and I went for SiRF, the SiRF III (the EM-406A by USGlobalSat). I picked it over the Trimble Lassen IQ and the Parallax.

Great learning exercise for getting down to the bare-metal. I decided to write it in raw C (UART driver, LCD driver, flash data logger,…), all from scratch, instead of Arduino’s Wiring language. This amounts to pretty much reading most of the 300 page data sheet for the MCU, giving you a thorough understanding of all aspects of the MCU – GPIO, clocks, counters, interrupts, UART, SPI, I2C,… all related considerations like registers, masks, timings, memory organization,…

Arduino LCD

My first step, in my foray into embedded systems: interfaced a 4×20 character LCD panel to the Arduino. Details on interfacing any Hitachi HD44780 based LCD panel can be found here.

Went for the default parallel LCD’s. They’re cheap, about $15 for a 20×4 panel on eBay (HD44780). The serial ones cost about 2-3 more. These LCD panels allow you to use 4 data lines (with some bit-banging) instead of 8. Get one that is STN and transflective (vs reflective and transmissive), known for better contrast and brighter.

Check out also LCDProc.

The Arduino

Just got it today :-). The Arduino is a great learning platform for anyone interested in the embedded world. The entire platform is open (hardware schematics, bootloader, lots of examples, etc.).

Comes with a programming language that abstracts out lot of the bit-level stuff… but for learning purposes I’d recommend just using straight C – i.e. to get right down to the bare metal. You’ll probably end up reading two-thirds of the 350 page ATmega168 specs. Atmel’s AVR docs are really well done, with assembly language and bit-level C-language code snippets. Ubuntu has a ready-made GNU C toolchain for the AVR which works quiet well. There is also an Eclipse plugin.

Also, check this site out: Atmel AVR Application Notes. Tons of stuff. You don’t really need to buy any embedded systems books. Also Atmel AVR 8-bit Instruction Set.

ATmega128

The Atmel ATmega128 AVR is a nice little full featured general purpose 8-bit MCU (i.e. not including MCUs which add on a host of other features like controllers for LCD, USB, Ethernet MAC, DSP, MMU, etc.).

For my own quick reference:

Feature ATmega128 ATmega168 ATmega8
Flash 128K 16K 8K
SRAM 4K 1K
512
EEPROM 4K 1K
512
UART 2 1
1
8-bit Timer 2 2
2
16-bit Timer 2 1
1
PWM (channels) 6+2 5
3
10-bit A/D (channels)
8 6
8
DebugWire/OCD Y

Analog Y

JTAG Y

SPI 1 1
1
TWI 1 1
1