Rudolph
### DESCRIPTION
A very cute reindeer Christmas ornament. You can hang it on the Christmas tree or anywhere you like
It`s very simple to make and requiers few components!
### TECHNICAL DETAILS / COMPONENTS
Here are some links to where you can buy what you need to build this project.
8mm Red led:
Attiny85 SO8:
SMD Switch:
1206 160ohm Resistor:
1206 100nF Capacitor:
CR2032 Battery Holder:
Mini USB SMD Connector for programming (OPTIONAL):
### LEARN / TOPIC / BUILD INSTRUCTIONS
After you solder all the components together, you need to program the attiny85 to light up Rudolph`s nose.
Here is some code to help you with that. You can modify it as you please
(To program the attiny I used my ICSP cable, wich uses a mini USB connector, but you can program it through other means
https://www.instructables.com/id/Arduino-ICSP-Cable/ )
/*
Ultra Low Power Led Flasher
with AtTiny85 @ 1Mhz
by Luca Soltoggio
06/01/2014
http://www.arduinoelettronica.com
*/
#include <avr/sleep.h>
#include <avr/wdt.h>
#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
#ifndef sbi
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
#endif
int pinLed = 0;
volatile boolean f_wdt = 1;
void setup(){
pinMode(pinLed,OUTPUT);
setup_watchdog(7); // 0=16ms, 1=32ms,2=64ms,3=128ms,4=250ms,5=500ms
// 6=1 sec,7=2 sec, 8=4 sec, 9= 8sec
}
void loop(){
if (f_wdt==1) { // wait for timed out watchdog / flag is set when a watchdog timeout occurs
f_wdt=0; // reset flag
digitalWrite(pinLed,HIGH); // let led blink
delay(100);
digitalWrite(pinLed,LOW);
pinMode(pinLed,INPUT); // set all used port to intput to save power
system_sleep();
pinMode(pinLed,OUTPUT); // set all ports into state before sleep
}
}
// set system into the sleep state
// system wakes up when wtchdog is timed out
void system_sleep() {
cbi(ADCSRA,ADEN); // switch Analog to Digitalconverter OFF
set_sleep_mode(SLEEP_MODE_PWR_DOWN); // sleep mode is set here
sleep_enable();
sleep_mode(); // System sleeps here
sleep_disable(); // System continues execution here when watchdog timed out
sbi(ADCSRA,ADEN); // switch Analog to Digitalconverter ON
}
void setup_watchdog(int ii) {
byte bb;
int ww;
if (ii > 9 ) ii=9;
bb=ii & 7;
if (ii > 7) bb|= (1<<5);
bb|= (1<<WDCE);
ww=bb;
MCUSR &= ~(1<<WDRF);
// start timed sequence
WDTCR |= (1<<WDCE) | (1<<WDE);
// set new watchdog timeout value
WDTCR = bb;
WDTCR |= _BV(WDIE);
}
// Watchdog Interrupt Service / is executed when watchdog timed out
ISR(WDT_vect) {
f_wdt=1; // set global flag
}
Rudolph
*PCBWay community is a sharing platform. We are not responsible for any design issues and parameter issues (board thickness, surface finish, etc.) you choose.
- Comments(0)
- Likes(3)
- Vincent Claes Dec 11,2018
- rachman bobo Mar 02,2018
- Sam Perry Dec 23,2017
- 0 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
More by katalin_123m
-
-
-
-
-
-
3D printed Enclosure Backplate for Riden RD60xx power supplies
154 1 1 -
-