Pages

Friday, August 14, 2020

gherkin remote

Using a Gherkin as an IR remote control

The recently released IRremote 2.61 library for Arduino supports the Sparkfun Pro Micro. Only one small change needs to be made for it to work with a Gherkin.

On the original Gherkin the backlight control pin is on PB5 (Arduino pin 9). The default for the IRlibrary is to use PC6 (Arduino pin 5). After installing the library with the Arduino library manager you need to edit the IRremoteBoardDefs.h file and comment out the line for Pin 5 and uncomment the line for Pin 9

The location of this file varies. On Windows it is in \Documents\Arduino\libraries\IRremote\src\private

On the PB Gherkin there is no backlight circuit, but PB5 is unused. You can connect an LED directly to PB5 and ground (with a currently limiting resistor.) 

The same can be done on the original Gherkin if you did not install the MOSFET for backlight. If you did install the MOSFET then you can connect the IR LED to any of the 30 in switch LED pads. The MOSFET is also controlled by PB5. The Pro Micro is installed face down on the original Gherkin. The pins will be on the opposite side.

The LED is the IR LED from Adafruit. Any 940nm should work. The brighter the better. The ATmega32U4 has a max 20mA per pin output, do not exceed this when connecting directly to the data pin. Select an appropriate current limiting resistor.

If you are using the original Gherkin with the MOSFET backlight output then you can pull much higher current through one of 30 LED backlight pads, all the current flows through the MOSFET and not the data pin.

You will also need an IR sensor to record the original codes from your old remote control. You use this in conjunction with the IRrecord.ino sketch to capture the codes using another Arduino compatible board.

Much more information on the IRremote library is available in it's wiki. https://github.com/z3t0/Arduino-IRremote/wiki

I have an example Arduino sketch that will control a Visio TV. You will need the Adafruit Keypad library, which is in the Library Manager. If you have not installed the Sparkfun board definitions you will need to add that to the Arduino IDE as well. https://learn.sparkfun.com/tutorials/pro-micro--fio-v3-hookup-guide/all