Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

LED blinks now what? ( not a technical question)
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

LED blinks now what? ( not a technical question)

by jbisjim on Tue Nov 09, 2010 9:25 am

I entererd the world of AVR, soldered a few projects. I porgrammed some attiny 2313 chips made the leds blink.

Now what else can i build with attinys?

or

is it time to learn whats next? Is Arduino next? or is staying with Attinys for now better to prepare for what is next.
jbisjim
 
Posts: 26
Joined: Sun Oct 17, 2010 7:33 am

Re: LED blinks now what? ( not a technical question)

by robodude666 on Tue Nov 09, 2010 10:43 am

The major differences between the ATTiny and ATMega is the ATTiny is really tiny. It has less FLASH, RAM and less I/Os. If you find it is no longer enough for you, then you can get a larger chip. Having at least one Arduino around can be handy, in either case :). You'll be able to do a lot more with it than with the ATTiny, though it certainly isn't required.

Now that you've got blinking LEDs, how about trying to get them to fade via PWM? Learning how to use Timers is a very useful thing to know.
robodude666
 
Posts: 118
Joined: Sun Mar 28, 2010 12:12 am

Re: LED blinks now what? ( not a technical question)

by stinkbutt on Tue Nov 09, 2010 12:41 pm

I don't think you're really at a point where you need to upgrade to a Mega, if all you've done is make an LED blink. The 2313 should be able to make quite a few LED's blink, but there are a few broad concepts you should master before you need to move on:

1. Interrupts - Chances are the first program you wrote didn't have any interrupts, or if it did, it was implemented half-assed by polling a pin in an infinite loop. Interrupts allow you to watch for something, like a pin change, and then execute a routine once that happens asynchronously so you can go back to the main loop afterwards and not end up writing ugly, inelegant code inside of a giant while(1) loop.

2. Timers & PWM - There are several flavors of PWM in avr-gcc, but they all involve a timer that counts (mostly up) until it hits a magic number and then something happens. Sometimes you'll turn on or off a pin, sometimes you'll fire off an interrupt, sometimes you'll actually reverse the direction of counting. PWM is also how you control servos, though at a much slower rate than your AVR is going to count at, so you'll probably need to kludge something together to control a servo.

3. ADC - This let's you read non-digital voltages on a pin and will probably be fairly important if you ever want to read a sensor. However, the 2313 doesn't have ADC, as near as I can tell, so for that you'll probably need to upgrade. Or hack together a homemade ADC, which seems like a hell of a lot more work than just upgrading to an ATMEga168.
Red M&M, Blue M&M: They all wind up the same color

stinkbutt
 
Posts: 593
Joined: Wed Feb 17, 2010 2:40 am

Re: LED blinks now what? ( not a technical question)

by Entropy on Tue Nov 09, 2010 1:21 pm

jbisjim wrote:I entererd the world of AVR, soldered a few projects. I porgrammed some attiny 2313 chips made the leds blink.

Now what else can i build with attinys?

or

is it time to learn whats next? Is Arduino next? or is staying with Attinys for now better to prepare for what is next.

As to "is Arduino next" - do you mean Arduino hardware, or the Arduino development environment?

If Arduino hardware, the time to move to a MegaXX8 is "when you can't fit something into the Tiny2313", or possibly "When you need a 2313 but you can only find MegaXX8s" - Tiny2313s are often very difficult to source, they always seem to be backordered.

The Adafruit Boarduino is a great ATMega238 development/prototyping board - a lot of my projects I start with the Boarduino and then port the code down to a smaller device. For example, one of my projects (multichannel software PWM, with a sigma-delta modulator wrapped around an 8-bit PWM engine to increase bit depth while keeping the math in the "fast" ISR 8-bit) was prototyped in a Boarduino then ported to a Tiny85.

If the Arduino development environment - The Arduino development environment is a step backwards if you have the skills to use straight avr-gcc. The Arduino development environment adds a lot of abstraction layers that make the "simple stuff simple, but the hard stuff potentially impossible". At one point (this may have been fixed...) the Arduino development environment needed something like 20 clock cycles to change an output pin state.
Entropy
 
