Pengenalan Infrared

By Mr. Widodo

Dari berbagai sumber

 

Simple IR transmitter circuit

Transmitter circuit information

This is an IR transmitting circuit which can be used in many projects (I designed this to try to make my 3D glasses wireless). This IR transmitter sends 40 kHz (frequency can be adjusted using R2) carrier under computer control (computer can turn the IR transmission on and off). IR carriers at around 40 kHz carrier frequency are widely used in TV remote controlling and ICs for receiving these signals are quite easily available.

The circuit can be controlled using any TTL or RS-232C level control signal which makes the interfacing very simple. The circuit can be used for example for using computer to generate IR remote control signals or experimental IR data transmission.

IR transmitter circuit

The circuit works so that when the input (LEFT/RIGHT CONTROL) pin is in logic high state (+4..15V) the transmitter is on and when it is in logic low state (+1V..-15V) the transmitter is off.

Component list for IR transmitter

C1     1 nF
C2     10 nF
C3     220 nF
D1,D2  1N4148
D3     TIL31B (or other suitable IR LED)
R1     1 kohm
R2     22 kohm trimmer
R3     120 ohm
U1     NE555, LM555 or similar

IR receiver and sega glass interface circuit

I designed the circuit to make my Sega 3D glasses wireless, but system did not work as well as I wanted it to work. I used the circuit below to receiving the IR signals and controlling the IR glasses.

Sega 3D glass IR receiver

Component list

Amount  Component
  2     10 kohm resistor
  2     22 kohm resistor
  1     10 uF electrolytic capacitor
  1     100 nF capacitor
  1     10 nF capacitor
  1     78L05 regulator (normal 7805 works also)
  1     GP1U52X receiver module
  3     1N4148 diode
  1     2N2222 transistor (BC547 works also)
  1     3.5 mm stereo jack

Modification ideas

The circuit can be also used for slow serial data transfer by connecting RS-232 data output to the transmitter module left/right control pin and connect the output of GP1U52X receiver module to RS-232 data input through suitable RS-232 buffer circuit. Maximum data rates achievable are at around 1200-2400 bps speed.

Transmitter Electronics

The transmitter electronics is built into each loco. It generates the pulses for the two IR LEDs that are mounted underneath the loco.

Schematic

Figure 1. IR transmitter schematic.

The components shown in the schematic are the ones I use in the final design. They are chosen mainly because of their small size. In my prototypes, I have used slightly different components, but this does not have any effect on the function.

If you don't care about the size, you can replace V1 with four standard diodes, e.g. 1N4148, and the transistors can be replaced by some other types e.g. BC547B instead of BC847CW and BC557B instead of BC857CW. You can also use a PIC12C508 instead of the PIC12C508A version. Only the 'A' version comes in the smaller package (/SN package option).

Pulse generation

The pulse generation is done by the PIC processor. The rest of the components are power supply and reset circuitry. The transmitter sends out two different 8-bit codes, one for each LED. This makes it possible to detect the direction of the loco. I let the codes differ only in bit 7 and the parity bit. This gives a very simple PIC program.

Data is sent as 'LED off' pulses, where a '0' or a '1' is coded by the length of the pulse. Each data sequence consists of:

The length of a '0' pulse is 38 PIC instructions, and a '1' is 102 instructions. The 'LED on' time between each bit is 38 instructions, and the 'LED on' time between two consecutive data sequences is at least 178 instructions. The PIC processor runs from its internal RC oscillator, which gives a nominal instruction cycle time of 1 microsecond.

An example of a pulse sequence with hexadecimal data 1A (decimal 26). High = LED on:

Figure 2. IR transmitter pulse sequence example.

The PIC12C508A processor has to be programmed with an individual code for each loco. The PIC program for the transmitter can be found here:

These files send the hexadecimal data 0A and 8A (10 and 138 decimal). In the source code, the data value to be sent is defined in the beginning of the program. Just change it to the value you want for the moment. The program will send this value on one of the LEDs, and the value + hex 80 on the other LED.

In the HEX file, you can change the value with e.g. IC-prog. You find the value 0C0A at hexadecimal address 100. The two least significant hex digits (0A) is the data value.

Power supply and reset circuitry

The diode array V1 forms a rectifier bridge, that converts the incoming AC or digital signal to DC. Resistor R1 is there to limit the peak current through the diodes to well below the specified maximum value of 450 mA. Capacitor C1 is the bulk decoupling capacitor. It must be rather large to overcome the power drops that occur due to bad contact between the wheels/pick-up shoe and the track. The bulk decoupling is placed before the voltage regulation, because it is here you get the most effect out of it. But this also means that you need to have a high voltage rating, at least 35 V.

R2, V2 and Q1 is the voltage regulator. The function is equivalent of a standard 7805 regulator, but the discrete solution is smaller, and probably also cheaper. C2 is another decoupling capacitor, to filter out the switching noise from the PIC.

R3, R4, R5 and Q2 is the reset circuitry. When the voltage drops below a certain level (approximately 2.8 V), the transistor Q2 turns off, and the resistor R5 will pull the MCLR pin of the PIC down to 0.  This will prevent a so-called "brown-out condition", which otherwise may occur if the supply voltage to the PIC drops below 2.5 V without going all the way down to zero.

