Connect Four with Programmable Infrared Receiver Atmel Mega32

We have designed a programmable infrared receiver which can utilize any pulse coded IR signal to play Connect Four from a remote distance.
The programmable infrared receiver device we have created can decode any pulse-width modulated signal of an IR remote control, store it in non-volatile memory, and then recognize that signal again the next time it comes to existence.  We have also coded Connect Four which can be played remotely with one or more remote controls to demonstrate the versatility of our receiver.

Connect Four with Programmable Infrared Receiver Atmel Mega32
Connect Four with Programmable Infrared Receiver Atmel Mega32

High Level Design

I.  Rationale
 
There were several reasons why we chose to create a programmable infrared receiver device which can decode the signals of any pulse coded remote control.  The first is simply a matter of convenience.  Because most remote controls are brand sensitive, only that brand of receiver can accept and decode the signal (like a lock and a key).  It becomes irritating when one suddenly finds out that one has lost the TV remote whilst lying down in a comfortable position.  If one has a VCR or DVD remote nearby, he or she can then use that in its stead.  Secondly, universal remotes these days are quite inexpensive but programmable remotes can run anywhere from a hundred to several hundred dollars.  If the receiver is programmable and can be brand insensitive, then one can entertain the illusion of making any ordinary remote control programmable.  Thirdly, as ECE majors interested in wireless communications, we thought it would be interesting to explore how IR signals are coded in a remote control.
We realize and consequently insist that our device can be implemented to control a myriad of applications such as TV, radio, computers, and so on.  However, rather than implementing our device in every possible application we can think of, we have chosen to show its versatility on one application: Connect Four.
We chose Connect Four amongst other games because it allows us to use more buttons than just the key pad arrows as in most action games.  Making 9 different columns and 8 different rows, we are able to utilize 9 buttons on a remote control.  We can also program a second remote control for player 2 to use.
II. Background Math
 
There is not a lot of hardcore theoretical math involved in the decoding of IR signals.  The only math we had to do was simple arithmetic to figure out a sampling rate at which we could attain the essence of the signal without excessive sampling.  We have observed on the oscilloscope that the smallest pulse in any pulse-coded signal was 0.5 milliseconds.  We chose a 0.1 millisecond sampling rate to take approximately 5 samples of the smallest pulse.
III.  Logical Structure
Logical Structure for  Infrared Receiver
Our design consists of two microcontroller units (MCUs).  As shown in the diagram, the left MCU, communicates with the computer through serial port, accepts signals from the IR receiver via a serial like transmission, decodes the signals, and then outputs in parallel using port C (the numbers from 0x00 to 0x1A).  The right MCU accepts the numbers 0x00 to 0x1A, each representing a remote control button.  It also contains the video game programming and outputs to the Television.  Pin A.0 is used between the two MCUs for the second MCU to communicate to indicate to the first MCU that the button number transmitted by the first has been received so that it can stop transmitting the same signal, and turn off port C before transmitting the next signal.
IV. Hardware / Software Tradeoffs
 
As good ECE majors, it would not have been impossible for us to figure out a circuit that would decode the IR signals and put them into usable form.  However, doing such would in reality be unnecessary.  Using a single Atmel Mega 32 CPU, we can perform IR sampling, decoding, re-programming, storing, and communication with another device (such as a computer through RS232 as well as with another Mega 32 through port pins).  We have used a second Atmel Mega 32 CPU to store our video game.  In honest truth, most of our complexity comes from software that controls the hardware.  Decoding the remote control signal and storing it in usable form was a bit tricky as the signal for each button was well over 128 x 0.5msec (extremely long sequence to decode manually).  We compressed and stored the information in a 16-bit integer.  We are convinced, however, that our implementation is effective as subsequent tests showed that the software took a matter of seconds to decode two entire remotes accurately, where it took us two lab periods just to decode and verify a single remote with an oscilloscope by hand.   Again we utilized software for the RS232 communication with the computer.  In order to make our receiver programmable, we modified the security system framework and menu from lab 3.  Our video game was almost entirely software as we built upon the TV code utilized in lab 4.  Our hardware complexity consists of several remote controls, infrared receiver at 38 kHz, two inter-communicating MCUs, a small circuit to the television, and an RS232 cable running to the computer.
V.  Design Standards
 
Our design conforms with a variety of standards.  In terms of IR remote control signals, there are three different popular standards: pulse-coded, space coded REC-80, and Shift coded RC-5.  We conformed to the pulse-coded standard as that is used by several well-known brands including Sony.  The carrier signal used by these remotes can go anywhere between 32 to 38 kHz so we used a IR receiver that picks up signals up to 38 kHz.  Second of all we have conformed to the RS232 standard for serial communication between the computer and the MCU.  We have also conformed to the EIA RS 170 and NTSC video standards.  The EIA RS 170 is used for generating black and white signals for TVs in the United States.  The NTSC standard dictates the rate in which the motion pictures would be displayed.

VI.  Existing Patents, Trademarks, Copyrights:

This is discussed in III.  Patents, Trademarks, and Copyrights under the ‘Conclusions’ link to the left.

 parts list:

STK 500————————$15
Power Supply—————–$6
Custom PC Board———–$5
Atmel Mega32—————-$8
Atmel Mega32—————-$8

IR demodulator————–$1.15

 
Total                                $43.1
 
For more detail: Connect Four with Programmable Infrared Receiver


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top