Page 1 of 2
Problem with LIRC configuration
Posted: Wed Jul 31, 2013 1:14 am
by Akkrand
Hi,
I have been using lirc on my laptop (a dell mini 910), and using an FTDI USB-Serial cable with an infra-red LED and sensor attached to the end of it, to pick up signals from my TV remote and transmit back. I got all that working, finding the right remote file, compiling and installing lirc, etc.
I got the instructions for the ftdi usb-cable from
http://www.huitsing.nl/irftdi/
I then installed lirc on my raspberry pi, but even with the same installation, same lircd.conf, the pi was not able to turn my TV on nor pick up the transmissions from the remote.
I installed lirc on a second raspberry pi, and even when one of them transmits, the other does not pick it up.
Some things that I've noticed that seem weird:
Using mode2, both pick up pulses and spaces when I point the remote at them and press a button. Also, both pick up the transmissions of the other when I send with one and listen with the other:
Code: Select all
piOne$ sudo irsend SEND_ONCE remote button
piTwo$ sudo mode2
will produce spam of pulses and spaces in piTwo, but
will produce nothing.
The only thing I can think of is that something is 'intercepting' the commands before irw gets them, because they're clearly being received.
Another thing that I'm not sure about is that if I install lirc via "apt-get install lirc" I get a hardware.conf in /etc/lirc as well as lircd.conf, but I'm not sure what should be in that file. When I remove lirc and compile and configure it, it says that no kernel modules are required for the hardware I'm using.
Any help? Anyone else used a USB-Serial cable like in
http://www.huitsing.nl/irftdi/ on a raspberry pi?
Cheers,
Antony
Re: Problem with LIRC configuration
Posted: Wed Jul 31, 2013 8:06 am
by mba
Hi Antony,
in hardware.conf you can specify things such as which driver and device to use. Could you try posting your hardware.conf? And also try finding out which device ftdi is connected to in /dev/?
If all things fail I can only recommend using a GPIO blaster/receiver. Its super simple and works flawlessly. Take a look at
http://www.datscharf.dk/amote/hardware/diy-transmitter/
Best regards
Martin
Re: Problem with LIRC configuration
Posted: Wed Jul 31, 2013 11:10 am
by Akkrand
Hey, thanks for you help.
When I compile the lirc binaries and install them myself, there is no hardware.conf at all, nor lircd.conf - I provide the lircd.conf and put it in /etc/lirc/ myself. My other laptop didn't have one in it's installation, either.
When there is a hardware.conf (after installing lirc via "apt-get install lirc") then it's just the default. Something like:
Code: Select all
# /etc/lirc/hardware.conf
#
# Arguments which will be used when launching lircd
LIRCD_ARGS=""
#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=""
MODULES=""
# Default configuration files for your hardware if any
LIRCD_CONF=""
LIRCMD_CONF=""
No difference in operation if I say:
or
or
or
or
or
But usually anything deviating from those entries will give me an error of some kind, so I'm fairly sure they're correct.
It's worth noting that SOMETHING is reading my lircd.conf, because if I try:
Code: Select all
sudo irsend SEND_ONCE notMyRemote notAButton
I get an error that either the remote is not found, or the button does not exist, and when I use irsend correctly, I can 'eyeball' the pulses and spaces on the other pi and they match with what they should be according to what was pressed - some parts, like the headers & gaps, have pulses and spaces that are of lengths that are very close to those received. With an eps of 20 (a 20% error margin), I would expect them to be decoded.
I might head down to Jaycar next week and pick up the bits necessary to make the circuit you linked to; can it both send and receive at the same time?
Cheers,
Antony
Re: Problem with LIRC configuration
Posted: Wed Jul 31, 2013 8:54 pm
by mba
All sounds to be in working order then

