Git Product home page Git Product logo

ir-tool's Introduction

IR Tool

Infra-red (IR) transmitter and receiver. A simple Zephyr project for TV control and general IR experiments.

Features:

  • Based on the Zephyr project - interactive UART shell interface

  • Support for ESP32-DevKitC and SAMD21 Mini, easily portable to other boards

  • IR receiving using interrupts

  • NEC protocol decoding and encoding (using nec_protocol library)

  • Repeating the last received IR message (protocol independent)

  • Configurable receive timeout

  • Adjustable timing compensation for both transmitting and receiving

Usage

HW

A suitable IR LED and a 38-kHz IR receiver is needed for transmitting and receiving, respectively. The LED can be switched directly or using an N-type MOSFET, to increase the output power.

For instance, the following components can be used:

It is possible to hook-up only the LED or the receiver, if the other functionality is not required (IR receiving can be disabled in the shell, or you can tie the recv pin to GND).

Devboard IR LED pin IR receiver pin

ESP32-DevKitC

25

14

SAMD21 Mini

D13 (PA17)

D11 (PA16)

Shell

In a terminal, connect to the USB UART port - the interactive shell interface will show.

There is a help message for each available command, simply start with the help command.

Receiving

Receiving is enabled by default, but you can also use ir_recv disable and ir_recv enable.

Each received messsage is decoded using the nec_protocol library and results are shown.

receive

Transmitting NEC command

You can either transmit a NEC message (8-bit address and command) using ir_send nec <address> <command> or you can transmit the last received message - ir_send last_recv.

send

Timing adjustments

The application internally represents each IR message as a sequence of pulse and space durations (waveform). The IR receivers usually make the pulses shorted and spaces longer, so the received waveform may not be sucessfully decoded. To compensate for this, there are configurable adjustments for both receiving and transmitting.

The default adjustment will prolong all received pulses by 50 microseconds and shorten all spaces by 50 microseconds. This could also be set by the following command:

ir_adj recv 50 -50

Building and flashing

Clone the repository, including the sub-modules:

git clone https://github.com/privara/nec-protocol --recursive

Build for the target board and flash using Zephyr’s west:

west build --pristine -b <esp32/adafruit_feather_m0_basic_proto> ir-tool/app
west flash

Build options

Refer to the KConfig file.

Porting to other boards

Refer to DT-overlays for currently supported boards.

PWM at 38 kHz is required for transmitting.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.