CircuitPython: PulseIO and cloning an IR remote control with Tony D!

Subscribers:
458,000
Published on ● Video Link: https://www.youtube.com/watch?v=TIbp7DzfOBM



Duration: 49:51
13,606 views
219


Live stream to http://twitch.tv/adafruit showing the pulseio module in CircuitPython and how to use it with an IR receiver and IR LED to clone a remote control. Learn a bit about how IR remotes work and how CircuitPython can capture and generate their signals.

Links and hardware mentioned in the video:
- Feather M0 Express guide (go here to learn about loading CircuitPython on this board): https://learn.adafruit.com/adafruit-feather-m0-express-designed-for-circuit-python-circuitpython/overview
- IR LED: https://www.adafruit.com/product/387 (don't forget you need a ~200-500 ohm resistor too)
- IR receiver: https://www.adafruit.com/product/157
- Generic remote control: https://www.adafruit.com/product/389
- NEC remote protocol: http://techdocs.altium.com/display/FPGA/NEC+Infrared+Transmission+Protocol#
- CircuitPython PulseIO documentation: http://circuitpython.readthedocs.io/en/latest/shared-bindings/pulseio/__init__.html

Recap of wiring and code in video:
- IR receiver right most pin (with bump facing you) to board 5V power (USB on Feather boards plugged into computer).
- IR receiver middle pin to board ground.
- IR receiver left most pin to board D6.
- IR LED anode (longer leg) to board D11
- IR LED cathode (shorter leg) to one side of 220 ohm resistor
- Other side of 220 ohm resistor to board ground

Capture signal with code:
import board
import pulseio
ir_read = pulseio.PulseIn(board.D6, maxlen=100, idle_state=True)

Press remote control button with it facing the IR receiver. Now copy the value out to an array object in a specific 16-bit format:
import array
on_command = array.array('H', [ir_read[x] for x in range(len(ir_read))])

Finally create a PWM output and PulseOut object to play back the on command above:
ir_led = pulseio.PWMOut(board.D11, frequency=38000, duty_cycle=2**15)
ir_send = pulseio.PulseOut(ir_led)
ir_send.send(on_command)

Acknowledgements:
- Music: bartlebeats
- Intro shuttle footage: NASA
- Intro fonts: Typodermic
- Intro inspiration: Mr. Wizards's World
- Matrix background: cool-retro-term & cmatrix

-----------------------------------------
Visit the Adafruit shop online - http://www.adafruit.com

Subscribe to Adafruit on YouTube: http://adafru.it/subscribe

Join our weekly Show & Tell on G+ Hangouts On Air: http://adafru.it/showtell

Watch our latest project videos: http://adafru.it/latest

New tutorials on the Adafruit Learning System: http://learn.adafruit.com/

Music by bartlebeats: http://soundcloud.com/bartlebeats
-----------------------------------------




Other Videos By Adafruit Industries


2017-05-12第十版苹果维修宝典 3rd edition of the apple maintenance book @adafruit #adafruit @apple #iphone
2017-05-11New Products 5/10/2017
2017-05-10ASK AN ENGINEER - LIVE electronics video show! 5/10/17 @adafruit #adafruit #electronics #programming
2017-05-10SHOW-AND-TELL Google+ LIVE Hangout! 5/10/17 (video) #showandtell @adafruit #adafruit
2017-05-103D Hangouts – 3D Printing a Guardian Sword ++
2017-05-103D Printing Zelda: Breath of the Wild – Guardian Sword++ #3DPrinting #Adafruit #Nintendo
2017-05-09#DeskOfLadyada Circuit Playground Express tester @adafruit #adafruit
2017-05-09Baby's First Mace by @Dutchmogul - 3D Printing Timelapse
2017-05-08Limor “ladyada” Fried @MAKE magazine #MakeV57 @adafruit #adafruit
2017-05-07#DeskOfLadyada ESP32 FEATHER is (almost) HERE :) @ESP32net ‏@ESP8266 ‏#esp32 #adafruit
2017-05-05CircuitPython: PulseIO and cloning an IR remote control with Tony D!
2017-05-05John Park’s Remote Effects Trigger Box @adafruit @johnedgarpark #adafruit
2017-05-05hot off the machine @adafruit @esp32 @esprissif #esp32 feather
2017-05-04New Products 5/3/2017
2017-05-04Fusion 360 Tutorial – Joy Bonnet Pi 3
2017-05-03ASK AN ENGINEER - LIVE electronics video show! 5/3/17 @adafruit #adafruit
2017-05-03SHOW-AND-TELL Google+ LIVE Hangout! 5/3/17 (video) @adafruit #adafruit
2017-05-033D Hangouts – Zelda Sword, Mini PCs and CNC
2017-05-03How to CNC – Raspberry Pi 3 Case
2017-05-02(behind the scenes!) live @adafruit with @nasa !!
2017-05-023D Printed Eyewear Display - Timelapse Tuesday



Tags:
adafruit
electronics
diy
arduino
hardware
opensource
projects
raspberry
computer
raspberrypi
microcontrollers
limor
limorfried
ladyada
STEAM
STEM