• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Start from the beginning. I want to randomly fade leds

Status
Not open for further replies.

neelyjer

New Member
Hello everyone.

I am in the midst of a project that I would like to incorporate about 20 LEDs randomly fading on and off with more than 1 LED lit at any given time. I want to build this on my own, and have been doing lots of research (Google). It seems that the best way to do this is by PIC. I am good at programming and can pick up quite well what I need to know there.

I will be using 5-7 red LEDs & 13-15 yellow LEDs. This will be ran from a 5 volt power source.

What I would like to know is what chip should I use?
What do I need to interface with the chip in order to program it?
What software do I use to write my program (preferably a free one)?
Once the program is written, what do I need to build my circuit?
I would like to build my circuit in a strip form about 20" long and hopefully no more than 1" wide.

I know it's alot of questions, but that's why it's titled "Start from the beginning..." As I build this with your assistance, I will record a worklog of progress, steps made, materials used, and the written code for everyone's free use.

Thank you all very much for your help!!

Jeremy

P.S.
Remember, I am very VERY new to all of this so jargon won't work with me. I need the basics and everything in plain english.

THANKS!!
 
Last edited:

tresca

Member
I would suggest to start reading the datasheet on a a specific microcontroller. If you are using PIC, for sake of simplicity, i would recommend an 18F series, because the older PICs have something called bank switching, which can be a bit of pain.

You can get C18, which is microchips C compiler for the PIC18 series. The student one is free, but after 60 days, optimization is limited and you are bounded to a 2Kb program. If you are coming from a computer programming side, 2Kb may not seem like alot, but its pretty decent on an embedded scale.

To program, I would recommend getting some type of ICD2 or some clone of it. The reason is because if you are learning, there are going to be mistakes which you just cant understand and having an ICD2 would be helpful. I bought mine off ebay for $50, and it works fine. I believe there is something called a Junebug floating around here that is an ICD2 clone or something. Not to sure, but Im sure someone will post more info on that a little later.

To build your circuit, start off with something called a breadboard. Its pretty much a plug-and-play type deal. No solder required. This way, you have the ability to make changes until you are finally content with it, and then from there, either get a perf board or make your own pcb.
 

gabeNC

Member
I would start with Nigel's tutorials. That is where I started and probably quite a few people on the board.

Nigel's PIC Tutorial Page

Once you get the basics down like flashing a LED you could probably alter the delay routine to slowly fade out.

I'm new too but his site has been invaluable. So to answer your questions (for what worked for me)

1) I bought a 16f876a (77 has more pins).
2) pickit 2 is a good programmer. Bill has a great site blueroomelectronics - Smart Kits Build Smart People and sells kits.
3) I use mplab that came with the pickit programmer. You can download the latest version at microchip's site.
4) start with the basics and experiment. Have fun!
 

neelyjer

New Member
Hey thanks for the quick replies!!

I just came across this...



Found here...

That is very similar to what I am looking for. In the article, the author states that his transistor is 'BC547'. I looked that up and found that there are multiple types of transistors (ie. PNP, NPN, BiPolar). Any idea which type is most likely being used?

Thanks again for your help!

Jeremy
 

kjennejohn

New Member
Hi.
OK, in simplest English: Get the Basic Atom Microcontroller from BasicMicro(.com). This comes as a DIP 28 pin device (PIC16F876A); the DIP 40 pin is PIC16F877A. These two are $20 each. The provide a great BASIC compiler for a FREE download! You provide the bare minimum crystal+2 caps, or resonator, to clock it. And the usual voltage supply. It has a bootloader onboard, so you need a serial connection to your PC. These program from the IDE of the compiler. Has a debugger (for some LEDs?!) and of course, each pin supplies enough current to drive an LED on its own, no transistors or driver ICs needed.

Or get one of their Nano Atom DIP chips. The DIP 40 is the PIC16F887. I believe this has 20 or 22 I/O pins available. It needs no clock because it runs at 8MHz using an internal clock! And the BASIC is free, as before. This is $10.97.

If you want something usable out of the box, and can't be bothered scrounging for parts, buy their Atoms in module form, prices start at $60.

Go check them out!
kenjj
 

be80be

Well-Known Member
Even if you get more output pin to drive leds a pic can only sink and source so much power
200 mA is it to drive most led to full on you need 20 to 30 mA 20 x20 is 400mA you have to use a driver if you want full brite leds and a lot of them
 

3v0

Coop Build Coordinator
Forum Supporter
Guys: This is BULL !

neelyjer said he was good at programming but not one of you bothered to find out in what language or languages. We have one vote each or C18, ASM, and "Basic Atom Microcontroller".

Each of these is solution of choice you the person who posted it. What we need here is to find out which is the best fit for neelyjer.

How many LEDs you can run off the uC (microcontroller) depends on how much each draws which depends on the LED type and the limit resistor.

No one mentioned the use of shift registers. The 74HC595 or a similar device with more drive current would one way to go.

But prior to going there lets find out from neelyjer where we are starting from.

3v0
 

be80be

