IR Testing

Issue #33 resolved
Turgut Guneysu created an issue

Hi John

I was trying to test the IR libraries and noticed it is asking for a “device” number of sorts. It gets filled in by a number “253” when I connect, however I was not able to get it to work. I tried using port numbers without success.

Could please tell me what that number is and how I can find out my sensor's device number?

Thx. Turgut.

Comments (8)

  1. John Maloney repo owner

    The “device” ID depends on the remote. You can find it by using the “test IR” block. Click that block. It will highlight to show that it’s running. Then point your IR remote at the IR receiver and press a button. A talk bubble should appear showing the device ID and the button code.

    However…

    The MicroBlocks IR library only supports one of many IR remote protocols. The one it supports, the “NEC” protocol, is fairly common, but your IR remote may be using a different protocol. In my informal testing of about a dozen remotes, I found that about two thirds of them worked with MicroBlocks. So if one remote doesn’t work, try every remote you can get your hands one and you’ll probably find one that works. :-)

    Good luck!

  2. Turgut Guneysu reporter

    Hi John

    I already tried that and TESTIR did not produce any results for me.

    I definitely know that my remotes are NEC protocol. Tested them with normal micro:bit code without problem, also with Arduino.

    The SENSOR is VS1838B as can be seen in this article and pics. http://osoyoo.com/2014/12/08/decode-infrared-remote-controller-with-ir-receiver-vs1838b/

    I will try again while I wait for your reply.

    Thanks, Turgut

    Windows 10 için Postahttps://go.microsoft.com/fwlink/?LinkId=550986 ile gönderildi

  3. Turgut Guneysu reporter

    Hello John,

    Did some further testing on the IR Library.

    I looked into the code for IRTest and saw that it is polling PORT26 for the IR Signal.

    On the micro:bit, there is no 26, only up to 20.

    Also there is no way to select the IR sensor connection port in the code.

    I used MakeCode editor with different libraries for IR and could make the sensor work by selecting various port numbers in the other libraries.

    I am using micro:bit connected to a KeyesStudio Motor Control Card with port extensions.

    I tried every port on it with the IRTest and did not get a reading for Device number.

    If you have any suggestions on what I can try, please let me know.

    Thx, TG

  4. John Maloney repo owner

    The current library has the AdaFruit Circuit Playground pin number (pin 26) hardwired. I’ll add a way to change that without editing the library code as you did.

    To debug this, you might try writing a loop that outputs the IR signal to the user LED. For example, if you’ve connected the IR remote output to pin 0 of your micro:bit it would look like this:

    You should see the LED flicker when you press a button on the remote. The output of the IR sensor is normally high, so it will be on when there is no IR signal. If you have some sort of speaker (i.e. a piezo “buzzer”), using sound as the output works even better. (I haven’t actually tried using an LED as output, only sound, but you may not have a speaker.)

    If this test is able to detect a signal but you’re still not getting any output from the “test IR” block , then I’m guessing that the the library is failing to decode your remote’s protocol. You might try whatever other remotes you can lay your hands on in case one of those works better. There could be variations of the NEC protocol and maybe MicroBlocks isn’t handling your variation.

  5. Turgut Guneysu reporter

    Hi John,

    A bit more testing to verify port no issue:

    I configured an ESP32 with the microBlocks firmware loads and connected it.

    I chose ESP32 because it has ports all the way to 39 !

    I connected the IR Sensor to port26 per default.

    Lo and behold everything worked:

    TESTIR reported Device 255 and started giving codes on button presses.

    After that I could read all the button codes using the “receive IR code from device 255” block.

    Just to let you know, default port 26 in the IR library code should be changed to at least a lower port no in the 0-20 range for micro:bit support.

    Better yet, to have a selection for the port no in the block.

    Thx, Turgut

  6. John Maloney repo owner

    Glad you got it working!

    Better yet, to have a selection for the port no in the block.

    Yep, I’ll do that.

  7. connochaetes

    Hi. I’m running some tests on my new Citilab ED1 Rev. 2.0. In the upper right corner, there ‘s an infrared receiver modules for remote control systems (“receptor infraroig TSOP754”). It’s labeled “IR RX”. I thought, that it might work with the library “IR Remote” v1.1.

    Maybe, it’s a silly mistake: But, how can I practically check out, if this component is working?

  8. Log in to comment