EEVblog #505 - IR Learning Remote Control Hack - Page 1
Forum section: electronics / general

author: EEVblog
author_rank: Unknown
timestamp: August 08, 2013, 12:41:00 pm
content: Dave wires up an Arduino (Freetronics Eleven) to control his video camera via a learning IR remote control matrix keypad.NOTE: this is NOT an optimised solution, nor a tutorial on the best way to do this, it's a quick rudimentary hack while showing a few traps.

author: EEVblog
author_rank: Unknown
timestamp: August 08, 2013, 12:42:08 pm
content: This one will of course bring out the "you should have done this", "you could have done this", "why didn't you do this" crowd.

author: mickpah
author_rank: Regular Contributor
timestamp: August 08, 2013, 12:57:00 pm
content: Quote from: EEVblog on August 08, 2013, 12:42:08 pmall ways does,I often use quick and dirty scripting languages to automate repetitive boring jobs that might only have to be done a few times - a favorite is autoit.It's guaranteed I'll get bagged that it should have been done in a "real programming language" - Why? it gets the job done and it's disposable.I did something simlar last year with an arduino and these remote power points to control christmas lights ,http://www.bunnings.com.au/products_product_homeauto-pwr-pt-cntrl-kambrook-4pce-indoor-inc-remote-rf3672_P7030054.aspx30 mins working hacking and moved on to more important things - worked a treat better & cheaper than 3 timers spread around the house

author: madires
author_rank: Super Contributor
timestamp: August 08, 2013, 01:17:31 pm
content: Quote from: EEVblog on August 08, 2013, 12:42:08 pmSince you're asking for it so politely ... :-)I guess, I would record the RC signal with a DSO, add an IR LED to the Arduino and let the Arduino send the RC directly.

author: nitro2k01
author_rank: Frequent Contributor
timestamp: August 08, 2013, 02:13:55 pm
content: Quote from: EEVblog on August 08, 2013, 12:42:08 pmM-hm, signing in. This should still be easy to do with a bipolar transistor and common ground. If you figure out the polarity of the output side of the matrix, you can choose an NPN or PNP and hook it up so that the base emitter junction doesn't allow the transistor to turn when that row isn't being scanned.The base would go to the external control, the emitter would go to the matrix output in question and the collector would go the matrix input in question. The type of the transistor would be decided by the polarity of scanning.No, not complaining about the video, but hopefully we can still discuss better solutions here.

author: Alana
author_rank: Frequent Contributor
timestamp: August 08, 2013, 02:37:55 pm
content: MiniDCC command station has the same kind of matrix keyboard as this pilot. This guy uses 4066 to short out keys in matrix keyboard controlled from RC reciever chip. Schematics:http://www3.telus.net/HarrisFamily/MiniDCC.html

author: Mikey
author_rank: Regular Contributor
timestamp: August 08, 2013, 03:02:38 pm
content: Quote from: EEVblog on August 08, 2013, 12:42:08 pmIndeed, I have done exactly this thing too... But all I needed was a resistor and an IR led, besides the arduino itself.

author: lgbeno
author_rank: Frequent Contributor
timestamp: August 08, 2013, 03:10:47 pm
content: Thought provoking video, I'll throw my idea out there."Hack" is a good name for this but that's the spirit, quick and dirty. Optos would work, relays would work but I was thinking that perhaps you could also use a logic buffer with an output enable. Figure out what pin is being driven by the scan controller, attach that to the OE pin. Output to the other pin and input to the MCU.Sent from my iPhone using Tapatalk 2

author: free_electron
author_rank: Super Contributor
timestamp: August 08, 2013, 03:45:01 pm
content: You should have recorded the pulse stream using that 200k$ agilent scope , loaded it in that PFANG and played it back from there... Arduino .. Pfoeh ..Camera doesnt have LANC ? It's a canon, it should have one... Get a cheap lanc controller , you will have much finer control over the camera.

author: Unknown
author_rank: Unknown
timestamp: August 08, 2013, 05:41:58 pm
content: Ehm, i dont understand it.Say i have a dev. Board connected to the USB port, and a second board is connected to the floating voltage.How can both? boards communicate without having common GND reference? So logic '1' of the dev Doard wouldn't be logic '1' for the other...or am i wrong somewhere?

