mba
Posts: 110
Joined: Fri Jun 08, 2012 7:05 pm
Location: Denmark

Re: LIRC GPIO driver for homebrew adapter

Sun Sep 29, 2013 7:03 pm

What is the problem? Do you have any output from when lircd starts? Can you post your hardware.conf file. Have you setup lircd to start automatically? See my instructions around step 23. which describes how to make lircd start.
AMOTE - a LIRC client for Android. Build your own Android-based universal remote.

AlmightyTech
Posts: 24
Joined: Thu Oct 11, 2012 11:16 am

Re: LIRC GPIO driver for homebrew adapter

Mon Sep 30, 2013 7:39 am

http://aron.ws/projects/lirc_rpi/
The driver is not in the main lirc repository, so the lirc sources must be patched first then the driver must be compiled.
what does it mean..

http://www.raspberrypi.org/phpBB3/viewt ... 27#p146427
i think step 19 & 20 doing same ( lirc sources patched).
but patch file is not available as on step 19.

so how to override this problem...?
when ./configuring , we must specify driver.

AlmightyTech
Posts: 24
Joined: Thu Oct 11, 2012 11:16 am

Re: LIRC GPIO driver for homebrew adapter

Mon Sep 30, 2013 10:31 am

ok.. now I am very near..
please tell me in detail about step 25.
25. nano /etc/init.d/lirc
I have modify as bellow..

Code: Select all

#! /bin/sh
### BEGIN INIT INFO
# Provides: lirc
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Enable service provided by daemon.
### END INIT INFO
but,,
did not understand..
insert at start and restart:
if test ! -d /var/run/lirc; then
mkdir /var/run/lirc
fi
insert this under start and restart where lircd is started:
start-stop-daemon --start --quiet --exec /usr/local/sbin/lircd -- --device=/dev/lirc/0 --listen

reply please mba..
thanks in advance..

AlmightyTech
Posts: 24
Joined: Thu Oct 11, 2012 11:16 am

Re: LIRC GPIO driver for homebrew adapter

Mon Sep 30, 2013 10:39 am

Code: Select all

#! /bin/sh
#
# This is an init script for Debian 2.1 Slink distribution.
# Copy it to /etc/init.d/lirc and type
# > update-rc.d lirc defaults 20
#


test -f /usr/local/sbin/lircd || exit 0
test -f /usr/local/sbin/lircmd || exit 0

case "$1" in
  start)
    echo -n "Starting lirc daemon: lircd"
    start-stop-daemon --start --quiet --exec /usr/local/sbin/lircd -- --device=/dev/lirc
    echo -n " lircmd"
    start-stop-daemon --start --quiet --exec /usr/local/sbin/lircmd
    echo "."
    ;;
  stop)
    echo -n "Stopping lirc daemon: lircmd"
    start-stop-daemon --stop --quiet --exec /usr/local/sbin/lircmd
    echo -n " lircd"
    start-stop-daemon --stop --quiet --exec /usr/local/sbin/lircd
    echo "."
    ;;
  reload|force-reload)
    start-stop-daemon --stop --quiet --signal 1 --exec /usr/local/sbin/lircd
    start-stop-daemon --stop --quiet --signal 1 --exec /usr/local/sbin/lircmd
    ;;
  restart)
    echo -n "Stopping lirc daemon: lircmd"
    start-stop-daemon --stop --quiet --exec /usr/local/sbin/lircmd
    echo " lircd"
    start-stop-daemon --stop --quiet --exec /usr/local/sbin/lircd
    sleep 1
    echo -n "Starting lirc daemon: lircd"
    start-stop-daemon --start --quiet --exec /usr/local/sbin/lircd -- --device=/dev/lirc
    echo -n " lircmd"
    start-stop-daemon --start --quiet --exec /usr/local/sbin/lircmd
    echo "."
    ;;
  *)
    echo "Usage: /etc/init.d/lircd {start|stop|reload|restart|force-reload}"
    exit 1
esac

exit 0
this is my original lirc.debian file

