HOME   PCB269 MAIN PAGE     StumbleUpon.Com Recommend to StumbleUpon

Testing PCB269, the 24/7 power supply for low current projects

(filename: PCB269-SolarWBackup-Testing.htm)

This page is about several questions: What's a quick test for PCB269, how much power can it provide, and what have the results been of tests conducted in the evolution of the board's design?

A quick "nota bene" before we go any further: REMEMBER: The whole point of this board is that it stores power. Don't treat it as "dead" just because you have disconnected Vin... it will usually have some charge stored in the super-cap. Before working on the board, discharge C1, using a suitable resistor across Vout and ground. (Why not just short? You might cause currents in the supercap which are high enough to damage it.)

It assumes that you can program an ATtiny85. If you can program Arduinos, you can program ATtiny85s with very little trouble or expense. All of "the stuff" you need to master to get to the point of being able to program them and their fuses may be a little daunting... but once you are there, you will look back on your adventure and say, I think, "Well... that wasn't so bad". At least it isn't expensive! If you have an Arduino, a breadboard, some wire, and the means of programming the Arduino, you've already bought what you need to buy... apart, of course, from the ATtinys. They cost about $3 each. And run on a breadboard as soon as you give them power. With only 8 pins, 5 of which are GPIO, some of which are capable of things like serial comms, I think you can guess that a lot of fancy support circuitry isn't needed! I'm trying to get at least a rough guide to "How you program ATtinys" out. It isn't online yet (29 Nov 17)... but I hope it will be there by 10 Dec 17... pester me, if this hasn't been changed to a link by then, please?

Testing PCB269

To test PCB269, my board based on Nick Gammon's circuit to provide 24/7 power, using solar panels (or other intermittent source), I programmed another ATtiny85. (There's one in PCB269, too.)

For my tests, I didn't do anything "clever" to make this second ATtiny use as little power as possible.

What it does...

When it starts up, either after a power cycle, or after the /reset line is pulled low for a bit, it repeatedly "blinks" an LED briefly. No rocket science here!

If the user pulls input D1 low for a bit, the LED changes its behavior, does a "double-blink" from then on.


I built this program to test a feature of PCB269.

After failure of the power from PCB269... they can occur! They will occur is Vin is not available for too long, or if the circuits powered by Vout are using too much power.

As I was saying: After a failure of the power from PCB269, when Vout eventually begins to rise again, it may rise slowly. Many systems "don't like" a slowly rising voltage on their supply, and respond by "locking up". This is a "brownout" triggered failure... though perhaps "brownup" would be a better term.

Happily, such lock-ups can be cleared by a power cycle, or, in the case of circuits with such an input, a reset cycle.

So PCB269 provides a brief off/on/off pulse after it has resumed operation after a power failure.

What if PCB269 suffers a "brownup" lockup? Happily, inside PCB269, in the ATtiny, to be specific, we have set a fuse that says "don't even try to start operating until you have a "good" Vcc to run from". Thirty minutes after that happens, PCB269 sends the reset signal out to the equipment it is powering.

So! My test circuit is used as follows....

