Ultra low power microcontroller design - LCD Clock - Page 1
Forum section: electronics / projects

author: Howardlong
author_rank: Super Contributor
timestamp: January 02, 2017, 11:31:13 pm
content: Edit 15 Jan 2022: see also updated sub microwatt version here:https://www.eevblog.com/forum/projects/ultra-low-power-mcu-design-the-nanowatt-clock/https://youtu.be/yyoR0o5YBVIAim: make a useful microcontroller project that will work in under 1uA aggregate current, to be powered by one or two of those tritium/solar cells that Nurd Rage built.Result: An LCD clock is close, it worked, but not quite sub 1uA. Despite a lot of work, 1.8uA was the best I managed, so about 100+ years on a pair of AAs if they didn't self discharge and leak all over the place beforehand.It's based on PIC24FJ256GA410 Nanowatt XLP processor. i couldn't achieve one or two of the datasheet delta current specs by some way, particularly the low voltage sleep current by an order of magnitude (60nA spec'd, 550nA achieved), others weren't spec'd or occasionally I achieved better.What I learned...O Don't trust all datasheet and marketing specs;O Prototype everything first (I knew this already, this just reinforces it);O Clean your boards or your current measurements are shit with ultra low power stuff;O Closely follow crystal specs and layout for ultra low power oscillators;O Measure high dynamic range very low duty cycle aggregate current, and it's not the uCurrent (at least not on its own).O Remove your debugging/programming tool when taking current measurements.Non-junk box parts:o Microchip PIC24FJ256GA410-I/PT Farnell ref 2493343o Abracon ABS25-32.768KHZ-T Farnell ref 1611824o LCD Clover Display 5042PHRwww.rs-online.comref 184-7737Oscillator startup times from cold power up, VDD yellow, 8MHz FRC green, 32.768kHz crystal oscillator blue. Note that I modified the code to output the SOSC on a buffered REFO pin as probing the SOSC low power oscillator crystal directly is extremely difficult to do without stopping the oscillator. Even spring grounded techniques with Tek 3.9pF/10Mohm load passive probes, or 0.6pF/0.3pF single ended/differential 100kohm FET browser probes stopped the oscillator.The low power secondary oscillator is very picky about crystals, 0402 22pF loading caps and parasitics, so I soldered them directly on the breakout board and isolated the two SOSC pins from the breadboard by cutting the tracks. There is a ground adjacent to one of the SOSC pins where both the caps terminate. The device's pitch here is 0.4mm to give a sense of scale. Not sure if the obligatory cat hair has any beneficial effect. I know it's not one of mine, I'm bald as a coot.

author: edavid
author_rank: Super Contributor
timestamp: January 02, 2017, 11:43:33 pm
content: Nice!What's the current with the LCD disconnected?

author: kiran_shrestha
author_rank: Regular Contributor
timestamp: January 03, 2017, 01:20:30 am
content: I suggest to go paper displays , as do not eat any current when display is not updating and remove the "seconds" part of the circuit and update only at a minute. You can get oh very less current and hell long life.

author: Ian.M
author_rank: Super Contributor
timestamp: January 03, 2017, 01:35:19 am
content: A common cause of PIC MCUs not meeting sleep mode current specs even though all possible optional modules have been powered down, and no inputs have been left floating, is ESD damage.

author: Howardlong
author_rank: Super Contributor
timestamp: January 03, 2017, 06:25:06 am
content: Quote from: Ian.M on January 03, 2017, 01:35:19 amAll done. Moved on quite away from that stage I'm afraid. In this case, I am fairly sure there's a typo in the device's data sheet. The low voltage sleep mode shows less than for deep sleep, and he difference between 25 deg C and 60 deg C is over 50 times, 60nA to 3.6uA. I get around 550nA with all peripherals off, both WDTs off, all BORs off, all oscilators off, all I/Os force low in low voltage sleep. I even went as far as suspecting cap leakage. The biggest delta was to get the breakout board cleaned, went from 3uA or so down to 500nA. I knew something wasn't right as I could get a DIP device plugged to the breadboard down to 100nA or so deep sleep on a PIC24F08KA102.I couldn't get deep sleep to work as specified either on the LCD device, about 5uA compared to 100nA in the data sheet. Not much use anyway, the LCD wouldn't work in deep sleep.