mba
Posts: 110
Joined: Fri Jun 08, 2012 7:05 pm
Location: Denmark

Re: LIRC GPIO driver for homebrew adapter

Mon Sep 30, 2013 7:33 pm

Hi Mahendra,

I just went through the installation myself. This is how you can compile and install lirc.

1. installed 2013-09-25-wheezy-raspbian.zip, expanded fs and enabled ssh

2. Edit modules and insert the following two lines at the end of the file. Replace gpio numbers with numbers that makes sense on your system:
sudo nano /etc/modules
lirc_dev
lirc_rpi gpio_in_pin=18 gpio_out_pin=17

3. sudo apt-get install libtool
4. sudo apt-get install autoconf
5. git clone git://lirc.git.sourceforge.net/gitroot/lirc/lirc
6. cd lirc
7. ./autogen.sh
8. ./configure --sbindir=/usr/sbin --with-driver=userspace
9. make
10. sudo make install
11. Copy the attached lirc file to /etc/init.d/. I took it from the LIRC debian package which you can install with apt-get.
12. sudo chmod +x /etc/init.d/lirc
13. sudo insserv /etc/init.d/lirc
14. sudo mkdir /etc/lirc
15. sudo cp contrib/lircd.conf /etc/lirc/ (or make your own)
16. Copy the attached hardware.conf to /etc/lirc/
17. sudo reboot
config.zip
lirc script and hardware configuration
(1.95 KiB) Downloaded 394 times
Best regards
Martin
AMOTE - a LIRC client for Android. Build your own Android-based universal remote.

AlmightyTech
Posts: 24
Joined: Thu Oct 11, 2012 11:16 am

Re: LIRC GPIO driver for homebrew adapter

Wed Oct 02, 2013 2:36 pm

thanks Martin..
I will let you know after testing..

AlmightyTech
Posts: 24
Joined: Thu Oct 11, 2012 11:16 am

Re: LIRC GPIO driver for homebrew adapter

Fri Oct 04, 2013 9:47 am

it works...Martin
but it is difficult for me to add new function SEND_RAW.. I want to make this function for AC.
I decode IR code of AC(mitsubishi) ,it send whole string(all data) of remote on any button press.
currently I manage these things working by
browser->websocket- >python tornado->serial comm>arduino-->GPIO

mba
Posts: 110
Joined: Fri Jun 08, 2012 7:05 pm
Location: Denmark

Re: LIRC GPIO driver for homebrew adapter

Fri Oct 04, 2013 10:01 am

I am a bit unsure why you need to send the command in raw format every time and why its not possible to store the raw commands your AC knows in your lircd.conf? Or maybe I don't understand what you are actually trying to achieve altogether.

Could you try to explain your project in more general terms?
AMOTE - a LIRC client for Android. Build your own Android-based universal remote.

AlmightyTech
Posts: 24
Joined: Thu Oct 11, 2012 11:16 am

Re: LIRC GPIO driver for homebrew adapter

Fri Oct 04, 2013 10:11 am

I send you excel file which i make from decoding of AC remote.
if i press fan speed button from remote. than remote will not send only fan speed data. but remote will send send fan speed data including all other (like temp, ventilation, cooling mode etc..)
after seeing excel sheet , you will know better.

AlmightyTech
Posts: 24
Joined: Thu Oct 11, 2012 11:16 am

Re: LIRC GPIO driver for homebrew adapter

Fri Oct 04, 2013 10:19 am

this is the file.

mba
Posts: 110
Joined: Fri Jun 08, 2012 7:05 pm
Location: Denmark

Re: LIRC GPIO driver for homebrew adapter

Sun Oct 06, 2013 7:56 am

I am still not sure what you are after. Do you need to dynamically change the command you are sending based on the parameters and values listed in the excel sheet, making it impossible to create every command statically in lircd.conf?

If so I guess theres no easy way other than implementing the raw function as you suggested in lircd.