The two resistors R6 and R7 are there to limit the current to the two LEDs to a suitable value.

Prototype

I have built two prototypes and mounted them in two of my locos. Here is a picture of the prototype, mounted in a Märklin 3374. At the same time, I converted the 3374 to fully regulated digital, with the 60901 conversion kit.

Figure 3. IR Transmitter prototype.

Final design

The final version of the transmitter electronics is a 18.5 x 14 mm single-sided circuit board. My friend and colleague Stefan Eskilsson designed the layout. A PDF drawing of the layout can be found here.

I have assembled the transmitter boards, and built them into most of my locos. The PIC processor is mounted first, together with five temporary wires connected to the five
round soldering pads. The five wires are used when programming the PIC, and are removed before the rest of the components are mounted.

The square soldering pads to the left are the connections for power and for the two IR LEDs.

Figure 4. Final IR transmitter board.

 

Serial port controlled infrared transmitter with PIC

2002/06/16
designed by Peter JAKAB

This is a programmable infrared (remote control) transmitter, which can be controlled from a PC serial port. It is capable of sending many remote control formats, including the Philips RC-5 standard. Exact formats with the timing parameter names are shown on the pictures:

operation

The controller will accept commands on the serial port. Settings are: 19200 bps, 8 bits, no parity, 1 stopbit, no flow control (XON/XOFF or RTS/CTS). Commands consist of hex coded bytes and must be written on the port as ASCII characters separated by space, terminated by ENTER (ASCII char 0d) The list of commands is here:

SETSTATE

set IR mod output state
Setting the mod output HIGH for a long time can result in blowing the IR transmitter LED out!

54

<state>

 

 

SETPARAMS

set coding parameters

55

<ir_T> <head_h> <head_l> <bit0_h> <bit0_l> <bit1_h> <bit1_l> <tail_h> <tail_l>

55

<ir_T> <skipbits> <togglebits> <firstbyte> <rc5tail>

 

 

SENDPDM

send ir command
header pulse high for T*head_h, low for T*head_l
data bytes transmitted as: bit#0 bit#1 bit#2 bit#3 bit#4 bit#5 bit#6 bit#7
tail bit is high for T*tail_h, bit0 is high for T*bit0_h, low for T*bit0_1,bit1 is high for T*bit1_h, low for T*bit1_l

56

<byte> [byte] [byte] ...

 

 

SENDRC5

send ir command
transmit 2 bytes per ir command: <firstbyte> 8-skipbits bits then <secondbyte>, all 8 bits
data bytes are transmitted as: bit#7 bit#6 bit#5 bit#4 bit#3 bit#2 bit#1 bit#0
bit0 is high for T, low for T, bit1 is low for T, high for T

This command can be used to repeat a given ir command, but not to transmit more commands one by one, because the toggle bit is only set after sending out all the ir commands. To send more than one ir commands, repeat the SENDRC5 command with the appropriate second byte(s).

57

<second byte> [second byte] ...

ir_T is given in 10 usecs, other timing values are given in ir_T steps

You can use a terminal emulator program to test out the circuit (for example minicom on linux, NC terminal on DOS, or hyperterminal on windows), but the settings usually won't work at first, so it is recommended that you write a small program to set the parameters and send commands by pressing keys on the keyboard.

Download source code here.

examples

To program the controller to send a "channel +" command to an ITT 3520 video recorder, you need to send:

55 38 10 8 1 1 1 3 1 1

This command will set these parameters: T=560 usec, header pulse=16T, header gap=8T. bit0 pulse=1T, bit0 gap=1T, bit1 pulse=1T, bit1 gap=3T, tail pulse=1T

56 31 ce 01 fe

This command will send the required command bytes to the video recorder. You can see that this format contains some type of ID and a command code. Each byte is transmitted normally then with all bits reversed. You can repeat this second command more times to ensure reception.

obtaining the protocol for your remote

The easiest is if you find the specification of your remote. Good pages to start are: the SIRCS page and the HP48 remote control program page. If you have no success, you need to measure the signal timings yourself. If you don't have a storage oscilloscope, here is a cheap trick: connect an IR receiver module to your soundcard line input and digitize the modulation waveform of all the buttons on your remote with a sound recorder and editor program. Here is a waveform example for the ITT 3520 video recorder remote.

You can actually measure all the signal times of header, bit0, bit1 and the tail pulse in a sound editor and decode the bits by hand. The yellow bars on the picture show the decoded bits. The last 16 bits contain the button code. The actual code calculated from the bits is "31 ce 01 fe", and will control the video to step one channel up. Another example for the Panasonic remotes POWER button digitized is here:

The encoding scheme is quite similar, with the difference being only in the header/bit pulse/gap times. You can decrypt the command shown yourself. It shows the sequence 02 20 90 00 3d ad, where the first 4 (!) bytes are the device identifier and the last two (3d ad) are the actual command. These remotes employ some strange checksum/code integrity mechanism, where the codes are in byte pairs and the second byte is actually calculated (?) from the preceding one or they contain more than 8 bits and mirror some of the bits.

schematic diagram

The first picture shows the controller and the IR transmitter parts. The second shows the (nonstandard) serial interface level translator, which converts the TTL voltages to/from RS232 levels of the serial port.