Go Down

Topic: SMD MOSFET to power down my SMD H-Bridge (Read 5839 times) previous topic - next topic

SouthernAtHeart

Adding a 16x2 LCD in low quiescent mode

I got the RTC DS3234 added into my schematic.  One more thing I'm going to need is an LCD screen to enable the user to set the date/time.
For all the more it'll be used (probably once in 10 years if the coin cell last as long as they say they do), I won't even bother with the back light.  And data sheets I've looked at are showing Vcc for LCDs to only be 1-2 mA, so I can power that from a digital pin, too.  Would a 150 ohm resistor be good between the I/O pin and the Vcc on the LCD?

What about the 6 I/O pins controlling the LCD?  I know they're a kind of communication lines, but I just use a liquid crystal library to control them.  I'll likely be losing some current through them?  After the user is done setting the time, I could disconnect the LCD, only I don't see a LCD.end() function only the LCD.begin().  Will the be any power consumption from this connection?
thanks.
PS. I've read some threads about powering off the backlight, but what I need to do is power off the whole LCD.

dc42


One more thing I'm going to need is an LCD screen to enable the user to set the date/time.
For all the more it'll be used (probably once in 10 years if the coin cell last as long as they say they do), I won't even bother with the back light.


Then get a reflective mode LCD display, otherwise you may find the LCD display very hard to read without the backlight.


And data sheets I've looked at are showing Vcc for LCDs to only be 1-2 mA, so I can power that from a digital pin, too.  Would a 150 ohm resistor be good between the I/O pin and the Vcc on the LCD?


Yes, that's what I do.


What about the 6 I/O pins controlling the LCD?  I know they're a kind of communication lines, but I just use a liquid crystal library to control them.  I'll likely be losing some current through them?  After the user is done setting the time, I could disconnect the LCD, only I don't see a LCD.end() function only the LCD.begin().  Will the be any power consumption from this connection?


You need to drive all the pins connected to the LCD low before turning off its power, then they won't draw any current.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

SouthernAtHeart

Quote
You need to drive all the pins connected to the LCD low before turning off its power, then they won't draw any current.


They will already be set from the LCD.begin() function.  What will I need to do to turn them low, just digitalWrite(pin, LOW)?
Or will I first need to use pinMode(pin, OUTPUT)?
thanks.

dc42

#33
Mar 27, 2013, 07:20 pm Last Edit: Mar 27, 2013, 07:24 pm by dc42 Reason: 1

What will I need to do to turn them low, just digitalWrite(pin, LOW)?


Yes. BTW there is a problem with the LiquidCrystal library: it makes a call to the begin() function in the LiquidCrystal constructor (a very silly thing to do IMO, and completely unnecessary because you should call begin() in setup). So you should preferably patch the LiquidCrystal library source file to remove this call, to avoid feeding power through the I/O connections before you power up the LCD.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

SouthernAtHeart

#34
Mar 27, 2013, 09:42 pm Last Edit: Mar 27, 2013, 09:44 pm by SouthernAtHeart Reason: 1


What will I need to do to turn them low, just digitalWrite(pin, LOW)?


Yes. BTW there is a problem with the LiquidCrystal library: it makes a call to the begin() function in the LiquidCrystal constructor (a very silly thing to do IMO, and completely unnecessary because you should call begin() in setup). So you should preferably patch the LiquidCrystal library source file to remove this call, to avoid feeding power through the I/O connections before you power up the LCD.

Is there an updated library that fixes this?  I don't know anything about working with or editing libraries.

Edit:  ill search around about this. I should've done so before asking more about it.

SouthernAtHeart

#35
Mar 28, 2013, 03:22 am Last Edit: Mar 28, 2013, 04:33 am by SouthernAtHeart Reason: 1
Quote
Yes. BTW there is a problem with the LiquidCrystal library: it makes a call to the begin() function in the LiquidCrystal constructor

Searched for 20 minutes, but couldn't come up with any more info about this. Is this something that I need to address?
Quote
avoid feeding power through the I/O connections before you power up the LCD

Will this matter?  If so, I assume you mean I should edit one of the text files on my Mac?  Under /Applications/Arduino.app/Contents/Resources/Java/libraries/LiquidCrystal I found 2 files that look like something you might mean to edit?  These came with the Arduino IDE, if something's not right with one of them I'm surprised I couldn't find anything about it around here.
Please advise.


also, here is my completed schematic for the H-bridge shutdown.  I tried to tidy it up a bit, and I think I understood where to add/remove the caps, but if you could check it out, I'd sure appreciate it.

dc42

You only need C9 if you also have the other 0.1uF capacitor between Vdd of the 9986 and ground.

To fix the LiquidCrystal library to allow for the LCD not being powered up permanently, edit the LiquidCrystal.cpp file, commenting out the call to begin() at the end of the init() function.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

SouthernAtHeart

Very good!  I found the begin() statement and commented it out.  

I reckon I should use the backlight for my LCD, then.  I searched and found this schematic that turns is on and off.  I cuts the NEG side, but I reckon the POS side isn't connected to the LCD's POS, so it won't back feed into it when I power off the LCD's chip.  Not sure about the value of R7.  Running from 4.5v, I may not need a very high resistor?

