#### Colossus

Joined Aug 12, 2009
18
I am working on a project and I am unsure what hardware components I should use.

My goal is to connect two sets of 4 LEDs to a module and be able to control the LED flash rate via a software program. The usb cable will be connected to the dongle where it will power the LEDs. The cables will run from the dongle to the PCB where the LEDs and resistors will be placed.

My software program will allow the user to control the frequency of all 8 lights simultaneously within the frequencies of 1-20 Hz.

Something like this but using 2 sets of 4 lights instead.

(The picture is a Texas Instruments link connector and a PCB)

I am hoping my device will look somewhat similar...

Last edited:

#### jj_alukkas

Joined Jan 8, 2009
753
Do you have that dongle with the AVR chip? Or do you need to start from scratch??

#### Colossus

Joined Aug 12, 2009
18
No I don't need to start from scratch but i was assuming a USB microcontroller would be necessary.

Although, it is $19 plus S&H so if you have any ideas please let me know! I also found this module for$18 DLP-USB245R

Also, could you give me a list of the components i will need to order.

Last edited:

#### ELECTRONERD

Joined May 26, 2009
1,146
USB can supply up to 5V, so I'm guessing that you have this 5V going into an LED driver to drive all those LED's. In fact, you would have to in order to light up so many of them. So this means the LED driver should have a PWM input or something to vary the frequency I would think. Oh, I see...you just want to drive eight LED's. Much simpler.

#### jj_alukkas

Joined Jan 8, 2009
753
People used to do this with the printer port without a microcontroller.

For your current setup, all you need is that microcontroller dongle with USB cable and LED's on PCB.

If you want to do that dongle also by yourself, get an AT90S2313, provided you know programming and Pc GUI interface. For some help on that, you can try www.cesko.host.sk .... A PC remote module design using the same chip is explained there. Also LED control is explained and the USB drivers, source code and program is also provided. But if you are in short of time, better get that dongle.

Parallel port could also have been considered but I dont think you can touch 4Mhz on that.

What is the purpose of blinking an LED at 4MHz??

Also make sure you dont pull more than 500mA from the USB of your PC. The internal electronic fuse will cut the supply to your port. If you need more current, take the supplies alone from another USB port in parallel with the current.

#### Colossus

Joined Aug 12, 2009
18
People used to do this with the printer port without a microcontroller.
I had thought about that but i really wanted to use the usb due to the fact it will be used on laptops, doesn't need batteries and looks way cooler.

People used to do this with the printer port
For your current setup, all you need is that microcontroller dongle with USB cable and LED's on PCB.
Will i need any resistors or anything else?

If you want to do that dongle also by yourself, get an AT90S2313, provided you know programming and Pc GUI interface. For some help on that, you can try www.cesko.host.sk .... A PC remote module design using the same chip is explained there. Also LED control is explained and the USB drivers, source code and program is also provided. But if you are in short of time, better get that dongle.
Thanks i'll look into that but i'm pretty bad at electrical engineering. I do have a degree in computer science but i don't know if that will help much.

Parallel port could also have been considered but I dont think you can touch 4Mhz on that. What is the purpose of blinking an LED at 4MHz??
The device needs to be able to run at variable flash rates from 1 to 50 flashes per second. I just realized that I put Mhz in the OP I meant Hz. Will this microcontroller allow me to design an interactive software driver? I need to have the user be able to download the driver when they plug in the usb into there PC. The program will allow them to control the flash rates and patterns of the LEDs.

Also make sure you dont pull more than 500mA from the USB of your PC. The internal electronic fuse will cut the supply to your port. If you need more current, take the supplies alone from another USB port in parallel with the current.
Do i need resistors? I don't understand what you men...

#### jj_alukkas

Joined Jan 8, 2009
753
Will i need any resistors or anything else?
I can only tell you that if you tel me which microcontroller your dongle has. But since you have Vcc at 5v and LED's at 3.4V, mostly you wouldnt need anything, but check that microcontroller please.

Will this microcontroller allow me to design an interactive software driver? I need to have the user be able to download the driver when they plug in the usb into there PC. The program will allow them to control the flash rates and patterns of the LEDs.
It is not the microcontroller that helps design the software. The software will be the same for any microcontroller and only the source code and USB driver for windows changes. I would never suggest you to look into device driver writing as you will need to study Microsoft Windows DDK programming. However with some effort you can do it. But these days most chips provide the USB drivers free online and you just need to know their ports and know how to design the GUI in visual basic with these. You can study it with some effort.

Do i need resistors? I don't understand what you men...
Each single USB port of a PC has a current limited output of 500mA. You can't draw current more than that. It doesn't affect your project here, so leave it.

Please post your microcontroller to know wether you need resistors. However, i would reccomend 100 ohms for every single LED.

#### Colossus

Joined Aug 12, 2009
18
http://www.pjrc.com/teensy/index.html

or

http://www.mouser.com/Search/ProductDetail.aspx?qs=sGAEpiMZZMuDw7xUFNwm7BQUazJLXDb7AvGFXvQYxl0%3D

The top one uses the WinAVR C compiler. The Teensy Loader program communicates with the Teensy board when the HalfKay bootloader is running, so you can download new programs and run them.

I do have a degree in computer science and experience with C/C++ and java but have never used visual basic. Would i be able to use visual c++?

I just want to create a little program that allows you to raise or lower the flash rate of the LEDs from 1 to 20 flashes per second.

Does this look ok?

Last edited:

#### jj_alukkas

Joined Jan 8, 2009
753
In this diagram found on that site, It is pretty clear that you need resistors.

I guess that the microcontroller's output is around 5V, so 100 ohms on each C2, D0-D6 for white LED's would make it safe. If you can test the correct output voltage, the correct value can be calculated. However, I think the datasheet for AT90USB162 will also give you an idea of the voltage on the uC's ports.

And about the software, no, C/C++ and java are entirely different high level languages compared to VB which is GUI. However, C++ will help you in doing the calculations in Vb for blinking as they are almost similar if you view it as code instead of design mode. I think the website for that kit will provide enough help with developing the software.

What colour LED's are you going to use??

#### Colossus

Joined Aug 12, 2009
18
I will be using Red/Yellow LEDs.

I think i will be able to handle the software it's the hardware that concerns me. I looked at that picture on there webstite but i am confused how to set it up like that. There appears to be 20 LEDs and 20 resistors.

If i wanted to use 8 LEDs (4 red and 4 yellow) what type of resistors would i need and how many?

#### jj_alukkas

Joined Jan 8, 2009
753
Each colour of LED's draw a different current. So you will need 1 resistor per LED. First after you buy your AVR board, program and run it without LED's and then measure the output with a multimeter. For your microcontroller, I have no idea, but for AT90S2313, no resistors are necessary.

I am assuming it to be 5V, so you can also do your calculations for a different voltage.
To calculate resistor values, (Vcc-Vf)/0.02 gives your resistor for a particular LED.
Vcc is your microcontroller's output voltage and Vf, your LED's voltage drop

For Normal RED Vf = 1.6, Vcc = 5, R = 170 ohms
Normal Yellow Vf = 2.1, Vcc = 5, R= 145 ohms

If you are using high intensity LED's or any other colour, find its Vf from its datasheet and recalculate using the formula.

The above resistors are safe even if you dont measure your AVR's output as it is based on the maximum output possible, i.e, 5V. If LED's light up dim, then measure and do the calculations. Lower the resistance, more current the LED gets and more brightness it gives. But dont go too low and blow up the led.