![]() |
![]() |
![]() |
|
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
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.
__________________
L.Chung |
|
|
|
|
|
|
(permalink) |
|
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.
__________________
We never have time to do it right; but we always have time to do it over. |
|
|
|
|
|
|
(permalink) |
|
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.
__________________
L.Chung |
|
|
|
|
|
|
(permalink) | |
|
Quote:
|
||
|
|
|
|
|
(permalink) |
|
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
__________________
L.Chung Last edited by eblc1388; 5th April 2008 at 10:05 AM. |
|
|
|
|
|
|
(permalink) |
|
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.
__________________
L.Chung |
|
|
|
|
|
|
(permalink) |
|
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.
|
|
|
|
|
|
|
(permalink) | |
|
Quote:
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 It wasn't as pretty as that though. |
||
|
|
|
|
|
(permalink) |
|
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).
|
|
|
|
|
|
|
(permalink) |
|
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++.
__________________
L.Chung |
|
|
|
|
|
|
(permalink) |
|
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.
|
|
|
|
|
|
|
(permalink) |
|
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.
__________________
L.Chung |
|
|
|
|
|
|
(permalink) | |
|
Quote:
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. |
||
|
|
|
|
|
(permalink) |
|
eblc1388, can you post the source code for the Mega8 version. I went to get it and saw it was not in English. I pulled the schematic and I have the parts and a dragon programmer.
Like to get the Mega8 code and the PC code if possible, mainly the mega8 code to play with a USB interface. Thanks |
|
|
|
|
|
|
(permalink) |
|
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
__________________
L.Chung |
|
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Latest |
| Tough assembly program for the PIC16F84 | asmpic | Micro Controllers | 34 | 3rd December 2004 06:50 PM |
| An error in pic16f84a, why? | Zener_Diode | Micro Controllers | 6 | 11th April 2004 02:55 AM |
| Tring to build an infrared remote control...need help | homemade | Electronic Projects Design/Ideas/Reviews | 1 | 19th March 2004 08:43 AM |
| any code loader example from remote machine to uP device | mikemikemike | Electronic Projects Design/Ideas/Reviews | 0 | 12th October 2003 04:39 PM |
| Remote control code grabber | nonzero | Electronic Projects Design/Ideas/Reviews | 5 | 20th July 2003 04:01 PM |