author: Howardlong
author_rank: Super Contributor
timestamp: January 03, 2017, 06:27:16 am
content: Quote from: kiran_shrestha on January 03, 2017, 01:20:30 amI's already looked but the ones I found were far more power hungry than a static LCD. Do you have a device in mind?

author: Howardlong
author_rank: Super Contributor
timestamp: January 03, 2017, 06:34:43 am
content: Quote from: edavid on January 02, 2017, 11:43:33 pmIt's about 300nA for the display depending on the number of segments that are on, and 400nA for the LCD peripheral depending in the speed it's running (16Hz here). Using a smaller (lower capacitance) display and fewer segment would, of course, reduce this. By using only four digits, and therefore only updating the display every minute and not flashing the colons every half second would also be pretty beneficial as the device would only be waking up 1/120th of the time.

author: richardlawson1489
author_rank: Regular Contributor
timestamp: January 03, 2017, 01:51:45 pm
content: Happy Nerd Year! Nice project. I would love to know more about your project.

author: Howardlong
author_rank: Super Contributor
timestamp: January 03, 2017, 02:57:29 pm
content: Quote from: richardlawson1489 on January 03, 2017, 01:51:45 pmI have done a video on it but five minutes of it need re-shooting as it was out of focus. I'll publish the URL here in the next day or so.

author: Howardlong
author_rank: Super Contributor
timestamp: January 04, 2017, 09:22:29 am
content: I've updated the original post:o Embedded the video;o Added a picture of the basic schematic;o Added three attachments including two source files and the spreadsheet I used to hook up the LCD, and generate code to paste into C source files;o Amended title.

author: BrianHG
author_rank: Super Contributor
timestamp: January 04, 2017, 10:50:29 am
content: For my PIC battery powered projects, having it on my bread-board also drew extra current. In fact, the bread board's extra current draw swung widely with a slight change in ambient temperature, as did the prototype PCBs until I remover and replaced the PIC, scraped traces between IO pins and finally cleaned everything over & over again with a electric sonic vibrating toothbrush and cleaning solvents. It took time, but, I finally did manage to get the battery power consumption down to sub 20ua where I needed it. (note this was 2002 and 20ua on a a pic + and active IR receiver was considered great back then).

author: jdraughn
author_rank: Regular Contributor
timestamp: January 04, 2017, 10:57:32 am
content: What voltage are you running at? Maybe the current draw in the datasheet is based on a lower voltage then what your using?

author: BrianHG
author_rank: Super Contributor
timestamp: January 04, 2017, 11:15:29 am
content: About voltage regulators in Howardlong's video.For ultra low power regulator with a good 25v input range, I use a simple N-Channel J-fet with the gate tied to GND, the source is your output and the drain goes to your power source. The 0 load current of the J-fet regulator should be in the picoamp range or less with a dropout voltage range of 0. The vgs of the Jfet you choose determines the output voltage. This solution works great for apps below 10ma. The cons is that the Jfet's vgs isn't precise from part to part, however, usually for these PICs, this isn't too much a problem.

author: BrianHG
author_rank: Super Contributor
timestamp: January 04, 2017, 11:25:42 am
content: From video: Measuring current with Dave's uCurrent board, getting rid of those current peaks.Just tie a 1000uf, or, 10000uf cap, or larger, right on the terminals, in parallel across the + / - current input. This removes the peaks & you can now choose an averaging filter of your choice to smooth out the current spikes when the CPU goes in and out of sleep.

author: Howardlong
author_rank: Super Contributor
timestamp: January 04, 2017, 11:26:08 am
content: Quote from: BrianHG on January 04, 2017, 11:15:29 amNice tip! My point is around reasonably accurate generation of bias voltages that inevitably involves some current, and that's why integrated voltage regulators tend to have significant quiescent currents in these applications.

author: Howardlong
author_rank: Super Contributor
timestamp: January 04, 2017, 11:29:21 am
content: Quote from: BrianHG on January 04, 2017, 11:25:42 amThat was my original solution, but it doesn't work. You need an RC solution as I explained in the video I'm afraid. And you need to take care that the leakage in your cap is minimal (or model it out). In the vid I used a 10k and 470uF which had sub 100nA leakage current at the operating voltage.

author: BrianHG
author_rank: Super Contributor
timestamp: January 04, 2017, 11:38:38 am
content: Quote from: Howardlong on January 04, 2017, 11:29:21 amYup, sorry, I see that now. My recent emergency 1 pulse every 5 sec LED sign with spikes at 2 amps for .025 sec avg, then sleeps, had also had a 220000uf cap in on the power with 10 ohm series. I forgot about it. (Damn thing took 1/2 hour to stabilize my true average current readings...)

author: Howardlong
author_rank: Super Contributor
timestamp: January 04, 2017, 12:43:04 pm
content: Quote from: jdraughn on January 04, 2017, 10:57:32 am2.5V, but if you watch the video you'll see I account for that.

author: Howardlong
author_rank: Super Contributor
timestamp: January 09, 2017, 07:10:31 pm
content: o Added a scope screenshot of the internal FRC oscillator and low power crystal startup times.o Added two pics showing the 32.768kHz crystal and 22pF loading caps, together with PCB mods/hacks to the breakout board.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: January 09, 2017, 08:05:37 pm
content: Haven't watched the vid but....I'd have used a 10u ceramic rather than a 4u7 tant - potentially less leakage.Also 10M on the buttons is high for a pullup - could get into floaty-input territory- I'd use a lower pullup, switched on & off as necessary. Power draw when switches are on isn't going to be a big deal anyway. If it's a concern due to peak current, maybe use interrupt-on-change to switch off the pullup as soon as switch is detected, then polling to detect release.How low did you take the LCD frequency? Driving the LCD capacitance will be a significant part of the current draw

author: Howardlong
author_rank: Super Contributor
timestamp: January 10, 2017, 12:15:54 am
content: Quote from: mikeselectricstuff on January 09, 2017, 08:05:37 pmI used a tant because it had leads, I don't have any TH ceramics at 10uF, plenty of 0603 and larger sizes in SMD 10uF but not directly breadboardable. I did measure the leakage on the tant (I just checked, it's actually 10uF) and it was negligible, maybe 10nA delta of leakage current, it was very near the noise floor of my measurement setup.10M, yes that was carefully chosen. The problem is that you want the MCU to wake up immediately to a button press, not wait for a half second or so to poll it. Equally, you need it to pull up strongly enough not to cause the input to go into a linear region, or indeed oscillate. But when the button is pressed, you don't want it to take gallons of power when it pulls low, relatively speaking. I spent half a day on various complex schemes to minimise current, including mux scenarios, but this was the least bad. It debounces well too. Sure, if you put your finger on the GPIO pin it'll merrily oscillate at 50Hz.LCD is driven at 16Hz. I started at 32Hz but reduced power fairly significantly dropping to 16Hz. I don't think the peripheral will go any lower, but even at 16Hz this is pretty low. I can't see any visible flicker though.I am sure you can forget most of the bullet point content in the video. The scope comes out at the end, not my best to be honest, but I rarely re-shoot video so what you see is usually the first take, warts and all.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: January 10, 2017, 12:48:21 am
content: Quote from: Howardlong on January 10, 2017, 12:15:54 amI wonder if some series resistance on the LCD COM might shave a little more current off before contrast is affected too badly.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: January 10, 2017, 01:10:39 am
content: Quote from: Howardlong on January 10, 2017, 12:15:54 amHow about this:Connect the currently-grounded ends of the buttons to two I/O pins ( PGC/PGD are available, buttons won't affect programming). Set them as low outputs.Cofigure button inputs for interrupt-on-change, with the internal pullups.When pressed, the change interrupt flips the corresponding IO pin state and also changes the pullup to pulldown, so no current drawn and MCU can go back to sleep ASAP. The reverse on the next IOC.The slow clock (assuming you're running at 32K) will probably do enough debounce.Just for good measure, do an occasional poll when awake in case IOC somehow got missed and pullups/IO pins have gone out of phase.

