How to use Infrared Receiver Sensor Module

Can receive pressed buttons from remote control using infrared rays.
You can also control SPACEBLOCK® using the remote control.
About the Module
The infrared receiver sensor receives infrared signals (38kHz, NEC protocol) sent from a remote control and outputs them as a digital signal on a single signal line.
Each button on the remote control sends a different code, so you can tell which button was pressed. The included remote control supports CR2025 batteries.
Specifications
| Voltage | 5V |
|---|---|
| Frequency Modulation | 38kHz |
| Output | Digital |
How to Connect
Connect the infrared receiver sensor module and SpaceBlock microcontroller board using jumper wires (male-female) as follows:
- Infrared receiver sensor S pin to a SpaceBlock digital-compatible pin (e.g. A0)
- Infrared receiver sensor G pin to SpaceBlock GND
- Infrared receiver sensor V pin to SpaceBlock 5V

※The image shows the signal line connected to pin A0. Pins that can be used for the IR receiver are A0 to A2, A4 to A10, A13, A15, B0 to B15, C14 to C15 (A3 cannot be used because it is the receive pin for the BLE module). Select the pin connected to the S pin in the pin field of the block.
※5V and GND can also be inserted into pins with the same markings on the SpaceBlock microcontroller board.
How to Use
The "IR receiver [A0] received" block becomes true when a new remote control signal is received. While you keep a button pressed, it becomes true repeatedly.
The "IR receiver [A0] code" block returns the received code as an 8-digit hexadecimal string (e.g. 00FF30CF). Each button on the included remote control returns a different code.
The "Remote button [▲]" block returns the code of the button you choose on the included remote control. Combine it with the text comparison block in the "Logic" category, like "if IR receiver [A0] code = Remote button [▲]", to find out which button was pressed without typing the 8-digit code.
You can get values from the infrared receiver sensor module using blocks in the "Input" category of your project.
Buttons and Codes of the Included Remote Control
Pressing a button on the included remote control sends the code shown in the table below. The "Remote button" block returns the code of the chosen button as listed here.
| ▲ | 00FF629D |
|---|---|
| ◀ | 00FF22DD |
| OK | 00FF02FD |
| ▶ | 00FFC23D |
| ▼ | 00FFA857 |
| 1 | 00FF6897 |
| 2 | 00FF9867 |
| 3 | 00FFB04F |
| 4 | 00FF30CF |
| 5 | 00FF18E7 |
| 6 | 00FF7A85 |
| 7 | 00FF10EF |
| 8 | 00FF38C7 |
| 9 | 00FF5AA5 |
| * | 00FF42BD |
| 0 | 00FF4AB5 |
| # | 00FF52AD |
For other remote controls, display the code received by the "IR receiver [A0] code" block to look it up, then put it in a text block to compare. When the board is not connected, you can try it with the remote control shown in the "Simulator" tab (same layout as the included remote control).
For detailed block usage, click here
Digital Read