[SOLVED] Connect analog non-rgb led strip to photon


I would like to connect a 12v simple analogic led stripe to my photon… I’m using a transistor and an external 12v battery, but nothing lights up…

Do you have any ideas?

Thank you.

How have you wired things up, what does your code look like?

Hi, thank you for your reply:

My code sets HIGH the pin D7 to light the stripe.

I use a IRLB8721 to drain the current.

I connected all like this:

12V power suply positive to led strip positive
12V negative to common ground
Photon ground to common ground
led strip ground to collector (transistor)
D7 pin to base (transistor)
emiter (transistor) to ground

Could you copy your code here?

Looking at the datasheet, it’s a MOSFET you’re using, with Gate/Drain/Source, so make sure you’re got everything hooked up correctly.

defining the pins (for led strip segments)

int Led[8] = {D7, A1, A2, A3, A4, D2, D3, D4} ;
in a for bucle, to light all of them :slight_smile:

digitalWrite(Led[i], status);

I was hoping for the full code, since things have gone awry elsewhere as well. Have you set the pinModes properly?

The code is fine, it works with regular leds.

The obvious thing to do is remove the Photon from the equation. With the Photon removed can you get the strip to light-up? If so, what does your circuit look like (draw it for us please). What did it look like with the Photon inplace?

the led strip works well with only 12v current (positive to positive, negative to negative)

I want the photon to act as a relay to light or not the led strip.

I wired it like this, but only with 2 wires (my led strip only has 2 wires)


Cool, now we are getting somewhere. I want to verify your MOSFET setup is correct. Please try adding the MOSFET (like in the adafruit tutorial) and then triggering the MOSFET manually (wire it into the “ON” position)

@ericmelvin10, how are you powering the Photon? Also, I assume each LED strip only has one FET associated with it. Make sure to have your FET source (GND) and drain (12V) correctly wired. As @harrisonhjones pointed out, disconnect the A7 pin from the FET gate and instead connect the gate to GND or 3V3 to test that it switches correctly. Let me know what your results are.

It seems to work without the photon :\

@ericmelvin10, pin D7 already has an LED on it which may affect the voltage to the FET gate. Have you tried a different pin?

Also for your code, digitalWrite(Led[i], status);, I assume you declared status as an INT with a value of HIGH or LOW, correct?

Wow!! Now it’s working perfect… I did’t changed anything :\ Only tested the led strip without the photon, and now it works perfect.

Thank you

Mod edit (@harrisonhjones): Language


@ericmelvin10, it’s the magical Elite effect. Unquantifiable, unmeasurable, unexplainable but it works! :stuck_out_tongue:


sorry for not posting my code but it has 1087 lines of code, too much for a forum :slight_smile:

why so much?? :neutral_face:

Because my code does a lot of things… button handling (debounce, seconds hold …), state machine, music playing, light making… you know…weird stuff :slight_smile:

Over 1.000 lines of code :sweat: - have an eye to my project: MyPIR-Senor triggers analog RGB Stripe

Sure, I’m not going to explain more about my app, but it’s a multi-game with serveral imputs and outputs… It’s pretty common to have that kind of code length.