Page 1 of 1

Using a Pi for transmitting IR signals

Posted: Tue May 19, 2020 9:48 pm
by mahran
Hi has any one tried using a Pi to transmit IR signals without using LIRC library. i managed to this working quite well on my Arduino by customizing the pwm pins.but now I want to try it on the pi, any pointers into how to do this.

Re: Using a Pi for transmitting IR signals

Posted: Sun May 24, 2020 9:12 pm
by mahran
So managed to make some progress on this I went with the wiringPi library , got the frequency matched up to 38Khz on hardware pwm.
but for some reason the timing is off by about 80us. I can see this on my scope. you can see this quite clearly on the IR analysis software session history too when compared with the remote signal .. How do you get around this problem.

Is this because of the delay in response of the PWM when switching between 50% and 0% or is this a delay issue between C and python . C seemed to have less of a delay , put it was there as well

Re: Using a Pi for transmitting IR signals

Posted: Wed May 27, 2020 2:10 pm
by AnalysIR
Yes the Pi runs Linux which is not usually a realtime OS. So you will always get small time offsets which will impact IR sending. That is why LIRC uses the kernel.

FYI: our A.IR shield Nano (see our shop via link above) comes with a python script for sending and receiving on RPI (and other platforms that have Python). It connects to the RPi via USB and will also work on Windows.

Re: Using a Pi for transmitting IR signals

Posted: Thu May 28, 2020 8:29 pm
by mahran
637263109624199970_AnalysIR_Screenshot.jpg
Yes, definitely the approach I would need to take especially with my web-server running on the pi can see the delays in real time.
, had the signals almost matched and it still was intermittent at best. Some times it would work and some times it wouldnt.

Think the issue is the interface with the hardware PWM. Its the switching time between 0 and 50% duty cycle that was the main issue, I gave up on python and went with C++. I wish there was an PWM_OFF command on wiring pi.. would love to get one of your modules but I am still in lockdown ... :cry: :cry: :cry: havent got my packages ordered in march

Re: Using a Pi for transmitting IR signals

Posted: Fri May 29, 2020 11:14 am
by AnalysIR
one approach that might improve your timings....

- when sending a marks and spaces...keep a running total of the time since the signal started and synchronise the start and end of marks with that.
- if you continually do a wait for the mark & space durations then you will get a cumulative offset error of the code in any loop you have plus in the case of Linux additional OS overheads.

....try it out and it may solve your timing issue.

Re: Using a Pi for transmitting IR signals

Posted: Sat May 30, 2020 2:51 pm
by mahran
dang that was clever, yeah the dynamic delay works quite well my error is down by almost 50%.

Re: Using a Pi for transmitting IR signals

Posted: Sat May 30, 2020 4:09 pm
by AnalysIR
...nice

where exactly is the error now? in the PWM signal or the mark/space timing. It is OK to set the carrier to 33% duty cycle instead of 50%, if that helps.

With AnalysIR, you can 'clean' the signals via Menu->Power Tools->History Clean

Re: Using a Pi for transmitting IR signals

Posted: Wed Mar 17, 2021 6:31 pm
by Thomasid1
AnalysIR wrote: Wed May 27, 2020 2:10 pm Yes the Pi runs Linux which is not usually a realtime OS. So you will always get small time offsets which will impact IR sending. That is why LIRC uses the kernel.

FYI: our A.IR shield Nano (see our shop via link above) rachat de credit info comes with a python script for sending and receiving on RPI (and other platforms that have Python). It connects to the RPi via USB and will also work on Windows.
Wir werden also kein Problem damit haben, es mit unserem System zu verbinden.

Re: Using a Pi for transmitting IR signals

Posted: Wed Mar 17, 2021 7:00 pm
by AnalysIR
Thomasid1 wrote: Wed Mar 17, 2021 6:31 pm Wir werden also kein Problem damit haben, es mit unserem System zu verbinden.
I would need to know a lot more info, to answer your question - as I do not know what system your are referring to....etc.