Things used in this project

Hardware components:
SparkFun Attiny84
×1
SparkFun mini Breadboard
×1
SparkFun RGB common anode LED
×1
6.8 k Resistor
×1
2.2 k Resistor
×1
4.7 k Resistor
×1
10 k Resistor
×1
1N5819 Diode
×1
10 uF Capacitor
×1
100 uF Capacitor
×1
0.1 uF Capacitor
×1
Ardgen 101
Arduino 101 & Genuino 101
×1
12002 04
Breadboard (generic)
×1
Adafruit n-Ch MOSFET
×1
Adafruit Terminal Block 2 pins
×2
USB Female A Port
×1
SparkFun Protoboard
×1
SparkFun Resistor Kit
×1
Software apps and online services:
Ide web
Arduino IDE

Schematics

Schematic
Follow the link for better understanding
Sch xbhxbmqjkm
Attiny Sleep Controller
Visit link if you are going to make it ! Ask me in comments for help/advice

Code

Tiny Sleep ControllerC/C++
Entire code is available on the zip file.
For better realization entire code is segmented into functions,
Details of the functions can be seen in the tabs.
Codes written using a mix of Arduino Functions and AVR Register Control method.
#include <avr/interrupt.h>
#include <avr/sleep.h>
#include <avr/wdt.h>

volatile unsigned int sp = 0;
volatile unsigned int second = 0;
volatile unsigned minute = 0;
volatile unsigned hour = 0;

int old_sec=0;

volatile uint32_t net_sec_counter=0;
uint32_t total_off_sec=0;
uint32_t total_on_sec=0;

int sec_off=0;
int min_off=0;
int hrs_off=0;

int sec_on=0;
int min_on=0;
int hrs_on=0;


///////////// add debounce to switch ///////////////
void setup() 
{
setup_IOpins();
setup_timing();
show_timing();
disable_adc();
setup_watchdog(6);
digitalWrite(10,HIGH);
digitalWrite(9,HIGH);
digitalWrite(7,HIGH);


}


void loop() 


{
    
system_sleep () ;
sleep_disable();                     
update_time();
control_load();

}
full codeArduino
Open Tiny_Power_Saver.ino file in Arduino IDE,
No preview (download only).

Credits

Inductor color code   copy
Shahariar
17 projects • 57 followers
The Material/Worldly Life is void setup () { } The Spiritual/After Life is void loop () { }
Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Sign up / LoginProjectsPlatformsTopicsContestsLiveAppsBetaBlog