Having trouble connecting RGB strip to Particle Photon, all rgb's at full power (shining white)

Hi all. I just got a Photon and loving it so far.

I’m trying to hook up to an LED strip (generic 12v from ebay)

I was following this instructions

Using this setup:
https://community.spark.io/uploads/particle/_optimized/520/793/815d42c8b6_459x500.png

Not sure why all the LEDs are on max

My code:
https://pastebin.com/5NNTVuxQ

Take a look at the Photon datasheet peripherals and gpio ports.

PWM is available on D0, D1, D2, D3, A4, A5, WKP, RX, TX with a caveat: PWM timer peripheral is duplicated on two pins (A5/D2) and (A4/D3) for 7 total independent PWM outputs. For example: PWM may be used on A5 while D2 is used as a GPIO, or D2 as a PWM while A5 is used as an analog input. However A5 and D2 cannot be used as independently controlled PWM outputs at the same time.

The code indicates you are trying to use pin 4, 5 and 6. You may need to rewire and reassign them to D0, D1 and D2 or any combination of above to allow PWM to work for you. Use the pin names.

e.g.:

#define REDPIN    D0
#define GREENPIN  D1
#define BLUEPIN   D2
1 Like

Thanks for your reply. This is what i came up with, with no results :confused:

Strip: 12v rgb generic strip. (Not addressable)

Using:

  • Particle Electron to send RGB values
  • 12v 3A Power supply to provide power
  • Transistors: TIP42C

Fritzing:
http://imgur.com/gPPDpJR

LED’s on: http://imgur.com/eDTcDlV

LED’s “off”: http://imgur.com/1B25GnC

Code: https://pastebin.com/QCUs0sb8

pinMode set to OUTPUT :heavy_check_mark:

I believe you want to use analogWrite (PWM) on the digital pin. See in the example, ignore the analog pin. See the use of the digital pin and then the use of analog write on the digital pin to set the PWM.

// EXAMPLE USAGE

int ledPin = D1;               // LED connected to digital pin D1
int analogPin = A0;            // potentiometer connected to analog pin A0
int val = 0;                   // variable to store the read value

void setup()
{
  pinMode(ledPin, OUTPUT);     // sets the pin as output
}

void loop()
{
  val = analogRead(analogPin); // read the input pin
  analogWrite(ledPin, val/16); // analogRead values go from 0 to 4095,
                               // analogWrite values from 0 to 255.
  delay(10);
}

My 50ct is this example project with works well:
https://www.hackster.io/ingo-lohs/mypir-sensor-activate-analog-rgb-stripe-controlled-by-photon-2e8240