Instructables
 Every year the holiday season rolls around and I get stuck on what to give for my friends and family.  People always say that it's better to make the gift yourself than buy it at a store so this year I did just that.  The first displays a name or basic image when waved through the air, the second fades smoothly between two white led's (It also has a safety pin to attach it to clothes or a purse), and the third is a mood light of sorts, scrolling seamlessly between colors. All are under $15 and are easy to assemble in less than an hour.  You could also give these instructions as well as parts as a gift to someone interested in learning electronics.

Note:  A basic level of soldering is assumed.  However, unlike my previous instructable I will gloss over how to program an AVR.  I really hope that this helps people who are trying to get started in electronics.  I remember when I was there and will be happy to take any questions you may have.  Remember there are no stupid questions!  I have left it open to you to determine how you will lay out your circuit board in hopes that you will come up with a new way of displaying the simple circuits I have drawn out.  Please post pictures once you are done, I can't wait to see what you come up with!

Parts for All of the Projects
N = number of projects

xN ATTiny45 (www.digikey.com)
xN 8-pin DIP socket (RadioShack)
x 1  Large Perf Board (I got mine at RadioShack)
xN 3v Coin Cell Battery and holder (RadioShack)
x1 Programmer (I use this and the supplied makefile will be configured to use this one)
x2N Resistors, one 10 ohm and one 10k ohm (RadioShack)


Here's a picture of the three completed projects:
 
Remove these adsRemove these ads by Signing Up
1-40 of 43Next »
Build_it_Bob4 months ago

Very nice projects ...thanks for sharing .

Build_it_Bob

yachtsman8 months ago
Nice DIY project. :) Can be ATTINY45 programmed via the Arduino?
Ploopy11 months ago
Cool!
Thanks:D
where do you write the code sorry im new to AVRs
ogama8 (author)  harrypotterrocks12 months ago
I generally write in good old emacs when I'm on a *nix system, though I am partial to Sublime Text 2. Neither are IDEs.
enikka1 year ago
Hi!
First of all nice tutorial!
But I have one question, it is written in the Attiny45 datasheet that it has only 2 PWM pins, am I misunderstanding something?
Have a nice day!
ogama8 (author)  enikka1 year ago
*Note: OC stands for output compare. In the datasheet it says that the 2nd T/C has separate Output Compare Registers. This is what's really important to us. One output compare reg. gets us one easy channel of PWM.
ogama8 (author)  enikka1 year ago
Yep, that'a a little tricky. In the data sheet it says there's a Timer/Counter that has 2 PWM outputs. But, if you look right underneath that, there's the High-Speed T/C. This T/C can also do PWM on some other pins.

In general, I look at the pinout and see how many pins have a separate OC** designator, as those are the pins that can be used for PWM.
Cheers!
karonth3 years ago
Great instructable!
This evening i got the rgb scroller working with the abby version, and i got an idea for a mod.
My idea is to read a 10 k potentiometer and to select a color based on the value.
So if the potentiometer is a 10 bit value i could break the value in blocks of three that'll be the codes for the color components, and if the last bit is set it scrolls through colors.
I'm loosing some resolution there, but it's ok.
I'm just starting to work with microcontrollers and i have had experience only with arduino so far. What do you think, could this work?
Can you give me some advice on how to proceed?
ogama8 (author)  karonth3 years ago
I think this could work. If you didn't mind (relatively) low resolution you could use the number from the adc to specify where in the code you are and have the code be near the same as I have already written. Since you're good with arduino I'd try out your ideas there and then translate them into code for the attiny45.
can you give the code for writting robot
ogama8 (author)  robot13983 years ago
I'm not sure what you mean by that statement. Could you explain?
as you rote zoe with pov can you give the code to write robot with pov
ogama8 (author)  robot13983 years ago
It would look something like this:

00011111
00000101
00011010

00011111
00010001
00011111

00011111
00010101
00001010

"o" again

00000001
00011111
00000001
robot797 ogama82 years ago
lol thank you
karonth ogama83 years ago
I'm having some trouble modifying the code. If i try something like y=bright(); the hex file gets almost 10 times bigger and i get the following

>>avrdude: ERROR: address 0x1010 out of range at line 257 of new.hex

Can I use the adc value directly or am I missing something? I'd like to change the wait time with a pot so i could "freeze" a color or fast forward if i don't like it

Sorry if this is a noob question, but i haven't got much experience with microcontrollers.

Thank you!
ogama8 (author)  karonth3 years ago
I'm not sure why "y = bright();" would kill the hex file. You will need to change the bright() function so that if the pot at a certain point stops the cycle. Something like this:

