Getting Started: Difference between revisions
m (→Arduino IDE) |
|||
(12 intermediate revisions by the same user not shown) | |||
Line 7: | Line 7: | ||
== Arduino IDE == | == Arduino IDE == | ||
Make sure you have installed and tested support for the ATmega328PB, into your Arduino IDE. (use the [https://github.com/ | Make sure you have installed and tested support for the ATmega328PB, into your Arduino IDE. (use the [https://github.com/watterott/ATmega328PB-Testing ATmega328PB core from watterott]). Instructions on how to install this Core using the Boards manager are available via the link. You may have to resart the IDE. Check you can see the option for '''ATmega328PB Crystal Clock''' under the Tools:Board selection menu in the IDE. | ||
Make sure you have the extEEPROM library installed on the Arduino IDE. If not, you can get it at the link below, which also provides instructions. This is required to run the test suite. | Make sure you have the '''extEEPROM''' library installed on the Arduino IDE. If not, you can get it at the link below, which also provides instructions. This is required to run the test suite. | ||
[https://github.com/JChristensen/extEEPROM Install the extEEPROM library from here] | |||
'''User feedback:''' If you manually installed extEEPROM previously, you may have to remove it and re-install using the library manager of the Arduino IDE '''''(via Menu->Sketch->Include Library->Manage Libraries)''''' | |||
''Also see forum post, in case you get related compiler errors. ([https://irforum.analysir.com/viewtopic.php?f=16&t=992#p2092 related IRforum post] )'' | |||
When using the Arduino IDE, you must always make sure that the folder Name & the name of the main '.ino' both match (including lower/upper case characters but excluding the '.ino' extension). Otherwise you will likely experience some compilations errors. | |||
[https://github.com/JChristensen/extEEPROM | |||
== Required Arduino Libraries == | |||
You will need to have several libraries installed & configured on the Arduino IDE. | |||
* IRremote (see [[Configuring IRremote]]) | |||
* extEEPROM (via [https://github.com/JChristensen/extEEPROM GitHub]) | |||
* Wire | |||
Make sure to have these libraries installed, before proceeding. | |||
== Checklist == | == Checklist == | ||
* Make sure you have | * Make sure you have a 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. Vcc & Signal pins should operate at 5V (not 3V3) levels. | ||
* Make sure you have a USB cable, of sufficient length, to use with the serialUSB adapter. | * 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) | * Double check your order to establish if you have one or more of the options (EEPROM or dual IR Receivers) | ||
Line 36: | Line 50: | ||
To upload the Test Suite Firmware Sketch: | To upload the Test Suite Firmware Sketch: | ||
* Copy the folder | * Copy the folder KIR_TestSuite to your Arduino sketch folder | ||
* Open it in the Arduino IDE | * Open it in the Arduino IDE | ||
* Under Tools menu, Select ATmega328PB Crystal Clock as the target board | * Under Tools menu, Select ATmega328PB Crystal Clock as the target board | ||
Line 47: | Line 61: | ||
* Open the Arduino terminal window and set the BAUD rate to 19200. | * 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. | * You should see a menu and initial test reporting displayed from the sketch. | ||
* Verify that the configured EEPROM size matches what you ordered in KBytes. If it doesn't, change the definitions for EEPROM size near the end of the ''KIR_Vars.h'' header file. | * Verify that the configured EEPROM size matches what you ordered in KBytes. If it doesn't, change the definitions for EEPROM size near the end of the ''KIR_Vars.h'' header file. ''(If you did not order an EEPROM option, you can ignore this. However, you will still need to install extEEPROM library for the tests to compile.)'' | ||
* CAUTION: Most of the files in the test suite are similar to the main KontroLIR file. Be aware they are not the same and may have minor differences - even though the files names are the same. | * CAUTION: Most of the files in the test suite are similar to the main KontroLIR file. Be aware they are not the same and may have minor differences - even though the files names are the same. | ||
Latest revision as of 10:20, 13 January 2021
Follow this section the first time you get your KontroLIR remote control.
Arduino IDE
Make sure you have installed and tested support for the ATmega328PB, into your Arduino IDE. (use the ATmega328PB core from watterott). Instructions on how to install this Core using the Boards manager are available via the link. You may have to resart the IDE. Check you can see the option for ATmega328PB Crystal Clock under the Tools:Board selection menu in the IDE.
Make sure you have the extEEPROM library installed on the Arduino IDE. If not, you can get it at the link below, which also provides instructions. This is required to run the test suite. Install the extEEPROM library from here
User feedback: If you manually installed extEEPROM previously, you may have to remove it and re-install using the library manager of the Arduino IDE (via Menu->Sketch->Include Library->Manage Libraries) Also see forum post, in case you get related compiler errors. (related IRforum post )
When using the Arduino IDE, you must always make sure that the folder Name & the name of the main '.ino' both match (including lower/upper case characters but excluding the '.ino' extension). Otherwise you will likely experience some compilations errors.
Required Arduino Libraries
You will need to have several libraries installed & configured on the Arduino IDE.
- IRremote (see Configuring IRremote)
- extEEPROM (via GitHub)
- Wire
Make sure to have these libraries installed, before proceeding.
Checklist
- Make sure you have a 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. Vcc & Signal pins should operate at 5V (not 3V3) levels.
- 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 Alkaline batteries available before you plan to start using KontroLIR as a stand-alone 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_TestSuite to your Arduino sketch folder
- 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 configured EEPROM size matches what you ordered in KBytes. If it doesn't, change the definitions for EEPROM size near the end of the KIR_Vars.h header file. (If you did not order an EEPROM option, you can ignore this. However, you will still need to install extEEPROM library for the tests to compile.)
- CAUTION: Most of the files in the test suite are similar to the main KontroLIR file. Be aware they are not the same and may have minor differences - even though the files names are the same.
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 tests 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.
If you see any issues or Fails, contact support.
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 3 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.