!
mode2 displays the raw data as its received while irw displays any command it recognizes. The question is, are you using a remote which is defined in your /etc/lirc/lircd.conf? When pressing a key on the remote, the key must be declared in the lircd.conf file in order for irw to detect and display it.
You can both send and receive using GPIO pins on the Raspberry Pi. I just added a description of a very simple receiver circuit at
http://www.datscharf.dk/amote/hardware/diy-receiver/
Br
Martin
Re: Problem with LIRC configuration
Posted: Thu Aug 01, 2013 1:06 am
by Akkrand
Yeah, that's what I thought when it wasn't showing up in irw (even though it did on my other laptop with the same lircd.conf file).
That's why I tried transmitting from one pi to the other, to take the remote out of the equation; they both have identical everything, so my logic was that what piOne was transmitting would have to be received by piTwo, because it was transmitting using *exactly* the same file that piTwo was using to decode the signals.
The other advantage of this approach (ignore the remote) is that's what I'm going to use it for; I don't need them to actually be able to turn on my TV or pick up signals from my remote, I want them to be able to send signals to *each other*, because I'm trying to build a lasertag-type system with them.
It reinforces my belief that either:
a) something else is intercepting the signals other than irw.
b) irw can't keep up with the rate of decoding and so doesn't recognize anything.
c) some other weird thing is happening.
So regarding the GPIO pins, if I make up a couple of DIY Transmitters & Receivers, I should be able to connect both a transmitter and a receiver to different GPIO pins and use one to transmit and one to receive? Then I guess I'd require two lirc daemons running, one for each?
Cheers,
Antony
Re: Problem with LIRC configuration
Posted: Thu Aug 01, 2013 7:38 am
by mba
That is weird. People are definitelaty using LIRC and IR receivers for controlling XBMC so the Raspberry Pi should be able to keep up with the conversion of the signals. Maybe its disturbances in the field? Like sunlight or other IR sources that pollutes your commands. I am out of good (or bad) ideas
Maybe its time to try out another hardware solution (like the GPIO based).
To answer your last question: You only need one instance of LIRC running it can receive and send at the same time. Its all in the lirc_rpi module which you have to add to your /etc/modules. I've written another small tutorial on how to setup LIRC on Raspberry Pi
http://www.datscharf.dk/amote/tutorials ... pberry-pi/
It sounds like a fun project, maybe you need 'narrower' LED to achieve a more point-like beam. There's the TSAL6100 or TSAL5100 which has a 10degree angle instead of the TSAL6400 which has a 30 degree angle.
Best regards
Martin
Re: Problem with LIRC configuration
Posted: Thu Aug 01, 2013 7:47 am
by mba
Just one more thought. Is lircd running? If you can use mode2 which connects directly to the device then lircd must not be running, but maybe you kill before running mode2?
Re: Problem with LIRC configuration
Posted: Fri Aug 02, 2013 7:26 pm
by mba
I did some testing and I seem to have the same problem. No output from irw. But I found one positive thing and that is the standard LIRC package seem to support the USB IR Toy using the irman driver and /dev/ttyACM0 device. No need for patching and building LIRC manually.
Just change the following lines in /etc/lirc/hardware.conf:
DRIVER="irman"
DEVICE="/dev/ttyACM0"
Re: Problem with LIRC configuration
Posted: Sat Aug 03, 2013 2:42 am
by Akkrand
You're right about mode2: I'm not killing lircd before running it, so lircd mustn't be connecting to the correct device.
How can I find out what mode2 IS connecting to?
Re: Problem with LIRC configuration
Posted: Sat Aug 03, 2013 3:19 am
by Akkrand
Ah, now I've found something else;
- when the system starts, I get:
Code: Select all
dmesg | grep ftdi
[ 6.406435] usbcore: registered new interface driver ftdi_sio
[ 6.703678] ftdi_sio 1-1.2:1.0: FTDI USB Serial Device converter detected
[ 7.244565] ftdi_sio: v1.6.0:USB FTDI Serial Converters Driver
But after running irw just for a moment, without even using a remote or trying to receive anything, I get:
Code: Select all
dmesg | grep ftdi
[ 6.406435] usbcore: registered new interface driver ftdi_sio
[ 6.703678] ftdi_sio 1-1.2:1.0: FTDI USB Serial Device converter detected
[ 7.244565] ftdi_sio: v1.6.0:USB FTDI Serial Converters Driver
[ 425.442641] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0
[ 425.442784] ftdi_sio 1-1.2:1.0: device disconnected
The reasons for this I'm not 100% sure of, but I found this thread:
http://www.raspberrypi.org/phpBB3/viewt ... =44&t=8010
So there's something else at work here, it's not necessarily my configuration, and I'm not going insane.
I'll do a bit more reading, but it seems more likely I'll be trying your receiver/transmitter and going down that path.
Re: Problem with LIRC configuration
Posted: Sun Aug 04, 2013 3:31 pm
by mba
It will without a doubt be a cheaper solution with fewer things that can go wrong.
And btw. it must be the heat here in Denmark cause my previous post was half an answer to this thread and to another thread I am posting to about USB IR Toy... sorry about that

Re: Problem with LIRC configuration
Posted: Mon Aug 05, 2013 6:42 am
by Akkrand
No problem; today I went and got a bunch of parts from my local electronics store, but after assembling and soldering the transmitter in the diagram you linked, and found out just how bad my soldering skills were after doing a basic electronics course 15 years ago.

