ATtiny Dark Detector




About: 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, surf, and snowboard.

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

  • 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

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

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

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

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



  • IoT Challenge

    IoT Challenge
  • Colors of the Rainbow Contest

    Colors of the Rainbow Contest
  • Fandom Contest

    Fandom Contest

2 Discussions