Well-Known Member
I am in the midst of a project that I would like to incorporate about 20 LED
He doesn't need a shift register for that.But he needs to watch how much it draws. It is very easy to use
to much current with 20 leds. Looks like he was asking for help with his circuit
That is very similar to what I am looking for. In the article, the author states that his transistor is 'BC547'. I looked that up and found that there are multiple types of transistors (ie. PNP, NPN, BiPolar). Any idea which type is most likely being used?
And seeing he said he was good at programming One would think he has that part worked out
I would use a pic 18f1320 and a pickit2 or 3 Or bills junebug.
Sorry I missed the part about picking a chip. And I would use the languish I no the best be it C assembly or basic
 
Last edited:

be80be

Well-Known Member
That light show is using fiber to shine the leds into and it only using 5 led 2 red 1 green and 2 blue
 
Last edited:

kjennejohn

New Member
Dude! This is NOT Bull!

3V0, I think he was clear what he wanted and could do up front, and believe we met his every criteria:
A. He already programs. How hard can it be to adapt to a BASIC? If he needs help, he just visits the forum there at BasicMicro or emails support. I figure he only needs a very few commands to do this.
B. He wants free software. This BASIC is a free download.
C. I'm sitting in front of a development board with 32 TI 1-3/4 LEDs (5mm?) , current limited with 390 Ohm RPacks. The program produces 19 LEDs on hard, seven blinking. This is with a Basic Atom40B. This sounds VERY close to what he wants to do. And for grins, at the same time I have an LCD displaying the value of a port and the value of a loop. With a 20MHz resonator, this thing is loafing.
D. The Processor is wired straight to the LEDs. I'm sitting here in bright daylight, and they show just fine.
E. The regulator's heat sink is barely warm, and the PIC is room temp.

'Nuff said,
kenjj
 

be80be

Well-Known Member
Your using about 90 mA which no load for you setup. Seeing your using less than half the chips rating.
 

3v0

Coop Build Coordinator
Forum Supporter
Is so :)

Each of you want Jeremy to do his project using your language of choice. Which one of you is right?

You do not have enough information to know.

A few days ago one of the mikes gave away his junebug. There was lots of advice, but like here, there was no agreement.

Everyone is entitled to their choice of language. In this case let the user have his.

Do you want to help him or promote your relegion/language ? FWIW I am an atheist !

3v0
 

be80be

Well-Known Member
Where do you get each
Each of you want Jeremy to do his project using your language of choice. Which one of you is right?
I never said any thing about what to use I just told him to keep from burning his mcu up.
 

3v0

Coop Build Coordinator
Forum Supporter
I was only ranting about language.

be80be/Burt seems to have been caught up my triade about language. It was not my intention. My inclusion of suggestions regarding driving the LEDs were only suggestion. They were not critical of Burt's text on how to drive them. I was only ranting about language.

Burt accept my apologies :)

The rest of this is not so kind.
He already programs. How hard can it be to adapt to a BASIC? If he needs help, he just visits the forum there at BasicMicro or emails support.
How hard would it be for kenjj to learn asm, C, C#, Pascal, Ada, or any other language he does not know. (he may know some of the above)

If you do basic and basic help is asked for then help. But if the poster needs C or ASM help do not ask him to learn BASIC. If there are others here who can help the OP in his choice of language let them help.

3v0
 

be80be

Well-Known Member
I'll tell you how hard that can be. It could be the loss of years of leaning say Basic and wasting mouths to learn how with C. and ending up totally lost and giving up.
 

Sceadwian

Banned
Did any of you guys actually read the original post the person here made? He didn't say he was programming in basic he said he wanted the basics explained to him without a lot of jargon....

It seems that the best way to do this is by PIC. I am good at programming and can pick up quite well what I need to know there.
P.S.
Remember, I am very VERY new to all of this so jargon won't work with me. I need the basics and everything in plain english.
If you haven't scared neely off I would offer this advice.

Read these
Atmel AVR - Wikipedia, the free encyclopedia
PIC microcontroller - Wikipedia, the free encyclopedia

Check out this site (there are many others) for a programmer and some basic chips.
SparkFun Electronics - News
They sell programmers and chips both, and some other really nifty modules.

There are a lot of options, most any of them will do. I recommend AVR's myself many users here prefer PIC's but they are roughly capable of the same functions. AVR's have some technical advantages but they're irrelevent for your uses, either PIC or AVR will be fine. AVR's do have an opesource GCC port for C code though. There C compilers for PIC's as well but none opensource that I'm aware of. There are free ASM and BASIC compilers for both AVR and PIC chips. If you decide you want to dive in pick PIC or AVR and start learning. If after viewing the entries for PIC's and AVR's and checking out the programmers and chips that Sparkfun has available, start a new thread here with your questions. There are a lot of devices to chose from so it's a bit hard to get started. Once you have a programmer and a device chosen to work with though it gets easier. They can be quiet affordable. Basic programmers are under 20 bucks, and they program a wide range of chips.
 

be80be

Well-Known Member
I think I said that to Sceadwian :D But any way it's good to point it out one more time. I thought he wanted help designing it. Seeing he said he was good at programming. Then some one said get a pic with a bootloader and a **** pot of pins and watch the smoke roll off of it.:eek:
 

Sceadwian

Banned
I didn't mean to sound too harsh, especially considering I've done the same thing more than once on threads here. But we're not helping the poster.
 
Status
Not open for further replies.

EE World Online Articles

Loading
Top