Getting started with the Atmel AVR

Published by:

AVR Chips

There are two major microcontrollers in the hobby domain, the popular PIC and Atmel’s AVR line. PICs are tried and true in both commercial and hobby implementations, but the Atmel AVR offers affordable programming solutions, a free development environment, a free assembler and a stable gcc toolkit that work across the entire AVR line.

Affordable Programmers

The AVR is well known for how simple it is to program. To start, you only need a few resistors and a parallel port. This will burn your code onto the microchip, but if you plan on pursuing larger projects you will need a more complex programmer with ISP support. This will enable the extra features and debugging support.

  1. The ultra low-cost AVR programmer uses an LPT port and a few resistors, but requires special software.
  2. A simple serial programmer for Linux uses several resistors and two LEDs. Programming is done with uisp.
  3. More complex schematics for ISP programmers that can be programmed via AVR Studio or AVR-Dude.
  4. A usb programmer that supports ISP.

AVR Programmer

A free development environment

AVR Studio is available directly from Atmel at no cost. It has an integrated simulator and programming software. However, there is only an assembler available. You will have to purchase more software for high level languages.

The gcc-toolkit

If you want to use C/C++, then the gcc-toolkit is available for the AVR, free. WinAVR comes loaded with a gcc, binutils, the avrdude programmer, simulavr, and more. On Linux, you will need to download the packages for your specific distribution or compile your own cross-compiler.

A great community

AVR Freaks is a site dedicated to the AVR line of microcontrollers. There is a large archive of tutorials and a very helpful forum.

Charging batteries with Solar energy

Published by:

Solar Panel

Depending on the application, charging batteries can be complex process. Charging methods range from constant voltage to pulsed and random charging. Once power is being delivered back into the battery, you have to know when to stop charging!

Once a battery is fully charged, the charging current has to be dissipated somehow. The result is the generation of heat and gasses both of which are bad for batteries. The essence of good charging is to be able to detect when the reconstitution of the active chemicals is complete and to stop the charging process before any damage is done.

Typically, common household batteries are charged with a current that is kept constant and relieved when the batteries reach a predetermined potential. However, solar cells typically generate a constant voltage of 0.5V and a varying current that depends on the amount of collected light. As such, a consant voltage charging model is easier to implement. I found two respectable tutorials on building your own charger:

  1. AA Battery Solar Charger
  2. Clean Power’s Solar battery project charger

The first solution uses a diode to stop the batteries from discharging when there is no sunlight. I highly reccomend including this protection. Unfortunately, neither project implements a charge limit. You have to remove the batteries and test their charge with a multimeter. A shunt regulator is the simplest way to regulate the upper limit.

Solar Charger Circuit

New Oscilloscope: Instek GDS-820C

Published by:

Instek Oscilloscope

If you know me on a more personal basis, then you know that I have been experiencing some issues with several projects/articles in the works for this site. Up until now, I did not have my own oscilloscope. Usually I am able to make due, but recently it has been making things harder than it is worth.

After some research I happened to find a deal on a new Instek GDS-820C DSO. The offer was impossible to refuse and cheaper than the GDS-805C. Besides the obvious increase in sample rate, the GDS-820C comes standard with USB and parallel ports along with the RS-232 port, but GBIP is still only an option. These digital storage options will allow me to post pretty pictures on the blog!

This oscilloscope samples at 100MSamp/sec and is capable of 150mHz operation. They claim an ‘effective’ sampling rate of 25GSamp/sec when viewing repetitive signals. In comparison, Tektronix base model samples at rates up to 1GSamp/sec.

At 150mHz it will be hard to see much if the signals are not repetitive! If you know anything about Shannon’s Sampling Theorem, the effective sampling rate makes 150mHz operation seem… possible. Without this hack, the scope would be limited to half the sampling frequency or 50mHz. I could have paid more for a Tektronix scope, but the hardware would have been limited to 40mHz, mono anyway. This will suit my needs.

Update: If you view a signal sampled at over 100MSamp/sec, then you can tell it is making due with the effective sampling rate. I am not sure if this really matters because I do not have access to signal over a MHz at the moment.

Vex Robotics Starter Kit – $179.99

Published by:

Vex Robotics Examples

The Vex Robotics Starter Kit is currently on sale cheap at If you are interested, then you better buy impulsively. Their deals last 24 hours, tops. It is exclusive to RadioShack and normally retails for $299.99. There is also a large assortment of Vex Robotics Kits & Accessories at

PC Magazine has a review along with the infamous Myth Busters. Their main gripes were a lack of accessories and motors that were geared for speed instead of power. Combined with the weight of a steel frame, this hindered a their stair climbing application.

A rich system of hardware, software, and powerful sensors, along with documentation that doesn’t skimp, makes this a terrific first experience with robotics for anyone. Well-machined. Expertly documented. Quite powerful. Tremendous fun. – From PC Magazine’s Review

Compared to other robotics kits in its class, the Vex system is capable of creating some rather large robots.

Building a Large Vex Robot

Downtime & Lag

Published by:

I’m extremely sorry about all the downtime and lag lately. Dreamhost was trying be on the cutting edge by upgrading to Ruby on Rails 1.1 last night. Unfortunately, Typo does not currently support Rails 1.1. A post in the forums brought me back online using slow CGI this morning.

The good news is that the site is back up and running. Dreamhost has also rolled back to Rails 1.0 allowing Superpositioned to speed along on FastCGI again.

Unfortunately between this fiasco and a borked Typo upgrade earlier this week, I have exhausted what little spare time I had. I promise updates soon, though. My TODO list is full of circuits and projects!

