ATtiny Dark Detector

by peterfoxflick in Circuits > Arduino

3987 Views, 33 Favorites, 0 Comments

ATtiny Dark Detector

IMG_3691.JPG

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 www.PeterFoxFlick.com

Parts

IMG_3659.jpeg
IMG_3662.JPG
IMG_3666.JPG
IMG_3667.JPG
IMG_3670.JPG
IMG_3702.JPG
  • Solderless Breadboard
  • ATtiny 85
  • Red Led
  • Green Led
  • 2 330 ohm Resistors
  • 10k ohm Resistor
  • Photocell
  • Jumper Wires

Tools

  • Arduino
  • ATtiny Programer

Build the Photocell Circuit

IMG_3692.JPG
IMG_3693.JPG
IMG_3694.JPG

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.

Serial Communication

IMG_3695.JPG

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.

Upload Code to ATtiny

IMG_3699.JPG

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.

Build the Circuit

IMG_3678.JPG
IMG_3679.JPG
IMG_3682.JPG
IMG_3683.JPG
IMG_3684.JPG
IMG_3685.JPG
IMG_3687.JPG
IMG_3688.JPG
IMG_3689.JPG
IMG_3690.JPG

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