ILI9341 TFT how to save power with no touch for 30 seconds?

Status
Not open for further replies.

Matadormac

Well-known member
Hi all.

I have a working battery powered portable light meter project using the ILI9341 TFT and XPT2046 touch screen. This is with a Teensy 3.2 There are also a number of sensors attached.

There are four active buttons on the TFT for various functions.

Right now a "No Touch" signal is sent if 30 seconds elapse without a touch on the TFT.

The project draws between .04 and .06 amps at USB voltage (using Adafruit USB power meter).

I would like to save power during intervals of "no touch". Can the power draw for the LCD be diminished somehow and then returned upon a fresh touch? I was wondering if the LCD backlight might be turned down or off.

I am not looking at a hibernate or snooze function right now but perhaps I should.

I am looking forward to your thoughts.

Thank you.
 
You could connect the backlight to a Teensy-PWM-PIN, using a small extra circuit with Transistor+FET for example.
The plus is, you can control the brightness very smooth.
 
I use this circuit - i had the components at home :)

PWM.png

"LED" is a Teensy-PWM PIN, the display-LED is connected to the 10ohm resistor, "VIN" is 5 V.

I do not know wether this circuit is good, and esp. wether the resistor-values are optimal or not. But it works.
Question to the others: How could this be done better ?
 
Last edited:
Really nice. Thank you. I will give this serious consideration. I think I could build it too. How do you control this in sketch code?

Regards

Matadormac
 
Thank you again. I don't have the parts on hand at home but they are now on order (enough for more than a few LCD's LOL). It will be interesting to see if and how much energy is saved.

Best
 
Thank you again. I don't have the parts on hand at home but they are now on order (enough for more than a few LCD's LOL). It will be interesting to see if and how much energy is saved.

Best

I had the n-fet from an old (years old) project left over.

For my Display and the above circuit, the difference between Backlight-off ( analogWrite(pin, 255) ) and full-bright-on ( analogWrite(pin, 0)) is ~~60mA.
I think, you could save a bit more with putting both the ILI9341 itself and Teensy into sleep-mode.

Frank
 
Last edited:
I guess my next question would be if I put the display to sleep will the touch function still be active enough to sense a touch to trigger coming awake.

I have never worked with the sleep and hibernate functions of the Teensy so this is an upward learning curve for me.

Thank you
 
Frank, will your circuit work on a 3.3v PWM pin and a 3.3v pull-up.? I need to control dimming with my ILI9341 as well. Can't you just use a pn2222 transistor with 1k resistor to the base tied to a PWM pin, the emitter tied to the anode of the backlight led and the collector pulled up with 100ohm resistor without using the bs108 fet?

Tnx.
 
Frank, will your circuit work on a 3.3v PWM pin and a 3.3v pull-up.? I need to control dimming with my ILI9341 as well. Can't you just use a pn2222 transistor with 1k resistor to the base tied to a PWM pin, the emitter tied to the anode of the backlight led and the collector pulled up with 100ohm resistor without using the bs108 fet?

Tnx.

Yes it works with any 3.3v PWM pin. What do you mean with 3.3v pullup? You don't neeed a additional pull-resistor, the 47k on the n-fet is already a "pullup"..

Your other idea: don't know. Maybe the others can say more?.

I'm kind of a noob with analog electronics :) I'd say a single NPN is not enough, but i'm not sure. You have a ~0.7v Voltage drop, but, again with 5v.. hm..could you try it and report back ? i guess the brightness must be much less compared to the fet-circuit above.

@Matadormac: The touch-ic is a different IC, so i'd say you can put the ILI to sleep without problem.
 
Last edited:
Frank B, thank you. I wondered if that might be the case. Will report back when I get the parts and get it working.

Thanks again.
 
Frank, just so you know. I put together a quick circuit using the N2222 transistor driving the base of the transistor with the PWM pin through a 1K resistor, I then pulled up the collector to 3.3V with a 100ohm resistor and tied the Touch screen backlight pin to the emitter. The backlight on the ILI9341 has a 10ohm resistor on that line, so it shouldn't need anymore current limiting.

The bottom line is, it does kind of work, but the backlight is not very bright with the analogWrite set to 255 which is kind of what you were saying. I also tried a 2N3904 power amplifier/switch transistor too in place of the n2222 transistor and it has the same results. I think if maybe I was using 5V for the N2222 transistor circuit it might have worked since that is what this guy is doing with an uno http://gordonsprojects.blogspot.com/2014/04/arduino-tft-serial-spi-22-ili9341.html and it works for him. But I'm using just a 3.3V device and I'm sure that is my problem.

Anyway, I guess if no one else has any other ideas, I'll just order the n-fet and try your circuit since I can't really find anyone else using the Teensy 3.3v device and adding a backlight dimming control to the ILI9341 display. I'm not electrical guru either, but just a software engineer looking for an easy solution =)

Tnx.
 
