[userMODULE] Lircd - Razberry IR control
Posted: 19 Apr 2015 20:27
Here is a razberry module for popular Lirc library that will allow you to control your Razberry Smart Home with any ordinary remote control or replace your any IR remote control with razberry.
In this topic I'll describe how to control your razberry devices with simple IR control priced 5$ or you can choose Logitech harmony for 150$
Checked on razberries with 2.0.1-rc25 version.
Step 1 - Buy TSOP38238
To allow razberry to recieve IR commands we need the next part:
TSOP38238 Datasheet Step 2 - Connect TSOP38238 to your Razberry
Power off your board.
Connect 1st pin of TSOP to GPIO24
Connect 2nd pin of TSOP to Ground
Connect 3rd pin of TSOP to 3.3V
On my PI 2(same for PI B+) board it looks like Where Red wire is 3.3V, Black wire is Ground and White wire is GPIO24
Step 3 - Install Lirc
Power on razberry.
Connect to SSH and issue the next command.
With your favorite editor add the next lines to your '/etc/modules' file:
and change '/etc/lirc/hardware.conf' file like
For raspberry Pi 2 and B+ add the next lines to '/boot/config.txt'
For raspberry Pi 2 also run 'rpi-update'
Step 4 - Test IR reciever
Restart your Lirc deamon
Input the next commands to put IR reciever driver in debug mode
Point any of your IR remote at your TSOP reciever and you then should see some lines added evry time you press a button on it
If something goes wrong check your TSOP connections and check this link
Step 5 - Learn IR codes from your remote
To learn codes from your remote follow a procedure described in this link
Step 6 - Install Lirc module to your razberry
Unpack and copy attached zip file to 'opt/z-way-server/Automation/userModules'
restart z-way server with '/etc/init.d/z-way-server restart'
After restart there will be a new Lircd module in Home Automation UI 'preference->modules->devices'
Select it and configure with 'localhost' for lircdURI.
Uh, at last installation is complete!
How to use it
On IR code recieving from one of your previously configured remotes the Lircd module emit event 'lircd.key' and pass an object with keyName (name of the key pressed) and isPressed (weather it was pressed or pressed and hold down).
Below is the sample for test.
Instantiate CustomUserCode module from 'Preferences->Modules->Scripting' and put the next code in it
or with eazyLogic module just put
That's all! Comments are welcome
In the next topic I'll describe how to replace all your IR remotes for your audio/video/climate equipment with Razberry.
In this topic I'll describe how to control your razberry devices with simple IR control priced 5$ or you can choose Logitech harmony for 150$
Checked on razberries with 2.0.1-rc25 version.
Step 1 - Buy TSOP38238
To allow razberry to recieve IR commands we need the next part:
TSOP38238 Datasheet Step 2 - Connect TSOP38238 to your Razberry
Power off your board.
Connect 1st pin of TSOP to GPIO24
Connect 2nd pin of TSOP to Ground
Connect 3rd pin of TSOP to 3.3V
On my PI 2(same for PI B+) board it looks like Where Red wire is 3.3V, Black wire is Ground and White wire is GPIO24
Step 3 - Install Lirc
Power on razberry.
Connect to SSH and issue the next command.
Code: Select all
sudo apt-get install lirc
Code: Select all
lirc_dev
lirc_rpi gpio_in_pin=24 gpio_out_pin=25
Code: Select all
########################################################
# /etc/lirc/hardware.conf
#
# Arguments which will be used when launching lircd
LIRCD_ARGS="--uinput --listen"
# 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=""
########################################################
Code: Select all
dtoverlay=lirc-rpi,gpio_in_pin=24,gpio_out_pin=25
Step 4 - Test IR reciever
Restart your Lirc deamon
Code: Select all
sudo /etc/init.d/lirc restart
Code: Select all
sudo /etc/init.d/lirc stop
mode2 -d /dev/lirc0
If something goes wrong check your TSOP connections and check this link
Step 5 - Learn IR codes from your remote
To learn codes from your remote follow a procedure described in this link
Step 6 - Install Lirc module to your razberry
Unpack and copy attached zip file to 'opt/z-way-server/Automation/userModules'
restart z-way server with '/etc/init.d/z-way-server restart'
After restart there will be a new Lircd module in Home Automation UI 'preference->modules->devices'
Select it and configure with 'localhost' for lircdURI.
Uh, at last installation is complete!
How to use it
On IR code recieving from one of your previously configured remotes the Lircd module emit event 'lircd.key' and pass an object with keyName (name of the key pressed) and isPressed (weather it was pressed or pressed and hold down).
Below is the sample for test.
Instantiate CustomUserCode module from 'Preferences->Modules->Scripting' and put the next code in it
Code: Select all
controller.on('lircd.key', function (event) {
if(event.keyName == 'KEY_1') {
controller.devices.get('RemoteHA_3_ZWayVDev_zway_10-0-38').performCommand('on');
}
})
Code: Select all
_z('dimmer on desk').onRemote('KEY_1').on()
_z('dimmer on desk').onRemote('KEY_2').off()
That's all! Comments are welcome
In the next topic I'll describe how to replace all your IR remotes for your audio/video/climate equipment with Razberry.