suggestion for a transistor and setup

hello,

I am going to build a very simple allarm clock
my plans are:
arduino nano
lcd 16x2
lipo 1 cell with step-up
transistor to turn the lcd on only when needed

so my problem is with the transistor, the lcd of the allarm clock will be off 99% of it's time so i would like to power it with a switch transistor, am i wrong or should i use a npn?

i currently have the irLz44n so perfect for logic level, could i use them?
or did i completely misunderstood everything and i need a pnp?

You’re not wrong, you can switch the LCD screen with a transistor, but that depends on certain things.

How much voltage and current does your LCD screen need? If it ain’t much you can go with transistors, else use a logic level mosfet.

thanks noobian,

the lcd is the "typical" lcd all arduino folk used when they started, so 5V and i am without multimeter at the moment to check the absorpion, but i guess it is under 0.5A

I am not sure about the difference between a transistors and a logic level mosfet, could you explain it?
anyway the irLz44n is rated to 29A (i am not sure to have read correctly the datasheet) so i think it is ok

While i am here i would like to buy a PNP transistor for future usage, always logic levels, i need it working also on 3.3V, any suggestion?

edit: LCD Backlight current - Displays - Arduino Forum yes the current should be under 0.5A

Hi,

To answer your question,

A transistor “receives” current into the base - emitter connections (aka junction). It multiples that current by ~10 or 20 and allows that much current to flow from the collector to the emitter. It doesn’t create current, the circuit must do that. If you exceed the current that is allowed, the transistor collector will start to increase above “0”.

A Mosfet “receives” voltage at the Gate to Source junction. It allows much larger current to flow in the Drain - Source junction (actually channel) based on the device’s specification (aka design).

The advantage of the Mosfet is that is draws nearly no current into the gate so there is very little load on the nano output pin. CAUTION different mosfets require different voltages on the gate to operate. For the nano you want to look for a "logoc: level Mosfet (Which the IRLZ44N is).

Now I’ve taken huge liberties from semiconductor theory in the above in the name of simplicity. So be aware for complex applications more information should be sought out.

For your application I would suggest a 2N7000 it is a small part and many have found it very useful. Note when you look at the data sheet, look at “Gate to Source threshold voltage” this is the voltage where the Mosfet starts to turn on. It doesn’t take much voltage above this to turn on fully.

Hope this helps

Good luck

ok now i am sure that i don't know a transistor work, i took it from google and modified:

i thought that when i put the pin LOW there is NO connection between the LCD and GROUND so no flow of current
and when i put the pin HIGH there is flow of current from the battery throught the lcd until ground

i thought that the transistor is a kind of "switch", i am sorry if it sound funny and stupid but i never studied electronics i am in a very different field

aster94:
yes the current should be under 0.5A

Normal npn transistors can't really handle that much current, so you would have to go with a darlington transistor like the TIP122 but since you don't have that component and you already have a logic level mosfet I suggest use the mosfet.

aster94:
i thought that when i put the pin LOW there is NO connection between the LCD and GROUND so no flow of current
and when i put the pin HIGH there is flow of current from the battery throught the lcd until ground

i thought that the transistor is a kind of "switch", i am sorry if it sound funny and stupid but i never studied electronics i am in a very different field

Actually that is how they work and you are correct with that diagram and explanation. Except for the LCD screen you will need a powerful transistor.

i am still very confused

Noobian:
Normal npn transistors can't really handle that much current, so you would have to go with a darlington transistor like the TIP122 but since you don't have that component and you already have a logic level mosfet I suggest use the mosfet.

Actually that is how they work and you are correct with that diagram and explanation. Except for the LCD screen you will need a powerful transistor.

as far as i know if the current flows between the battery throught the lcd until ground, the current for the lcd "cames" from the battery! reading what you wrote i am wrong, but i don't understand how

reading what you wrote i am wrong,

No. Nothing was said that contradicts your impression that the current for the LCD comes from the battery.

Grumpy_Mike:
No. Nothing was said that contradicts your impression that the current for the LCD comes from the battery.

someway yes,
"Normal npn transistors can't really handle that much current"
it looks like that the current of the lcd is provided by the arduino pin!

Switching the ground pin of an LCD and leaving all the data pins connected seems a very bad idea.

Did you measure how much that LCD is using with backlight turned off?
Leo..

no, honestly i thought that it wouldn’t have been a big problem. but i guess you don’t think it, could you explain it? and maybe suggest a better solution

Not much of a clock without a clock module.

not very needed, it is an allarm clock, 1-2 seconds of sleeping more or less never killed someone

Noobian:
Normal npn transistors can’t really handle that much current

Using a 150 ohm base resistor with a 2N2222 or better switching transistor, 0.5A is just doable
with a bipolar transistor. 0.5A seems more thah is likely to be needed.

Make sure that you make all the logic pins high-impedance (INPUTs) before powering down the
LCD.

You will also need an RTC module in your list of parts I think.

MarkT is correct, a 2N2222 will work fine. The specification I have for a “typical” LCD display states the nominal current for the display and backlight is 0.229 amps.

My personal preference is to use the mosfet with a 2k between the nano and gate of the mosfet.

My reasoning: (for hobby related designs, not necessarily production)

  1. I like to keep the power down on the nano.

  2. with the 2k there, if the mosfet fails or is miss-wired the nano will be spared. Assuming your system is below 24Vdc or so.

