3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

The Raven, high-pitched torture

Step 3Program

Program
Once you have put the circuit together you need to program the microcontroller with the attached program. Because build environments can vary wildly based on you choice of operating system, programmer, and software, I won't get into setting that up here (For some help, you might want to check out Ladyada's page on this topic). For the purposes of this tutorial I'll assume you are using the same sort of setup in the above link, the USBtinyISP programmer, and a linux (or unix-like) operating system. If you are using a different setup (especially if you are using a different programmer) you will likely have to edit the Makefile (again, too much to get into here, try reading the comments in the file).

Once you have everything set up, and the programmer attached, it's time to program. I have found that the speaker can't be attached while programming, so you should unhook that for this step. It is also very important that the crystal be attached (along with the 2 18 pF capacitors), as it will become necessary after burning the fuses.

DO NOT perform the next step (burn-fuse) if you are not using the crystal, once you do the AVR will require a crystal to operate. If you burn the fuses and you don't have a crystal your out of luck until you can get one.

Now, we need to burn the AVR's fuses (see a tutorial on AVR's for more information, and the above warning). To do so, run this command from within the same directory you have the files: main.c and Makefile.

make burn-fuse

If you are programming this thing some other way, the fuse values are:
lfuse: 0xFD
hfuse: 0xDF

Next run the next two commands to compile the program and program the AVR:
make
make program

If you want you can run this command to clean up the excesses files that were created by the make command:
make clean

And there you go! Hopefully there weren't any errors and your AVR is programmed and ready to go. By default the AVR will wait for 15 minutes before doing it's thing, then beep for 1 second every 10 minutes for an hour. The beep frequency will be 17 KHz (quite high pitched). Check out the main.c file for more information and to change these values. I made sure to add lots of comments.
« Previous StepDownload PDFView All StepsNext Step »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
6
Followers
4
Author:Hungry_Myst