author: synapsis
author_rank: Regular Contributor
timestamp: August 08, 2013, 05:52:00 pm
content: I've done this same type of thing with just an Arduino using this library.http://www.righto.com/2009/08/multi-protocol-infrared-remote-library.htmlAll the remotes in my house have the IR protocol they use written on the back in Sharpie.I need to find a cheap remote like Dave's. My learning remote is from 1998 and is a pain to teach.I would like a little more explanation about the ground connection issue. I've run into similar issues with other projects, but I'm so new that I'm not entirely sure what's going on. Which also makes it hard to know what to type into Google.

author: DavidDLC
author_rank: Frequent Contributor
timestamp: August 08, 2013, 05:53:07 pm
content: Quote from: EEVblog on August 08, 2013, 12:42:08 pmWhich is a good learning experience for people, I can learn from this type of feedback.

author: SeanB
author_rank: Super Contributor
timestamp: August 08, 2013, 05:56:06 pm
content: I think I must post a few photos of one I did a few years ago ( last century actually) of a computer controlled remote control.

author: filip_cro
author_rank: Regular Contributor
timestamp: August 08, 2013, 10:27:21 pm
content: Why are there small holes on wide traces?You can see them on PCB at 11:30.

author: Smokey
author_rank: Super Contributor
timestamp: August 08, 2013, 10:39:26 pm
content: http://dangerousprototypes.com/docs/USB_Infrared_Toy

author: EEVblog
author_rank: Unknown
timestamp: August 08, 2013, 10:55:06 pm
content: Sometimes I don't think people actually listen to my videos...I mentioned IR direct with a library, I mentioned cmos switches, optos, relays, and external transistors, yet people will still comment on those as if I missed the obviousLANC is not an option, I want wireless. And before someone tells me, yes I know you can do LANC wirelessly too if you really want, but that would be silly when IR is available.

author: NickS
author_rank: Unknown
timestamp: August 09, 2013, 12:47:56 am
content: Quote from: EEVblog on August 08, 2013, 10:55:06 pmClearly you aren't a Slashdot reader. Don't you know that people start commenting as soon as they the title?Some don't even bother with the description text.

author: EEVblog
author_rank: Unknown
timestamp: August 09, 2013, 12:55:08 am
content: Quote from: NickS on August 09, 2013, 12:47:56 amYeah, description test is almost pointless it seems, just for SEO

author: TerminalJack505
author_rank: Super Contributor
timestamp: August 09, 2013, 01:06:49 am
content: Yes, a lot of people really just want to hear themselves talk. I'm sure there are certain personality types where a person's primary satisfaction comes from engaging with the community--as opposed to watching the video and learning.For some of these people the video is just an excuse to spout off. "Look at me!" "Look what I know." "You're an idiot and I'm smarter than you!" "I know something you don't."Note that I'm not suggesting that this is the only reason that a person engages with the community. Obviously, there are less selfish reasons.

author: EEVblog
author_rank: Unknown
timestamp: August 09, 2013, 01:36:57 am
content: Quote from: TerminalJack505 on August 09, 2013, 01:06:49 amI see that a lot, and I don't mind it at all, in fact I like when they point out stuff I didn't know (which is a lot BTW).But as a content producer it does grate a lot when I've mentioned something in the video, so clearly I'm aware of that and have considered it, yet they will comment on it anyway. Or worse, call me blah blah for not doing that or discussing that etc Ok, the first few times, but when you get it day after day...Oh the joys of producing content for the masses

author: ptricks
author_rank: Frequent Contributor
timestamp: August 09, 2013, 01:46:31 am
content: Dave, of course the IRToy can send IR commands, it is one of its major functions.http://dangerousprototypes.com/docs/USB_IR_Toy:_IRIO_raw_receive/transmit_modeoops, forgot they did away with the above in a firmware update in favor of something better:http://dangerousprototypes.com/docs/USB_IR_Toy:_Sampling_mode

author: EEVblog
author_rank: Unknown
timestamp: August 09, 2013, 02:24:32 am
content: Quote from: ptricks on August 09, 2013, 01:46:31 amYes, but only when it's hooked up to the PC, not standalone. Unless I'm mistaken?

author: ptricks
author_rank: Frequent Contributor
timestamp: August 09, 2013, 02:41:02 am
content: The IRtoy has 95% of the hardware , the other 5% would be buttons or keypad to trigger what you want sent. There are about 5 unused pins on the board that could be used for buttons . The eeprom also has plenty of space for commands. Someone just needs to take the time to write the code, the source is easy to read and add to. I may do that myself when I get time.

