PDA

View Full Version : Need help making a simple flashing LED device


ABN
Feb23-10, 05:03 PM
I'm sure this is very simple for everyone here.

I need to make a device that will allow an LED to flash at very specific rates (for example 4 times/sec).
I assume I need to use an I/O system that will allow me to program it via computer connected by USB.
If this is even the best way to go about this, my question is what kind of controller do I need or what should I be looking for to control the voltage?

berkeman
Feb23-10, 05:24 PM
I'm sure this is very simple for everyone here.

I need to make a device that will allow an LED to flash at very specific rates (for example 4 times/sec).
I assume I need to use an I/O system that will allow me to program it via computer connected by USB.
If this is even the best way to go about this, my question is what kind of controller do I need or what should I be looking for to control the voltage?

Welcome to the PF. There are many ways to do this, depending on what your overall goal and requirements are. You can make a simple stand-alone circuit adjusted by a potentiometer, or you can program a simple microcontroller (uC) board to flash one of its LEDs, or you can make something controlled by a PC like you mention.

What is your overall goal? What are the adjustment and accuracy requirements of the flash rate?

ABN
Feb23-10, 05:36 PM
Thank you berkeman

The device is to be used in a biology laboratory working with zebrafish. Basically, I need to expose the fish to light at a very specific rate, ideally controlling both the duration that the light is on as well as when it is off. The rate of flashes will often be tweaked as the experiments progress.

Precision is my main concern. And the other is ease of use.
I realize there are many routes to create this device but frankly I don't know what the pros and cons of each would be. Could you lay this out for me and recommend specific chips or modules I should be looking at?

taupune
Feb23-10, 09:14 PM
use labview. its very simple. however you need to connect the output from the computer to the LED. I am working on a similar project but way way harder. its about microsecond delays and it has to be damn exact, and not just one led but 100 of them. What class grade are you attending?

berkeman
Feb23-10, 11:12 PM
Thank you berkeman

The device is to be used in a biology laboratory working with zebrafish. Basically, I need to expose the fish to light at a very specific rate, ideally controlling both the duration that the light is on as well as when it is off. The rate of flashes will often be tweaked as the experiments progress.

Precision is my main concern. And the other is ease of use.
I realize there are many routes to create this device but frankly I don't know what the pros and cons of each would be. Could you lay this out for me and recommend specific chips or modules I should be looking at?

That's very helpful. For biological response times, a USB (or other) controlled interfaced from Windows will be fine. For really precise real-time control, you need to consider other OSs, but for people and fish response times, Windows based program control is generally fine.

Look at the National Instruments interfaces for USB and any other interfaces you might have available on your PC. I prefer to program in CVI, but you can use LabView if that works better for you. Omega Instruments also has hardware to get you from the PC out to digital/analog IO.

ABN
Feb23-10, 11:43 PM
Great. Thanks so much for your help. I'm at a loss weighing my options with these different modules, however.

NI offers this module:

http://sine.ni.com/nips/cds/view/p/lang/en/nid/201630

Omega Instruments has this:

http://www.omega.com/ppt/pptsc.asp?ref=USB-4751_USB-4751L

Would both of these options suit my needs?

And how about the much cheaper option of a PIC uC such as this:

http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en533925

What differences would I find between the two?

taupune
Feb24-10, 09:36 AM
if you choose the NI version it would work with labview. You can download a trial version and do your application and from there, convert it to exe file, so that when trial license expires , you can still have your working program. Labview can do it. If you choose the Pic, you need to create a routin for 1 sec delay and than have in the option to selec t for how long it would be on and off. You can find sample code online for sure. It all depends on budget and how comfortable are you with pic. You can even get free samples of pic, make your own device to connect the chip to computer and write your own code. or you can buy ready made from NI or omega. Good luck

vk6kro
Feb24-10, 07:12 PM
With old versions of Windows, this used to be easy. You could just write to the printer port and directly control the pins.
Windows XP is very protective and you have to use special drivers to turn off this protection.

However, a free program called Liberty Basic lets you control the printer port after you transfer a couple of small files to the Windows directory of your computer.

I just tried this and got a LED flashing from the parallel port. This port is not used on my computer.

Here is the program I used:

[start]

out 888,255
for j= 1 to 166000:next
out 888, 0
for j= 1 to 166000:next

goto [start]

Simple stuff. Liberty Basic is pretty powerful, so there are probably better ways of doing this. The delays in the above example program give a flash rate close to 1 Hz.
888 is the address of the parallel port (378 Hex)
for j= 1 to 166000:next .............this gives a delay of 500 milliseconds

You could vary these delays to give whatever flash rate you like.
---------------------------------------------------------------------

If you could use a free-standing device (with no connection to a computer) one way would be with a Picaxe chip.
You would use a program very similar to the one above , but the delay would be done with a "pause" command.
This is powerful and accurate. For example, "pause 423" means pause for 423 milliseconds before doing anything else.