Again these are my preferences, MarkT’s statement is absolutely correct, the 2N2222 will work fine. Especially if you already have them.

Good luck

"Switching the ground pin of an LCD and leaving all the data pins connected seems a very bad idea."

The data and control signals should all be driven low when the NPN transistor is off so the LCD is not powered thru the lines.

This simple clock code will keep pretty good time without a clock module. Add some button reads to adjust the time, or add an alarm function.

unsigned long currentMicros;
unsigned long previousMicros;
unsigned long elapsedTime;

// Initial time to start, adjust as needed.

byte hundredths;
byte tenths;
byte oldTenths;
byte secondsOnes = 0;
byte oldSecondsOnes;
byte secondsTens = 0;
byte minutesOnes = 2;
byte minutesTens = 3;
byte hoursOnes = 4;
byte hoursTens = 0;

void setup() {

  Serial.begin(115200); // make serial monitor match
  Serial.println ("Setup Done");
}

void loop() {

  currentMicros = micros();

  // how long's it been?
  elapsedTime = currentMicros - previousMicros;
  if ( elapsedTime >= 10000UL) { // 0.01 second passed? Update the timers
    previousMicros  = previousMicros + 10000UL;

    hundredths = hundredths + 1; // increment
    if (hundredths >= 10) {
      hundredths = 0; // else rollover and increment next digit

      tenths = tenths + 1;
      if (tenths >= 10) {
        tenths = 0;
        secondsOnes = secondsOnes + 1;
        if (secondsOnes >= 10) {
          secondsOnes = 0;
          secondsTens = secondsTens + 1;
          if (secondsTens >= 6) {
            secondsTens = 0;
            minutesOnes = minutesOnes + 1;
            if (minutesOnes >= 10) {
              minutesOnes = 0;
              minutesTens = minutesTens + 1;
              if (minutesTens >= 6 ) {
                minutesTens = 0;
                hoursOnes = hoursOnes + 1;
                if ((hoursTens == 2) && (hoursOnes == 4)) {
                  hoursOnes = 0;
                  hoursTens = 0;
                }// hours total rollover check
                if (hoursOnes >= 10) {
                  hoursOnes = 0;
                  hoursTens = hoursTens  + 1;
                } // hoursOnes rollover check
              } // minutesTens rollover check
            } // minutesOnes rollover check
          } // secondsTens rollover check
        } // secondsOnes rollover check
      } // tenths rollover check
    } // hundredths rollover check
  }// hundredths passing check

  if (oldTenths != tenths) { // show the elapsed time
    oldTenths = tenths;
    Serial.print(hoursTens);
    Serial.print(hoursOnes);
    Serial.print(":");
    Serial.print(minutesTens);
    Serial.print(minutesOnes);
    Serial.print(":");
    Serial.print(secondsTens);
    Serial.print(secondsOnes);
    Serial.print(".");
    Serial.println (tenths);

  } // end one second check

} // end loop

aster94:
I am not sure about the difference between a transistors and a logic level mosfet, could you explain it?

While i am here i would like to buy a PNP transistor for future usage, always logic levels, i need it working also on 3.3V, any suggestion?

Most BJT switching transistors already work on base voltages above 2V so there you don't have to specifically look for transistor term as "logic level". And also don't get confused between a PNP and an NPN. While you're at it also buy some darlington transistors.

It's Mosfets that need high voltage on the gate, probably 10V or more to fully open, which is why they can't be used on arduino output pin which tops out at 5V. This is why you need to look for special Mosfets labelled as logic level, these can open their gate at a lower voltage like 5V .

In your case you have a IRLZ44N which is a logic level mosfet as you can see in the third letter "L" which indicates it as a logic level. There is also the standard version of this mosfet which is an IRFZ44N which is not a logic level mosfet and you cannot control it directly from an arduino pin, but you can control it using some additional transistors and the circuit will look a bit complicated for you. So better to use logic level Mosfets.

MarkT:
Using a 150 ohm base resistor with a 2N2222 or better switching transistor, 0.5A is just doable
with a bipolar transistor. 0.5A seems more thah is likely to be needed.

you mean a 2N2222A right? isn't it being pushed to it's limits with a 1.5 to 2 Watt lcd screen

JohnRob:
The specification I have for a "typical" LCD display states the nominal current for the display and backlight is 0.229 amps.

Typical lcd being the 16x2 black on green ones. The 16x2 white/yellow on blue ones use more current.

CrossRoads:
"Switching the ground pin of an LCD and leaving all the data pins connected seems a very bad idea."

The data and control signals should all be driven low when the NPN transistor is off so the LCD is not powered thru the lines.

I think you mean HIGH, or high impedance(input).

If you switch/disconnect ground of a device, then everything becomes VCC.
Leo..

@aster94

If the component you already have in hand works for the application then it’s better to use that instead of buying a new one.

You said lcd will be 99% of time OFF. I’m guessing only the backlight will be OFF since it’s an Alarm clock? or will the entire display be OFF and turns ON only when the alarm rings or when you press a button?

Hi,

Do you want to just turn the backlight OFF or the whole LCD PCB?

Have you tried powering the LCD OFF then ON, to see if it is happy with rebooting?

Switching the LCD off from the gnd side is not recommended as @Wawa has said.

If the LCD is happy being turned OFF and ON, you will need to switch the 5V supply to the LCD PCB.

BUT check first if disconnecting power from the LCD then reconnecting will make the LCD initialise and communicate with your Arduino.

Tom... :slight_smile: