No announcement yet.

Maximum Power Saving

  • Filter
  • Time
  • Show
Clear All
new posts

  • Maximum Power Saving

    I have a Gen4-uLCD-35DCT-CLB screen connected to a DIY Arduino host (custom PCB using an ATMEGA328P).
    I am using the Diablo Serial Library and the 4D Workshop Extended Graphics to interact with the screen.

    To minimize standby power I set the screen contrast to zero and then put the ATMEGA328 to sleep.
    I wake the micro controller using a momentary switch, which triggers an interrupt. The screen contrast is then set back to 15.

    The problem is that the screen still draws a little over 40mA with this approach.
    Is there any way, programmatically, that I can further reduce the power usage of the screen?

  • #2

    To further reduce power draw, you can put the display processor into sleep mode.
    You can check it under the Timers Command section of the Diablo16 Serial Command Reference Manual.

    Best Regards,


    • #3
      Thanks for the pointer, but I am having issues getting it to work.
      Sadly, the command reference does not give any examples of the library functions, so maybe I am not getting the syntax correct.

      If I use Display.sys_Sleep(0); the function performs as stated and requires a power reset to wake the screen.
      Doing this I get a screen power reduction of approximately 70%, which is great, but...

      If I use any value above 0 and less than 65535 [Display.sys_Sleep(1); to Display.sys_Sleep(65535);] this function does not work as I expect it should.
      There is an initial drop in power usage, but nearly immediately that ends and I am only seeing a few mV improvement.
      I have tried numerous values above zero, but the result is always the same.

      Am I doing something wrong, or is this a bug?


      • #4
        Something very weird is going on here...

        This is the code I am using to put the micro controller to sleep:
        currentMillis = millis();
        if (startMillis >= currentMillis) startMillis = millis();
        if (currentMillis - startMillis >= sleepDelay) {
        for(int i = 15; i >= 0; i--){ // Fade screen to off
        goToSleep = true;
        LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);
        When the micro controller goes to sleep the sys_Sleep function only reduces the power consumption by about 3mA, compared to when the sys_Sleep function is not used.
        Initially, the power usage drops about another 25mA, but that only lasts for less than a second.
        When an interrupt is triggered, both the micro controller and screen come back to life, as you would expect.

        However... when the micro controller goes to sleep for the second time things change significantly.
        The power usage drops to a value slightly higher than when using sys_Sleep(0), but like when using this value, the screen cannot be woken up without a power reset.
        I am pretty sure that this is not how this function should work.

        Can someone give me some example code of how to use this function in a way that does not require a power reset to get the screen to come back to life?
        As it stands at the moment, this function seems pretty useless to me.


        • #5
          Good day!

          Can you check and tell us what PmmC and Driver is loaded to the Diablo16 display?

          We'll try to reproduce your issue on our end.

          Juniel Cruz


          • #6
            PmmC = 2.0
            Current Driver = Gen4-uLCD-35DCT-CLB-B dated 17/08/15

            Just updated the PmmC to v2.4 but that has not changed anything.
            It still does exactly the same thing.

            There does not appear to be any available driver updates.
            Last edited by SkiFreak; 22 September 2020, 05:39 PM.


            • #7
              Another question I have to ask is why the sys_Sleep function is a timer.
              Even if it did work as detailed, this would only allow the screen to be put to sleep for about 18 hours
              What if wanted it to sleep for much longer than that?

              I should start by saying that, for the most part, I am very happy with this screen, but I am confused as to why it does not have any decent power saving options.

              I am building a tank monitoring system that is only accessed as required, which will be very infrequent when the vehicle is not in use.
              The underlying controller has a standby current of around 15mA, but when the screen is connected that goes up to about 60mA.

              For me, not being able to put the screen to sleep is a significant power issue.
              If sys_Sleep(0) is used, the power consumption is nearly halved, but having to power cycle the system to get the screen to work again is definitely not ideal.

              Surely there are people at 4D Systems that are smart enough to come up with better power saving options than this.


              • #8
                The initial 'failure to sleep', is because you have a touch screen, but have not enabled (and maybe also disabled) touch before calling sleep. This has the unfortunate side effect of appearing to wake immediately. So add a touch_enable earlier in your code, and another disable, if desired and the first sleep will work fine.

                sleep(0), turns everything off for lowest power, so only way out of it is a power cycle, OR a hardware reset, which I think you should be able to manage in this case.

                If you really want to sleep 'forever', but be able to recover on a touch, just check the returned value, if it's 0 then your ~18 hours has elapsed, so you can simply go to sleep again.


                • #9
                  Thank you for your response Mark, but some of your suggestions are not really on point.

                  Firstly, as I stated initially, I will not be waking the screen with a touch. I will be using a momentary switch to trigger an interrupt to wake the micro controller.
                  When the micro controller wakes, the screen contrast is faded in from 0 to 15.
                  I do not have any touch events in my code, so your suggestion to check the return value after a touch is therefore not really a valid solution for my problem.

                  I cannot speak to other 4D screen models, but it would appear that currently there has been very little focus placed on power saving options for this screen model, which if I am honest, is very disappointing.
                  Not being able to put the screen into a deep sleep mode that can be woken by a host, is a serious failing in my opinion.
                  I am pretty sure that I am not the only person that is concerned about power usage with these screens.

                  Is there any chance that some additional power saving functionality can be added via a PmmC or driver update in the foreseeable future?
                  Being able to trigger the power saving modes via the serial library would also be highly desirable.
                  Last edited by SkiFreak; 23 September 2020, 07:14 PM.


                  • #10
                    Hi SkiFreak,

                    Since you are using Serial SPE, then you should be able to do what Mark said to achieve what you want.

                    You set the display to sleep forever, it should be in the region of a few mA draw. It will then only wake on a reset. This is the best power saving option there is, everything is asleep.
                    Since you are using SPE the reset itself is of no consequence as its all run off your host anyway, so you have no comms you are breaking as its all dictated by your host.
                    So do the following:
                    When you want to sleep, get the Arduino to do whatever display preamble you want, and potentially fade the display out from 15 to 0 if you wish.
                    Set the display to sleep forever Display.sys_Sleep(0), and do whatever you want with your Arduino at this point too.
                    Set your momentary button to connect to the displays Reset pin, which is active low to reset it. Also connect the same wire to your Arduino host.
                    So when the button is pressed and the signal goes low, it resets the display and wakes it up, but since its SPE it wont do anything until the Host sends it something (unless you do nothing for 5 seconds then the SPE splash screen will show).
                    The Arduino gets the same signal, writes the display contrast to 0 to the using the library Serial protocol.
                    The Arduino then writes whatever other things you want to the display to show some content on the display, while the contrast is still to 0 so you don't see it.
                    Then get the Arduino to ramp up the Contrast from 0 to 15, to fade in what you want to see.

                    Would that work for what you want?

                    In your responses, please don't be so attacking to 4D Staff or products, especially since you are coming to us asking for support. We are people too and are the developers of what you are using. We are here to help you as best we can, we don't need to read your snide comments stating whether 4D staff being 'smart enough' to answer your queries etc. Our products and software are capable of many things, and there are situations where there are specific user requests which are very different than what most people need, like yours. We cannot cater for every single possible option out of the box that people want, but there is scope to make the products work in the way you need. Touch wake is typically what 99% of cases have wanted, GPIO wake I cannot recall a request for it before.
                    Be kind in your messages, is all I am asking.



                    • #11
                      Attached is another way of, perhaps, solving your problem.

                      It does this by enabling SPE to wake from sleep(0) on a pin change.

                      You will need to connect your microswitch to an available PA pin and change PXa in the attached to the selected pin.

                      Due to the nature of the way the driver chip in the display glass works, you will also need to refresh the screen, as it is lost on sleep(0). You will need to set the contrast first as it is restored to full brightness after sleep(0).

                      Place the file in C:\Users\Public\Documents\4D Labs\4DUpdates\Utils and reload SPE.

                      By comparing this version and the supplied version you will see that very few changes were required to SPE.

                      Note that you could also take a copy of C:\Users\YourUsedID\AppData\Local\Temp\temp4D.4dg, apply the changes to that and save it somewhere else and load it onto the display. That way you would not be effectively replacing the supplied SPE.

                      Hopefully, you will also begin to understand just how specialised your requirement is and thus cannot possibly be ‘just added’ to the core. Similarly, hopefully, you can also see that what you want can already be done within the capabilities of what’s already available.
                      Attached Files


                      • #12
                        I will start by saying that I believe my comments have been misinterpreted.
                        I was eluding to the fact that there are smart people at 4D Systems and that I was surprised there were not better/more power savings options available.
                        I also said I was very happy with the screen itself, so I definitely was not rubbishing the product.
                        If any of my comments were seen as snide, I apologize, as they were not written with that intent.

                        As to James' proposed solution...
                        Yes, that would work, but aesthetically there is a down side to this approach, that being the white screen flash that occurs when the screen is reset.
                        Also, as per the documentation, the code should include a delay to allow the screen to fully initialize. That would result in an undesirable delay in showing the gauges on the screen.

                        In my testing, when I use sys_Sleep(0) the screen still draws about 15mA. That is a similar draw to the host when it is asleep.
                        As much as 30mA would still be more of a power draw than I would like, I could happily live with that.

                        Thank you for the obvious efforts you have made for a different solution.
                        Before trying to follow your instructions, I have a few questions.
                        • Will this approach still mean that I will see the screen flash when the system wakes up?
                        • Will there still be a delay as the screen reinitializes?

                        To digress from my original power saving question...
                        I am using a momentary switch to send an interrupt to my host, so I can wake the micro controller from sleep.
                        My preference would be to wake the system with a touch of the screen, but my understanding is that this cannot be done if the host is not poling/monitoring the screen for a touch response.
                        So, my question would be... can the screen act in a similar way to a physical switch and allow me to trigger an interrupt on the host when I touch the screen?

                        At the end of the day, I am after a viable solution to put the system to sleep, so it uses the least amount of power when not in use, plus a simple means to wake the system back up when required.
                        Sounds like a simple challenge, but it is proving not to be not so simple.


                        • #13
                          >white screen flash that occurs when the screen is reset.
                          On my display, using the same driver as yours I don't see a flash, could it be your eyes interpreting the BL coming on as a flash? Yes, you would have to wait for the 'delay' to allow for the screen to initialize.

                          >In my testing, when I use sys_Sleep(0) the screen still draws about 15mA.
                          On my display sleep(0) is immediately 10.7ma, which drops to 0.9ma after 15 seconds when the CT panel goes to sleep.

                          >Will this approach still mean that I will see the screen flash when the system wakes up?
                          Again, I don't see one. It is different to a 'reset', so maybe you may 'see' it differently.

                          >Will there still be a delay as the screen reinitializes?
                          Should be nothing of consequence, as in much quicker than a reset, but certainly not instantaneous

                          >can the screen act in a similar way to a physical switch and allow me to trigger an interrupt on the host when I touch the screen?
                          Well, 'asis' the display will send the ACK to the host when the display is touched, so if your host can wake on serial it's already working. (And this is what I mean earlier about checking the return code from the sleep command, if it's 0 you simply do another sleep(0), otherwise someone touched the screen).
                          Remember though, you wont be on 0.9ma if you go down this path. I measure 12.3ma to be able to utilize wake on touch.
                          If you need generate an interrupt to wake your host then this would require a few customizations to SPE to generate the interrupt on the host, at the same time maybe 'completely' manage the sleep by 'hiding' 18 hour wakeup.


                          • #14
                            As detailed in the SPE2DV90.INC file you attached Mark, there are 2 changes I need to make.
                            M_PAx and PAx

                            Just confirming...
                            Assuming the digital pin connected to the momentary switch is D2, am I correct that the above needs to be changed to M_PA2 and PA2.


                            • #15
                              Yes, the flash I am describing is the back light coming on. Is there any way to eliminate that?

                              >On my display sleep(0) is immediately 10.7ma, which drops to 0.9ma after 15 seconds when the CT panel goes to sleep.
                              I am definitely not seeing that.
                              My multimeter is connected in series to the main power input, so it measures the overall power draw of my system.
                              If the +5v wire to the screen is not connected, when the micro controller goes to sleep I am seeing 16mA. With the screen connected, and using sys_Sleep(0), when the micro controller goes to sleep I am seeing 31mA. That value remains constant.

                              >If you need generate an interrupt to wake your host then this would require a few customizations to SPE to generate the interrupt on the host, at the same time maybe 'completely' manage the sleep by 'hiding' 18 hour wakeup.
                              Is there any possibility that a future version of the SPE would include the ability to trigger an interrupt? Would be great if it did.

                              As I mentioned previously, I would think that using a timer event for long term sleep is probably not ideal.
                              Is that what you are eluding to with "maybe 'completely' manage the sleep by 'hiding' 18 hour wakeup."?