author: BrianHG
author_rank: Super Contributor
timestamp: January 10, 2017, 06:11:57 am
content: Quote from: Howardlong on January 10, 2017, 12:15:54 amI've driven my clock LCDs as slow as 2hz for those with a second hand. Since your LCD has the ':' blinking on and off each second, you should be able to get away with a 4hz refresh as long as it is synchronous with the blinking.

author: edavid
author_rank: Super Contributor
timestamp: January 10, 2017, 06:19:50 am
content: Quote from: BrianHG on January 10, 2017, 06:11:57 amAt what point do you start causing LCD damage?

author: Howardlong
author_rank: Super Contributor
timestamp: January 10, 2017, 06:39:22 am
content: Quote from: mikeselectricstuff on January 10, 2017, 01:10:39 amThat was precisely one of the methods I tried, although I used other pins, there are quite a few pins left over. There are probably small remnants of it in the source code I attached. I am running at FRC 8MHz... because I found agregate static plus dynamic current draw is actually worse at 32kHz than at 8MHz, which seems to be the sweet spot.Using the method you mention I found there was relatively high current draw, about 5 to 10uA, when you quickly pressed the buttons, quite a common use case when adjusting the time. However after burning half a day at it and creating an increasingly complex state machine to implement it, I went back to a simple pullup setup which draws 250nA when the button's pressed. I might revisit it, because I never fully understood what was going on and why there was so much current draw, but sometimes you have to draw a line or else I find myself becoming unnecessarily fixated on one small facet.I did also specifically measure pulling those inputs to a supply rail rather than at the end of a 10M and there was no measurable difference in current draw.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: January 10, 2017, 10:50:53 am
content: Quote from: edavid on January 10, 2017, 06:19:50 amDoubt it's an issue as long as long-term avarage is 0

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: January 10, 2017, 10:53:41 am
content: Quote from: Howardlong on January 10, 2017, 12:15:54 amHow much of the draw is down to the LCD (and LCD controller)?If the inbuilt LCD module can't go below 16Hz, I wonder if simply bit-bashing slower with IO ports and not using the LCDC might save something.

author: Howardlong
author_rank: Super Contributor
timestamp: January 10, 2017, 01:38:49 pm
content: Quote from: mikeselectricstuff on January 10, 2017, 10:53:41 amBit banging was my first attempt, reason being that the LCD peripheral in the DS showed reasonably high current consumption, but as I mentioned in the vid, I found out later that was in multiplexed mode (i.e., required power-expensive biasing) rather than static mode. At 32Hz bit banging it appeared to be way too expensive, but at that time I didn't realise I could get away with going down to a lower frequency.I don't have enough experience of direct driving LCDs to be honest, this was my first time doing so, so I don't know what the longer term effects are of lower frequency operation. What I've been trying to avoid is DC on them which I know is a no-no.

author: BrianHG
author_rank: Super Contributor
timestamp: January 10, 2017, 02:46:41 pm
content: Quote from: Howardlong on January 10, 2017, 01:38:49 pmLong term DC is a no-no.For driving your LCD, just output the digits active high and the common to ground.4 times a second, just invert the digit IOs and invert the common to high.For your clock, this means Once a sec, feeding the new set of 7 segments on the clock.Every sec, and half sec for the ':'.Inbetween each half sec, invert the value on the segments, ':', and common.This would be a procedure where the average voltage bias on the entire LCD segs would be 0v meaning it is safe for long time use.Just to be careful here, we are not using the LCD voltage charge pump, I am assuming your chosen LCD will go black with the voltage difference between GND and your VCCIO.

author: edavid
author_rank: Super Contributor
timestamp: January 10, 2017, 04:41:23 pm
content: Quote from: mikeselectricstuff on January 10, 2017, 10:50:53 amThere must be some minimum drive frequency to avoid the damage that is caused by DC. Has anyone ever seen a spec on this?