Posts: 472
Joined: Tue Jan 08, 2008 12:43 am
Location: Owego, NY USA

Re: LED blinks now what? ( not a technical question)

by stinkbutt on Tue Nov 09, 2010 1:31 pm

Yeah, I concur about Arduino. If you're already programming via avr-gcc, don't regress into Arduino programming.
Red M&M, Blue M&M: They all wind up the same color

stinkbutt
 
Posts: 593
Joined: Wed Feb 17, 2010 2:40 am

Re: LED blinks now what? ( not a technical question)

by jbisjim on Wed Nov 10, 2010 4:28 pm

I have built two larson scanners and am attempting to linking the two of them. This requires me to put new code into two chips and wire them together to make this.

Thanks for all the "you really should knows" i have been looking for more 2313 projects and they are often light blinks, light blinks faster, etc, and that alone helps me learn what the code does, but id like to try a few other 2313 projects as well. Dont get me wrong i do love a good light show.

If you know of some other 2313 projects pls insert link.

I been tying to figure out how to build this too
jbisjim
 
Posts: 26
Joined: Sun Oct 17, 2010 7:33 am

Re: LED blinks now what? ( not a technical question)

by stinkbutt on Wed Nov 10, 2010 8:21 pm

You can also try downgrading. I find it's much more fun to try to implement projects on the ATTiny13, because it's such a piece of shit! Only one timer, only 8 pins, no ADC, writing code for the '13 can be something of a challenge.

There's an even smaller chip out there, 6 pinned, (that removes one third of your I/O pins, since two pins are always VCC and GND.) Now that would be a challenge too. I forget the name of it. Oh yeah, the ATTiny4, 5, 9, and 10's.

As for your Larson Scanner project, you might consider re-implementing it using 74HC4017's. I never liked EMS's implementation of the Larson Scanner with 2313's. It struck me as overkill when logic gates could accomplish the same thing.

I don't know, it seems like this whole post I'm telling you to downgrade to crappier and crappier chips. DO THE WHOLE GODDAMN THING WITH A PAIR OF 555's! GRR!
Red M&M, Blue M&M: They all wind up the same color

stinkbutt
 
Posts: 593
Joined: Wed Feb 17, 2010 2:40 am

Re: LED blinks now what? ( not a technical question)

by jbisjim on Wed Nov 10, 2010 9:46 pm

interesting

i found a schematic that uses a MC14017B is that the same as a 74HC4017? the description is almsot the same

I see what you are saying with logic gates

dang you now ive spent the last hour researching parts on how to do it with that. [shakes fist] and its very differnt that what i have built so far.
jbisjim
 
Posts: 26
Joined: Sun Oct 17, 2010 7:33 am

Re: LED blinks now what? ( not a technical question)

by stinkbutt on Thu Nov 11, 2010 1:35 am

It's got a "4017" in it, so yeah, they're probably the same(ish) part. There are quite a few versions of many of the iconic logic parts, with similar if not identical pinouts and just differentiated by their threshold voltages, (as in VCC and GND, the hysteresis points, etc...)

I pointed you toward the 74HCXXXX series, which is the latest, and given the rise of microcontrollers, the last generation of these logic gates. They're able to operate at a fairly large range of input voltages, and have very low quiescent current, (power consumption while doing nothing.) Daisy chaining 74HC4017's is tricky, but can be done.

Here is an excellent primer on all things logic IC.

http://www.kpsec.freeuk.com/components/ic.htm

Specifically check out the links for the 4000 series (the granddaddy of them all) and the 74 series, which is the latest and greatest.

Keep in mind, however, that there's nothing you can do with these chips that you can't do with a micro, often cheaper, believe it or not. Do not deliberately infect yourself with the my obsession with using the crappiest part possible. It's a disease. Save yourself, I'm done for!
Red M&M, Blue M&M: They all wind up the same color

stinkbutt
 
Posts: 593
Joined: Wed Feb 17, 2010 2:40 am

Re: LED blinks now what? ( not a technical question)

by stinkbutt on Thu Nov 11, 2010 1:44 am

