Energy saving while analogOutput

I am looking for an option in my current project to save energy while maintaining analog outputs?
I use the time-function and transfer the time to an analog voltmeter. Now it is a matter of doing without the constant supply of energy and wanted to switch to LiPo. If i put the photon into sleep mode, i will lose the output status on the voltmeter.
It would be enough for me to query the time-function from the cloud once every 24 hours: however, the analogOutputs should be displayed throughout the day; if possible using a LiPo.
I assume that this is not possible?

With Deep Sleep there is no way to keep the analog output going.
For Stop Mode Sleep I’m not sure whether the DACs would be still working. For PWM I’m pretty sure they won’t keep running.

So the obvious questions are

  • which sleep mode are you using?
  • how are you producing the analog output?

And while at it, why would you use an analog signal to transmit time?

@ScruffR, my read is that the time display using a voltmeter is a “novelty” time display.

@Postler, your best bet is to use an external low power DAC (I2C or SPI) that will remain powered while the Photon goes to deep sleep. In your case, I get the impression that the Photon will wake every minute to update the time so SPI may be the best protocol. Be aware, though, that you are powering via LiPo, you will need to power the DAC with a fixed voltage from which it will generate its output signal. This will require an extra LDO voltage regulator fed directly from the battery IMO.

1 Like

Yep, with hours, minutes and seconds it already works quite well in the aluminum housing, but it looks nice, but a LiPo only lasts for a maximum of one day and so I’m looking for a way to reduce the current consumption of the photon.

https://go.particle.io/shared_apps/5ee35877441e4a00221ec378

There is an easier way than a list of this

    if (h == 1 || h == 13) {
     analogWrite(pinStunde, pwm_h); // adjust 21,25 pwm (hour) meter level
    else if (h == 2 || h == 14) {
     analogWrite(pinStunde, 2 * pwm_h); 
    ...

instead you could use this

  int h = Time.hourFormat12(); // values 1..12
  analogWrite(pinStunde, pwm_h * h);

Additionally you could use map() instead of your constants

  int now = Time.now(); // take snapshot of time for consistent readings
  float h = map((float)Time.hourFormat12(now), 1.0, 12.0, 0.0, 255.0);
  float m = map((float)Time.minute(now), 0.0, 59.0, 0.0, 255.0);
  float s = map((float)Time.second(now), 0.0, 59.0, 0.0, 255.0); 
  analogWrite(pinStunde, h);
  analogWrite(pinMinute, m);
  analogWrite(pinSekunde, s);

Agree, ScruffR - good idea - further shorten the code.
Would you have a tip about which DAC + LDO I should buy? Did I understand the idea correctly that I use VIN to keep the photon alive with DAC + LDO and that the values can be shown on the display even though I put the photon into sleep mode?
For me it seems easier to use a power supply and I am still drilling a hole for the power plug.

One question before being able to answer that would be what LiPo you are intending to use and how you’d hook that up to the Photon.
If you are using the Photon with the Particle Power Shield or the SpakFun Photon Battery Shield you already have an 3.3V LDO on these which you could use to power a 3.3V DAC board too.

However, the Photon is somewhat more power hungry than the Argon which also already comes with its own LiPo connector and charging circuitry :wink:

When it comes to the DACs, do you want a standalone chip or a breakout board?

These hints come too late: I have a Sparkfun Battery Shield on hand, but it doesn’t fit in the case - LOL. In my case, a DAC with breakout. Thanks for the suggestions!
I should go back inside and swivel onto an Arduino Nano with RTC module before wasting a photon here.

I’d have a look at this DAC breakout
https://eckstein-shop.de/GY-MCP4728-12-Bit-Digital-to-Analog-Converter-DAC-Evaluation-Board

Although it is I2C and not SPI, it uses one of the more common DACs

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.