Editor Version ×
recommended

Pro Edition

free

Brand new interactions and interfaces

Smooth support for design sizes of over 3W

devices or 10W pads

More rigorous design constraints, more

standardized processes

For enterprises, more professional users

Std Edition

Easy to use and quick to get started

The process supports design scales of 300

devices or 1000 pads

Supports simple circuit simulation

For students, teachers, creators

Ongoing

STD ATtiny13 TinyDecoder IR

ATtiny13 TinyDecoder IR

Project tags

License

CC-BY-SA 3.0

License: CC-BY-SA 3.0

Mode:

Mode

Editors' pick

Editors' pick

  • 3.6k
  • 0
  • 9
Update time: 2021-12-17 22:05:06
Creation time: 2020-11-15 18:14:00
Description

Description

# Overview TinyDecoderIR is a simple stand-alone IR remote control receiver and protocol decoder based on ATtiny13A (NEC protocol only) or ATtiny25 (NEC, RC-5, SONY SIRC, SAMSUNG protocols). - Project Video (YouTube): https://youtu.be/LEl5Z9QBuHo - Firmware (Github): https://github.com/wagiminator/ATtiny13-TinyDecoder ![pic1.jpg](https://raw.githubusercontent.com/wagiminator/ATtiny13-TinyDecoder/main/documentation/TinyDecoder_pic1.jpg) # Hardware The basic wiring is shown below: ![wiring.png](https://raw.githubusercontent.com/wagiminator/ATtiny13-TinyDecoder/main/documentation/TinyDecoder_wiring.png) The device is powered by a 1220 coin cell battery. Please remember that only the rechargeable LIR1220 Li-Ion batteries work. The "normal" CR1220s don't deliver enough power. ![pic3.jpg](https://raw.githubusercontent.com/wagiminator/ATtiny13-TinyDecoder/main/documentation/TinyDecoder_pic3.jpg) # Software ## IR Receiving and Decoding The IR NEC decoding function utilizes timer0 to measure the burst and pause lengths of the signal. The timer is automatically started and stopped or reset by the IR receiver via a pin change interrupt. The measured lengths are interpreted according to the NEC protocol and the transmitted code is calculated accordingly. The program was tested with the TSOP4838, but it should also work with other 38kHz IR receivers (note different pinout if necessary). The output of the IR reciever is inverted (active LOW), a burst is indicated by a LOW signal, a pause by a HIGH signal. IR message starts with a 9ms leading burst followed by a 4.5ms pause. Afterwards 4 data bytes are transmitted, least significant bit first. A "0" bit is a 562.5µs burst followed by a 562.5µs pause, a "1" bit is a 562.5µs burst followed by a 1687.5µs pause. A final 562.5µs burst signifies the end of the transmission. According to the data sheet of the TSOP4838, the length of the output signal differs from the transmitted signal by up to 158 microseconds, which the code must take into account. The four data bytes are in order: - the 8-bit address for the receiving device, - the 8-bit logical inverse of the address, - the 8-bit command and - the 8-bit logical inverse of the command. The Extended NEC protocol uses 16-bit addresses. Instead of sending an 8-bit address and its logically inverse, first the low byte and then the high byte of the address is transmitted. For a more detailed explanation on the NEC protocol refer to [TinyRemote](https://github.com/wagiminator/ATtiny13-TinyRemote). ```c // pin definitions #define IR_OUT PB3 // IR receiver pin // IR receiver definitions and macros #define IR_WAIT_LOW() while( PINB & (1 MicroCore** and select **ATtiny13**. - Go to **Tools** and choose the following board options: - **Clock:** 1.2 MHz internal osc. - **BOD:** BOD disabled - **Timing:** Micros disabled - Connect your programmer to your PC and to the ATtiny. - Go to **Tools -> Programmer** and select your ISP programmer (e.g. [USBasp](https://aliexpress.com/wholesale?SearchText=usbasp)). - Go to **Tools -> Burn Bootloader** to burn the fuses. - Open TinyDecoder_t13.ino and click **Upload**. ### If using the precompiled hex-file - Make sure you have installed [avrdude](https://learn.adafruit.com/usbtinyisp/avrdude). - Connect your programmer to your PC and to the ATtiny. - Open a terminal. - Navigate to the folder with the hex-file. - Execute the following command (if necessary replace "usbasp" with the programmer you use): ``` avrdude -c usbasp -p t13 -U lfuse:w:0x2a:m -U hfuse:w:0xff:m -U flash:w:tinydecoder_t13.hex ``` ### If using the makefile (Linux/Mac) - Make sure you have installed [avr-gcc toolchain and avrdude](http://maxembedded.com/2015/06/setting-up-avr-gcc-toolchain-on-linux-and-mac-os-x/). - Connect your programmer to your PC and to the ATtiny. - Open the makefile and change the programmer if you are not using usbasp. - Open a terminal. - Navigate to the folder with the makefile and sketch. - Run "make install" to compile, burn the fuses and upload the firmware. ## Upgrading to an ATtiny25 The 1 KB flash of the ATtiny13 is too small to implement the decoding of several protocols in combination with an OLED display (at least I didn't manage to do it). Fortunately, there are pin-compatible models with more memory. The ATtiny25 is available in the same package (150mil SOIC-8, e.g. ATtiny25-20SSU) and double flash memory. In order not to reinvent the wheel, I took David Johnson-Davies' excellent implementation of his [IR Remote Control Detective](http://www.technoblogy.com/show?24A9) for the ATtiny85 and adapted it so that it works with the 2 KB flash of the ATtiny25. In addition to the NEC protocol, Samsung, Sony and RC-5 can also be decoded without further hardware adjustments. ![pic4.jpg](https://raw.githubusercontent.com/wagiminator/ATtiny13-TinyDecoder/main/documentation/TinyDecoder_pic4.jpg) ![pic5.jpg](https://raw.githubusercontent.com/wagiminator/ATtiny13-TinyDecoder/main/documentation/TinyDecoder_pic5.jpg) # References, Links and Notes 1. [ATtiny13A Datasheet](http://ww1.microchip.com/downloads/en/DeviceDoc/doc8126.pdf) 2. [SSD1306 Datasheet](https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf) 3. [TSOP4838 Datasheet](https://www.vishay.com/docs/82459/tsop48.pdf) 4. [IR Remote Control based on ATtiny13A](https://github.com/wagiminator/ATtiny13-TinyRemote) 5. [How to use an I²C OLED with ATtiny13](https://github.com/wagiminator/ATtiny13-TinyOLEDdemo) 6. [IR Remote Control Detective](http://www.technoblogy.com/show?24A9)
Design Drawing

Design Drawing

schematic diagram
1 /
PCB
1 /
The preview image was not generated, please save it again in the editor.
ID Name Designator Footprint Quantity
1 MSK-11027 KEY1 SW_SMD_MSK-11027 1
2 OLED 0.91 OLED I2C OLED 0.91 1
3 10R R2 0603 1
4 10k R1 0603 1
5 ATtiny13A U1 SOP-8_150MIL 1
6 ICSP H1 ICSP-PADS-SMALL 1
7 100n C1,C3 0603 2
8 47u C2 1206 1
9 TSOP4838 U3 TSOP18XX 1
10 LIR1220 B1 CR1220-SMD 1

Unfold

Project Attachments

Project Attachments

Empty
Project Members

Project Members

Target complaint
Related Projects
Change a batch
Loading...

Comment

Add to album ×

Loading...

reminder ×

Do you need to add this project to the album?

服务时间

周一至周五 9:00~18:00
  • 0755 - 2382 4495
  • 153 6159 2675

服务时间

周一至周五 9:00~18:00
  • 立创EDA微信号

    easyeda

  • QQ交流群

    664186054

  • 立创EDA公众号

    lceda-cn