TSOP Module Documentation
The TSOP (Thin Small Outline Package) Module is a versatile infrared receiver module designed for remote control applications. It receives infrared signals from a transmission source, such as a remote control, and decodes them into a digital signal that can be processed by a microcontroller or other digital devices.
The TSOP Module has three pins:
VCC: Power supply pin (typically 5V)
GND: Ground pin
OUT: Digital output pin (active low)
### Example 1: Basic Infrared Receiver using Arduino
In this example, we will use an Arduino board to read infrared signals from a remote control and decode them using the TSOP Module.
```cpp
const int irReceiverPin = 2; // Pin connected to TSOP OUT pin
void setup() {
Serial.begin(9600);
pinMode(irReceiverPin, INPUT);
}
void loop() {
if (digitalRead(irReceiverPin) == LOW) {
// Infrared signal received, decode it
decodeIRSignal();
}
}
void decodeIRSignal() {
// Implement your decoding logic here
// For example, use the Arduino's IRremote library
#include <IRremote.h>
IrReceiver decoder(irReceiverPin);
if (decoder.decode()) {
Serial.println(decoder.decodedIRData.command, HEX);
decoder.resume(); // Prepare for next signal
}
}
```
### Example 2: Using the TSOP Module with Raspberry Pi (Python)
In this example, we will use a Raspberry Pi to read infrared signals from a remote control and decode them using the TSOP Module.
```python
import RPi.GPIO as GPIO
import time
# Set up GPIO mode
GPIO.setmode(GPIO.BCM)
# Define the pin connected to TSOP OUT pin
irReceiverPin = 17
# Set up the pin as an input
GPIO.setup(irReceiverPin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
try:
while True:
if GPIO.input(irReceiverPin) == GPIO.LOW:
# Infrared signal received, decode it
decodeIRSignal()
time.sleep(0.01)
except KeyboardInterrupt:
GPIO.cleanup()
def decodeIRSignal():
# Implement your decoding logic here
# For example, use the Python's pyir library
import pyir
decoder = pyir.IRDecoder(irReceiverPin)
command = decoder.decode()
print(command)
```
Datasheet: [TSOP Module Datasheet](https://example.com/tsop_module_datasheet.pdf)
Application Notes: [Using the TSOP Module with Microcontrollers](https://example.com/tsop_module_app_notes.pdf)
Ensure the TSOP Module is properly connected to the power supply and ground pins.
Use a appropriate resistor and capacitor for power supply decoupling.
The decodeIRSignal() function should be implemented according to the specific infrared protocol used by the remote control.