Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

AVR InfraRed Remote code capture project

Status
Not open for further replies.

eblc1388

Active Member
I wanted to use IR for controlling purposes so I need to write some decoding routines.

I searched for projects on the web that allow me to actually look at the IR waveforms timings. I built several but the results are disappointing. Some how the designer expects everyone to know exactly what to do next and how to capture a real IR signature when one has the hardware built.

I nearly gave up but then I found the following project by Steve Childress to be very helpful. It was hidden in the project section of the AVRFreaks.net and dated back to year 2006.

The project name is "Two-way Infra-red Processor (TWIRP)" and you'll need to be a member to download it but anyone can register.

This implementation sits between the IR detector and PC host serial port. Not only does it logs and shows the timing between each logic level changes it also draw up a nice graph on the PC showing the waveform shapes. This helps to identify the remote codes variety easily.

I have made minor cosmetic changes to the result display and the following animated GIF shows the operation of the setup, recording a capture from a NEC remote control that I have.

Besides showing you the timing data, it also decode it into several bytes. It has other added features like assigning user defined key records to received IR signals so one can later play them back as if they are coming from the original IR remote control. I have not tried them out yet.

Unfortunately, the author did not include a schematic in the project file so it might create difficulties for someone else who wants to build it. I therefore provide my own schematic I "deduced" from the C source code definition of AVR pins. The original design uses a AT90S2313 but I drew it as a Tiny2313 instead because the AT90S2313 is now hard to find.

The original design uses 10.000MHz crystal which I don't have so I changed it into using 10.240MHz instead. I have also changed the communication baudrate from 19200bps into 56700bps. This would require changing both the AVR firmware and the associate Visual Basic Code so one would be better off starting the project with the original code provided by the author before making any changes.

You would need the CodeVision AVR compiler too but an evaluation version can be downloaded from the manufacturer's site which does have a 2K code size limit. Perfect for use on Tiny2313 which has only 2K program memory.

Sorry the project source code and additional information remains the intellectual property of the AvrFreaks.net and Mr. Steve Childress so I would not be distribute them here.

If you have any questions, you can direct them to Stevech in the Avrfreaks.net forum.
 

Attachments

  • Twirp_1.gif
    Twirp_1.gif
    26.7 KB · Views: 4,644
  • Twirp_ani.gif
    Twirp_ani.gif
    71.7 KB · Views: 3,009
I'm curious, did you use the input capture pin on the processor. I've experimented with using input capture on an ATmega128. We use a TFMS-5380 which produces negative edges when carrier is detected. These parts supposedly have a filter in them which will reject other frequencies besides 38 kHz. Works like a champ.
 
No. Its just polls the IR input pin in a loop.

The author use the 16-bit timer1 to generate 38KHz IR carrier instead for sending out signal to target equipment after receiving a command from the HOST.
 
Papabravo said:
I'm curious, did you use the input capture pin on the processor. I've experimented with using input capture on an ATmega128. We use a TFMS-5380 which produces negative edges when carrier is detected. These parts supposedly have a filter in them which will reject other frequencies besides 38 kHz. Works like a champ.

They do have a filter, but it's not particularly narrow, a 38KHz IC will work well outside it's specified frequency with little loss of performance.
 
Subsequent to my posting, I have located another huge AVR user site in China in which an user has built the same with a Mega8 and communicate using USB instead.The USB hardware interface is done in the Mega8 using the popular USB firmware from obdev so no other chips are needed. The IR timing capture is done via the capture pin of the Mega8 timer.

All one need is a Mega8 AVR, a 12MHz crystal, a IR module and a few resistors.

The PC HOST interface collects the data from USB, graphs it with timing data and allows zoom in and out on the captured waveform. Just learning how one can do that using software is rewarding.

The kind author "lzf713" has provided all the information like source code and HEX for AVR firmware, EXE and C++ builder source code for HOST software for free downloading. Just look for the file "ourdev_196057.rar" near the top of the webpage shown in the link below.

