Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

Thread: Controlling the Power Supplied to Touchscreen's LED Pin

  1. #1
    Junior Member
    Join Date
    Aug 2016
    Posts
    18

    Controlling the Power Supplied to Touchscreen's LED Pin

    I'd like there to be a button on the touchscreen that cuts power to the screen's LED pin, and then any touch on the screen restores power. Even with nothing on the screen, the backlight is too bright to have the screen displayed next to my LED strip.

    Ideas I have:
    1. Use a PWM or digital pin to provide power to the screen's LED pin
    2. Use a transistor controlled by a digital pin to provide power

    I'd like to do option 1 since it doesn't add any hardware components. I'm just concerned that the screen may require more current than a digital pin can supply. I'm also wondering if I'd still need the 100 ohm resistor between the power source and the screen.

  2. #2
    Senior Member
    Join Date
    Apr 2013
    Posts
    1,899
    To pin that down you need to know more about the design of the screen. Some already have a FET drive for the backlight so that makes it easy to PWM etc, others directly drive the LED from the pin and you'd need to find the current draw, either by measurement or from some sort of data sheet. Basic rule of thumb suggests that if there are visibly more than 2 LEDs in there you will be exceeding the pin drive capability and need to have a transistor drive stage.

  3. #3
    Junior Member
    Join Date
    Aug 2016
    Posts
    18
    Thanks Gremlin. If I tried powering it straight from a digital pin to see if it'd work, is there a chance I can damage the board if it draws too much current?

  4. #4
    Senior Member
    Join Date
    Apr 2013
    Posts
    1,899
    Yep. It's not garunteed and have seen them survive pretty horrible things but you risk not just damaged to the pin but also to the entire CPU if you manage to exceed it's total current capacity as well.

    If you want the poke it and see approch a 330 ohm resistor will clamp current to 10mA for a connection to ground, which is inside the pin capacity. If you know more about the diode voltages you can reduce that staying inside 10mA but would be a starting point. If they are white LEDs the may not even light from a 3.3V supply and 10mA is not very much in lighting terms (3.3V @ 0.01A = 33mW of light if magically 100% efficient).

  5. #5
    Senior Member
    Join Date
    Jan 2013
    Posts
    843
    I'm guessing from 100Ohm comment that you have the PJRC ILI9341 touchscreen. The digital pins will only output 3.3V which is a huge difference compared to powering the backlight from 5V.

    You can use multiple pins to share to the current. E.g. like this:
    Code:
             pin 1  ----- 200 Ohm -----|
    Teensy   pin 2  ----- 200 Ohm -----|------ backlight
             pin 3  ----- 200 Ohm -----|
             pin 4  ----- 200 Ohm -----|
    I'm guessing that 200Ohm is a good value. 4x in parallel are effectively 50Ohm, which will somewhat compensate for the lower voltage. 200Ohm @ 3.3V is 16.5mA max, well below the absolute maximum rating of 25mA / per pin current for Teensy 3. Make sure the current is 9mA or less, that's what the Teensy is rated for (continuous operation). (9mA corresponds to a voltage of 1.8V across the 200Ohm resistor.)

    You can control brightness by driving less pins. Set the pins to open drain output mode or input mode to turn them "off". Don't drive a mix of them low / high, you will have a high current flow between them (but there won't be damage if you only do it briefly).

    To set the pins to high drive strength (otherwise you only get 2mA per pin):
    https://forum.pjrc.com/threads/31941...ll=1#post91453

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •