QUESTION - IR module strange behavior...

Assembled a "Smart Car" below.

My question. I do not currently have a working Blue Tooth module so I opted to use the IR. It does work, actually this is the first build that worked without need to debug, and fight a little. It has a Ultra Sonic sensor that swivels and powers two motors. Pretty standard.

Well I did the k0070 project next which includes a BT and IR. Technically the IR works, but it takes lots of presses to get the button to register. So, I grabbed a spare arduino and loaded some IR test code on it, just to see the output in Serial Monitor of said button presses. IT does it there too. Several presses of the key before it spits out some HEX number starting with the letter J.

I am curious. Is there something I am missing? Messing with buffer or parity or baud rate maybe? It works, but takes way more presses of the button that it should.

Thanks for any tips.

I would suggest trying a different button, it sounds like it is intermittent.

I think you missed the part where you should be posting your project's schematics if you have questions about it.

You can test the remote. Most cell phone cameras are sensitive to IR. Point the remote at the cell phone camera and press a button. You should see a blue light blinking, in the camera, with the button press. If you have to press hard or many times to see the light, the remote is the problem.

So we did the basic schematic on the "kit 65" and then added our own IR module. I compared it to the IR/Motor shield and the IR is using the correct pin assignment according to "Kit69/70".

It is convoluted and for that I apologize. Let me see if I can post a couple pics and a better explanation.

So, we are testing with the “Example” provided to us through our sensor kit’s manufacturer…Elagoo. The IR module works with a single press of the key + or -. I also tested with the Arduino example for IR module which gives you some varied output from serial monitor. They all seem to work rather well, with single key presses. So this leads me to believe it is code issues with this “car kit”. Notably they do have a single shield for both driving the motors and the IR is built in, but I managed to trace what I believe is Digital pin 2 for the receive on the IR module. The examples are using D12 for that communication while the kit is using D2. Not sure that would make much difference. Perhaps it is in the code itself. Here is the code copied and pasted…again it works but takes several key presses before the signal is accepted…reminds me of IRQ issues in older PCs.

Attached. Code for smart car, option with IR and BT. AND the two libraries specific to this build.

UCMotor.h (5.89 KB)

UCNEC.h (3.39 KB)

Smart_Robot_Car_K0070_scratch.ino (14.2 KB)

The examples are using D12 for that communication while the kit is using D2. Not sure that would make much difference. Perhaps it is in the code itself.

UCNEC myIR(2);

That is the constructor for the IR receiver object in the code.

 UCNEC(int irpin);

This is the constructor declaration from the UNEC.h file.
So, you can see that the argument for the constructor (2) means the IR input and in this case, pin 2.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.