Update: As of April 4, 2006 everything should be working again. Wait.. I am getting the “Typo failed to start properly” message randomly again.

Update: A few minutes later and you should no longer be receiving that message.

The Open Automation Project

Published by:

Open Automation Robot

I am back from spring break. As of today, I should have significantly more time to dedicate to this site, unless school/real work builds up on me again.

Anyway, I just stumbled upon the Open Automation project. This ‘open source’ project has the following mission statement:

To fill the gap between the powerful mobile robot platforms typically used by researchers, and the small rug-roving robots with limited processing power that are popular with hobbyists.

The specific project goals are:

  1. Design a coherent set of modular components (hardware and software) that conform to standards (where possible), and implement the functionality of an intelligent mobile robot. Use pre-built components that are readily available where possible (and when such pre-built components are affordable).
  2. Minimize cost. It should be possible to build a robot for around the price of a PC (target: US$1,500 to $2,000). Consumer grade hardware components are to be used in preference to professional grade products.
  3. Focus on stereo vision as the primary spatial sensor to produce useful space occupancy data. Central to the success of this project is the implementation of a functioning low-cost real-time vision system. The prevalence of FireWire-enabled WebCams and mainboards makes this goal reachable from the standpoint of cost; the difficult part here is the software.

With two firewire webcams for eyes, a mini-itx brain, 4-12 sonar sensors, an I2C speech synthesizer, an LCD, the drive and chassis, and more, the bill of materials is not cheap. However, the prototype is really cute. If you want an overview of how it works, there is a block diagram of the system.

Unfortunately, the project seems to be hibernating right now, and there is not much detail on what to do when you are finished building the it. I would really love to build my own robot, but I would not know what to do with it.

Always be wary of schematics

Published by:

Ladyada has an interesting rant on her new blog. In linear circuit analysis, we tend to ignore the difference between the positive and negative inputs. However, in practice positive feedback results in a bistable circuit. (Also read up on negative feedback.)

Usually everyone ends up remembering this detail the hard the way. While designing a tape head preamplifier she was utilizing this circuit from an application note:

WTF Amplifier

After a few hours of staring at the circuit and debugging and wondering “man why the hell is this railing?” I finally look back at the datasheet and realize: oh its in positive feedback, of course its railing.

Just a reminder that the textbook (or pdf) isn’t always right!

Measuring the speed of light with Chocolate Chips

Published by:

Over the past week, I’ve been really busy with exams and projects. Trying to save time by finding the speed of light on Google, I stumbled upon an extremely interesting article on measuring the speed of light with a microwave. As any decent cook knows, microwaves do not heat evenly. In fact, this article explains their heating patterns are relative to the speed of light!

Understanding how a microwave heats

As we all know, microwaves heat using electromagnetic waves. These waves are at a frequency perfect for rotating water molecules (f = 2.5 GHz). The rotating water molecules create friction and thereby heat.

Two types of electromagnetic waves

Although there are two types of electromagnetic waves, we typically only consider traveling waves. The amplitude of the wave travels forward in position over times. The following animation demonstrates the amplitude of a wave over space and time.

Traveling Microwave

Chocolate Chips

The waves in a microwave are not traveling. If they were, it would be nearly impossible to distinguish any uneven heating patterns!

Standing waves in a microwave

The waves in a microwave oven are standing waves. These waves are stationary in space with an amplitude changing over time.

Standing Microwave

Chocolate Chips

With this demonstration, it is obvious that particular sections of the chips are heated more than others. In fact, these locations are located half of the wave’s length apart.

The physics of waves

We now know the frequency of the microwave and can presumably measure the length of the wave, but how are they related to the speed of light? Simple. Electromagnetic waves propagate through free space (like that in a microwave) at the speed of light. Therefore, their length is related directly to the speed of light by λ = c / f where λ is the wavelength, c is the speed of light, and f is the frequency of the microwave. Solving for the speed of light, c = λ * f.

Where do the chocolate chips come in?

Chocolate chips are perfect for measuring the distance between melted spots. The heat does not spread as quickly through them because they are not uniform. This means the melted spots will be smaller and you will have more time to measure before they all start to melt.


It is hard to tell from the photos, but there were distinct melting spots almost exactly 6cm apart. Remember, this is only half of the wavelength, so λ = 12cm. Plugging all the known variables into our equation, we get c = 12×10-2 * 2.5×109 = 3×108. Not bad! The true speed of light is 2.9987×108.

Notes if you replicate this experiment

  • The chocolate chips only take 20-30 seconds to melt. The longer you have them in, the bigger the melted spots will be and the less time you will have to measure.
  • This will not work in a microwave with a spinning carousel. In fact, the microwave spins to counteract these effects. Usually, you can just flip the carousel upside down to stop it from spinning. (Thanks Ryan)
  • If you plan on putting the chips back in the bag, simply refrigerate them. Freezing causes them to stick to the plate.
  • You can microwave anything that melts. (Cheese or a chocolate bar) However, chips work particularly well.

Photo gallery

BigDog: A heavy duty quadraped

Published by:

Big Dog Robot

BigDog is a quadraped robot being developed by Boston Dynamics for possible military usage. It is by far the most advanced quadraped around. The site has more mechanical details and a video! About 30 seconds into the video, he kicks BigDog and it stays balanced!

So far, BigDog has trotted at 3.3 mph, climbed a 35 degree slope and carried a 120 lb load. BigDog is being developed by Boston Dynamics with help from Foster Miller, the Jet Propulsion Laboratory, and the Harvard University Concord Field Station.Development is funded by the DARPA Defense Sciences Office.