Raspberry Pi Universal Remote

Published on 2020-06-07

I was working for a Smart light project for a while now. Goal of this project is to provide optimal brightness for occupancies in a room while saving the energy. This project is going to be setup in a campus building. But we still don't have the access to the building infrastructure yet. So we were setting up a test bed in a campus lab.

Then came covid19.

We had to move to work from home. To continue the work it's required to adjust the lights in the campus lab from home. Since we won't have any access to already installed lights in the lab, we bought were brightness adjustable generic led lights. Their marketing term was kitchen counter lights. They came with a remote. To operate you have to be there in person.

But our requirement is to change the lab lights from home.

We come up with two ideas.

  1. Use the existing remote interface of the lights and use a raspberry pi with IR emitter as a trigger.
  2. Use PWM with raspberry pi to control the LED brightness.

Since the first idea looked less complex we set out to try it first. Following it the high level plan.

  1. Setup a receiver with raspberry pi.
  2. Recode the signals from the remote to the raspberry pi.
  3. Setup a emitter with raspberry pi.
  4. Replay the signals to lights.
  5. Setup the raspberry pi in the test bed.

So I searched about it found some guides.

Well I think I should also mention that, Last time I did something electronic is like 15 years ago when I made a Knignt Rider circuit. Which was array of LEDs blinking for the pattern as same as the car(kit) in Knight Rider TV series. (That circuit was pretty famous those days)

Back to present, I bought the items required. full-width

Came home plugged them to raspberry pi using bread board. Configure the software. (That was more complex than setting up the circuit.) Pointed the remote to the sensor and pushed few buttons.

Nothing happened!!! It was supposed to display the signals.

Well It's simple circuit. An IR receiver plugged in to raspberry pi.

I started digging around and found there was a Kernel update few months ago which replaced the kernel module mentioned in the guide. Well, that's not too hard to fix. Downgrade the OS in raspberry pi to a version with early kernel version and start from the beginning.

So I removed the memory card from raspberry pi and flashed it with a early version of OS image. Inserted the chip to raspberry pi and turned on the power.

Pi refused to boot!!! Green LED was flashing to a pattern. As it happened the OS image was too old to work with the device.

Downloaded a fairly new OS image. Flashed the chip again. Started the raspberry pi.

It started. But that's the end of the good news.

I configured the software stack as per the guide. But still not getting the signals from remote. And I was stuck now. Don't know what part is not working. It could be,

  1. Faulty receiver
  2. Faulty wiring
  3. Library not working
  4. Or something completely unrelated.

I don't have any experience with these stuff. Don't know the tools of the trade.

How does one debug these stuff?

Well internet is a wonderful thing. I found a nice tool called piscope. It displays a voltages from GPIO pins in a live graph. So I could use it for eliminate some possible issue candidates.

I downloaded it, build it, installed.

Well no luck. Graph isn't showing any action.

Now what. I'm running out of ideas here.

Wait may be it's the remote. I tried the AC remote.

Voila, Graph came live.

Well Well Well, As it turns out I was trying to capture a RF signal from a IR receiver. (Remote came with a RF remote and I bought a IR sensor.)

I guess now I can make a smart AC...

Bellow are the guides I followed if you are interested,

lirc guide

https://gist.github.com[2^/prasanthj/c15a5298eb682b[2^de34961c322c95378b

hardware guide

https://www.hackster.io/austin-stanton/creating-a-raspberry-pi-universal-remote-with-lirc-2fd581

lirc guide for strech/buster

https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=235256