Could you break down the command into smaller pieces just sending each parameter at a time? Do you know the name of the protocol you are using? Maybe it is possible to generate the timings for every possible commands your AC knows using Bengt Mårtenssons excellent IrMaster. As a matter of fact I just stumbled accross something quite interesting on Bengt's site where he has made a patch available for LIRC that enables you to do exactly what you are after.

Best regards
Martin
AMOTE - a LIRC client for Android. Build your own Android-based universal remote.

AlmightyTech
Posts: 24
Joined: Thu Oct 11, 2012 11:16 am

Re: LIRC GPIO driver for homebrew adapter

Sun Oct 06, 2013 10:32 am

I have attach one sample..(temp31)

#define MITSUBISHI_HDR_MARK 3420
#define MITSUBISHI_HDR_SPACE 1680

#define MITSUBISHI_ONE_MARK 420
#define MITSUBISHI_ONE_SPACE 1225

#define MITSUBISHI_ZERO_MARK 420
#define MITSUBISHI_ZERO_SPACE 420
these are timing detail.
and code is dynamic.

AlmightyTech
Posts: 24
Joined: Thu Oct 11, 2012 11:16 am

Re: LIRC GPIO driver for homebrew adapter

Sun Oct 06, 2013 10:36 am

I cant attach whole file so..
download
http://www.ostan.cz/IR_protocol_analyzer/
and load the attached sample..

mba
Posts: 110
Joined: Fri Jun 08, 2012 7:05 pm
Location: Denmark

Re: LIRC GPIO driver for homebrew adapter

Sun Oct 06, 2013 11:09 am

I don't think I can help you more than I already did. Either write your own raw command addition to lircd or look at the CCF patch from Bengt
AMOTE - a LIRC client for Android. Build your own Android-based universal remote.

AlmightyTech
Posts: 24
Joined: Thu Oct 11, 2012 11:16 am

Re: LIRC GPIO driver for homebrew adapter

Sun Oct 06, 2013 11:45 am

mba wrote:I don't think I can help you more than I already did. Either write your own raw command addition to lircd or look at the CCF patch from Bengt
hey, MBA
you help me a lot..
thanksss for your help..
and I have also test your program amote.. Its supper cool app.

AlmightyTech
Posts: 24
Joined: Thu Oct 11, 2012 11:16 am

Re: LIRC GPIO driver for homebrew adapter

Thu Oct 10, 2013 11:14 am

I have installed lirc as MBA describe above , and it works as it should be.
but,
I make some minor change in lircd.c
than
1.sudo make uninstall
2.make
3.sudo make install

but changes(which i made in lircd.c) does not take effect..?
what steps should be take to make it work..?

AlmightyTech
Posts: 24
Joined: Thu Oct 11, 2012 11:16 am

Re: LIRC GPIO driver for homebrew adapter

Thu Oct 10, 2013 5:21 pm

reboot was missing..
problem solved by
sudo /etc/init.d/lirc restart

chrisalanwest
Posts: 2
Joined: Fri Oct 11, 2013 5:48 pm

Re: LIRC GPIO driver for homebrew adapter

Fri Oct 11, 2013 5:55 pm

I'm currently running lirc on my pi without any problems.
I now want to add some extra transmitters. That's how I found this post.
If someone's got time, please could you tell me how to implement Bengt Martensson's enhanced module?
I installed lirc and followed this setup guide: http://alexba.in/blog/2013/01/06/settin ... spberrypi/
I'm at a loss as to how to compile lirc_rpi.c. I've tried some google searches but nothing I do works!
Sorry the solution is obvious, I'm very new to Linux.
Thanks in advance...

AlmightyTech
Posts: 24
Joined: Thu Oct 11, 2012 11:16 am

Re: LIRC GPIO driver for homebrew adapter

Thu Oct 17, 2013 1:38 pm

Code: Select all

[b]typedef __u64 ir_code;[/b]
struct ir_ncode {
	char *name;
	[b]ir_code code[/b];
	int length;
	lirc_t *signals;
	struct ir_code_node *next;
	struct ir_code_node *current;
	struct ir_code_node *transmit_state;
};
here, i think "code" is 64 bit.
so there is limit of code .
if my code is more than 64 bit, example(mitsubishi AC).
how to send code more than 64 bit.
I am able to send raw code bellow 64 bit, by assigning value to code->code.
but what if code is bigger than 64 bit.

