Giter Club home page Giter Club logo

ir-receiver-controller's Introduction

Infrared controller to turn my audio receiver on

With a Raspberry Pi hooked up to my Yamaha receiver and raspotify we can play Spotify through our ceiling speakers. The receiver is in the basement and turns off after a few hours of inactivity which makes sense, most of the time we're not listening to music.

How do I turn it on though when we do want to listen to music? Go down to the basement every time seemed suboptimal. I didn't want to open the receiver and potentially break it with my poor soldering skills. The most straight forward way seemed to be to use IR (infra red) and remote control the receiver that way. So I built a contraption that sits in front of the receiver that "houses" an IR led, a 2N2222 transistor and a 10k Ohm resistor, wired up and controlled by the Raspberry Pi (GPIO) sitting on top of the receiver, hosting raspotify at the same time. I'm not that good with electronics so this is heavily inspired by this and this post. If you're on Raspbian Buster, make sure you follow the right instructions as LIRC, the IR control library, has changed. I looked up how the transistor worked here. The best GPIO diagram I could find was pinoput.xyz.

All the code really does is send IR commands using irsend, see LIRC. There are tons of profiles for all kinds of remote controls out there. I have a Yamaha RX30, there was no profile for that one. I tried the RAX26 but no luck. So I had to record my own profile. See here on how to do that. Beware of step 3, that's not compatible with Raspbian Buster, see above. To integrate it with existing home automation platforms, I added a simple REST API to trigger the irsend call. In the future I'd like to add MQTT as well. Finally we're installing the API as a systemd service.

I use Home Assistant and a REST API can be integrated like this (configuration.yaml)

rest_command:
  toggle_yamaha_receiver:
    url: 'http://raspberrypi-hosting-the-api.local:5000/rax30/power'
    method: 'post'

script:
  toggle_yamaha_receiver:
    sequence:
      - service: rest_command.toggle_yamaha_receiver

Raspberry Pi, Yamaha receiver, IR remote control contraption IR remote control contraption close up

Prerequisites

Requires virtualenv and LIRC.

Install dependencies

mkvirtualenv ir-receiver-controller
pip install -r requirements.txt

Start application

gunicorn -w 2 -b 0.0.0.0:5000 rax30_controller:app

Install as linux service

./scripts/build.sh && sudo ./scripts/install.sh

Turn on receiver

curl -X POST http://localhost:5000/rax30/power

ir-receiver-controller's People

Contributors

tobiasb avatar

Stargazers

 avatar

Watchers

 avatar  avatar

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.