You power everything up. You deprive PCB269 of its Vin, and eventually the powered circuit (our test ATtiny) drains the power off of PCB269, and everything dies. You restore Vin to PCB269. Usually, everything will fire up fine. PCB269 certainly will... and the test ATtiny usually will. (You don't always get a brownup failure. If you do, just repeat the above.) The LED on the test circuit will be doing simple single blinks.

Pull D1 low for long enough to switch the LED to doing rapid blinks, and then let it go high again. Now the LED will be doing double-blinks.

Go away, walk the dog. About 30 minutes after the system fired up, a reset signal will be sent by PCB269. (Make sure that Vin does not fail during this period... there's nothing wrong with giving PCB269 5v from a USB charger!)

The reset signal will switch the ATtiny with the testing program in it back to doing single blinks! We can "see" that the reset signal ACTUALLY WAS sent!

Power capabilities of PCB269

So... how much can PCB269 power?

I've only done crude and limited tests, to date.

I was using vers 17b06 of the PCB. (Nothing very remarkable about that. It was the first version.)

There was NO LED to indicate Vin present on the instance of PCB269 I was using.

I DID have an ST LE33CZ-TR (RapidOnline part number 82-3010) in my circuit, for the voltage regulator. The one specified by Nick Gammon probably wastes less electricity... but I had no load on the 3v3 output.

I was using a 5v5, 1F supercap, RapidOnline part number 11-2170

As I said... I'd done nothing "clever" to reduce the power consumption of the ATtiny with the test program in it. Fuses were in default states. Nick Gammon has a long article on Things You Can Do to reduce power consumption.

I was supplying power (to Vin) from a USB port on my PC. It was supplying about 4v8.. which may be a big part of why the results were disappointing! PCB269 should be fine with Vin of up to 7v. Anything above 5v6 is "thrown away", but in an exercise like this, the "extra" 0.8 v that I was missing can be important.

After many hours of charging, and several charge/ discharge cycles (supercaps improve with "conditioning", I gather), my "fully charged" Vout was getting to 3.92v. I suspect that could be improved, with further long periods of charge

The LED/resistor that ATtiny was blinking was on for 20 ms, off for 2200 ms. It drew 800 mA when running continuously on 5v. Less, of course, as the voltage fell.

Given all of the above, I'm afraid that my results weren't very exciting. The unit "worked", but wasn't going to power my "demanding" test circuit overnight. Sigh. But (see above) there are many areas for work, which could lead to better performance.

When Vin was removed, I started the test ATtiny double blinking right away. Initial Vout, with LED blinking: 3.80v. After 3 minutes: It was down to 3.56v. But by 20 minutes, it was already down to 1.8 volts. The blink, while still justvisible was very faint by now. In a similar test, I had 2.37v twelve minutes after disconnecting Vin.

Sigh. Not all I'd hoped for!...

But... "working". Now it's just a matter, I hope, of "tweaking" things to get overnight power coverage. It's a start... with promising avenues for tweaking. In particular, a better Vin will help, I hope. Already, it will "do" to see simple systems across a switchover from public power to standby generator.

The software

Here's the program I had in the test ATtiny. It's actually "two programs in one". How the ATtiny behaves depends on whether you've pulled D1 low or not. This is a "mode select" input, to switch between our "test PCB269" want and a different behavior which is just an enhanced Blinky to impress friends with.

  ATtiny003- enhanced enhancedBlink!

  Two "Blinkys" in one... selected by state of D1 (pin 6)
     D1 low, if that's what you want. (It will already be connected to internal
     pull UP resistor.

  Blink- MODIFIED 26 Nov 17 for ATtiny
  Turns on an LED on for one second, then off for one second, repeatedly.

  Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
  it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to
  the correct LED pin independent of which board is used.
  If you want to know what pin the on-board LED is connected to on your Arduino model, check
  the Technical Specs of your board  at https://www.arduino.cc/en/Main/Products

  This example code is in the public domain.

  modified 8 May 2014
  by Scott Fitzgerald

  modified again, 26 Nov 17, T Boyd

  modified 2 Sep 2016
  by Arturo Guadalupi

  modified 8 Sep 2016
  by Colby Newman

const byte Pin_LED=0;//LED is on this pin. Seems (from what "experts" did) that
   //it is okay to have an LED on this even when ATtiny connected to Arduino-as-ISP
const byte Pin_In0=3;//Alters on/off timings of Blinking
const byte Pin_In1=4;//As In0
const byte Pin_SelectMode=1;//Selects between the two "Blinkys" on offer in
   //the ATtiny with this program in it. ALSO: Prgm "remembers" if it has been in Mode0
   //at any time since the ATtiny was last reset, be it by power cycle, or by a pulse
   //on its /Reset line (pin 1). (DO NOT PULSE /Reset WHILE /Reset STILL WIRED TO
   //Mode 0 is a Basic Enhanced Blinky, for showing off the ATtiny.

   //Mode 1 is a version of Blinky for testing PCB269, in particular whether it
   //is resetting the ATtiny with this program, ATtiny003, in it. (The ATtimy with
   //ATtiny003 is serving as the "powered system", the "customer" for PCB269. It
   //is nothing (directly!) to do with the OTHER ATtiny which will be involved, the
   //ATtiny "inside" PCB269, which is providing the watchdog service.

boolean boHasBeenInMode0 = false;

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(Pin_LED, OUTPUT);
  pinMode(Pin_In0, INPUT_PULLUP);
  pinMode(Pin_In1, INPUT_PULLUP);
  pinMode(Pin_SelectMode, INPUT_PULLUP);
}//end of setup()

void loop() {
if (digitalRead(Pin_SelectMode)==LOW)
/*MODE 0- Simple Enhanced Blinky, for showing off ATtiny. DO NOT run
with ATtiny still wired to Arduino-as-ISP.

MODE 0 is entered if D1 (ATtiny pin 6) pulled low by a wire to GND. D1
will be high, if floating, as internal pull UP is connected via the
pinMode statement used.

Needs LED and resistor on
D0 (ATtiny pin 5), and momentary switches to pull one or both of D3, D4 (pins 2 and 3)
to ground.*/


  int DelayOn=300;
  int DelayOff=300;
  if (digitalRead(Pin_In0)==HIGH)
  if (digitalRead(Pin_In1)==LOW) DelayOff=900;

  digitalWrite(Pin_LED, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(DelayOn);                       // wait for a second
  digitalWrite(Pin_LED, LOW);    // turn the LED off by making the voltage LOW
  delay(DelayOff);                       // wait for a second
} //end of MODE 0 code
{/*MODE 1
  Immediately after power cycle or reset, if Mode 1 selected (by NO pull DOWN
  of D1 (pin 6)), then the LED on D0 will wink BRIEFLY (to conserve power)
  ONCE, and then go off for an extended period.

   If, since power cycle or reset, Mode 0 has been entered, even briefly,
   then the LED will blink TWICE, then go dark for an extended period.
   This is so that the user can "tell" the system "I've seen a power cycle
   or reset... tell me if you do another". If when user returns, there's a
   single blink, it means there has been one. If the system is still doing
   double blink, there has not.


   AH!! But it DOES, if I
   WATCH, after POWER Cycle, for half hour, having briefly put it into Mode0 with an input
   via D1, and ENSURED there's been no reset-by-power-cycle! (^_^)???

  int DelayOn=20;
  int DelayOff=2200;
  int DelayBetweenDbls=50;
 // if (digitalRead(Pin_In0)==LOW)
  //      {DelayOn=30;
  //       DelayOff=30;
  //      }
//  if (digitalRead(Pin_In1)==LOW) DelayOff=900;

  digitalWrite(Pin_LED, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(DelayOn);                       // wait for a second
  digitalWrite(Pin_LED, LOW);    // turn the LED off by making the voltage LOW

  if (boHasBeenInMode0)
  {//Dbl blink if it HasBeenInMode0
    delay(DelayBetweenDbls);                       // wait for a second
    digitalWrite(Pin_LED, HIGH);   // turn the LED on (HIGH is the voltage level)
    delay(DelayOn);                       // wait for a second
    digitalWrite(Pin_LED, LOW);    // turn the LED off by making the voltage LOW
   }//End of Dbl blink if has been in Mode 0

  delay(DelayOff);                       // wait for a second
}//end of MODE 1 code
}//end of loop()

Specific tests

Everything up to here has been about showing you how to test the instance you are building.

Now we come to the results from testing during the development of the PCB.

Early tests showed a design that "worked", but didn't seem to be able to deliver as much power as had been anticipated.

In his web-page, Nick Gammon speaks of using a 0.47F supercap, and running a small external system overnight.

When I tried to power a small Arduino which flashed an LED briefly every so often, I didn't get a good result... even with a 1F supercap. Fair enough... what I was powering wasn't optimized in any way for efficiency.

When I built instance "A" of PCB269 vers 17b28, I built it up in stages...

(1F supercap again)

Initially: All but the following installed: Q1 (ATtiny), Q3 (voltage regulator to produce 3v3, D4 (the "power present" LED). (The bad... but in many ways benign... connection between ATtuny85 and Vout... was present during these tests. Also, at some point along the way, I connected Vin (possibly reaching 6v) to the "R" terminal. (Which is supposed to be an OUTput from PCB269. Again... cursory consideration doesn't raise any red flags.)

I charged up the supercap, and disconnected Vin. 24 Jan 17, 09:15, Vout (withough any load) 4.95v. (I am new to the "3v3" notation... I will try to use that in component, etc, specs, but remain "traditional" when reporting test results.)

That test continued as follows. We're not headed towards major conclusions... I just want to present this data in case someone can point me to "where the problem lies"!

Time    Vout (no load)
21:15	4.95v
21:19	4.81
21:40	4.54
22:50	4.12
(25 Jan...)
00:40	3.79
13:25	3.23... and no, not confused. This about 13 hours after previous reading.
14:50	3.21

I then drained the residual charge off of C1, and installed Q2, a LE33CZ-TR (Rapid Electronics part 82-3010) and started a new trial. (It was just before this that I briefly connected the R output to Vin.) This data reports charge portion, as well... not very intersting! Discharge started at 21:56

25 Jan 18
Time   V**in**  V**out**, while C1 charging...
   (Nothing connected to Vout terminal)
15:06	(started charging, using sun on solar panels)
15:08	5.9v
... (sun went in for a while)
15:47... this was when, board vers 17b28, instance A, I cut the trace connecting C1 to C5
15:55			4.67v
... (changed from sun to desk lamp, as source of power)
15:56	5.7		4.72
16:29.. adjusted desklapm's position
16:30	5.4
21:55	5.5
21:56... took light away from solar panel
21:57	4.9
(26 Jan)
10:05			1.36

I then drained residual voltage, installed Q1, the ATtiny (instance "C"), and re-charged, watched discharge. Discharge starts at 21:18...

10:50	1.6	(panel under bright desk lamp)
10:52	2.0v
13:42	2.7		1.6
... adjusted position of light
13.46	3.6		1.6
21:18	5.34	4.86... and took off
                     charge after this reading
21:19	0	4.83 (panel still connected,
                     but in "dark")
21:46		4.08... voltage dropping much more quickly, alas.
22:50		1.97
(27 Jan)
00:09		1.43
08:52		1.34

So! Flaw in the way I programmed/ set fuses in ATtiny? Some bad path in PCB "connected" by inserting ATtiny? It seems that my earlier results (with actual external system and LED) were not due entirely to the external system. Sigh.

I think I copied Nick's program for the ATtiny faithfully, and I think I set the fuses correctly... but I don't know a lot about ATtinys. Here's the code I think I put into the ATtiny, just in case someone can spot a mistake.

My ATtiny DOES cause a pulse on reset line after half an hour. I haven't looked closely at whether it is going to sleep properly after sending the pulse. Ideas welcome! Or better yet, a known-good ATtiny to try in my board, if you've used Nick's ciruit! (Click here for contact details!)

// Reset solar panel watchdog
// Author: Nick Gammon
// Date: 22 March 2015

// Pin 1 is /RESET
//                  +-\/-+
// Ain0 (D 5) PB5  1|    |8  Vcc
// Ain3 (D 3) PB3  2|    |7  PB2 (D 2) Ain1
// Ain2 (D 4) PB4  3|    |6  PB1 (D 1) pwm1
//            GND  4|    |5  PB0 (D 0) pwm0
//                  +----+


 After reset waits for TIME_TO_WAIT minutes, then brings D0 (pin 5) high for long
 enough to activate a MOSFET and reset the other board.

 Fuses: Low: E2 High: DD

 (Brownout at 2.7V)


#include <avr/sleep.h>    // Sleep Modes
#include <avr/power.h>    // Power management
#include <avr/wdt.h>      // Watchdog timer

const byte MOSFET = 0;          // pin 5
unsigned long counter = 0;

const float TIME_TO_WAIT = 30; // minutes
const unsigned long SLEEPS_TO_WAIT = TIME_TO_WAIT * 60.0 / 8.0;  // 8 second sleeps

// watchdog interrupt
ISR (WDT_vect)
   wdt_disable();  // disable watchdog
  }  // end of WDT_vect

#if defined(__AVR_ATtiny85__)
  #define watchdogRegister WDTCR
  #define watchdogRegister WDTCSR

void setup ()
  pinMode (MOSFET, OUTPUT);
  ADCSRA = 0;            // turn off ADC
  power_all_disable ();  // power off ADC, Timer 0 and 1, serial interface
  set_sleep_mode (SLEEP_MODE_PWR_DOWN);
  }  // end of setup

void loop ()

  if (counter >= SLEEPS_TO_WAIT)
    digitalWrite (MOSFET, HIGH);
    delayMicroseconds (10000);
    digitalWrite (MOSFET, LOW);
    // our job here is done
    sleep_enable ();       // ready to sleep
    sleep_cpu ();          // sleep

  goToSleep ();
  }  // end of loop

void goToSleep ()
  noInterrupts ();       // timed sequence coming up
  // pat the dog

  // clear various "reset" flags
  MCUSR = 0;
  // allow changes, disable reset, clear existing interrupt
  watchdogRegister = bit (WDCE) | bit (WDE) | bit (WDIF);
  // set interrupt mode and an interval (WDE must be changed from 1 to 0 here)
  watchdogRegister = bit (WDIE) | bit (WDP3) | bit (WDP0);    // set WDIE, and 8 seconds delay

  sleep_enable ();       // ready to sleep
  interrupts ();         // interrupts are required now
  sleep_cpu ();          // sleep
  sleep_disable ();      // precaution
  }  // end of goToSleep

You are the final inspector

You are responsible for any consequences of using what is on any of my pages!

Please get in touch if you discover any flaws in the board, or any ways to go wrong. How are using it would also be of interest.

I would welcome news of any use you put the PCB to... especially if it comes with a photo, and permission to mention here. By all means give me with that any website, blog, etc, you want publicity for.

If you found this of interest, please mention in forums, give it a Facebook "like", Google "Plus", or whatever. I've almost given up writing these pages, because it seems they are seldom read, and of course not every reader will use them... so... is there any point? If you want more of this stuff, help!?

   Search this site                 powered by FreeFind
Site Map    What's New    Search

Click here to visit my main homepage where you can explore other areas, such as education, programming, investing.

Ad from page's editor: Yes.. I do enjoy compiling these things for you. I hope they are helpful. However... this doesn't pay my bills!!! Sheepdog Software (tm) is supposed to help do that, so if you found this stuff useful, (and you run a Windows or MS-DOS PC) please visit my freeware and shareware page, download something, and circulate it for me? Links on your page to this page would also be appreciated!
Click here to visit editor's freeware, shareware page.

How to email or write this page's editor, Tom Boyd

Valid HTML 4.01 Transitional Page tested for compliance with INDUSTRY (not MS-only) standards, using the free, publicly accessible validator at validator.w3.org. Mostly passes. A few "bad attributes" due to Google+ button, etc.

Why does this page cause a script to run? Because of the Google panels, and the code for the search button. Also, I have my web-traffic monitored for me by eXTReMe tracker. They offer a free tracker. If you want to try one, check out their site. Why do I mention the script? Be sure you know all you need to about spyware.

....... P a g e . . . E n d s .....