Things used in this project

Hardware components:
Attiny85
Atmel ATTiny85
I used the ATTiny45, but it will also work on the ATTiny85
×1
SparkFun Electrolytic Decoupling Capacitors - 100uF/25V
×1
SparkFun Electrolytic Decoupling Capacitors - 1000uF/25V
×1
SparkFun Capacitor Ceramic 0.1uF
×1
SparkFun SPDT Slide Switch
×1
SparkFun LED - RGB Addressable, PTH, 8mm
×1
SparkFun Transistor - NPN (2N3904)
×1
SparkFun 1N4001 Diode Rectifier - 1A 50V
×1
11026 02
Jumper wires (generic)
×1
12002 04
Breadboard (generic)
×1
AA Battery
×1
AA Battery Holder
×1
7mm Inner Diameter Ferrite Ring Iron Toroid
×1
22 gauge solid core wire
I used the wires inside an ethernet cable. Thinner wire works well also, just make sure it's a solid core.
×1
Software apps and online services:
Ide web
Arduino Arduino IDE

Schematics

Breadboard Diagram
Attiny joule thief neopixel

Code

CodeArduino
You should play with the WATCHDOG_SLEEP variable to speed up or slow down color transitions.
#include <avr/sleep.h>
#include <avr/power.h>
#include <avr/wdt.h>

#define adc_disable() (ADCSRA &= ~(1<<ADEN)) // disable ADC (before power-off)

volatile bool f_wdt = 1;
uint16_t j = 164;

#include <Adafruit_NeoPixel.h>
Adafruit_NeoPixel strip = Adafruit_NeoPixel(1, 1, NEO_GRB + NEO_KHZ800);

// 0=16ms, 1=32ms,2=64ms,3=128ms,4=250ms,5=500ms
// 6=1 sec,7=2 sec, 8=4 sec, 9= 8sec
#define WATCHDOG_SLEEP 0

void setup() {
  adc_disable();
  setup_watchdog(WATCHDOG_SLEEP);
  
  strip.begin();
  strip.setBrightness(64);
  strip.show();
}

void loop() {
  rainbow();
}


void rainbow() {
  strip.setPixelColor(0, Wheel((j) & 255));
  strip.show();
  j++;
  
  system_sleep();
}


uint32_t Wheel(byte WheelPos) {
  WheelPos = 255 - WheelPos;
  if(WheelPos < 85) {
   return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  } 
  else if(WheelPos < 170) {
    WheelPos -= 85;
   return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  } 
  else {
   WheelPos -= 170;
   return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
  }
}


ISR(WDT_vect) {
  f_wdt = 1;
}


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);
  WDTCR |= (1<<WDCE) | (1<<WDE);
  WDTCR = bb;
  WDTCR |= _BV(WDIE);
}


void system_sleep() {
  set_sleep_mode(SLEEP_MODE_PWR_DOWN);
  sleep_enable();
  sleep_mode();
  sleep_disable();
}

Credits

Avatar
Garrett Bartley

Husband, father, maker.

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

Similar projects you might like

Starry Night Prom
Intermediate
  • 655
  • 7

How did I stand out at prom? In a light up dress of course!

Third Eye for The Blind
Intermediate
  • 605
  • 8

Full instructions

An innovative wearable technology for visually impaired peoples.

DIY Fidget LED Display
Intermediate
  • 997
  • 6

Work in progress

Fidget spinners...the simple spinning toy that came out of nowhere. I thought it'd be cool give it some flare and make it a POV display.

Controlling 2 motors with Bean+ and TB6612FNG
Intermediate
  • 19
  • 1

Full instructions

This project aims to demonstrate the operation of the TB6612FNG drive together with the Bean+ to control two DC motors trough an iPhone app.

ArduRadio AlarmClock
Intermediate
  • 1,320
  • 2

Full instructions

Build an FM radio with alarm clock.

Scrumtato: Make Daily Stand-Ups Agile Again
Intermediate
  • 781
  • 10

Scrumtato is an ATtiny85-based gadget to keep overly passionate developers from excessively talking during daily stand-up meetings.

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login