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 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.

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

The composting friend
Intermediate
  • 675
  • 34

Full instructions

Our goal is to make composting easier to use and to maintain.

Automatic Fear 1.0
Intermediate
  • 336
  • 5

Full instructions

A device capable of frightening my sister and with compatibility with other members of the family

Theremino Adapter for CNC.
Intermediate
  • 303
  • 8

Full instructions

Attention: This adapter is used to replace the parallel port with the USB, and not to operate Mach3 CNC or Linux.

Theremino Logger
Intermediate
  • 175
  • 5

Datalogger is simple to use but with great performance. The base, concise and intuitive.

Smart Sump Pump Monitor
Intermediate
  • 851
  • 10

Full instructions

Sump pump monitor has live dashboard for usage statistics, and data logging. Email notifications through Particle Cloud or IFTTT.

Smart Home 433MHz RF <-> MQTT Gateway With Some Extras
Intermediate
  • 870
  • 4

Full instructions

Control your RF devices via MQTT and integrate them into your smart home 🏡, using the WEMOS ESP8266 connected to MQTT service via WiFi.

ProjectsCommunitiesContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login
Respect project
Feedback