cira
Posts: 4
Joined: Thu Oct 17, 2013 1:47 am

Re: LIRC GPIO driver for homebrew adapter

Mon Oct 28, 2013 12:29 am

nry wrote:I managed to hack some additional renamed drivers into the kernel. Works perfectly well for the first 2 receivers/transmitters. Haven't tried the other two.

My git repo can be found here: https://github.com/phillipsnick/rpi-linux

If you look under drivers/staging/media/lirc/
There are three additional files lirc_rpib.c lirc_rpic.c lirc_rpid.c

Then I simply run separate LIRC instances.

Understand this is a dirty hack but gets the job done!
@nry I have a question for you. I just downloaded your source and compiled it. Things seem to be working but not the way I expected them to. Maybe I have done something wrong? Maybe I am just clueless.

I will give a little bit of info on my setup. I have two TSOP hooked up because I want to receive two different frequencies and repeat them as well as be able to programmatic control the devices. That said I have a 38khz TSOP38238 (pin 1=out, 2 = gnd, 3=Vs) and a 56khz TSOP31265 (pin 1=gnd, 2=Vs, 3=out). I have the Vs pin on both tied to the PI gpio pin 1 (3v3), ground is tied to gpio 6, out from the 38khz is tied to gpio 18, and out from the 56khz is tied to gpio 22.

So I compiled the lirc_rpib.c lirc_rpic.c lirc_rpid.c, coppied over the .ko files and installed the lirc_rpib using:

Code: Select all

sudo insmod lirc_rpib.ko gpio_in_pin=22 gpio_out_pin=0
Started a second instance of lircd with:

Code: Select all

sudo /usr/sbin/lircd --driver=default --device=/dev/lirc1 --uinput --output=/var/run/lirc/lircd-lirc1 --pidfile=/var/run/lirc/lircd-lirc1.pid /etc/lirc/lircd.conf
So if understanding correctly, assuming the first instance or lircd is outputting to /var/run/lirc/lircd-lirc0 (which it is by the way), that anything transmitted in 38khz would show up at /var/run/lircd-lircd-lirc0, and anything by a 56khz device would show up at /var/run/lirc/lircd-lirc1. However when I run irw and watch the output from both I see all of the output coming from /var/run/lirc/lircd-lirc1, and nothing coming from ../lircd-lirc0. Is that the behavior I should be seeing or did I do something wrong?

Also, I noticed not all of the commands that are sent at 38khz are registered in this configuration. But when I kill the second instance of lircd and rmmod the lirc_rpib all the commands are then recognized for the 38khz remotes. Have I done something completely noobish in my setup? This is also my first time trying to compile a kernel module, so maybe I messed something up there?

Update: I did some tinkering and discovered it seems to be related to the order the modules are loaded? For example if I load the lirc_rpib.ko passing gpio_in_pin=22 (my 56khz TSOP), then I kill the lird and install the module lirc_rpi.lo passing gpio_in_pin=18 (my 38khz TSOP), and make sure lircd is running. The behavior flip flops the module loaded last works properly.

rwcherry
Posts: 10
Joined: Mon Oct 28, 2013 3:37 am

Re: LIRC GPIO driver for homebrew adapter

Mon Oct 28, 2013 3:56 am

Earlier Post:
"by mba » Fri Oct 04, 2013 10:01 am
I am a bit unsure why you need to send the command in raw format every time and why its not possible to store the raw commands your AC knows in your lircd.conf? Or maybe I don't understand what you are actually trying to achieve altogether.

Could you try to explain your project in more general terms?"

