Cat With Blinky Eyes and Nose // Light and Sound Sensors

by SabinaStan in Circuits > Sensors

300 Views, 1 Favorites, 0 Comments

Cat With Blinky Eyes and Nose // Light and Sound Sensors

IMG_20191229_130441.jpg
IMG_20191229_130253.jpg
IMG_20191225_100935.jpg

About a year ago, I made a cat lamp shade and I thought that it would be nice to make a circuit for the cat's eyes to light when the light goes down.

I finally made time (mentally mostly) to do the circuit.

It makes the eyes of the cat blink every 5 seconds when there is little light and the nose blink five times when there is a sound in the vicinity of the lamp.

I hope you enjoy it. I surely do like to make something just for fun from time to time.

The circuit is made with an Attiny85 as it has to be rather small. To see how to program it using Arduino Uno, check out my first tutorial.

Supplies

  • Arduino Uno
  • Attiny85
  • Jumperwires
  • Breadboards
  • Sound sensor
  • Phototransistor
  • 6 x 5V LEDs for the eyes
  • 2 x 5V LEDs for the nose
  • 3 x 100k resistors
  • 1 x 220k resistor

IMG_20191225_102301.jpg

Connect the VCC and GND of the Attiny to the Arduin Uno to provide power.

IMG_20191225_101226.jpg
IMG_20191225_101306.jpg
IMG_20191225_101503.jpg
IMG_20191225_103938.jpg

Connect the LEDs of the eyes and nose to the Attiny

  • LeftEye - pin 4
  • RightEye - pin 2
  • Nose - pin 0

To see the diagram of the Attiny pins go here.

The LEDs can be organized however suits you, just make sure to connect all the ground and out pins, respectively, together.

IMG_20191225_104057.jpg

Connect the phototransitor:

  • one pin of the phototransitor to the VCC of the Attiny
  • the other pin of the phototransitor to a 220k resistor and to the 3 pin of the Attiny
  • the second pin of the resistor to the GND

IMG_20191225_104159.jpg

Connect the sound sensor:

  • GND to ground
  • VCC to VCC
  • OUT to 1 pin of the Attiny

Code

IMG_20191225_104203.jpg
int lefteye = 2;
int righteye = 4; int nose = 0; int lightSensorPin = 3; int analogValue = 0; int sensor = 1; int val = 0;] void setup() { pinMode(lefteye, OUTPUT); pinMode(righteye,OUTPUT); pinMode(nose,OUTPUT); pinMode (lightSensorPin, INPUT); pinMode(sensor, INPUT); } void loop(){ digitalWrite(lefteye, LOW); digitalWrite(righteye, LOW); digitalWrite(nose, LOW); sound (); light (); } void light () { analogValue = analogRead(lightSensorPin); if(analogValue < 50){ digitalWrite(lefteye, HIGH); digitalWrite(righteye, HIGH); delay (500); digitalWrite(lefteye, LOW); digitalWrite(righteye, LOW); delay (300); } } void sound () { val =digitalRead(sensor); if(val==0){ for ( int i =0; i<5; i++){ digitalWrite(nose, HIGH); delay (200); digitalWrite(nose, LOW); delay (200); } } }

Final Result

videotogif_2019.12.29_13.33.09.gif

To make the circuit to fit the head of the cat, you have to solder it to a prototype board.

I chose for power to solder a 5V AC/DC Adaptor, but you can use a USB port as well or bateries although they are not environmentally ok. ^.^

Enjoy! :)