One thing I don't know/understand.  When I power down this circuit by a LOW arduino pin, there won't be any current left flowing in the BSS1338 mosfet, then will there? See the attached clip from the BSS1338 data sheet. Does that mean there'll be .5 uA current loss all the time?  Accord Nick Gammon's arduino power page, I can get the Atmega down to .335nA, so the current in the BSS1338 is considerable.  I reckon the one controlling my H-bridge will add another .5uA.

dc42


I reckon I should use the backlight for my LCD, then.  I searched and found this schematic that turns is on and off.  I cuts the NEG side, but I reckon the POS side isn't connected to the LCD's POS, so it won't back feed into it when I power off the LCD's chip.  Not sure about the value of R7.  Running from 4.5v, I may not need a very high resistor?


Depending on the LCD display, you may not need any resistor at all, because some displays have the series resistor built-in.


One thing I don't know/understand.  When I power down this circuit by a LOW arduino pin, there won't be any current left flowing in the BSS1338 mosfet, then will there? See the attached clip from the BSS1338 data sheet. Does that mean there'll be .5 uA current loss all the time?


0.5uA is the maximum, it may typically be much lower. For example, the datasheet for 2N7002 says 0.01uA typical, 1uA maximum @ 25C.


I reckon the one controlling my H-bridge will add another .5uA.


Don't forget the P-channel mosfet, that will have some zero gate voltage drain current too.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

SouthernAtHeart

Thanks for all1. I think that's pretty well it on the hardware end of the project. Will get some actual readings from the motor with its load attached, and see what amperage I'm using.  Then will make the final decision on whether to use AA or C cells. Will report back.

SouthernAtHeart


Running from 9V, you definitely need R1, R2 to be 2 x 1K. However, your schematic is wrong. They need to be in series, not in parallel, and the gate drive to the P-channel mosfet needs to be taken from the junction of the two.

I would connect the 100nF capacitor to the source terminal of the P-channel mosfet instead of the drain terminal, and put a much larger electrolytic capacitor (e.g. 1000uF) in parallel with it. Position the P-channel mosfet and capacitors close to the 9986, and keep the traces connecting these 4 components short.


I'm finishing up my board to send off to the fab house.  Everything on this board is very small, except that 1000uF CAP.  Is that correct, a 1000uF size?  Just checking, thanks.



dc42

1000uF was just a suggestion. You can use a lower value, but the ripple current rating should be at least half the maximum motor current. Maybe something like http://uk.farnell.com/rubycon/10tzv470m8x10-5/capacitor-smd-470uf-10v/dp/1281858RL. The purpose of the capacitor is to reduce noise on the power and ground lines when you PWM the motor.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

SouthernAtHeart

#42
Jun 29, 2013, 04:12 am Last Edit: Jun 29, 2013, 04:18 am by SouthernAtHeart Reason: 1
You need to drive all the pins connected to the LCD low before turning off its power, then they won't draw any current.

Here is a test code I made to be sure I'm properly powering up/down my LCD.  How does it look?  I don't want to test it on my LCD in case it's wrong and I mess up my LCD.

Code: [Select]
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(A7,A0,A2,A3,A4,A5);
int LCDpins[] = {
 A7, A0, A2, A3, A4, A5};
int LCDpower = 4; //pin controlling LCD power
unsigned long LCDtimer;  //counter

void setup() {
 //don't use LCD.begin() here, correct?
 pinMode(LCDpower, OUTPUT);  //set pin as output
 digitalWrite(LCDpower, LOW); //maybe not needed?
}

void loop() {
 if (millis() - LCDtimer > 10000) {  //every 10 seconds
   LCDtimer = millis();  //update counter
   display_something();  //activate the LCD
 }
 //do other stuff...
 delay(100);

}

void display_something() {
 digitalWrite(LCDpower, HIGH); //power up the LCD
 lcd.begin(16, 2); //start the LCD
 lcd.clear(); //clear the screen
 lcd.print(millis());  //print the time
 delay(2000); //give user time to read it
 for (int i = 0; i < 6; i++) {
   digitalWrite(LCDpins[i], LOW);
 }
 digitalWrite(LCDpower, LOW);  //power down the LCD
}


dc42

That looks ok to me. You may need to insert a delay between powering up the lcd and making the begin() call.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

SouthernAtHeart

Well, DC42, after getting my first version board back from the fab house, I discovered a few design mistakes, so I'm going to redo it.  I couldn't get the LCD to work, but I'm pretty sure it was something more to do with the LCD, rather than the schematic.  The LCD was this tiny one like the one pictured with a FCP connector, and I'd never used one like it before.  I've recently learned about these little OLED displays like adafruit sells, and want to switch to them on my next attempt at a board. (see link).  The OLED display uses very little current, so I'm guessing I can control it's power directly from a digital pin?
Quote
The power requirements depend a little on how much of the display is lit but on average the display uses about 20mA from the 3.3V supply
Seems I read somewhere else that with all the pixels lit one used 50ma.  I'll just be using it for text, not graphics, so I won't have anywhere near all the pixels used.
It may be a little while before I resume this project, I'll be gone a few weeks, but here a picture of the schematic I'm guessing will work for powering up/down the OLED from the Atmega328's D4 pin.  Would the I2C pull-ups get connected to D4 as well?
http://learn.adafruit.com/monochrome-oled-breakouts/overview

Thanks for taking a look at this.

Go Up