author: EEVblog
author_rank: Unknown
timestamp: August 09, 2013, 03:34:47 am
content: Quote from: ptricks on August 09, 2013, 02:41:02 amYeah, I was sure the IRtoy could do that, but I searched and could not find a ready made and easy solution to automatically program in and replay the received command with the button. It's a bit of a shame, but as you say, just needs some more code. I contemplated doing it, but it would have taken the same time to do it directly on the Arduino itself I guess. Then I found the learning IR remote.

author: free_electron
author_rank: Super Contributor
timestamp: August 09, 2013, 04:14:18 am
content: Quote from: EEVblog on August 08, 2013, 10:55:06 pmah, didn't catch that requirement. sorry.With lanc you can actually control things like zoom speed. My underwater housing uses an IR led in the grips. this sends commands through a lightpipe into the housing where it is received by a custom board. that then sends the appropriate lanc commands to the camera using a cable.

author: adcurtin
author_rank: Contributor
timestamp: August 09, 2013, 04:37:21 am
content: When I automated an xbox 360 controller, I found out the board I had was one of the matrix style ones (as opposed to other designs of the pcb that were common cathode or common anode). I ended up using 74HC4066 cmos switches, which worked out great.However, in your case, this arduino library would be much simpler:http://www.righto.com/2009/08/multi-protocol-infrared-remote-library.htmlthat allows the arduino to learn the commands itself (using a basic ir reciever), as well as transmitting them (via ir led). 4 parts: arduino, led, resistor, and ir demodulator. Maybe a mosfet if you want more power. I used this to control my air conditioner over the internet: ssh to a computer, connect to the arduino serial port (with gnu screen), and I could send any command from the A/C remote. Then I could turn off the A/C during the day when I wasn't there, and turn it back on long enough before I went home that it was cool when I got there.

author: PeteInTexas
author_rank: Frequent Contributor
timestamp: August 09, 2013, 05:44:28 am
content: Weird timing. I started this week to mess about with lirc on Raspberry Pi to control a cd changer. Naturally, I'm ripping my hair out and its still not working right. This video was helpful about about the common ground issue as my next try would have been to simply drive the key matrix lines directly. Thanks, cause I like to keep my hair

author: jnissen
author_rank: Regular Contributor
timestamp: August 09, 2013, 01:35:26 pm
content: For the hack to work as intended you really need to emulate a switch as you indicated. What I am not clear on is why you still went ahead and attempted to do it half assed. That Arduino clone had a proto area on it for a few simple CMOS switches so why not do it so that the thing will be reliable and easy to power? I guess your still stuck in the bailing wire and duct tape mode! Over the years I've learned that if your spending the time to do a task at least do it in a manner that doesn't require you to constantly come back to it. You spend twice as much time using a hack as doing it well to begin with. Then again the recommendations where you properly learn the codes and let the Arduino spit them out is likely the best solution overall. You already have to interface to the LED sign and countdown timer so why not make it a real integrated solution?Yeah you did invite us to comment on the project!

author: sonic
author_rank: Regular Contributor
timestamp: August 09, 2013, 01:43:48 pm
content: Nice video!The way I did it (to let my linux box wake me up):Unfortunately, the range of the ISM transmitter and/or receivers is terrible

author: synapsis
author_rank: Regular Contributor
timestamp: August 09, 2013, 05:21:39 pm
content: Even if it seems like people are saying "You should've done this!", it's nice to have a lot of solutions in one forum post. If I need to do some quick project at 2AM and Google it, I click on the EEVBlog links first because they usually have a number of solutions.I'd like to know more about the LED matrix. It looks like the housing is 3D printed?

author: Mikey
author_rank: Regular Contributor
timestamp: August 09, 2013, 05:27:52 pm
content: Quote from: EEVblog on August 08, 2013, 10:55:06 pmYup, not fun when people question the one normally questioning and ranting about how others did what they did.

author: SeanB
author_rank: Super Contributor
timestamp: August 09, 2013, 05:34:36 pm
content: I have dealt with a few remotes, and you really need a scope to see which is driven, column or row. Then you can use a signal FET to do the switching of row to column very easily. The connection used by Dave looks like he has the common pin of the 3 pins being the driven one, so when the Arduino is unpowered the ESD diodes in the unit become forward biased and conduct slightly, enough to lock up the other micro with 4 inputs pressed. With power applied the pins are pulled up enough so they appear open circuit.