author: Howardlong
author_rank: Super Contributor
timestamp: January 10, 2017, 05:50:18 pm
content: Quote from: BrianHG on January 10, 2017, 02:46:41 pmAt 2.5 to 3.3V Vdd there's not problem (5 to 6.6Vpp SEG-COM). It works down to 2V but the display loses contrast significantly. To implement a charge pump completely blows the power budget out of the water, it's a design compromise.

author: BrianHG
author_rank: Super Contributor
timestamp: January 10, 2017, 06:04:03 pm
content: Quote from: edavid on January 10, 2017, 04:41:23 pmAround a few days for LCDs within the pas 20 years. Have you ever seen unconnected LCDs with some characters left on due to a static charge at one point, basically a charged DC on voltage. I've had a few in my box of junk parts, they work fine once connected up. The key is the shorter, the better. Anything less than minute, as long as each segment is either off, or, 50% of the time a positive charge, 50% of the time a negative charge, damage wont build up on one side of the conductive traces printed on the LCD glass. LCD controllers usually operate faster for the multiplexing and if the have a switched cap voltage doubler, the charge pump they cycle at each inversion to make enough electricity to keep the pixels dark.

author: David Hess
author_rank: Super Contributor
timestamp: January 11, 2017, 03:09:40 pm
content: Quote from: Howardlong on January 02, 2017, 11:31:13 pmIncluding a JFET source follower as part of the circuit will allow probing the oscillator behavior without disturbing it.

author: NiHaoMike
author_rank: Super Contributor
timestamp: January 11, 2017, 04:30:06 pm
content: I once took a LCD from a calculator or something and left it connected to a 9V battery for a few months. I did not see any adverse effects, so either that LCD was unusually robust or the issue takes years to show up.

author: edavid
author_rank: Super Contributor
timestamp: January 11, 2017, 07:02:10 pm
content: Quote from: NiHaoMike on January 11, 2017, 04:30:06 pmYes, it can take years, and I think it's also temperature dependent, which is why I would want to see some kind of spec before assuming there won't be a problem.

author: Ian.M
author_rank: Super Contributor
timestamp: January 11, 2017, 07:30:20 pm
content: http://ecee.colorado.edu/~moddel/QEL/Papers/PerlmutterEtAl96.pdfhas some info on the degradation mechanism and timescales. Also there are reports that the InSnO electrodes can be reduced to an opaque In/Sn alloy or eroded away around defects in the alignment layer that expose the electrode to the liquid crystal fluid.

author: Howardlong
author_rank: Super Contributor
timestamp: December 26, 2020, 03:44:29 pm
content: I have an update, I have managed my nirvana, and achieved an average just under 1 uA clock, albeit only 4 digits. You could reduce this further if you don't want a flashing colon.In addition, I offer a multiplexed low pin count 6 digit option that draws about 2.1uA.Both use the on chip secondary oscillator with a tuning fork crystal.Furthermore, of interest to others might be this new device, with a claimed 45nA RTC & digitally compensated 1ppm:https://www.microcrystal.com/en/products/real-time-clock-rtc/rv-3028-c7/

author: coppice
author_rank: Super Contributor
timestamp: December 26, 2020, 04:19:52 pm
content: Until maybe 10 years ago there was a very peculiar thing in the MCU market. A lot of products do some kind of measure, analyse and display result job. The measurement and analysis parts are usually quite quick, but you need to display the result for maybe 30 seconds, to give the user plenty of time to read it. So, to keep the overall energy consumption low, the display phase is the key part. Its hard to make a sub microamp LCD controller, but its easy to make one that takes a few 10s of microamps. However, most MCUs from the early 2000s required milliamps to keep the LCD running. The Japanese made some 4 bit MCUs that took this requirement seriously. Among the 8 bit and larger MCUs, only the MSP430 and uPD78 families did a good job, yet it would have been so easy for most MCU makers to provide the functionality to compete with them in some high volume applications.

