Ring flash - power question and buttons not working

Hi,

I am a newbie making a ring flash for the macro lens of my DSLR camera. I am using a 24 RGB LED ring and control the intensity with two push buttons. The device runs on an Arduino Nano which does a startup sequence, reads the buttons and controls the intensity of the LEDs using the Adafuit Neopixel library. I designed and 3D printed a neat housing that interfaces with the lens hood interface of my macro lens.

The housing fits and the startup sequence of the LED ring works, however, I have two remaining issues:

ISSUE 1. POWER
I see two options to power the setup (see attached schematic, I couldn’t insert it here):

Option 1: Directly via the mini USB port
I can power the Arduino Nano directly from the USB port. If I do this, the 24 LEDs draw too much power (estimating 5W, so 1A), so the Arduino voltage regulator gets very hot and the voltage drops to 3V. This is probably not a good idea, but currently my Nano is still working.

Option 2: Connecting a 5V USB power supply on the 5V
This way, I can use a 5V/2A USB power supply that provides plenty of power to drive the LED ring. I tried this too but the Nano does not start up.

I was guessing I should not connect external power to Vin, since this is specified for 6…12V, so it will probably not work on 5V.

ISSUE 2. BUTTONS
I used the internal pullup resistors of the Nano an wired the buttons to pull down pins D4 and D5. But somehow I see no reading at all (see the attached code).

The essential part of the code:

const int   BUTTON_PLUS    =   4; // Yellow button
const int   BUTTON_MINUS   =   5; // Black button
const int   DATAPIN        =   7; // Data for LED ring

bool  minusPressed        = false;
bool  plusPressed         = false;

void setup() {
   pinMode(BUTTON_PLUS,  INPUT_PULLUP);
   pinMode(BUTTON_MINUS, INPUT_PULLUP);
   pinMode(DATAPIN,      OUTPUT);
}

void loop() {
   // Check buttons
   minusPressed = !digitalRead(BUTTON_PLUS );
   plusPressed  = !digitalRead(BUTTON_MINUS);

   if (plusPressed )  buttonPlusPressed(); 
   if (minusPressed)  buttonMinusPressed();

   // Manage state
   manageState(); // function handling the state machine of the LED ring
}

It may be that the buttons don’t work since the voltage is too low, but then I would expect to see both pins low instead of high all the time. What am I doing wrong?

I would really appreciate some good advice. Thanks in advance.

HenkJan van der Pol.

Flash.ino (5.6 KB)

Try powering the controller from USB and the LEDs from the external supply to get started.

Dear Railroader, thanks for helping me.

I considered this, but was afraid I would create a situation where the data output pin of the Arduino would have a different ground reference than the ground of the LED ring.

Would a setup according to the attach schematic work? I guess I need to cut off a connector from a USB cable and connect that to the power supply.

Also, I may need to connect the ground of the buttons to GND of the Arduino, or can I be sure that the ground levels of both boards are interconnected?

Also, as a photographer: You won't get any good quality picures with rgb-leds.

henkjan_nl:
It may be that the buttons don't work since the voltage is too low, but then I would expect to see both pins low instead of high all the time. What am I doing wrong?

You set the pinMode to INPUT_PULLUP which means digitalRead() on that pin will always return HIGH, unless the pin is pulled to GND by pressing the button.

Looks good with the grounds connected like this...

If the exernal supply is well-regulated (pretty much all phone chargers are) then you can connect it directly to the 5V pin on the Arduino to power it.

Hi,

Make that 2.5uF cap a 470uF or 1000uF, to compensate for the current surge produced by the LEDS.

If you are using a phone charger, it will possibly not have the regulation response time to cope with 1A surge.

Make the leads to the LEDs a bit heavier than the rest, how long is the lead from controller to LEDs?

Thanks.. Tom.. :slight_smile: