Other Language Versions: English | 中文 | 日本語
- InfraCamControl
InfraCamControl is a multifunctional smart camera control system based on Raspberry Pi, integrating infrared remote control, computer vision, and gesture recognition technologies. It receives instructions via Slack, supports infrared device control, face and gesture recognition, and automatically adjusts infrared lighting based on ambient light conditions. The system also supports voice interaction with Apple devices, enabling more intelligent device interaction.
- Remote Control: Efficient remote management via Slack.
- Infrared Learning and Sending: Supports learning and sending infrared signals.
- Computer Vision:
- Supports multiple face detection methods.
- Real-time hand gesture recognition.
- Ambient Light Management: Automatically adjusts infrared lighting based on light conditions.
- Multitasking: Supports multithreading for improved efficiency.
- Protocol Compatibility: Supports NEC and Mitsubishi infrared protocols.
- Apple Device Integration: Enables smarter control via voice recognition.
- Raspberry Pi (Model 4B)
- PiCamera2 (OV5647 IR-CUT)
- Infrared LED Emitters (OSI5LA5A33A-B 940nm) ×9
- Red LED Indicator Light (2.3V, 25mA)
- Diode (1N5819)
- Infrared Receiver Module (OSRB38C9AA)
- N-channel MOSFETs (2SK2232) ×2
- Slide Switch
- Button
- Resistors:
- 2.2Ω (±5%) ×3
- 10Ω (±5%) ×1
- 100Ω (±5%) ×1
- 10kΩ (±5%) ×2
Note: The OV5647 IR-CUT module cannot automatically switch the infrared filter and needs to be manually removed. Follow these steps for non-destructive disassembly:
-
Remove Screws and Connectors
Unscrew the red-marked screws and unplug the blue-marked connector.

-
Adjust Filter and Lever
Move the blue-marked filter to the target position, and gently lift the red-marked lever while keeping it in place. Reattach the screws without reconnecting the connector.
- Python 3.x
- Necessary Python Packages (install via pip):
picamera2opencv-pythonpigpioslack-sdknumpyonnxruntime(for Ultra-Light-Fast model)ultralytics(for YOLOv8)mediapipe
-
Clone the Repository
git clone https://github.com/CC5103/InfraCamControl.git cd InfraCamControl -
Install Dependencies
pip install -r requirements.txt
-
Configure Slack Integration
Create aconfig.jsonfile and add your Slack credentials:{ "BOT_TOKEN": "your-slack-bot-token", "ID": "your-channel-id" }
-
Start the pigpio Daemon
sudo pigpiod
-
Run the Main Program
python3 InfraCamControl/software/main_mediapipe.py
-
Create Infrared Signals
Input the following command in Slack to record a signal:crate <save_type> <save_key> <save_name>
- Hardware Operation: Set the switch to the infrared receiver, press the button to record the signal.
- Signal Protocol: Supports NEC or Mitsubishi protocols (940nm).
- File Management: The system automatically generates signal files and updates them in
signal_list.json.
-
Send Infrared Signals
- Slack Control: Type
<save_key>to trigger the signal (press the button to light up the red indicator for confirmation). - Gesture Control: Use hand gestures to send the bound signal (spread fingers to activate the system, then the red light automatically turns on as feedback. After activation, perform the corresponding gesture).
- Slack Control: Type
The system consists of two main threads:
-
Slack Message Thread
- Listens for commands
- Manages infrared signal recording and sending
-
Camera Thread
- Face detection
- Ambient light monitoring and infrared light adjustment
The system offers the following face detection methods:
- Advantages: Fast, low resource usage.
- Disadvantages: Lower accuracy, sensitive to lighting conditions.
- Use Case: Resource-limited environments.
- Advantages: High detection accuracy, supports multi-target detection.
- Disadvantages: Higher resource usage.
- Use Case: High-precision applications.
- Advantages: Fast, moderate resource usage.
- Disadvantages: Only supports single-face detection.
- Use Case: Balanced performance and resource demand.
- Advantages: High accuracy, supports multi-person detection.
- Disadvantages: Requires significant computational resources.
- Use Case: Applications needing detailed feature analysis.
The system uses MediaPipe for real-time hand gesture recognition. Supported gestures include:
- Open Hand: Activate the system, and the red light turns on.
- Index Finger: Turn the light on/off.
- Index + Middle Finger: Turn on the air conditioner.
- Index + Middle + Ring Finger: Turn off the air conditioner.
Key GPIO Interface Descriptions:
- GPIO8: Infrared LED Emitters
- GPIO25: Infrared Receiver Module
- GPIO23: Gesture Recognition Feedback (lights up the red indicator)
- CSI Interface: Camera Module Connection
- Status LED: Displays system status
- Fork the repository.
- Create a branch.
git checkout -b feature/AmazingFeature
- Commit your changes.
git commit -m 'Add some AmazingFeature' - Push the branch.
git push origin feature/AmazingFeature
- Submit a Pull Request.
This project is licensed under the GNU General Public License (GPL). See the LICENSE file for details.
- Ensure the
pigpiodservice is running. - Check if the Slack configuration is correct.
- Verify hardware connections.
- Confirm the camera module is enabled.
- yhotta240's Infrared Tutorial
- Casareal BS Blog's Air Conditioner Remote Control Tutorial
- Ultra-Light-Fast-Generic-Face-Detector-1MB
- YOLOv8
- OpenCV
- Google MediaPipe






