A tiny Arduino project: Generic IR receiver using ATTiny85 and TL1838

This project uses a small arduino compatible microcontroller board called Digispark which is based on attiny85 chip. It has a PCB usb header which can directly communicate with PC through a USB bootloader. The board is relatively inexpensive compared to regular arduino board. As it comes with a usb connector, no other programmers are needed. It is best suited for projects which require less memory and few i/o pins.


Board setup

  • Go to, File->preferences->in ‘Additional Boards Manager URLs’ enter


  • Go to,  Tools->Board->Boards Manager->Contributed-> Install ‘Digistump AVR Board’


  • Install the drivers from here
  • Tools->Board->Select ‘Digispark (Default – 16.5mhz)’



  • Arduino code is here, the irPin is ‘p2’ of board which is connect to IR module TL1838, 300ms debounce time is added to avoid false triggering. There is an inbuilt LED which is connected to ‘p1’ that is turned ON and OFF with the IR pulse.
int irPin=2;
int onoff = 0;

void setup()
void loop()
    delay(300); // the debounce time 300ms;
    if(onoff == 0)
      onoff =1;
      onoff =0;
  • The code is looking for a low transition on the IR receiver to toggle pin 1, any IR remote can be used since this is a generic receiver which does not actually decode the IR signals.


  •  Programming is different from normal arduino boards since USB bootloader is active for first 10s from power on. After 10 seconds the board will switch from bootloader to sketch execution state. The board needs to be plugged-in where the arduino IDE shows notification for programming.

arduino digispark programming


  • Pin out of TL1838 is shown below,


  • The connection for IR module is shown below, IR input is connected to p2 of the board.

  • Any IR remote can be used to give the signal. Here is the board connected to a usb powerbank and controlled by TV remote


Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.