Then, having finished it, I realised my ribbon cables have not yet arrived, and I'm not comfortable soldering directly to the gpio pins themselves, so I guess I'm going to have to wait before I can try it out.
Ah well, I've got other projects I can work on in the meantime, I'll post back in here when I've made more progress.
Re: Problem with LIRC configuration
Posted: Mon Aug 05, 2013 6:53 am
by Dilligaf
You can use the terminals from an old PC fan connector or many other old pc connectors. Just cut and solder the wires
Re: Problem with LIRC configuration
Posted: Tue Aug 06, 2013 1:38 am
by Akkrand
Thanks Dilligaf, I didn't think of that!
Cut a couple of old fans cables, soldered up the receiver circuit, and plugged it in;
mode2 shows spaces and pulses, used irrecord to generate a lircd.conf, and success!
Code: Select all
$ irw
0000000000000002 00 KeY_POWER2 temp.conf
0000000000000002 00 KeY_POWER2 temp.conf
0000000000000002 00 KeY_POWER2 temp.conf
I've run out of old fans, though, so I couldn't hook up the transmitter as well, and I certainly don't have enough for both of my Pi's.
Ribbon cables and other bits and bobs in the mail, so I'll be able to continue the python side of my programming without worrying that it's not going to work in the end.
And thanks again to mba for all your help; I'd still be banging my head against a wall if it wasn't for you!
Cheers,
Antony
Re: Problem with LIRC configuration
Posted: Tue Aug 06, 2013 3:21 am
by Akkrand
Found one last fan, and tried hooking up the transmitter to the other pi; no dice.
I hooked up to the 3 pins in a row +5V/GND/GPIO14, but could see no flashes on my camera when I attempted to send.
Also, dmesg had nothing to say about it.
Code: Select all
$dmesg | grep GPIO
[ 15.293697] lirc_rpi: auto-detected active high receiver on GPIO pin 18
I assume that dmesg should have something to say about the transmitter being connected, and that I'm able to use the pins I did.
I'm guessing I messed up something when I soldered it all together, as I said, it had been 15 years since I'd held a soldering iron.

Re: Problem with LIRC configuration
Posted: Tue Aug 06, 2013 3:47 am
by Dilligaf
I knew you couildn't wait for connectors in the mail

try loading the module with the output pin specified and see if that makes a difference
http://aron.ws/projects/lirc_rpi/
Re: Problem with LIRC configuration
Posted: Tue Aug 06, 2013 4:19 am
by Akkrand
Did all that, nothing seemed out of the ordinary. Checked on my multimeter that I had the correct +5/GND, it was showing about 4.7v.
Another thing that could have gone wrong is the transistor; the shop I went to didn't have the one in the diagram, I bought a mixed bag of transistors. The one I ended up using was BC547, which when I looked at the datasheet pdfs, didn't seem altogether different from the BC337.
EDIT: there may be more to it than that. Switched off all the lights, and I can see a faint glow in the camera viewfinder when I start sending via irsend. The IR LED I used was a TSOP 6100, not a TSOP 6400, but the datasheets for them are almost identical, only the radiant intensity is different as far as I can tell, so I would expect the LED to be brighter, not dimmer. The voltage levels and current appear to be the same. I'm sure I could see my LED flashing in my viewfinder when I had it running through my FTDI cable.
Re: Problem with LIRC configuration
Posted: Thu Aug 08, 2013 3:50 am
by Akkrand
Hey wait a minute; the TSOP6100 has a forward current of 100mA, and a max current of 200mA. That's way over what the GPIO pins are able to supply. Am I reading that right?
Is the 5V in the transmitter diagram supposed to be an external 5V source?
Re: Problem with LIRC configuration
Posted: Thu Aug 08, 2013 5:32 am
by Dilligaf
According to this
http://aron.ws/projects/lirc_rpi/ yes, it requires an external source
Re: Problem with LIRC configuration
Posted: Thu Aug 08, 2013 8:18 am
by mba
No you can't draw that much current the GPIO pins, thats why you have the transistor. You can either connect it to an external power supply, just make sure that the ground from the external supply is connected with ground on the Raspberry Pi as you need a common ground as reference. Or you can use the 5V from the USB on the Raspberry Pi if your USB power supply is up for the extra load.
You must use the GPIO pin you specify when loading the module. dmesg says you have configured the module to use pin 18 but you say that you used GPIO pin 14.
The last thing is that BC547 is not quite up for the task. The absolute maximum rating on the collector current is 100mA I would be vary of getting that close to a maximum rating. The BC337 has more headroom where the maximum collector current is 800mA.
Re: Problem with LIRC configuration
Posted: Fri Aug 09, 2013 2:34 am
by Akkrand
Hey,
Ok, external power source is doable, the pi runs off a powered USB hub, and I have a USB cable with the ends loose I can get the +5V from that. But you say I hook up the ground to the pi's ground? So does that mean I should have the black wire from my USB external power hooked up to that ground as well?
So from an distance, it would look like;
USB black and red wires connecting to the circuit board; then a black wire connecting back to a GND on the pi, and another wire connecting to my GPIO pi? So two connections coming from my circuit board going to the pi, and 2 going to the external power?
Sorry for all the questions, it's been so long since I've done anything this low-level I'm sure my understanding of a bunch of terms is patchy at best.
my /etc/modules file had:
Code: Select all
lirc_dev
lirc_rpi gpio_in_pin=18 gpio_out_pin=14
dmesg was only reporting the active receiver, nothing about the transmitter.
I'll head down to my electronics store and ask if they have a greater selection of transistors than I saw last time.
I'll also see if they have anything I can use in lieu of my ribbon cables arriving from the UK. Couple of weeks away

