LEDs-GettingStarted

From Teesside Hackspace
Revision as of 13:09, 19 January 2023 by Smithson (talk | contribs) (Created page with "Below is a quick overview to get started on electronics with LEDs, if you have questions ask on our slack group. == Low Power LEDs == Low power LEDs (Light emitting diodes), commonly in 5mm, 3mm or surface mount packages are a great start to electronics. To power them a series resistor should be used otherwise a small change in supply voltage can cause a huge change in current causing burn out. Typically such LEDs are 20mA (0.02A), their voltage depends on their co...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Below is a quick overview to get started on electronics with LEDs, if you have questions ask on our slack group.

Low Power LEDs

Low power LEDs (Light emitting diodes), commonly in 5mm, 3mm or surface mount packages are a great start to electronics. To power them a series resistor should be used otherwise a small change in supply voltage can cause a huge change in current causing burn out.

Typically such LEDs are 20mA (0.02A), their voltage depends on their colour with Red typically being 2V and Blue 3.6V.

A 5V circuit would need to drop 3V over the resistor for a 2V red LED, using ohms law at 20mA this gives us: (5V-2V)/0.02A= 150Ohms so use a value higher than this.

an online calculator can be found here: DigiKey Online LED series resistor calculator

High Power LEDs

High Power LEDs (eg 1W+) would waste a lot of energy (as heat) if a series resistor was used so a current driver circuit should be used (such a circuit would be overkill for a low power LED). There are many preassembled modules available for this find one matched to the current requirement of your LED that is able to provide the voltage it your LED needs.

Over recent years COB (chip on board) LEDs have multiple LED chips all connected together in one package. In the case of White LEDs (which are actually Blue LEDs with a phosphor to produce the other wavelengths) the phosphor is added after the LED chips have all being connected together, making them look like one big LED.

For AC circuits a capacitive dropper (using the reactance of a capacitor to reduce the current flow without turning energy to heat) is typically used to reduce the current, more info on capacitive dropper can be learned from Big Clive, although we recommend avoiding mains DIY electronics for beginners.

RGB LEDs

RGB LEDs have a red green and blue LED all in one package. By varying the brightness of each colour different colours can be made.

To vary the brightness PWM (pulse width modulation) is generally used, this flashes the LEDs on/off faster than the eye can see and alters the duty cycle to change the apparent brightness, eg if its flashing fast and on half the time and off half the time it will look half as bright as when it is on 100%, if its flashing such that its on a quarter of the time and off three quarters of the time it will appear to the eye to be 25% brightness. this can be done to each channel (R,G and B) simultaneously to produce more apparent colours. Microcontrollers are generally used to provide the PWM signals.

RGB LEDs can be bought on cheap self adhesive strips eg 5m long.

When controlling a large amount of LEDs (eg in a strip) a mosfet is needed as a microcontroller can not source or sink much current. pre-built controllers can be bought including ones that use an ESP8266 wifi enabled microcontroller compatible with open source projects like Tasmota or WLED

Addressable RGB LEDs

Addressable LEDs allow each LED on a string to be controlled by a digital signal, thus each LED on a strip does not need to be the same colour allowing for much more effects.

Software libraries such as Adafruit Neompixel library have been written to allow users to write code without having to go too low level.

To allow users to control addressable LEDs on a higher level (without writing code) Projects like https://kno.wled.ge/ WLED do this.

Some Features of WLED:

  • Over 100 effects
  • Over colour 50 pallets (plus can make your own pallets) -the effects then run in the colours from your selected pallet.
  • Runs on ESP8266 or ESP32 (ESP32 better for animations with more LEDs, my ESP8266 has been fine with 300LED)
  • Nice web interface (inc mDNS naming)
  • Full control via MQTT (need to activate MQTT in interfaces menu)
  • Works with WS2812b (or any WS281x or many other protocols)
  • Can simply use ESP
  • Can control from Node-Red etc (via MQTT or WLED nodes)
  • Can define segments and have different animations in different segments
  • Can sync multiple units, or even go all out and sync to a track with XLights (free) software
  • Now also does 2D Matrix

Some useful tips

  • Can be programmed with Tasmotizer or ESPGUI
  • Easy to get started with a Wemos D1 mini, this doesn't require a separate FTDI converter, just plug in the USB and prog. added a cheap as level shifter + (then main power (fused) from PSU), no fancy specific hardware needed.
  • For sending custom themes via MQTT you send the JSON data to "YourMqttTopic"/api . I thought formatting the JSON would be a pain, but you simply get the theme how you want in the web GUI, then save it as a preset then you can copy paste the JSON from the preset, easy.
  • In the LED setup you can set a (software) current limit, save you stressing the PSU accidentally (but don't forget to turn it up from default), set pin and number of LEDs here too.