Tiny Bicolor LED Fader

Not all Arduino projects demand all GPIOs. ATtiny85 microcontroller certainly helps in miniaturizing such projects as required. So, for simple projects, the ATtiny85 can be a great choice.

Recall that the ATtiny85 microcontroller chip is capable of 10-bit analog-to-digital conversion, control of 6 of its GPIO pins, and 2.7-5.5V working voltage range. It provides a serial interface, which allows it to be programmed by another Arduino board, as well. Or you can try an easy-to-use tiny programmer

ATtiny85 Microcontroller

The real purpose of this short write-up is to share the basic project idea of an Attiny85 microcontroller-based bicolor LED fader good for beginners. Besides the microcontroller, the fairly simple fun project only demands a couple of LEDs and resistors. See its schematic below.

ATtiny85 Bicolor LED Fader Schematic

This is the Arduino-Style code for the bicolor flasher. You can use your Arduino IDE to upload this code to the Attiny85 chip. This is another helpful Attiny85 programming pointer

const int LED1 = 1; // PB1
const int LED2 = 0; // PB0

void setup() {
  pinMode(LED1, OUTPUT); // LED_YEL
  pinMode(LED2, OUTPUT); // LED_BLU
}

void SetColour (int colour, int intensity) {
  analogWrite(colour, intensity);
}
void loop() {
  for (int i = -255; i <= 254; i++) {
    SetColour(LED1, abs(i));
    SetColour(LED2, 255 - abs(i));
    delay(2);
  }
}

Now it’s time for a simple online simulation. This link will take you to the online Arduino simulator page https://wokwi.com/projects/343602333300556371. You can tinker with the sketch and watch the outcomes instantly. At last, use a small breadboard or general purpose circuit board to build your prototype.

WOKWi SiM

There it is the bicolour LED fade project based on an ATtiny85 microcontroller with just a 5VDC power source to energize it. When you’re ready to up sticks on to the next level of tiny microcontroller projects, the ATtiny85 can offer you increased capability and flexibility. Yes, you can do many fascinating projects – only your imagination is the limit here and the number of GPIO pins of course. If you have any questions, leave a comment down here.

Leave a Reply

Your email address will not be published. Required fields are marked *