Introduction: ATtiny Dark Detector

Picture of ATtiny Dark Detector

This little project makes an ATtiny tell you when it is dark or bright. This project is an excellent introduction to the capabilities of the ATtiny85 chip.

You can also see these instructions on my website

Step 1: Parts

Picture of Parts
  • Solderless Breadboard
  • ATtiny 85
  • Red Led
  • Green Led
  • 2 330 ohm Resistors
  • 10k ohm Resistor
  • Photocell
  • Jumper Wires


  • Arduino
  • ATtiny Programer

Step 2: Build the Photocell Circuit

Picture of Build the Photocell Circuit

Build the photocell circuit. Connect one leg of the photocell to 5v. Connect the other leg to the digital 2 pin on the Arduino Uno and the 10k resistor. Connect the other leg of the resistor to ground.

Step 3: Serial Communication

Picture of Serial Communication

Use the Arduino Uno and serial communication to read the level of light coming from your photocell. You will need to upload the code at the bottom of the page and then click on the Serial Monitor button (top right). Record a number that seems to be a good cut off for when you want your ATtiny to say it is dark.

Step 4: Upload Code to ATtiny

Picture of Upload Code to ATtiny

Upload this code to the ATtiny85. If you need help on how to do this follow this tutorial. Feel free to change the threshold to whatever number you decided on in STEP 2. I picked 600 because it worked where I was at the time of programming.

Step 5: Build the Circuit

Picture of Build the Circuit

Build the circuit for the ATtiny85 chip. Follow the images or the schematic in the program.


JessicaN21 made it! (author)2017-04-08

I loved this project and edited it for my fabric night lights!

MsSweetSatisfaction (author)2014-08-16

Nice little project! Thanks for sharing!

KyleTheCreator (author)2014-08-15


About This Instructable



Bio: I'm an eagle scout from Colorado. I like to program, Arduino (if thats a verb) and make cool things. I also like to hike ... More »
More by peterfoxflick:ATtiny Flower PotPrograming an Attiny With Arduino IDEATtiny Dark Detector
Add instructable to: