USB IR Toy

Not rated 9,243

USB IR Toy
USB IR Toy

Use a remote control with your computer, view infrared signals on a logic analyzer, or capture and replay remote control buttons. The USB Infrared Toy v2 features an enhanced IR transmitter and several new functionalities. Numerous intriguing infrared projects are available online. Serial port infrared PC remote control decoders have been popular for years, with a USB version published by Ian at Hack a Day. The TV-B-Gone is a well-known kit that turns off most TVs by transmitting POWER codes using infrared LEDs. The IR Toy integrates all these projects into an upgradable USB dongle, incorporating additional functions, such as a simple logic analyzer that visualizes remote control signals. The 28-pin PIC 18F2550 with USB is utilized in IR Toy v2. This chip is common in many hobby projects requiring USB, although it is becoming outdated. The cost of 5-volt components like the 18F2550 is rising, while 3.3-volt versions with more features (18F25J50) are decreasing in price. The price of the PIC18F2550 has increased by about $1 since the launch of v1, contributing to approximately 50% of the price increase in v2. The entire circuit operates at 5 volts, drawing power directly from the USB port without regulation. A single power supply pin is accompanied by a 0.1uF decoupling capacitor (C1). USB functionality necessitates a 20MHz external oscillator (Q1, C5, C6). The chip is initially programmed through a 5-pin ICSP header. A 10K pull-up resistor (R1) and a diode (D1) on the MCLR pin safeguard the circuit from the 13-volt signal used during programming. The USB transceiver includes an internal 3.3-volt regulator requiring a 220nF (0.22uF) external capacitor (C2). The footprint for an additional capacitor for use with 0.1uF capacitors has been eliminated. An infrared demodulator (RX1) decodes infrared remote control transmissions, detecting signals on a carrier wave and converting them into a clean stream of 1s and 0s. A demodulator centered at 38kHz is employed, although it can function over a broader frequency range with reduced distance. An alternative demodulator may be necessary for 56kHz remote controls. The demodulator connects to a PIC pin with an edge-selectable interrupt (RB2/INT2) for detecting the initiation of IR activity. RB2 is equipped with a Schmidt trigger to filter out noise. The RX output is also linked to one of the interrupt-on-change pins (RB4) for experimentation with different interrupt types and a TTL pin buffer. While 36-38kHz is the most prevalent frequency for remote controls, some operate at 56kHz or other unique frequencies. The new infrared frequency detector (RX2) measures raw infrared signals, differing from the demodulator, which seeks signals on a 38kHz carrier wave. The detector identifies individual transitions of the carrier wave, providing extra data for measuring carrier frequency and potentially recording signals in frequency ranges not compatible with the 38kHz demodulator. Working with the detector illustrates the necessity of modulated signals in remote controls, as external noise significantly degrades signal quality. For optimal results, it is recommended to use the device in a dim room and hold the IR source very close (1-2cm). An infrared LED or emitter (TX) transmits signals, functioning like any other LED but emitting light centered around 940nm, outside the visible spectrum. The transmitter connects to a PIC pin with a hardware pulse-width modulator, facilitating the generation of infrared pulses at frequencies detectable by IR receivers. The IR Toy v2 employs a new constant current driver circuit to power the LED at high currents, surpassing the single resistor configurations of earlier IR Toy designs. The LEDs receive a constant 100mA of current regardless of supply voltage, with the USB power supply fluctuating between 4.5 and 5.5 volts. This new design ensures maximum current across all voltages without relying heavily on a large current-limiting resistor. Previous designs dissipated excess current through the typical LED current-limiting resistor circuit, necessitating a minimum power rating of 0.34 watts for a 100mA IR LED, exceeding the capacity of standard surface mount resistors (<0.125 watts). The constant current driver minimizes reliance on the current-limiting resistor. High currents are feasible using standard SMD components, although a robust 1206 resistor is utilized for safety. IR emitters are generally rated for 100mA of continuous power, and most remote control protocols modulate the LED rapidly at around 38KHz, effectively turning it off half the time. Many LEDs are rated for double their continuous power rating (200mA), with some rated for 1A+, but only for brief pulses at a 50% duty cycle. The IR Toy v2 emitter is restricted to the maximum continuous rated current for the IR diode (100mA), minimizing the risk of damage if the transmitter remains activated. As a development platform, safety is prioritized. Custom current settings can be configured by replacing R4 with a smaller resistor. However, this adjustment shifts a significant portion of the current from the resistor to the transistor. The transistor in IR Toy v2 may operate at higher temperatures than that in v1. For an IR LED with a forward voltage (Vf) of 1.35 volts, power dissipation is calculated at 0.295W, approaching the rated 0.310W of the BC818 transistor in an SOT-23 package. These calculations consider the worst-case scenario of a continuous 100mA load, with IR transmissions typically being brief and at a 50% duty cycle. Additional calculations are available in a spreadsheet located in the hardware folder of the project archive. Acknowledgment is extended to Rafa and rsdio for their assistance with the constant current circuit. The ICSP group is utilized for programming the PIC. A jumper is placed between PGC and PGD to activate the bootloader. This header was repositioned in V2 to prevent interference from the PICKIT2's extra pin with the breakout area. The PIC 18F2550 features an internal 3.3-volt regulator to supply the USB components, which generates some heat as the smallest 18F2550 is housed in a large SOIC package. Passive components have been upgraded to 0603 to maintain the board size similar to v1, despite the addition of several components. The 0603 size is not recommended for beginners, and the DO323 diodes are considered the most challenging components to solder. The Microchip USB stack is employed to operate the 18F2550 as a virtual serial port. Although Microchip's code is open, it is not redistributable. To compile the source, it is necessary to download the stack from Microchip and integrate the source code into the installation directory. Detailed instructions are available in the PIC compiler how-to documentation. The rising costs of the QSE159 sensor and the PIC 18F2550 chips have increased the price of IR Toy v2 by over $2. Efforts will be made to reduce costs by transitioning to a more affordable 3.3-volt PIC 18F25J50 in v3.Use a remote control with your computer, view infrared signals on a logic analyzer, or capture and replay remote control buttons. USB Infrared Toy v2 has an improved IR transmitter and several new features. There`s lots of interesting infrared projects on the web. Serial port infrared PC remote control decoders have been popular for years, Ian pub lished a USB version at Hack a Day. The TV-B-Gone is a popular kit that turns most TVs off by transmitting POWER codes with infrared LEDs. The IR Toy combines all these projects into an upgradable USB dongle, with some extra functions, like a simple logic analyzer that visualizes remote control signals.

The 28pin PIC 18F2550 with USB is back in IR Toy v2. This chip is used in lots of hobby projects that need USB, but it`s starting to show its age. 5volt parts like the 18F2550 are increasing in price, while the 3. 3volt versions with more features (18F25J50) keep getting cheaper. The PIC18F2550 has gone up about $1 since we started v1, it accounts for about 50% of the price increase in v2. Everything runs at 5volts, so power is taken directly from the USB port without regulation. A single power supply pin gets a 0. 1uF decoupling capacitor (C1). The USB features require a 20MHz external oscillator (Q1, C5, C6). The chip is initially programmed thorough a 5pin ICSP header. A 10K pull-up resistor (R1) and a diode (D1) on the MCLR pin protect the rest of the circuit from the 13volt signal used during programming.