author: RupertGo
author_rank: Regular Contributor
timestamp: August 09, 2013, 09:13:52 pm
content: The one trouble with the quick and dirty hack that just works is when you start building stuff on top of it and you end up spending more time working around the problems it brings than going back and doing it properly.That bit me on the backside thirty years ago, and it bit me last week. The only thing that experience has won me is that I spotted it early this time, and only ditched two days of work instead of six months. Also, my backside is scarred and hardened, so it didn't hurt quite so much...

author: crisr
author_rank: Contributor
timestamp: August 09, 2013, 09:26:48 pm
content: QuoteYou are definitely right about that! I guess I am a little bit disappointed with Dave on this solution... an Arduino AND an Universal Learning Remote Control for sending a couple of IR signals? As someone said in a previous post, just sample the commands with a DSO (using a TSOP4838 or similar IR receiver IC -- heck, using a DSO with decent memory, even a conventional IR phototransistor if the emitter is held close enough), take note of the pulse timing (usualy 2 start pulse lengths, plus one "1" length and one "0" length), there will probably be around 32 or so bits max, and hardcode them in a program on an 8-pin ATTiny or 12F pic running on the internal RC oscillator and connected to an IR LED (timing the carrier on an ISR) - part count: 3 (uC, resistor, LED), no need for even a crystal. Writing such a program takes less time than it is needed to open an universal remote, trace the matrix and connect everything together, and edit a whole video about that. Of course, you might need the Arduino for other purposes, but I think there is absolutely no need for the universal remote.Nevertheless, a good video showing a possible solution to interfacing maybe some other type of device in which you must do it through a button matrix - avoiding the common ground is a neat hack which I would probably not remember if I had to do such thing. The issue that happens when the Arduino is powered off is probably due to everything being at 0V potential (as if it had a 0V power supply) when off, and all the outputs are as if the were connected to ground, or in the case in the video, as if the buttons are shorted or always pressed. Such type of issue always gets me, as I usually forget to consider the internal protection diodes on the uCs. As someone else said in this topic, this can be avoided, even in a common ground setup, by using either PNP or NPN bipolar transistors whether the matrix scanning is active high or active low.A great resource on IR protocols:http://www.sbprojects.com/knowledge/ir/- check the specific protocols on the left hand menu.

author: crisr
author_rank: Contributor
timestamp: August 09, 2013, 09:44:38 pm
content: QuoteTo communicate between boards with independent floating voltages, if you don't want to use optoisolators or similar techniques, you need a common reference indeed. That reference doesn't need to be GND, even though it is used in the great majority of circuits. It can be VCC, for instance, or any through which current can flow, on levels that each circuit can understand. In the case of Dave's video, it it the scanning signal from the remote control microcontroller. A little more difficult to follow and understand (and prone to "bugs"), but a common reference nonetheless.

author: Pilot3514
author_rank: Contributor
timestamp: August 10, 2013, 03:34:22 am
content: I love ya Dave, but this was not up to your usual high standards.I was expecting scopes and logic analyzers. I was expecting to see signal levels and modulation frequencies.When I saw the Arduino I half expected what others have said about the Arduino learning then sending the IR signals. But I was hoping to see the Arduino used as a logic analyzer to read the pins as the keyboard was scanned. Collect the data as each key on the remote is pressed. Then teach the Arduino to watch the signals as the rows were scanned and then put the proper signals on the columns when it need to be there.Anyone can solder in place a bunch of reed relays. But who other than the great "Aussie Bloke" could completely simulate the entire keyboard with just a couple of MPU ports?

author: ju1ce
author_rank: Regular Contributor
timestamp: August 10, 2013, 05:16:28 pm
content: I didn't mind the approach at all, I think it was nice to see something different.On another note, finding such a hackable remote by a chance is quite unbelievable. The display at the end was nice too. I'm looking forward to getting to know more about it...

author: raymond2000
author_rank: Contributor
timestamp: August 10, 2013, 05:22:55 pm
content: very interesting video as always, at 5 min watch "the matrix reloaded"Flexible as the JP1 universal remoteshttp://www.hifi-remote.com/jp1/help/http://www.hifi-remote.com/forums/good stuff