I might be able to add some to this as I want to do exactly the same thing; except in my case it is a YMGI mini-split heat pump installed in my hangar 4 miles away. In these systems the IR remote is not the simple media type remote used by media devices where the code is fixed for each button. The IR remote here is actually the thermostat and contains some higher level of control. When ever any button on the remote is pressed the whole state of the heat pump as a result of that button press is sent and could be different for each press of the same button. So it is not a static key code. For example, say the heat pump is in the heat mode and the temperature set point is 20C. The user presses the '+' key and the remote will send the complete state of the heat pump with a new temperature set point of 21C. Press '+' again and the whole state of the heat pump will be sent with the set point of 22C.

So it cannot be a static key code in a config file somewhere. It has to be created on the fly, or in the 'raw' mode.

I am hoping there is a solution (not smart enough yet to create it myself) ad I want a web interface from home to turn on the heat 30 minutes before I head out & so forth.

bc

rwcherry
Posts: 10
Joined: Mon Oct 28, 2013 3:37 am

Re: LIRC GPIO driver for homebrew adapter

Mon Oct 28, 2013 1:09 pm

rwcherry wrote:Earlier Post:
"by mba » Fri Oct 04, 2013 10:01 am
I am a bit unsure why you need to send the command in raw format every time and why its not possible to store the raw commands your AC knows in your lircd.conf? Or maybe I don't understand what you are actually trying to achieve altogether.

Could you try to explain your project in more general terms?"

I might be able to add some to this as I want to do exactly the same thing; except in my case it is a YMGI mini-split heat pump installed in my hangar 4 miles away. In these systems the IR remote is not the simple media type remote used by media devices where the code is fixed for each button. The IR remote here is actually the thermostat and contains some higher level of control. When ever any button on the remote is pressed the whole state of the heat pump as a result of that button press is sent and could be different for each press of the same button. So it is not a static key code. For example, say the heat pump is in the heat mode and the temperature set point is 20C. The user presses the '+' key and the remote will send the complete state of the heat pump with a new temperature set point of 21C. Press '+' again and the whole state of the heat pump will be sent with the set point of 22C.

So it cannot be a static key code in a config file somewhere. It has to be created on the fly, or in the 'raw' mode.

I am hoping there is a solution (not smart enough yet to create it myself) ad I want a web interface from home to turn on the heat 30 minutes before I head out & so forth.

bc
Or I guess an alternate plan, if LIRC is able to handle command codes that are 64+ bits long, is to create (by recording) just a few 'commands' for the few things you might want to do remotely:

- Turn heat pump off
- Turn on in heating mode, target temperature 68F, fan on auto, sweep on, turbo mode
- Turn on in cooling mode, target temperature 72F, fan on auto, sweep on, turbo mode

bc

rwcherry
Posts: 10
Joined: Mon Oct 28, 2013 3:37 am

Re: LIRC GPIO driver for homebrew adapter

Mon Oct 28, 2013 1:59 pm

AlmightyTech wrote:I cant attach whole file so..
download
http://www.ostan.cz/IR_protocol_analyzer/
and load the attached sample..
In looking at your data & spreadsheets, it would appear that Mitsubishi & YMGI heat pumps use the same controllers/protocol; so I am very interested in your status & progress. Last summer I did some reverse engineering and made some notes, attached as a .pdf here. (pdf not allowed?)

rwcherry
Posts: 10
Joined: Mon Oct 28, 2013 3:37 am

Re: LIRC GPIO driver for homebrew adapter

Thu Oct 31, 2013 12:51 am

Have not seen any post on controlling a heat pump with raspberry pi LIRC, nor received any responses to my email; but I will go ahead and post anyways.

Today I took my Raspberry Pi Test IR setup out to the hangar, made sure the heat pump was off & sent the 1 command stream I had built which should have turned the heat pump on to heat mode. It seemed to turn on, but I could not tell what it was doing beyond that as I must have had the bit that turns the front panel status indicators off in the commend I built. So I need to figure that bit out and make a couple more commands like cool_on & off.

rwcherry
Posts: 10
Joined: Mon Oct 28, 2013 3:37 am

Re: LIRC GPIO driver for homebrew adapter

Thu Oct 31, 2013 2:24 am

It looks like the YMGI heat pump uses 66 bits in its commands.

Return to “HATs and other add-ons”