Re: Problem with LIRC configuration
Posted: Fri Aug 09, 2013 7:38 am
by mba
Ahh yes I missed that it was the reciver gpio dmesg was showing info about. I have the same output as you, with no info about the transmitter pin.
I guess if you use power from the same hub as the pi is powered from then the gnd's are already connected. Maybe you can measure the resistance between gnd on the loose cable and gnd on the pi, just make sure power is off when doing it.
But why not use the 5V supply on the P1 header? I think you can draw somthing like a couple of hundred milliamps before the polyfuse kicks in.
If you are having trouble sourcing components where you live, I can only recommend ebay. The BC337 I use, I bought in China for <$2 for 20 pieces including international shipping.
Re: Problem with LIRC configuration
Posted: Wed Aug 14, 2013 7:30 am
by Akkrand
Hey, my ribbon cables and other goodies have arrived!
Now, the first thing I found I didn't know, and couldn't seem to find out easily, is that when I attach the ribbon cable, I'm not sure which holes at the other end are which pins. I don't want to hook something up and find I've fried the pi. It's a female-female cable, so I would have thought that if it was plugged into 2 male connectors, those connectors would match up.
So, with it turned off, I tried to work out which of them was ground, by testing the resistance between pairs of them. None of the combinations seem to work. There's a ground in the bottom left corner, and so by testing each of the 4 corners with the pin 3 'up' and 1 'across' from it, I found none which were linked. Is it possible they don't match unless the pi is turned on?
The store I went to did have the BC337's, they weren't with the other components, they were behind the counter for some reason. I've picked up all the necessary parts now.
In any case I've got constant problems getting my wifi working and it's a mess trying to do anything next to the router, so again I'm putting this on hold whilst I sort out other issues.
Re: Problem with LIRC configuration
Posted: Thu Aug 15, 2013 9:54 am
by Akkrand
So I've got all that sorted, and run through a bunch of tutorials of the GPIO (blinking LEDs, switches), and got back to where I was before.
Using an external power source, 5V coming from my USB hub, I've tested the transmission circuit. I could see nothing with my digital camera, like before.
Then, I tried the following:
- stopped the lirc service.
- replaced the IR LED with a standard Red 5mm LED.
- made a simple python program to blink the gpio pin I have the transmitter circuit (and lirc) hooked up to.
I can see the LED blinking, so the circuit works. However, the LED is very dim, and I'm fairly sure it's a 1.7v / 20mA LED. When I then restarted lirc and used irsend to transmit, I could see a faint light pulsing in the LED.
What I'm thinking is maybe there's a difference in the TSAL6100 that's affecting my output, as compared to the TSAL6400 you've used. I thought it was just to do with the luminosity and angle of half intensity.
I'll have another close look at the datasheets tomorrow, but I'm pretty sure the only difference was luminosity and the angle.
Cheers,
Antony
Re: Problem with LIRC configuration
Posted: Thu Aug 15, 2013 5:26 pm
by mba
Hi, sounds like either the transistor is not fully on or your not letting enough current flow through the LED.
Are you sure that R2 is the correct value? It needs to be around 7 ohm. What is the voltage accross R2, it should be roughly 0.7V. What type of diode are you using and are they connected in the forward direction as shown in the schematic?
Beware that if you manage to get the current flowing as it should you will be pouring 100mA into your red LED which you states is only spec'ed at 20mA.
Br
Martin