author: tonyp12
author_rank: Contributor
timestamp: August 10, 2013, 05:38:01 pm
content: Is the key matrix a Positive check?X side is step by step provided with Vdd on each pinand each pin on Y is checked for a Vdd result.Could you not then use P-channel mosfet as a "Key-button" press so youcan have 4 simultaneous simulated button presses.Or the other option is that the Arduino reads the X side to see the scanning in actionand only output a 1 to the Y-side at appropriate times slots.e.g a software and-gate, but don't set pin as output=0 but instead change it toinput to turn it off as not to create a short if actual buttons is still there.

author: bitwelder
author_rank: Super Contributor
timestamp: August 10, 2013, 09:14:20 pm
content: If anybody in central/northern Europe is interested in such a IR learning remote, Lidl (German-based discount supermarket chain) sells a similar device.When I watched the video, I noticed the shape of the arrow keys, and the display that were similar to a SilverCrest URC 101 remote that I bought in Lidl about a year ago.I "pried the sucker open" and I found the same construction scheme, with a small PCB containing all the active parts, soldered to a long PCB that contains just the pads for the keyboard (and a ATMLH848 at the bottom).

author: Electro Fan
author_rank: Super Contributor
timestamp: August 13, 2013, 03:45:33 am
content: Quote from: EEVblog on August 09, 2013, 12:55:08 amDave, A little bit off topic, but you seemed to enjoy using the decoding capability on the Rigol (and the Saleae); have you had any reason to try the decoding capability on one of the Agilents? If so, let us know if you see any notable differences in terms of functionality, ease of use, etc. Please/Thx. EF

author: greatal
author_rank: Newbie
timestamp: November 24, 2013, 02:34:43 pm
content: Hi Dave and all other perfect forum usersWhen I watch this video it just remind me some old Ethernet cable testers which use bunch of resistor with deferent values that anyway you sum them together it show you which resistors are used for example some think like this 1ohm 10ohm 56 ohm 75 ohm 100 ohm 120 and … so if you some two value none of them equal to each others value 100+1 1+10 ... so if Dave’s universal remote controller Carbone traces have deferent resistances actually it may coded by restores values to do more keys and its seams to identical because that pins that look 2*10 or 2*12 and that’s way more less than numbers of those keys on that remote control so if you use same value restores hook to your pins it should do the job and that’s my opinionAll EEVblogers sincerelyGreatAL

author: MrAureliusR
author_rank: Unknown
timestamp: November 26, 2013, 02:11:22 am
content: Here's an excellent App Note from Microchip on this very subject:Decoding an Infrared Remote using a PIC16C5X MicrocontrollerYes, it's for the PIC16C5X which is a bit outdated, but all the theory is there and it's easy to convert to your favourite microcontroller code.Here's the source code they provide:AN657 Source CodeMicrochip has an amazing number of really great App Notes, check them out here:Microchip - Browse Application NotesI don't even use PICs that often, but I find Microchip has a great database of information. To those out there who haven't read App Notes, almost every company (TI, Atmel, Lattice, Xilinx, Microchip, Maxim, NXP) have Application Notes for their products. They are usually chock full of really valuable information on how to use their chips in a particular setting. Recently I read an App Note from Microchip on how to directly interface a micro to AC line voltage, to detect the zero crossing for switching a triac on and off. Almost like PWM for AC. Extremely interesting App Note.Seriously -- check out your favourite manufacturer's app notes -- you will always find something interesting. Best of all, they're freely available!

author: Kjelt
author_rank: Super Contributor
timestamp: November 26, 2013, 09:21:57 am
content: Quote from: MrAureliusR on November 26, 2013, 02:11:22 amNice find, but pretty outdated since the IR codes now run upto 500kHz modulation according to Global Cache (www.globalcache.com see GC-IRL), probably they mean IrDa. This would require about 2MS/s sampling rate, an arm micro would be a better choice these daysI don't see how one can easily convert microchip assembly to another companies microcontroller code, ansi C would have done a much better job.

author: Six_Shooter
author_rank: Regular Contributor
timestamp: November 26, 2013, 08:18:41 pm
content: Quote from: synapsis on August 09, 2013, 05:21:39 pmI agree, I like seeing several solutions to the same problem. This allows for using the the best approach when some other part or idea is introduced to the problem.there have been a number of times where the best approach that was taken was perfect until one other parameter was added to the design which needed a different set of solutions for the previous tasks.

author: callipso
author_rank: Regular Contributor
timestamp: February 15, 2015, 11:21:18 am
content: Quote from: sonic on August 09, 2013, 01:43:48 pmTry rtcwake