Submind YouTube summaries
Thumbnail for John Park's CircuitPython Parsec: Fruit Jam Infrared IR Receiver

John Park's CircuitPython Parsec: Fruit Jam Infrared IR Receiver

Watch on YouTube

Video summary

The video introduces a practical guide on utilizing the built-in infrared (IR) receiver located on the Adafruit Fruit Jam board within the CircuitPython environment. This small component, marked as "IR IN" on the silk screen and situated near the green power LED, allows users to interact with standard IR remotes commonly found with TVs or LED lighting products. To process signals from these devices, the tutorial demonstrates importing two key libraries: `pulseio` for reading raw pulse data and `adafruit_circuitpython.irremote` for decoding those pulses into meaningful commands. The code setup is notably simplified by using `board.ir`, a predefined constant that automatically identifies the correct pin without requiring the user to manually specify a number, making the implementation accessible for beginners. Once the hardware is configured, the program establishes a connection between decoded button presses and visual feedback through NeoPixels. The presenter creates a dictionary of "learned codes" by physically pressing buttons on various remotes and recording their specific bit patterns. When the main loop runs, it continuously reads incoming pulses, decodes them into bits, and checks if the resulting code matches any in the learned list. If a match is found, the system identifies the specific button pressed—such as "brighter," "dimmer," or color controls—and triggers the NeoPixels to light up in corresponding colors like red, green, blue, or white. The code also includes logic to handle unknown buttons by printing their raw data for future learning and manages edge cases like NEC repeat codes or failed decodings caused by ambient IR noise in the room. The demonstration highlights the versatility of this setup by testing two distinct types of remotes: a 44-key remote with an address-based protocol and a simpler Sony remote that lacks an address field. When using the 44-key remote, the system receives 67 pulses per command, displaying both the raw pulse count and the decoded NEC standard format which includes the address, its inverse for error correction, and the command bits. In contrast, the Sony remote generates only 27 pulses and transmits a simpler signal containing just the operation code. This comparison illustrates how the same CircuitPython script can adapt to different IR protocols, allowing users to control various devices or simply monitor which buttons are being pressed across different brands and models. In conclusion, this project showcases an efficient method for integrating IR remote control functionality into microcontroller projects using the Fruit Jam board. By combining the native IR decoder with pulse timing libraries and LED feedback, developers can create interactive applications that respond to physical remotes without needing external sensors or complex wiring. The tutorial emphasizes the ease of expanding the system's capabilities by simply adding new button codes to the dictionary, enabling users to build custom interfaces for home automation, media centers, or educational projects. Ultimately, the video provides a clear pathway for hobbyists to leverage the Fruit Jam's hidden IR capabilities to bring responsive, touchless control to their electronic designs.
Read the full video transcript
The circuit >> for the circuit python parseek today I want to talk about using the built-in IR infrared reader or decoder on the fruit jam. So fruit jam right here right next to the green power light there's a little hole and on the silk screen probably can't see it there on the silk screen it says uh IR in. So there's a little receiver there. It's uh partly covered just cuz I have the lid on right now with this board. Uh but that's a little standard IR receiver. And inside of Circuit Python, we can use our Adafruit IR remote generic decode library along with pulse IO to read and interpret IR pulses coming from your standard infrared remotes. Could be TV remotes, could be these little generic remotes that you get with LED products. Uh so the way I'm doing this inside of circuit python is I'm importing pulse io which allows us to read pulses and I'm uh importing adafruit IR remote which helps us with the decoding. Then I'm setting the IR pin to IR pin equals board.ir. So since we imported the board directory up here I didn't mention that we have board.ir. We don't have to know a pin number. It's just easy to easy to remember. It's board.ir. Uh then I'm creating the pulse in object with pulse IO on that IR pin. And I'm creating the decoder as the Adafruit IR remote with generic decoder. I'm also setting up some NeoPixel stuff here. Uh and then I have this little list of um learned codes. So I just pressed the buttons on these, saw what each button did, wrote them down, and added a little uh sort of dictionary here of them for two different remotes. So, I also have some behaviors of the LEDs that are keyed to those button names that'll cause the LEDs to light up a certain color. In the main loop here, you can see pulses equals decoder read pulses. So, that's going to read the pulses. And then we can print those. Uh code equals decoder decode bits. Pulses. That's the uh decoding those bits. And then I'm printing the pulses. I'm printing the length of the pulses just because it's kind of interesting. Different remote protocols use different ones. And then if the code is in my little list, I'm going to uh print the button name and I'm going to light up the uh neopixels if it's one of the ones in this list right here of colors. Otherwise, I'll say it's an unknown button, but I'm still printing what uh was decoded so that I can then use that as a learned thing. Uh we also have a little um print statement here for an NEC repeat and failed to decode. You can see right now I've failed to code probably just because some IR bouncing around in the room and it uh at some point thought, "Are you trying to send me a remote?" So, let's let's do a little demo. You can see here with this remote, if I press the very first button here, it just lists all the pulses. Then it says received pulses 67. The decoded bits are 0 255 58 197. On the NEC standard, I wrote it down up here. This is the address, the bitwise inverse of the address, which is used for sort of error correction. The command and the bitwise inverse of the command. And if I then look here, it says what's the button name since it's one I've learned before. It's the 44key remotes brighter. Uh, if I go the next button down, dimmer. I can do play. I can do power. And then these ones I have keyed to colors. So I press this one. It says that's the 44 key red. And I'm going to light up the Neopixels red. This is the green. This is the blue. This is the white. If I point this up at the camera, you'll see there's the little sort of purpley uh blinking that's going on that is being decoded over here. Uh here's a completely different remote. This one's a Sony. If I press, let's say, the play button, you'll see, okay, these are much shorter. Receive 27 pulses instead of the 67. Uh and it decodes it more simply. Uh it doesn't have the address, just the uh operation. So I can press these and change uh the color on a couple of them as well or just read what button has gotten pressed. And so that is how you can use the IR detector or IR. What is this? This is how you can use the IR receiver on the fruit jam inside of Circuit Python. And that's a circuit python parseek.