char bright()
{
....
....
(just before the return statement)
while(adc <= 1); //This'll do nothing while the adc is less than 1
...


You'll need to change the "_delay_ms(y);" to "_delay_ms(bright());"
theAVRdude3 years ago
Hi ogama8, I like your intruc :) but could you please specify if in the _delay_ms(x)?
Should I put a value for the x in there? How is this sentence written. I tried both with a value of 100 and x alone.

Maybe could it be the char x = 10; that should be change?

I did recompile this twice but could not get anything except Kligon stuff!!!

Thanks a lot for your time

Eric
ogama8 (author)  theAVRdude3 years ago
Yes, char x = 10; should change. If you want the lights to go faster you'd lower the value of x, like so:

char x = 2;

char specifies the type of variable x is, and = 2 sets the value of x when it's called elsewhere. For example:

char x = 10;
.....
_delay_ms(x);

because x == 10 that means that _delay_ms(x) is the same as _delay_ms(10).

Since I have multiple instances where I'm using a _delay_ms() it makes the value easier to change.
Yes, such a great answer!! That make so much sence. Thanks a lot...
punkzter3 years ago
Is there a way to speed up the flashing on this project? So that it is more like a bike light?
ogama8 (author)  punkzter3 years ago
Yes. Lower the value of x.
Please update this post with the applicable code. The zip files which were previously hosted on a free hosting site have been deleted due to inactivity.
ogama8 (author)  Absolute_Zero3 years ago
All done.
Thanks :)
punkzter3 years ago
I built the purse light, but it does not work, I am hoping that someone can help me out. I used avrdude to flash the chip with the make.hex file. I built everything, but it doesn't turn on. I am new to these projects, so I do not know appropriate troubleshooting steps.

I did run a wire directly from the battery (+) to the 2nd pin of the chip, and one of the leds turned on. Running it to the 3rd pin turns the other on. Does this mean that the chip wasn't programmed correctly?

Thanks.
ogama8 (author)  punkzter3 years ago
Are you sure that you have the resistor from pin 1 to 8? What about the ground on the chip (pin 4)? Did you solder directly to the chip or use a socket? Could you upload a picture of both sides of the board? That'd really help.
punkzter ogama83 years ago
Yes. I rechecked those connections. Interestingly, I rebuilt the project on a breadboard with the original LEDs. It didn't work, even though I knew that the LEDs worked. Then, I tried some different LEDs and they did work. I put those back into the original circuit board (what I took a picture of) and it worked.

Do you think that you could add some information on how to compile a *.c file?
P1140443 copy.jpgP1140444 copy.jpg
ogama8 (author)  punkzter3 years ago
I'm glad it's working now.

I have no idea on how to compile a .c file on AVRDude. If you do decide to use emacs you simply press Alt-x, type compile, press enter twice and you will (hopefully (if your code is correct)) end up with a hex.
punkzter3 years ago
Also, could someone help me with the programming part of this project? I have avrdude and avrstudio installed. I do not understand how I can take the modified *.c file and convert it back into a .hex file.
punkzter3 years ago
What settings did you use to burn the fuses on the chip?

Thanks!
klarkg3 years ago
Thanks man , these are really cool , Ive got these all going now im lovin the AVRs. Your instructables are really good. The only other question I had was how to beableto read the name flasherI got it going fine dude but Icounlnt figure out how to read it . did you put it on a wheelor somthing?
ogama8 (author)  klarkg3 years ago
I took a long exposure pic in the dark. A wheel will also work. You have to move your hand from left to right. Try starting out slow and then speed up until you see it. You can't focus on it too much.
klarkg3 years ago
Wondering about the Abby varrient file you have there schematic?
ogama8 (author)  klarkg3 years ago
Ah. I forgot about that one. It's new since this was written. The Abby Variant adds a photo-resistor on pin 2. You hook one end to Vcc and the other to the second pin. You also have to hook up a 10k resistor between that pin and Gnd, too. This gets read by the AVR and turns the light off if there is enough light. I'm working on another version that automatically turns off after a pseudo-random time so it wont go all night.
klarkg4 years ago
Sorry I meant attiny45 or attiny12 ..
ogama8 (author)  klarkg4 years ago
This instructable was written for the 45. The 12 will not work any PWM application but will work for the Name Flasher. I'd change the value for "MEGA" to 12. Let me know if that doesn't work.
klarkg4 years ago
Anyone know how to change the code to use a aattiny13 instead? that would be radd!
ogama8 (author)  klarkg4 years ago
You will have to go into the make file with your text editor and change the entry for "MEGA" to 13 (I think). Sadly the attiny13 only has 2 PWM pins so you won't be able to do the color scroller *easily.* You could hook it up to some transistors etc. but then it's a real pain and it gets bigger. The purse light also won't work because it is using different pins for the PWM. I can work around these problems for you if you like but I'm on vacation and don't have access to AVR's at this time. I hope this helps!
1-40 of 43Next »