Intro
This will be a series of posts on how to make an universal remote controller with a Raspberry Pi.The main motivation of doing this is to be able to control every (?) device on my home from a web API. This way I'll be able to control this API from my phone, web or even using Jasper.
The hardware I'll use for this is a Raspberry Pi, a few IR leds and an IR sensor.
Disclaimer: My knowledge about electronics it's practically null, so apply this at your own risk, ha...
For the software, I'll be using:
- Raspbian for the Pi OS (you can find hundreds of tutorials for setting that up)
- LIRC for handling the IR in/out
- Node, to expose an API for using the Pi as a remote controller.
Index
- Setting up LIRC
- Setting up IR Receiver and storing the codes
- Setting up IR Leds and using LIRC
- Create the Node API
Setting up LIRC
Installing LIRC on raspbian is pretty straight forward, I used most of the steps from here
> sudo apt-get install lirc
Now we need to configure a few files.
Open /etc/modules with nano:
> sudo nano /etc/modules
and add these lines:
lirc_dev lirc_rpi gpio_in_pin=23 gpio_out_pin=22
*Notice we're using pin 23 as IN and 22 for OUT, we'll have that in mind when wiring everything up.
Open /etc/lirc/hardware.conf
> sudo nano /etc/lirc/hardware.conf
And copy this:
######################################################## # /etc/lirc/hardware.conf # # Arguments which will be used when launching lircd LIRCD_ARGS="--uinput" # Don't start lircmd even if there seems to be a good config file # START_LIRCMD=false # Don't start irexec, even if a good config file seems to exist. # START_IREXEC=false # Try to load appropriate kernel modules LOAD_MODULES=true # Run "lircd --driver=help" for a list of supported drivers. DRIVER="default" # usually /dev/lirc0 is the correct setting for systems using udev DEVICE="/dev/lirc0" MODULES="lirc_rpi" # Default configuration files for your hardware if any LIRCD_CONF="" LIRCMD_CONF="" ########################################################
Case you're using 3.18.x or up Raspberry Pi firmware, you'll need to modify /boot/config.txt:
>sudo nano /boot/config.txt
Add:
dtoverlay=lirc-rpi,gpio_in_pin=23,gpio_out_pin=22
After that, you'll need to reboot your Pi.
On the next post, we'll attach a IR receiver to the Pi and get the remote controls.
On the next post, we'll attach a IR receiver to the Pi and get the remote controls.
No hay comentarios:
Publicar un comentario