Advertisement

38KHz or 40KHz signal generator

Not rated 7,200

#PIC12C508 #38KHz #40KHz #signal generator #infrared #carrier frequency #microcontroller #GPIO #frequency control
38KHz or 40KHz signal generator
38KHz or 40KHz signal generator

Description: The small 8-pin PIC12C508 is pre-programmed to generate our 38KHz carrier frequency by simply pulsing I/O-pin GP1. The PIC will generate either 38KHz or 40KHz, depending on the state of GP3 when power is first applied. If you connect GP3 to ground, then apply power to the circuit, the frequency will be 40KHz. This was implemented for people using the older 40KHz style infrared detector modules. The default is 38KHz with pin #4 (GP3) left floating or not connected to anything. Pin #7 (GP0) is to inhibit the carrier output. When GP0 is connected to ground, the PIC will halt generation of the carrier frequency. This is an optional control feature for power saving, and in most cases, unnecessary, but it's there if you need to use it. Ground pin #7 to inhibit the carrier frequency. Release this pin from ground to start the carrier frequency again. Connect GP1 (pin #6) of the PIC12C508 to pin #1 of the two-input NAND Schmitt trigger. The data signal pin can be any I/O-pin from the BASIC Stamp or other microcontroller. By referring to the NAND truth table, you can see how the PNP transistor is held OFF by the logic "1" output of the NAND on pin #3 until both inputs #1 & #2 are logic "1". The 38KHz carrier generated by the tiny 8-pin PIC pulses from logic "1" to logic "0" at a rate of approximately 38,000 cycles per second, hence 38KHz. The serial data signal is 1200 or 2400 bps (bits per second), and considerably slower than the 38KHz carrier frequency. You'll need a power supply that can deliver 5-volts @500mA for the circuit configuration. The Lumex OED-EL-8L, High-Power 180mW, 940nm Infrared LEDs will drop approximately 1.6V each. To figure total peak pulsed current: 5V - (1.6V + 1.6V) / 5.1-ohms = 352mA peak pulsed current.

The circuit utilizes the PIC12C508 microcontroller, which is programmed to generate a modulated carrier frequency suitable for infrared communication. The choice between 38KHz and 40KHz operation is determined by the state of GP3 during power-up, allowing compatibility with various infrared detector modules. The configuration allows for efficient control of the carrier frequency, with GP0 serving as an inhibit pin, providing an option for power-saving during idle periods.

The output frequency modulation is achieved by connecting GP1 to the input of a two-input NAND Schmitt trigger, which is critical for shaping the output signal. The use of a PNP transistor in conjunction with the NAND gate output ensures that the carrier is only active when the conditions for both inputs are met, providing a reliable method for controlling the modulation based on the data signal received from other microcontrollers.

The design specifies the use of Lumex OED-EL-8L infrared LEDs, which are suitable for applications requiring high power and efficiency in the 940nm wavelength range. The calculation for peak pulsed current is crucial for ensuring that the power supply can adequately support the demands of the circuit, particularly when multiple LEDs are used in parallel. The total current draw is calculated considering the forward voltage drop across the LEDs and the resistance in the circuit, ensuring that the design operates within safe parameters while delivering the necessary performance for infrared transmission applications.The small 8-pin PIC12C508 is pre-programmed to generate our 38KHz carrier frequency by simply pulsing I/O-pin GP1 (shown above). The PIC will generate either 38KHz or 40KHz, depending on the state of GP3 when power is first applied.

If you connect GP3 to ground, then apply power to the circuit, the frequency will be 40KHz. This was implemented for people using the older 40KHz style infrared detector modules. The default is 38KHz with pin #4 (GP3) left floating or (not connected to anything), Pin #7 (GP0) is to inhibit (stop) the carrier output. When GP0 is connected to ground, the PIC will halt generation of the carrier frequency. This is an optional control feature for power saving, and in most cases, un-necessary, but it's there if you need to use it. Ground pin #7 to inhibit the carrier frequency. Release this pin from ground to start the carrier frequency again. Connect GP1 (pin #6) of the PIC12C508 to pin #1 of the two-input NAND schmitt trigger as shown in figure 2.

The data signal pin can be any I/O-pin from the BASIC Stamp or other microcontroller. By referring to the NAND truth table below, and the schematic above, you can see how the PNP transistor is held OFF by the logic "1" output of the NAND on pin #3 until both inputs #1 & #2 are logic "1". The 38KHz carrier generated by the tiny 8-pin PIC pulses from logic "1" to logic "0" at a rate of approximately 38,000 cycles per second, hence 38KHz.

The serial data signal is 1200 or 2400 bps (bits per second), and considerably slower than the 38KHz carrier frequency (as shown below). You'll need a power supply that can deliver 5-volts @500mA for the circuit configuration shown in Figure 2.

The Lumex OED-EL-8L, High-Power 180mW, 940nm Infrared LEDs will drop approximately 1.6V each. To figure total (peak pulsed current): 5V - ( 1.6V + 1.6V ) / 5.1-ohms = 352mA peak pulsed current.

Related Circuits