Saturday, March 6, 2021

Capabilities of Supercapacitor

 



Several years ago I built the project utilizing supercapacitor (useless machine). Now I returned to this component again to make a set of small projects, which  will use super capacitor as backup power supply. Clip above shows initial test. Several seconds of charge is enough to power Attiny85 chip controlling blinking be-color LED for five minutes. At the end of this time LED blinks are barely visible but anyway I found result impressive. In case you need details, here is circuit diagram:


 And here is list of components:

  • Supercapacitor 0.1 F, 5.5 V (NEC)
  • Attiny85 microchip
  • Red-Green bi-color LED (5mm)
  • Resistor 180 Ohm, 0.125 W
  • Diode Schottky ( 1N5817) (for this test it is not really needed but later I will utilize it to detect the moment  when external power is down).
Circuit initially powered up by 5V USB 0.5 A power supply.
 Code is short, so I put it here as well.

#include <avr/io.h>
#define 	F_CPU   1000000UL
#include <util/delay.h>

typedef enum {OUT_LOW, OUT_HIGH} OutputLevel;

#define pinOut(bit, outLevel) \
(DDRB |= (1 << ( DDB##bit)));\
switch(outLevel) \
{\
	case OUT_LOW: (PORTB &= ~(1 << (DDB##bit))); break;\
	case OUT_HIGH: (PORTB |= (1 << (DDB##bit))); break;\
}

int main(void)
{
    while (1) 
    {
		pinOut(0,OUT_LOW);
		pinOut(2,OUT_HIGH);
		_delay_ms(200.0);
		pinOut(0,OUT_HIGH);
		pinOut(2,OUT_HIGH);
		_delay_ms(800.0);
		pinOut(0,OUT_HIGH);
		pinOut(2,OUT_LOW);
		_delay_ms(200.0);
		pinOut(0,OUT_HIGH);
		pinOut(2,OUT_HIGH);
		_delay_ms(800.0);
    }
}