Precise and bright LED control

Article

I have a family member with Alzheimer's and my parents have asked me to set something up like is described in the article. Both of my parents are scientists and know that this is incredibly unlikely to work but given the lack of any type of hope they figure it can't hurt. They asked me to do it because I own a software development company so I must know how to do this right!? No, I can't even code.

But, I can learn. So, I started dabbling at an awesome electronics store in town. My first purchase was an Arduino UNO and one of those experiment kits that has instructions and components to practice. I did all of the basic LED stuff it included and even took it further connecting a button and adding code to manually control the color of the RGB LED the kit included. Fun stuff and I look forward to diving in further and continuing to learn.

For now, however, I've got my parents on me to get this out to them. So, here are my questions.

Requirement: Strobe an LED at 40Hz bright enough to illuminate a small dark room with it staying on for 1ms and off for 24ms. Do this with as little equipment and complexity as possible!

  1. Is it possible to run an LED off of the Arduino alone that will be sufficiently bright? By sufficiently bright I mean that it has to light up a small room noticeably. That could even be with the lights off so it doesn't have to be blinding but the little LEDs that came in the kit are not enough. I recently bought this: LED STRIP and will be tinkering with that today but as of yet I don't know if I can even run that off of the board. It is meant to be run off of USB... can I just connect up the power and ground wire and use it like a regular LED? It doesn't have to be a strip though. Just a nice bright LED would work. Color is kind of up in the air too. The experiment used 473nm but I've read some discussion that that was probably just the color of the laser in their first experiment so they stuck with it. Maybe white is even better since it would presumably activate more of your photoreceptors and increase the response. But, I am fine with being a purest about it too. No preference for this initial version. It should be noted that one of the complexities here is that the experiment strobed the LED for 1ms on then 24ms off. So, the brightness has to be pretty substantial to overcome that limited amount of time on.

  2. Is the processing time relevant to the timing? So, as you can imagine, my code is really basic. Just firing up the LED, delaying a millisecond, then turning it off, & delaying 24 milliseconds. Since that is the entire length of the code is the time it takes the processor to run through the loop negligible? If it just takes 20 microseconds or something for the processing then I will still be effectively getting 40Hz and it will be fine. But if it takes a lot longer than I would have to get more creative with my timing of the LEDs or try to do it via code with millis() or something. I figure I can hook up a light sensor to test the final product but it would be useful to know ahead of time. As I'm writing this maybe it's better to use PWM and just set the duty cycle down to where it is off 96% of the time or something... don't know if there is some advantage here.

Thank you all in advance for any help you can provide. It is appreciated

Since that is the entire length of the code is the time it takes the processor to run through the loop negligible?

Yes it is.

As I'm writing this maybe it's better to use PWM and just set the duty cycle down to where it is off 96% of the time or something.

No because the frequency would not be 40Hz.

Is it possible to run an LED off of the Arduino alone that will be sufficiently bright?

Possibly not, you would need an external power supply and a FET to drive the LED.

Note this is just a research observation and nothing suggests that it has any therapeutic value.

richburg:
It is meant to be run off of USB... can I just connect up the power and ground wire and use it like a regular LED?

That strip just uses USB for the power supply so you could rig up a USB jack or cut the cable but the strip uses much more current than an Arduino Uno pin can supply(40mA absolute maximum, 20mA max recommended) so you will need to use external switching hardware that can handle the current of the strip, as recommended by Grumpy_Mike.

Per the Arduino Reference pages (see: AnalogWrite() ), on UNO board PWM on most pins is 490Hz, and 980Hz on pins 5 and 6. For a 40Hz LED flash rate, you could use Arduino function delayMicroseconds(). Also see the example code on Reference page for delayMicroseconds().

int ledPin = 5;                 // digital pin 5
int ledBrightness = 255;           // adjust led brightness w/values between 125-255

void setup()
{
   pinMode(ledPin, OUTPUT);      // line unnecessary for PWM, but sets the digital pin as output
}

void loop()
{
   // 40Hz blink rate, full brightness
   analogWrite(ledPin, ledBrightness);   // sets the pin PWM on
   delayMicroseconds(12500);        // pauses for 12,500 microseconds      
   analogWrite(ledPin, 0);    // sets the pin PWM off
   delayMicroseconds(12500);     // pauses for 12,500 microseconds      
}

Arduino digital pins can only safely deliver up to 20mA (see product page specifications for UNO). However it would be easy to drive that USB LED strip with a separate power supply from a single digital pin of your Arduino UNO using a MOSFET transistor switch. You can buy an "Arduino MOSFET Switch Module" from a China seller on eBay shipped to USA for about $2.25USD.

I would use digitalWrite rather than analogWrite then you could use any pin. Just writing values of 255 or 0 with analog is the same as using HIGH, LOW with digital and you could use any pin.

True, but since pin 5 has 980Hz PWM, (much faster than 40Hz), you can use analogWrite() to vary LED brightness and still have approximately 40Hz flash rate.

how critical is the duty cycle?

Im thinking I'd be tempted with a 555 into a CAT4101 driver then into power led. the whole shooting match could be powered quite happily from USB.

borland:
True, but since pin 5 has 980Hz PWM, (much faster than 40Hz), you can use analogWrite() to vary LED brightness and still have approximately 40Hz flash rate.

Sorry that is total rubbish in the context of this thread.mthis is because putting extra modulation on the LED was not done in the origional experiment and doing so would invalidate any result.

The duty cycle opinion the origional paper is 100% and unless you want to introduce an other variable it is best not going there.

The human optic nerve has limited bandwidth (think maximum shutter speed limit), so human eye can't detect the faster PWM on/off duty cycle of the LED.

so human eye can’t detect the faster PWM on/off duty cycle of the LED.

But we are not talking about the eye’s perception we are talking about the brains stimulation.

However all this about dimming is irrelevant because the LEDs are not required to be dimmed, in fact just the reverse.