views:

842

answers:

8

For someone wanting to learn the rudiments of embedded programming, what are some simple projects they could tackle?

We're talking about someone that does know the basics of electronic circuitry (resistors, capacitors, digital ICs, etc...) and can do basic soldering. An electronics hobbyist that is looking to get into embedded programming, or maybe a sophomore or junior in a EE college degree.

The platform doesn't really matter and neither does the language (it could be C or assembler or whatever). The point is to get ideas for a simple project that does something.

If there is a book covering something like that, could you post a link to it?

A: 

A simple project (akin to the Hello World) would be to make a LED chaser. You need: 6 to 10 LEDS and a simple switch.

Everytime you press the switch, the LEDs blink in a different pattern. Some pattern:
1 LED scrolling right
1 LED scrolling left
Alternating LEDs
...

This will teach you about I/O pins, how to use a timer, maybe how to use an Interrupt for the switch (or you could use polling).

Benoit
A: 

Personally, I would build a simple sound recorder. Let's you practice using the AD converter and PWM wave output. Also it would teach how to modularize the code to allow for record and playback control. Only limitation is the amount of memory, but even a 1 kB sample should be fun.

Frank Krueger
+3  A: 

The following project is for the CSC460: Real Time Operating Systems class at the University of Victoria. This project is designed to get CS students with no knowledge of embedded systems comfortable programming on micro-controllers.

Goal:

Design a sensor actuator system to control the temperature of a room. This project will teach you pulse width modulation and AD (Analogue to Digital) conversion.

Parts:

  • One 8-bit AT90USB1287 micro-controller demonstration board
  • One temperature sensor ( on board the AT90 )
  • One DC motor ( sensitive to voltages between 3.3V and 5.0V )
  • Propeller or fan blade that fits the DC motor
  • One L293D H-bridge
  • One 5V regulator

Design:

This system will use the temperature sensor of the AT90USB1287 to read the current room temperature and adjust the speed of DC motor ( with fan blade attached ). By adjusting the fan speed this with theoretically cool down the room.

The temperature sensor is already on-board the AT90USB1287 and wired to and AD port of the micro-controller. You are required to read the data sheet for this micro-controller and write code to configure and poll the temperature sensor.

The DC motor will be controlled with pulse width modulation. PWM can control the speed of an attached DC motor by varying the duty cycle of the PWM signal. For more information about PWM consult the large and detailed ( maybe a bit too much ) data sheet for the AT90USB1287.

Once you have the temperature sensor and DC motor working, you have completed this project. The L293D H-bridge and 5V regulator can be used to increase the power provided to the DC motor ( from 3.3V on-board vs to 5.0V from the H-bridge ).

Justin Tanner
+5  A: 

I purchased an Arduino recently, which is easy to get up and running. It's a small, fairly inexpensive board running an Atmega168 with the I/O broken out, power, USB, and other fun stuff. It runs native C code (as one would expect from an Atmega chip) and can be used to drive circuits through software.

coledot
+1  A: 

In my experience there is an initial learning "hump", if you will, in embedded systems that can be tough to get over, but once you do you will be disappointed if the first project you choose is very simple.

There is some initial investment in the development tools (ie. the chips and the programmer at the very minimum). Building a very simple project will not let you explore the more useful areas of the chip, hence the amount of knowledge that you will obtain will be disproportionate to the amount of resources that you invest; both in time and money.

I suggest making something more engaging than a couple of blinking LED's. The hardest part of developing for a new embedded platform, for me, is always getting the initial compilation and uploading the first program to the chip. Since this step is the same no matter how complicated or easy your first project is, I would again vote strongly in favor of embarking on a moderately complicated project right away. Something like an IR remote control comes to mind. In any case expect to invest a lot of time if you truly want to learn anything.

I would also suggest NOT going for something like a BASIC STAMP or even Arduino, since these devices wouldn't teach you the true skills needed to do embedded programming. They are more of a platform that will run your high level code. You are using a glorified version of such a platform to read this post, your PC; hardly an embedded device. On the plus side, they will save you a lot of trouble if you are not familiar with electronics.

Get an 8-bit chip made by Microchip or ATMEL, both very popular and relatively cheap to start, get a programmer and perhaps a demo board, the demo board works if you are not familiar with electronics, for one of those chips. Most importantly, read the accompanying data sheets, and try to build something moderately useful. Program in C or assembler. ATMEL is much better with compilers and support for C. In the long run you will be glad you did not waste your time learning a platform that nobody in their right mind would use for a commercial product and you will gain a better understanding of dealing with the limitations of embedded systems, since there is no better source of information than the data sheet.

Nick
A: 

There is a pretty good book on the subject called "Embedded Linux Primer" (Christopher Hallinan is the author). This book takes you though the nuts and bolts of developing software on an embedded Linux platform. Couple this with a relatively inexpensive development system and the sky's the limit.

Pick up a copy of Circuit Cellar magazine (a really good resource for embedded software and hardware) and you will find dozens of ads for little systems that should allow you to get yourself up and running quickly.

Steve Hawkins
A: 

See this answer for relevant books.

Matthew Murdoch