stinkbutt wrote:Daisy chaining 74HC4017's is tricky, but can be done.


Actually, if you look at the datasheet for your MC14017B, you'll find the way to do it on page 6:

http://www.utm.edu/staff/leeb/mc14017b.pdf

Implementing the AND gate isn't too terribly difficult. You can use one of the IC's from the previous link, or you can just use a pair of diodes as a ghetto gate.
Red M&M, Blue M&M: They all wind up the same color

stinkbutt
 
Posts: 593
Joined: Wed Feb 17, 2010 2:40 am

Re: LED blinks now what? ( not a technical question)

by jbisjim on Thu Nov 11, 2010 9:06 am

Actually, if you look at the datasheet for your MC14017B, you'll find the way to do it on page 6:

http://www.utm.edu/staff/leeb/mc14017b.pdf

The way i read that I can strap 1 clock on for up to 3 mc14017bs, but can the 555 do all the stages indicated there? or would i need a multi stage timer?

I also saw where one 4017 chip was used to drive 24 leds in series.
jbisjim
 
Posts: 26
Joined: Sun Oct 17, 2010 7:33 am

Re: LED blinks now what? ( not a technical question)

by Entropy on Thu Nov 11, 2010 2:03 pm

Also note that the 74XX595 is often used for output expansion for AVRs. (e.g. control a multiple of 8 outputs using only a few pins on the AVR.)

Unfortunately it also fits into the "blinky flashy" category, but RPM over at doityourselfchristmas uses Tiny2313s + 595s for quite a few DMX-controlled lighting projects (such as a 16-channel AC dimmer.)

The nice thing about the Tiny2313 is that it's the smallest/cheapest AVR I know of with a full blown UART.

The Tiny48s are interesting in that they appear to be the cheapest AVR with hardware I2C (but no UART).

Oh - the USI interface used to implement I2C on the really small AVRs is an epic pain to work with. Not sure how much better it is if you're using it for SPI.
Entropy
 
Posts: 472
Joined: Tue Jan 08, 2008 12:43 am
Location: Owego, NY USA

Re: LED blinks now what? ( not a technical question)

by jbisjim on Thu Nov 11, 2010 2:27 pm

Unfortunately it also fits into the "blinky flashy" category, but RPM over at doityourselfchristmas uses Tiny2313s + 595s for quite a few DMX-controlled lighting projects (such as a 16-channel AC dimmer.)


This logic chip plus a clock has made my head spin as to what i can make blink and do it in a different way. kind of excited to get some parts in and give it a wirl

doityourselfchristmas

i didnt even open a post yet there all i can say is wow

All my nerd senses are all tingly
jbisjim
 
Posts: 26
Joined: Sun Oct 17, 2010 7:33 am

Re: LED blinks now what? ( not a technical question)

by stinkbutt on Thu Nov 11, 2010 2:38 pm

jbisjim wrote:
Actually, if you look at the datasheet for your MC14017B, you'll find the way to do it on page 6:

http://www.utm.edu/staff/leeb/mc14017b.pdf

The way i read that I can strap 1 clock on for up to 3 mc14017bs, but can the 555 do all the stages indicated there? or would i need a multi stage timer?

I also saw where one 4017 chip was used to drive 24 leds in series.


No the 555 (or some other oscillator) drives them all, though at any given time it's really driving a pair of AND gates that may or may not be on.
Red M&M, Blue M&M: They all wind up the same color

stinkbutt
 
Posts: 593
Joined: Wed Feb 17, 2010 2:40 am

Re: LED blinks now what? ( not a technical question)

by westfw on Thu Nov 11, 2010 5:02 pm

LED blinks now what?

FANCIER blinking lights! Multiplexing, charlieplexing, PWM, multi-color, multisegment, light sensing, touch sensing, beeping, hissing, spinning, IR-communicating, Power, EL, Xenon, AC, incandescent....

Sometime I want to write a whole book hobbyist electronics books titled something like "Blinkenlights"...

westfw
 
Posts: 1709
Joined: Fri Apr 27, 2007 1:01 pm
Location: SF Bay area

Please be positive and constructive with your questions and comments.