Category Archives: Microcontrollers

Quick and Dirty D to A on the AVR: A timer tutorial

So you’ve got a microcontroller and you want to use it to control something analog. That’s a common task, and a number of good solutions exist, depending on exactly what you need to do.
Most microcontrollers do not include built-in digital-to-analog conversion (DAC) hardware, and external converters cost money. There is, however, a quick, easy, and cheap little trick of a solution that can be played by averaging a digital output.
This is a short tutorial on making useful (but crude) analog output signals with a low-cost microcontroller. The analog signals will be made by averaging a digital pulse width modulation (PWM) output from one of the counter/timer units in the microcontroller, and do not require any dedicated digital to analog conversion hardware. We will first introduce some aspects of the counter/timer and discuss how it can be used to generate the pulse width modulation signal. After that, we’ll implement the scheme on an AVR microcontroller and use it to make a simple and slow little function generator circuit.

Continue reading Quick and Dirty D to A on the AVR: A timer tutorial

LabVIEW routines for the MAKE Controller

MakeController

As evidenced by a growing collection of projects, the MAKE Controller has great potential as a hardware platform enabling computers to really do things.

We won a MAKE Controller for our set of Halloween projects this year, and we’re just starting to play around with it. Having spent some pondering how best to communicate with the board, it’s clear that one of the barriers to more widespread use of this and other embedded systems is the lack, or perceived lack at least, of user-friendly software for programming and communication.

A number of open-source software packages, such as processing and Ruby, can communicate with the MAKE Controller using its OSC interface. However, there has been a noticeable absence of a suitable interface to LabVIEW, a program that is commonly used for interfacing to other similar types of hardware.

So, we wrote one. It’s a simple LabVIEW “vi” routine for issuing (most) simple commands and queries to the MAKE controller. We’ve also included some example routines to help you get your blinky lights going a few minutes sooner.
Continue reading LabVIEW routines for the MAKE Controller

Fixing a bad frequency fuse bit on an AVR

ATtiny2313

This is a quick note on AVR programming with the AVRISP MkII programmer, with which it is possible to foul up your clock fuse bits. =)

(This might be plain as day to some out there, but *I* didn’t know about it, so I thought I’d jot it down.)

Minor problem: I was programming some AVRs when I thought I might try to change the clock fuse bits to use one of the low-frequency internal oscillators. Apparently, it is possible to change the clock frequency low enough that the ISP interface can no longer program the flash– at which point it *seems* as though the chip is lost. These are inexpensive chips, (around $2 each), but the cost can add up quickly if you don’t fix the broken ones. Besides, they’re made of plastic, so you can’t even recycle them into a trivet.
Continue reading Fixing a bad frequency fuse bit on an AVR

Programming the Atmel ATtiny2313 in Mac OS X

avrdevboard

For a recent project, I needed to control sixteen or seventeen LEDs with a microprocessor. The one that I chose was the Atmel ATtiny2313, because it has 20 pins, with up to eighteen outputs, can run without an external oscillator, and is fairly inexpensive at around $2.00 per piece.

Since I’ve got a Mac laptop and no real serial or parallel port, I opted to go with a USB-based programming solution. Furthermore, I wanted to program in C, not assembler, and use open source development tools. Since I was (eventually) successful in all of these goals, I thought that I should write up a few notes about it.
Continue reading Programming the Atmel ATtiny2313 in Mac OS X