DDC
  • Welcome
    • Introduction
    • Supported hardware
  • 1: Project planning
    • Switch inputs
      • Switch table
      • Direct
      • Shift register
      • Port expander
    • Analog inputs
      • External ADC
    • RGB LED
    • Digital outputs
    • PWM / Circuit control
    • EEPROM
    • Processing and memory
  • 2. Wiring
    • Switch inputs
      • Matrix
      • Direct
      • Shift register
      • Port expander
    • Analog
      • Analog switches
      • External ADC
    • RGB LED
    • Digital outputs
    • PWM / Circuit control
    • EEPROM
  • 3. Coding
    • Essentials
      • 02_Board.ino
      • 08_Joystick
      • 10_TableAndAnalog.ino
        • Switch table
        • Analog channels
      • 30_Switches.ino
    • Peripherals
      • RGB LED
        • Firmware control
          • LED functions
          • Color
          • Brightness
          • Presets
        • SimHub control
      • Digital outputs
        • Setup
        • SimHub control
        • Firmware control
      • PWM / Circuit control
        • Setup
        • Calibrate
        • Switch control
        • Trigger control
      • Shift register
      • I2C devices
        • ADS1115
        • PCA9555
        • CAT24C512
    • Advanced
      • Analog inject
      • Conditional coding
        • Triggers
        • Editors
      • Field placement
      • Presets
        • 31_RunningPresets.ino
        • 32_Presets.ino
        • Example
    • Upload
    • Naming the controller
  • 4. Connect to SimHub
    • LED control
    • Controller settings and properties
      • How to connect?
      • How does it work?
      • How to control it?
      • Property list
  • Switch library
    • Pushbutton
    • Function switches
    • Toggle switches
    • Hat switches
    • Car control functions
      • QuickSwitch
      • BrakeMagic
      • ThrottleHold
      • Handbrake
    • Pedals & paddles
      • Brake/throttle
      • Clutch
      • Bite point & launch
      • Filtered curves
      • Shifter
    • Funky switch
      • Directional
      • Center push
    • Encoders
      • rotary2Bit
      • rotary4Bit
      • funkyRotary
      • wildEncoder
      • E18
      • rotaryPulse
      • PEC11
    • Rotary switches
      • rotaryAnalog
      • quickRotary
      • SW1
      • Editing functions
    • Multiswitch complexes
      • Hybrid rotary
      • Multifunction rotary
      • Modded encoder
      • Stacked encoder
    • Preset
    • DDS
    • RGB LED control
    • PWM / Circuit control
    • Utility
  • Fast DDC
    • Buttons and LED
    • 4 encoders, buttons and LED
    • Dual clutches, 4 encoders, buttons and LED
    • Dual clutches, 6 encoders, button matrix and LED
  • CB1
    • Ordering
      • Order together
      • Order yourself
        • 1. Open in EasyEDA
        • 2. Export files
        • 3. Edit Pick&Place
        • 4. Pin headers and jumper
        • 5. Order from JLCPCB
    • Wiring
    • Code
      • Essentials
      • Complete project
      • Settings
    • Circuit
    • Shields
      • Robin
  • Collaboration
Powered by GitBook
On this page
  • Microcontroller wiring
  • Port expander wiring
  1. 2. Wiring

Digital outputs

PreviousRGB LEDNextPWM / Circuit control

Last updated 10 months ago

Wiring digital outputs is fairly straight forward. One pin for each device, a resistor to limit the current. You can use both the microcontrollers digital pins and/or a port expander (PCA9555).

  • Microcontroller output pins can supply a maximum of 50 mA

  • PCA9555 can supply a maximum of 25 mA per pin

    • However, the first 8 and last 8 pins on the expander are seperated in terms of power draw, and you can only supply a maximum of 100 mA across the 8 pins in pair. Meaning maximum 12.5 mA for each pin if all 8 are used.

    • The total current supply of the whole expander is not 100 mA + 100 mA, but 160 mA. So if all 16 pins are used, 10 mA is the maximum current per pin.

Select the correct resistor size to match the current you want. Higher current means brighter light for LEDs. The max current rating might be too bright, so do some tests to see what feels right.

The size of the resistor has to be calculated. The equation is like this:

r=VCC−VfIr = {VCC - V^f \over I}r=IVCC−Vf​
  • r is the size of the resistor you need

  • VCC is the operating voltage of the microcontroller board (typically 5V or 3.3V)

  • Vf is the forward voltage of the LED, or the "voltage drop". Typically 1.8V for a red LED, increasing through the rainbow colors with purple at 3.0V.

  • I is the desired current through the LED. Typically 20 mA is maximum and quite bright. 5-10 mA gives a comfortable brightness.

You can also use an to find the resistor size.

Microcontroller wiring

Here we're wiring 5 red LEDs directly to our microcontroller.

If we use a Pro Micro board that runs at 5V, and want to drive an LED with 2.2 V forward voltage with 8 mA current, the equation looks like this:

5V−2.2V0.008A=350Ω{5V - 2.2V \over 0.008A} = 350 Ω0.008A5V−2.2V​=350Ω

The closest available resistor value would be 360 Ω.

Port expander wiring

Here we have 16 LEDs wired to our PCA9555 port expander. They're wired exactly like the example above with the microcontroller. Resistor size is calculated the same way.

DDC allows you to use up to 16 microcontroller pins as output pins, more on this under the

The other parts of this circuit is explained under , the only difference is the interupt pin INT# is not used, since it is only needed when using the port expander for inputs. It is pulled up to VCC with a 10k resistor.

Keep in mind the from a port expander.

online calculator
coding section.
PCA9555's own documentation
maximum pin current