Using a Pi for transmitting IR signals

An area for more general discussion by the user community for topics not covered elsewhere
Post Reply
mahran
Posts: 5
Joined: Tue Mar 31, 2020 4:44 pm

Using a Pi for transmitting IR signals

Post 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.

mahran
Posts: 5
Joined: Tue Mar 31, 2020 4:44 pm

Re: Using a Pi for transmitting IR signals

Post 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
You do not have the required permissions to view the files attached to this post.

User avatar
AnalysIR
Site Admin
Posts: 616
Joined: Sat Aug 31, 2013 3:51 pm
Location: Dublin, Ireland
Contact:

Re: Using a Pi for transmitting IR signals

Post 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.

mahran
Posts: 5
Joined: Tue Mar 31, 2020 4:44 pm

Re: Using a Pi for transmitting IR signals

Post 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
You do not have the required permissions to view the files attached to this post.

User avatar
AnalysIR
Site Admin
Posts: 616
Joined: Sat Aug 31, 2013 3:51 pm
Location: Dublin, Ireland
Contact:

Re: Using a Pi for transmitting IR signals

Post 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.

mahran
Posts: 5
Joined: Tue Mar 31, 2020 4:44 pm

Re: Using a Pi for transmitting IR signals

Post by mahran »

dang that was clever, yeah the dynamic delay works quite well my error is down by almost 50%.

User avatar
AnalysIR
Site Admin
Posts: 616
Joined: Sat Aug 31, 2013 3:51 pm
Location: Dublin, Ireland
Contact:

Re: Using a Pi for transmitting IR signals

Post 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

Post Reply