author: Howardlong
author_rank: Super Contributor
timestamp: December 26, 2020, 04:36:42 pm
content: The whole thing about low power is a can of worms, and it's incredibly application specific, and one of those many facets of engineering where you need to look at it as a system, and weigh up the pros and cons. For example, running the core at a faster speed for a shorter period of time is often more efficient than using a low speed oscillator, even one that's already running (as is the case in these examples). Wake up times and low voltage retention regulators are another area which confuses the mix.I spent a lot of time with a device that showed inconsistent results: it looked like it was behaving well, but it turned out that there were relatively huge current spikes when it was coming out of a low voltage sleep mode, charging up a regulator cap, upsetting the results substantially.Confected benchmarks are seldom useful on their own.I agree, it's easy if your power budget is 10s of uA: if only many OEMs would even aim to achieve even that!

author: coppice
author_rank: Super Contributor
timestamp: December 26, 2020, 04:52:26 pm
content: Quote from: Howardlong on December 26, 2020, 04:36:42 pmFor a mixed signal application a common pattern is that energy consumption is minimised by turning the analogue stuff (including the ADC) on for the shortest possible time. So, you want the processing that works in parallel with the analogue stuff to run as the highest possible speed. Its all a race to get to sleep as soon as possible.Quote from: Howardlong on December 26, 2020, 04:36:42 pmTracking the true energy consumption of bursty applications has been a big problems. I've seen people implement designs they were convinced would have a 10 year life from their battery, only to have products return after a couple of years with dead batteries. Sometimes it was that the crude tools available had not measured the true energy consumption over the huge dynamic range between the processing bursts and the idling in between. Sometimes it was insufficient capacitance across the battery, so the battery was facing the full brunt of the high consumption bursts. Sometimes it was usage patterns that had put the product into high consumption bursts at a far higher rate than the designers thought possible.Quote from: Howardlong on December 26, 2020, 04:36:42 pmThere are now some newer ultra low power benchmarks which are far more representative of typical ULP applications. However, ULP characteristics are so application specific you can never tell what you will get overall until you start roughing out a design.

author: Howardlong
author_rank: Super Contributor
timestamp: December 26, 2020, 09:22:55 pm
content: Quote from: coppice on December 26, 2020, 04:52:26 pm100%. And it's certain that there won't be enough information on the datasheets & errata. Experience and working empirically is the only way.In the meantime, I'll drop in my current spreadsheet for PICs.

author: bson
author_rank: Unknown
timestamp: December 27, 2020, 09:52:47 pm
content: Nice. At 1µA it should be able to run 20+ years off a 210mAh CR2032!

author: coppice
author_rank: Super Contributor
timestamp: December 27, 2020, 09:57:42 pm
content: Quote from: bson on December 27, 2020, 09:52:47 pmIf you look at the self leakage and corrosion specs for most CR2032s, you won't consistently get more than 15 years life with no load at all. You need to look at some of the things Tadiran have made for some time, or the new generations of solid electrolyte primary cells to get 20 years operation with any reliability.

author: anas
author_rank: Newbie
timestamp: October 30, 2022, 02:26:48 pm
content: Dear Sir,Please suggest me the best available Microcontroller whose current consumption is in microamperes, and which can run on the lithium ion coin battery of 3 volt (I am attaching the link below )that microcontroller should also have a Ram which can record the data on the microcontroller memory all east 20-30 events.Please suggest me this microcontroller.Please do replyI want to run my microcontroller from this batteryhttps://www.digikey.com/en/products/detail/panasonic-bsg/CR2032/31939Thanks and regards.

author: anas
author_rank: Newbie
timestamp: October 30, 2022, 02:28:58 pm
content: Dear Sir,Please suggest me the best available Microcontroller whose current consumption is in microamperes, and which can run on the lithium ion coin battery of 3 volt (I am attaching the link below )that microcontroller should also have a Ram which can record the data on the microcontroller memory all east 20-30 events.Please suggest me this microcontroller.Please do replyI want to run my microcontroller from this batteryhttps://www.digikey.com/en/products/detail/panasonic-bsg/CR2032/31939Thanks and regards.