ATtiny_Garden-Lamp/README.md

4.8 KiB

ATtiny 13 WS2812B-LED Fire-Effect Garden Lamp

This is how you can build a Garden Lamp based on an ATtiny13 and some WS2812B (Neopixel) LEDs. The LEDs are Simulating a nice-looking Fire-Effect. This effect is generated using a random number generator. It also features a LDR Light-Sensor to turn on the Lamp in the Darkness automatically. In the code you can set a time after which the lamp automatically turns off, even if it is still dark.

This circuit can be used with old solar lamps like i did it with this one:

Software

The software is based on several different code snippets. You can find links to them in the Sources-Tab. There are a view different configuration options (like on-time, color, ...), which can be done in the config.h file. They are well described in this file.

Features

  1. Fire-Effect turns on when LDR-value gets under on_val as defined
  2. Second state is entered after the timeout max_on_time is reached. The LEDs light in the color, defined as timeout_....
  3. If it gets light again the LEDs light in the color, defined as day_.... If you want it to be off, set all values to 0.

Program the ATtiny

1. Upload ArduinoISP sketch to the Arduino

You can find it in the Examples folder of the Arduino-IDE

2. wiring

I use a Arduino Nano to program the ATtiny, but also a Arduino UNO will do fine. Hook up the ATtiny like it is shown in the schematic:

The capacitor is important because it prevents the Arduino from resetting itself while programming the ATtiny.

3. Download ATtiny13 support for the IDE

Add the URL http://drazzy.com/package_drazzy.com_index.json to the Additional Boards Manager URLs in the IDE Preferences. After that open the Boards-Manager, search for "DIY Attiny" and install it. Now you should find the Attiny13 and some other Attiny Boards in the Board menu.

4. Uploading

Open the code in the Arduino IDE and select the Attiny13 as the Board. Select the following settings:

These settings are important:

  • Processor-Speed to 9.6 Mhz
  • Millis, Tone Support to "No Millis, No Tone"
  • Programmer: "Arduino as ISP" (NOT Arduino ISP)

After that Press Burn Bootloader to make sure that these Settings are applied.

Now you can upload the code by simply pressing Upload.

Hardware

Schematic

PCB Layout

ATtiny-Pinout


(Source: https://cdn.sparkfun.com/assets/f/8/f/d/9/52713d5b757b7fc0658b4567.png)

Sources / Useful Links

You can find more detailed information here:


I hope you like this project!


This work by Dustin Brunner is licensed under CC BY 4.0

Creative Commons Lizenzvertrag
Dieses Werk von Dustin Brunner ist lizenziert unter einer Creative Commons Namensnennung 4.0 International Lizenz.