Getting Started

From AnalysIR WiKi
Revision as of 10:01, 11 December 2019 by AnalysIR (talk | contribs) (→‎Test Suite)
Jump to navigation Jump to search

> KontroLIR Home

Follow this section the first time you get your KontroLIR remote control.


Checklist

  • Make sure you have s SerialUSB adapter which has a pin-out for Vcc, GND, Tx, Rx and either DTR or RTS. (Note: some adapters do not have a DTR/RTS pin available, which is required for uploading firmware using the Arduino IDE). If you are in any way unsure about this, make sure to purchase the SerialUSB option when ordering your KontroLIR.
  • Make sure you have a USB cable, of sufficient length, to use with the serialUSB adapter.
  • Double check your order to establish if you have one or more of the options (EEPROM or dual IR Receivers)
  • If you ordered the SerialUSB adapter, then it will be compatible with KontroLIR.
  • For the default CH340 based SerialUSB adapters, CH341SER.EXE drivers can be downloaded from [1]
  • For initial usage, it is best to power KontroLIR with the SerialUSB adapter, until you are ready to use with batteries.
  • Make sure to have 2xAAA batteries available before you plan to start using KontroLIR as a remote. (We have not tested with rechargeable batteries due to the lower voltage levels)
  • Batteries are not supplied with KontroLIR, due to shipping regulations. AAA Alkaline batteries are widely available worldwide. We suggest using quality batteries to avoid leakage related issues and if not using KontroLIR for extended periods it is generally a good idea to remove the batteries - as with any battery operated device. We have not tested with re-chargeable batteries due to the lower voltage levels. So stick with non-rechargeable Alkalines.
  • Advanced users can also make use of the internally accessible ICSP compatible programming header to upload firmware with or without a bootloader and change fuse settings. However, frequently opening the enclosure could cause some issues over time if care is not taken. We use spudgers designed or this purpose and lots of TLC when opening the enclosure to avoid potential for damage.

Test Suite

When you first receive your KontroLIR, the very first thing you should do (After your Arduino environment & serial driver are all OK) is to run the supplied Test suite sketch.

The reasons for this:

  • It allows you to check that your KontroLIR hardware is working properly, without defect.
  • We also run this test suite before shipping.
  • If it runs for you we can all be confident that you received a working unit.
  • Note: If you do not run this test suite first, before loading KontroLIR firmware, we will assume you did receive a working KontroLIR unit.


To upload the Test Suite Firmware Sketch:

  • Copy the folder KIR_Vx.xxTestSuite to your Arduino sketch folder (Vx.xx is the version number - initially V1.00)
  • Open it in the Arduino IDE
  • Under Tools menu, Select ATmega328PB Crystal Clock as the target board
  • Select Speed as 4Mhz
  • Select the Port to match the COM port of the KontroLIR SerialUSB adapter. (Verify using Device Manager, if required)
  • Verify/Compile the sketch and confirm it compiles OK.
  • Make sure the batteries are removed.
  • Make sure you have connected the SerialUSB to KontroLIR and your PC and that it is visible in Device Manager as a COM Port. Make a note of the Com Port and make sure it matches what you have selected under the Tools menu.
  • Upload the Test Suite sketch to the KontroLIR device.
  • Open the Arduino terminal window and set the BAUD rate to 19200.
  • You should see a menu and initial test reporting displayed from the sketch.
  • Verify that the EEPROM size matches what you ordered in KBytes. If it doesn't, change the definitions for EEPROM size near the end of the header file.


Now we are ready to run the tests:

  • The test commands are case insensitive and single characters. A brief explanation is provided in the displayed Menu.
  • '?' displays the Menu again.
  • FIRST run the LED blink test by entering option 'L'
  • The RED LED should blink ~5 times, indicating that the LED is operational.
  • SECOND, run the button test, by entering 'B'
  • You will then be prompted to press each button in turn. When You press the button the LED will blink briefly, indicating a successful test for that button.
  • If you get mixed up, go back or forward a few buttons, in case you missed one. You can continue on once you get a blink.
  • NOTE: The UP, DOWN, LEFT, RIGHT buttons have the potential for 2 different button presses on some models (e.g. UPleft & UPright etc.). For now just press the relevant button as requested even if it may seem that you are being asked to press the same button twice.
  • Once you have successfully pressed all buttons as requested you will see a message saying the test has passed. If a button fails, you will not be able to proceed beyond that button.
  • There is no time limit for the tests, as the system will wait until you successfully complete each prompt/step, after which a Pass or Fail message is displayed.
  • THIRD run the IR Receivers test, if installed. (If not installed, ignore this test)
  • Run the IR Receiver test, by entering 'R'.
  • You will then see if the IR receivers are present.
  • Then you are prompted to press any TV remote (over the VOL+ button should do).
  • You should then See a message indicating the IR receiver test have Passed.
  • FOURTH you can run the EEPROM test (only if installed)
  • Run the EEPROM test, by entering 'T'.
  • The system will proceed to go thru a series of tests writing and reading to/from EEPROM and finally erasing every page and verifying this.
  • IF the EEPROM test passed you will see a message saying so )(Otherwise the test will stop with an error message)
  • Congratulations, you have now successfully verified correct operation of your KontroLIR device.
  • There are additional EEPROM test available, which may prove useful at some stage later on.
  • There is also an option 'X' to send 4 test NEC signals @ 38kHz which will verify operation of the IR emitter circuit. If you have another IR receiver setup with say IRremote or our own AnalysIR you can use them to verify the signals being sent. Otherwise just make use of an indicator on a TV or similar or use a digital camera to see if there is IR being emitted from the IR LED.
  • You are now ready to move onto using KontroLIR to create your own custom remote control.

Default KontroLIR Firmware

We provide a fully functional firmware for 5 example devices, which uses only a small amount of FLASH and SRAM.

  • Device Mode 1 - is a Philips smart TV with a mix of RC5 and RC6 protocols (Press TV button to enter Mode 1, from all modes)
  • Device Mode 2 - is a generic satellite STB, which mainly uses the NEC protocol (press SAT button to enter Mode 2, from Modes 1,3,4 or 5)
  • Device Mode 3 - is for a Samsung smart TV, which uses the Samsung Protocol (press DVD button to enter Mode 3, from Modes 1,2,4 or 5)
  • Device Mode 4 - implements a Microsoft Media Center remote control using an extended RC6 protocol. (press SAT button to enter Mode 4, from Mode 2 only)
  • Device Mode 5 - implements a series of test signals, used for testing KontroLIR. (press DVD button to enter Mode 5, from Mode 2 only)
  • If the user is uncertain of the current mode, they can press TV to get back to the default Mode 1 and proceed to other modes as required from there.
  • It is always possible to extend the number of modes, by using other buttons or sequences for this purpose.
  • Conversely, if the user requires less modes you can convert one or more of the 3 device buttons into any other signal/command buttons as required.

You should now be ready to proceed to customising the firmware for your own needs. We recommend trying out small incremental changes and testing them out before embarking on a major overhaul of the official firmware. Of course once you are confident about the layout and functionality of the firmware, the possibilities are endless. Remember there are no hard and fast rules about how many devices you can configure or what signal(s) to associate to a button. For example, with an STB device you can use the VOL keys to send the TV signal for VOL instead of the ones for the STB. You can assign any button/mode to any signal or command you desire.

Always keep a separate backup copy of your last working firmware, so that you have something to compare against if you run into problems.

The image below shows the button map for each mode in the reference firmware along with other useful information and templates. You will be provided with the source spreadsheet for this as part of your order and you can customise to plan and match your own configuration requirements.


> KontroLIR Home