Skip to content

Wiring your LEDs

cp2004 edited this page Sep 3, 2020 · 15 revisions

heads up! The wiring diagrams are wrong. The text is right. Will be fixed shortly

Wiring LEDs to your Raspberry Pi is the most important step! It only requires a couple of steps to set up, WS281x LEDs are very simple with their 3 wires.

The guide below is based on the Adafruit Raspberry Pi Wiring Guide. Some of the images have been copied from their page, for illustrative purposes only.

Make sure you have a sufficient power supply! You cannot power more than a handful of pixels direct from the Raspberry Pi (it can output max 500mA, which with a printer and camera connected leaves little left over for LEDs). The best option, as demonstrated below, is an external 5V power supply.

You can only use one strip at a time with the Raspberry Pi, due to hardware limitations. If you have more than one, you can 'chain' them together to make one longer strip if you would like.

Raspberry Pi Wiring

The hardest part about wiring with a Raspberry Pi is connecting up the 3.3v logic from the Pi to the strip that wants 5v. There are several ways you can do this, which are described in more detail below.

No shifting

It is possible to connect the LEDs up without any kind of level shifting, however mileage varies from strip to strip. I have one setup like this, and one with the full logic shifter. This can work because the spec of the LED strips means they need 0.7 * VDD(5v) which is ~3.5v. Close to the Pi's 3.3, so depending on how tight of a tolerance your strip has, this is possible.

Wiring of this is as follows:

  • Pi GND to LED GND
  • Pi GPIO 10 to LED DIN (data in)
  • Power supply GND to LED GND - common ground between power supply and Pi
  • Power supply 5V to LED 5V

Level shifting chip

You can use a level shifting chip to convert the signals from 3.3v to 5v. Recommended one to use is a 74AHCT125, I have this and it works well.

Wiring of this is as follows:

  • Pi GPIO 10 to 74AHCT125 pin 1A
  • 74AHCT125 pin 1Y to LED DIN (data)
  • Power supply ground to 74AHCT125 ground
  • Power supply ground to 74AHCT125 pin 1OE
  • Power supply ground to Pi GND
  • Power supply ground to LED GND
  • Power supply 5V to 74AHCT125 VCC
  • Power supply 5V to LED 5V

Wiring with a diode

The diode method is a quick way to reduce the power supply voltage slightly, so that the LED strip can read the 3.3v. Make sure you have a diode that can cope with the amount of power drawn! Also as a result of them running a little less that 5V the LEDs may not be as bright.

Wiring is as follows:

  • Pi pin 10 to LED DIN (data)
  • 1N4001 diode cathode (side with the stripe) to LED 5V
  • Power supply ground to Pi ground
  • Power supply ground to LED GND
  • Power supply 5V to 1N4001 diode anode (side without the stripe)

Heads up! This documentation has migrated to Gitbook! Find it here: https://cp2004.gitbook.io/ws281x-led-status/

Clone this wiki locally