Last edited:
Frank, just so you know. I put together a quick circuit using the N2222 transistor driving the base of the transistor with the PWM pin through a 1K resistor, I then pulled up the collector to 3.3V with a 100ohm resistor and tied the Touch screen backlight pin to the emitter. The backlight on the ILI9341 has a 10ohm resistor on that line, so it shouldn't need anymore current limiting.

The bottom line is, it does kind of work, but the backlight is not very bright with the analogWrite set to 255 which is kind of what you were saying. I also tried a 2N3904 power amplifier/switch transistor too in place of the n2222 transistor and it has the same results. I think if maybe I was using 5V for the N2222 transistor circuit it might have worked since that is what this guy is doing with an uno http://gordonsprojects.blogspot.com/2014/04/arduino-tft-serial-spi-22-ili9341.html and it works for him. But I'm using just a 3.3V device and I'm sure that is my problem.

Anyway, I guess if no one else has any other ideas, I'll just order the n-fet and try your circuit since I can't really find anyone else using the Teensy 3.3v device and adding a backlight dimming control to the ILI9341 display. I'm not electrical guru either, but just a software engineer looking for an easy solution =)

Tnx.

hm, 3.3v
my circuit is meant for 5v too. You can try it, but i did not test it with 3.3v. I think, you might want to try an other n.fet with less on-resistance and voltage, remove my 10 OHM resistor and maybe change the other resistor-values...

the bs108 is quite old, there should be better ones today.
 
Last edited:
Actually, I got messing around and found that if I just tie the 3.3V PWM pin directly to the LED Backlight and use the map command (e.g. int level = map(Backlight% 0-100,0,100,0,255); ) it appears to the work pretty well w/o needing extra hardware. When I map the % down to 0-255 it dims down really nice within that range using my touch screen slider bar.

Currently I'm using all 3 PWM timers for driving some LED diodes at various frequencies, so to incorporate the backlight into a PWM pin I'll probably have to add an ATTINY85 into my project and control the backlight from a PWM pin on that chip and control the dimming via the I2C interface tied to the teensy board =)

Tnx.
 
Last edited:
Actually, I got messing around and found that if I just tie the 3.3V PWM pin directly to the LED Backlight a

oh... please take care of the current. the backlight needs more than the pins can provide. not healthy for the poor teensy...
 
yeah I know, I actually have it running through a 100ohm resistor into the PWM pin. It works pretty we'll. I added a sleep timer so it dims the display after a predefined time. Ultimately, I'm going to move the display LED backlight control on to a PWM pin on an ATTINY85 board which I will control over the I2C bus.

I'm designing a medical cold laser LLLT device with 3 Lasers tied to the PWM pins 3,5,25 which are on 3 different Teensy timers. Each Laser is driven at various frequencies, so I can't use the extra PWM pins that are tied unto the same timer otherwise the backlight will not be steady as the frequencies change below 200hz on the same pin set. The Teensy 3.2 has 12 PWM pins, but only 3 dedicated timers. Maybe there's a way to detach a PWM pin from the default timer since I just need a frequency in the kHz range that I can modify the duty cycle with. Not sure if I can do this, so I was just planning to use the ATTINY85 board to provide me an extra PWM pin with a separate frequency timer that I can control the backlight through. I have to say, the Teensy board is pretty amazing though and can do so much =)
 
Frank, for what it's worth I found another solution that allows me to control my touchscreen backlight via a library called SoftPWM. On the Teensy 3.0> boards they have a pool of Intervaltimers and the SoftPWM library utilizes these timers to simulate a PWM output on any nonPWM pins. It actually works =) The frequency isn't very high I don't believe, but I don't see any flicker when I adjust the duty cycle from 0-255. This allows me to use the other timer dedicated PWM pins for my project while the SoftPWM just drives the backlight intensity.

// ---------------------------------------------------------------------------
// Fade tft screen backlight up
// ---------------------------------------------------------------------------
void fadeUpTFTBacklight( int newRate )
{
int analogLevel = map(newRate,0,100,0,255); // map % to analog scale

// fade up to new level
for(int i=prevBacklightAnalogLevel; i <= analogLevel; i++ )
{
SoftPWMSet(TFTBacklight_Pin, i);
delay(10);
}
prevBacklightAnalogLevel= analogLevel;
}

// ---------------------------------------------------------------------------
// Fade tft screen backlight down
// ---------------------------------------------------------------------------
void fadeDownTFTBacklight( int newRate )
{
int analogLevel = map(newRate,0,100,0,255); // map % to analog scale

// fade down to new level
for(int i=prevBacklightAnalogLevel; i >= analogLevel; i--)
{
SoftPWMSet(TFTBacklight_Pin, i);
delay(10);
}
prevBacklightAnalogLevel= analogLevel;
}
 
It's worth throwing out there, depending on the display module itself, you may not require any transistors as these are already present on board. Rather, just supply a pwm signal to control it.
 
From what I've read in this thread however, wildview hasn't actually said which specific module he has?
 
Status
Not open for further replies.
Back
Top