The USB transceiver has an internal 3. 3volt regulator that requires a 220nF (0. 22uF) external capacitor (C2). The extra capacitor footprint to use with 0. 1uF capacitors was removed. An infrared demodulator (RX1) decodes infrared remote control transmissions. The demodulator looks for a signal on a carrier wave and decodes it to a clean stream of 1s and 0s. Learn more about infrared modulation and demodulation. We used a demodulator centered at 38kHz, but it will work over a larger range of frequencies at a reduced distance. An alternative demodulator may be needed for 56kHz remote controls. The demodulator connects to a PIC pin with an edge selectable interrupt (RB2/INT2) so we can detect the start of IR activity.

RB2 has a Schmidt trigger to `clean up` a noisy signal. The RX output is also connected to one of the interrupt-on-change pins (RB4) if you want to experiment with a different interrupt type and a TTL pin buffer. While 36-38kHz is the most common frequency for remote controls, some operate at 56kHz, or even more exotic frequencies.

The new infrared frequency detector (RX2) measures raw infrared signals. This is different than the demodulator above. The demodulator looks for a signal on a 38kHz carrier wave and decodes it to a clean stream of 1s and 0s. The detector sees the individual transitions of the carrier wave. The extra sensor data can be used to measure the carrier frequency. It might also be possible to record signals in frequency ranges that don`t work with the 38kHz demodulator.

Working with the detector will show you why remote controls use modulated signals. Any outside noise will degrade the signal quality a lot. A nearby window on a sunny day will activate it. Use it in a dim room and hold the IR source very close (1-2cm) for best results. An infrared LED or emitter (TX) is used to transmit signals. It`s like any other LED, but the color centered around 940nm outside the visible spectrum. The transmitter is connected to a PIC pin with a hardware pulse-width modulator. The PWM makes it easy to create infrared pulses at frequencies visible to IR receivers. IR Toy v2 uses a new constant current driver circuit to power the LED at high currents. It`s way better than the single resistor in the older IR Toy designs. The LEDs get a constant 100mA of current no matter the supply voltage. The USB power supply varies between 4. 5 and 5. 5volts, the new design ensures maximum current at all voltages. More importantly, we don`t rely on a huge current limiting resistor. Previous designs burned excess current in the typical LED current limiting resistor circuit. The resistor needs a minimum power rating of 0. 34watts for 100mA IR LED, way out of the range of common surface mount resistors (<0. 125watts). The constant current driver doesn`t rely on the current limiting resistor nearly as much. High currents are possible using standard SMD parts, but just in case we used a beefy 1206 resistor. IR emitters are typically rated for 100mA of continuous power. Most remote control protocols blink the LED rapidly (modulate it) at around 38KHz, so it is actually off half the time. In this setup many LEDs are rated for double the continuous power rating (200mA). Some are also rated for 1A+, but only for tiny pulses at 50% duty cycle. The IR Toy v2 emitter is limited to the maximum continuous rated current for the IR diode (100mA). Damage is less likely to happen if the transmitter is ever stuck on. It`s a development platform after all, so safety first. You can set your own current by replacing R4 with a smaller value resistor. On the down side we transferred a lot of the current from the resistor to the transistor. The transistor in IR Toy v2 can potentially run hotter than the transistor in v1. For an IR LED with a forward voltage (Vf) of 1. 35 volts the power dissipation is 0. 295W, nearly the rated 0. 310W of the BC818 transistor in an SOT-23 package. This is probably fine because we`re calculating the worst case scenario of a continues 100mA load, IR transmissions are likely to be short and at a 50% duty cycle.

These calculations are also in a spreadsheet in the hardware folder of the project archive. Special thanks to Rafa and rsdio who helped with the constant current circuit. The ICSP group is used to program the PIC. Place a jumper between PGC and PGD to trigger the bootloader. This header was flipped in V2 so the PICKIT2`s extra pin doesn`t interfere with the breakout area. The PIC 18F2550 has an internal 3. 3volt regulator to supply the USB stuff. That regulator must put out a bit of heat because the smallest 18F2550 is in a huge SOIC package. Passive components were changed to 0603 so the board would stay about the same size as v1, despite several extra parts. 0603 isn`t for beginners, but the DO323 diodes are the worst part to solder in our opinion. Neither the PCB nor the diode have much to solder onto. We used the Microchip USB stack to run the 18F2550 as a virtual serial port. Microchip`s code is open but not redistributable. If you want to compile the source, download the stack from Microchip, then drag the source code into the install directory.

See the detailed instructions in the PIC compiler how-to. The QSE159 sensor and rising cost of PIC 18F2550 chips increased the price of IR Toy v2 by more than $2. We`ll try to get the cost back down by using a cheaper 3. 3volt PIC 18F25J50 in v3. 🔗 External reference