Projects like this are a tremendous gift to every hobbyist because it provide insights into how different parts of an useful application are being linked together. It is the process that one learned during the making of the project.

Thanks lzf713 again for sharing.

Link for original article & software
 

Attachments

  • IRUSB_M8.gif
    IRUSB_M8.gif
    59.5 KB · Views: 2,674
Last edited:
I have built the AVRUSB_IR project above using a Mega8 with a 12MHz crystal.

The image is the result of a capture using my RC5 remote.
 

Attachments

  • RC5_Capture.gif
    RC5_Capture.gif
    16.9 KB · Views: 2,675
My PS3 IR to bluetooth box does kind of what you want. I am using the input capture circuit though I did consider polling early on. The input capture fits well with the event driven software model.
 
eblc1388 said:
I have built the AVRUSB_IR project above using a Mega8 with a 12MHz crystal.

The image is the result of a capture using my RC5 remote.

That's looking pretty good!.

I did something similar years ago (to decode Sharp remotes) using a 16MHz 386SX DOS laptop with an IR receiver connected to the parallel port, and a program written using Turbo Pascal 6.0 :D

It wasn't as pretty as that though.
 
Actually if you are still going to pursue this, I might have a PCB and some parts for exactly this. It would have the IR decoder, ATTiny2313 AVR Micro, 10 pin ISP header, LED, etc. It also has room for a CPLD but I don't think you would need that part. The PCB was a prototype for another project, but I have a couple that are not populated. The PCB fits into a hammond enclosure (can't recall exactly which).
 
Hi Crust,

Thanks for the PCB offer but these projects are just fun exercises for me. I have the Mega8 mounted on the breadboard and I will very soon move on to another project.

The great fun is in the trying, and modifying the way things work to my heart desire and see how the resultant display behave.

I have always wondering how one can display something on the PC screen that resemble an oscilloscope trace, with zoom and pan adjustment, and these examples do tell me a lot on how it is done in VisualBasic and C++.
 
If you look around there are several people that have generated the appropriate sync signals for a monitor from a micro. I can't recall if it was a vga monitor or a TV. I know I have seen it done for LCDs as well, but the refresh will not be as fast.
 
Sorry about my ambiguous wording.

I meant when one have gotten the set of timing data, between logic transitions, one would need to display them nicely on a chart or graph using software.

Some design even allows one to place cursors and measure the timing or frequency between cursors.
 
crust said:
If you look around there are several people that have generated the appropriate sync signals for a monitor from a micro. I can't recall if it was a vga monitor or a TV. I know I have seen it done for LCDs as well, but the refresh will not be as fast.

Look on the PICList, there's an audio spectrum analyser using FFT and directly driving a VGA monitor - using a 17C series PIC if I recall correctly?.

I've always meant to see about converting it for an 18F series PIC - but, like most things, I've never got round to it yet.
 
Sorry for the later reply. The files total size comes to ~1.5MB and this forum failed to accept such large file size, although the file size limit is some 9.8MB shown in the upload window. So I break them up into two.

As requested, the zip file(s) attached. Inside content are:

1. M8 C source file as an AVR Studio project
2. M8 HEX file for direct download to M8 via ISP.
3. Host EXE file for Windows
4. Host C++ Source files for BCB
5. Schematic(with minor changes & two additional LEDs)
6. Usbasp Windows Driver( for first connection to USB port)
7. Readme.txt file

Please report back if outcome is successful. Thanks
 

Attachments

  • Host_Source.zip
    933.2 KB · Views: 2,331
  • AVRUSB_IR_M8.zip
    518 KB · Views: 2,511
  • Schematic.gif
    Schematic.gif
    19.1 KB · Views: 2,713
zip files

Hi eblc1388,

I've downloaded the 2 zipped files, attached to your last post, however, for some unknown reaasons, I'm not able to unzip them.

Appreciate if you could kindly email them to me.

my email address is yanctl@yahoo.com.sg

Thank you
 
Hi Guys,

My Name is RRRE. I have already built this project but it did not work may be by wrong fuse bytes. Pls help
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top