| Name | Modified | Size | Downloads / Week |
|---|---|---|---|
| Arduino Test Program.zip | 2020-02-22 | 5.5 kB | |
| Arduion Test Program.zip | 2020-02-22 | 5.5 kB | |
| README.txt | 2020-02-22 | 3.5 kB | |
| IR Transceiver.svg | 2020-02-22 | 1.4 MB | |
| Totals: 4 Items | 1.4 MB | 0 |
A novel way to create a proximity detector is to use a commodity infrared receiver such as used in appliance remote controls. In spite of their small size and low price they are quite sophisticated and contain a complete IR detector, gain controlled amplifier, carrier band pass filter, demodulator, base band filter and level detector. An Arduino offers a timer counter which can be used to generate the carrier and the RS232 port can be used to generate the modulating signal. The carrier and modulating signal are used to drive an infrared LED which is detected by the IR receiver. The output of the receiver is connected to the receive input of the serial port. When the light from the LED is reflected from an object into the IR receiver, the RS232 port will read the signal and either trigger the CPU through an interrupt or the CPU can detect the input by polling. The normal RS232 data frame has a DC component which is incompatible with the IR receiver. By sending only codes with an equal number of ones and zeros, it is possible to send a signal with no DC component and which is compatible with the receiver. A data frame consists of a zero start bit, eight data bits and a one stop bit. To keep the number of ones and zeros equal, the data must consist of four ones and four zeros. Eight bits have maximum permutations of 8!. This is reduced because the four ones are interchangeable and the four zeros are interchangeable. The maximum number of permutations is then 8!/(4!*4!) = 70. This gives 70 possible codes with no DC component. A simple code would be "10101010" which when combined with the stop and start bit would be "0101010101". The start and stop bit are not distinguishable in this code. This will give the fastest possible response since there will never be a framing error. If multiple proximity sensors are used, it will be necessary to use different codes to prevent interference. Because of the base band filter, the number of carrier pulses per bit has a high and low limit. For the TSOP382 receiver the range is from 10 carrier pulses to 70 carrier pulses where each pulse has a 50% duty cycle. A further limitation is that only two carrier frequencies are readily available, 38 kHz and 56 kHz. For an Arduino running at 16 MHz, the 56 kHz carrier frequency can be generated most precisely. The RS232 baud rate is not critical provided that the pulses per bit is within limits of the receiver. If the minimum pulse burst length of 10 is used, the maximum baud rate must be 5600. The baud rate divider for a 16 MHz clock = 16 MHz / (16 * 5600) - 1 = 177.571428571. A divider value of 178 is used. If only a limited range is required, the Arduino outputs can be used to drive an LED directly. For greater range, higher current is required and MOSFET driver transistors are required to switch the higher currents. The output of the IR receiver is intended to drive a high impedance input. The Arduino UNO has only one serial port which is also used for programming the Arduino. The TXD output from the USB to serial chip is isolated by a 1k resistor. This resistor is too small to be driven directly by the IR receiver and an HCMOS hex inverter is used to overdrive the USB to serial chip. One gate is used as an inverter which then drives the other five gates. The five gates have their inputs and outputs paralleled to increase the available drive current. A Schmitt input hex inverter is used because these chips are cheap when bought in quantity and the Schmitt input has many other uses for other projects.