foos icon indicating copy to clipboard operation
foos copied to clipboard

Arduino push buttons and leds don't work with IR barrier

Open Metanolo76 opened this issue 7 years ago • 3 comments

Hi, I'm not an arduino expert, forgive me: when I connect only push buttons and less to Arduino, they work well. if I also connect IR barrier, buttons and leds stop working (IR works fine). Any Idea?

I use a compatible arduino UNO, can this be the reason?

Thanks.

Metanolo76 avatar Jan 28 '19 13:01 Metanolo76

Hey! No worries - it's a bit difficult to fin out what's going on without more information... Have you tested the serial port? Can you connect to it (115200 baud) and see what it outputs? My guess is that the IR barriers are not working correctly and are triggering all the time, causing the buttons not be processed:

https://github.com/swehner/foos/blob/master/foos_arduino/foos_arduino.ino#L143

Here you can see the code short-circuits in case a goal is detected... You should be seeing this information in the serial output. I'd review that the detectors are correctly connected.

I doubt there's an issue with the board itself (I think the UNO and nano are practically the same board where the I/O is concerned). I think they use the same atmega328 chip and have the same pinout. Can you confirm what revision of the board your'e using just in case?

swehner avatar Jan 28 '19 20:01 swehner

HI, thanks for answer. The board in a "Arduino Uno" COMPATIBLE with ATMEGA328P-AU Atmel

This in serial port output:

`Start with all connect: 19:45:35.080 -> P 19:45:36.323 -> BG 64 1235104

1° goal PIN 11 19:46:58.741 -> BG 81989416 816 19:46:58.923 -> BG 72 171964

1° goal pin 10 19:47:33.309 -> YG 616 452872 19:47:33.309 -> YG 180 620 19:47:33.309 -> YG 300 848 19:47:33.309 -> YG 2196 1236

2° goal PIN 11 19:48:02.627 -> BG 63355744 392 19:48:02.627 -> BG 212 360

2° goal pin 10 19:48:24.910 -> YG 51325028 300 19:48:24.910 -> YG 1712 364 19:48:24.910 -> YG 280 2972 19:48:25.335 -> YG 640 428128 19:48:25.335 -> YG 636 2584 19:48:25.335 -> YG 3420 1208 19:48:25.373 -> YG 1572 300

3° goal PIN 11 19:48:59.821 -> BG 56717088 156768

3° goal pin 10 19:49:25.216 -> YG 59525520 284 19:49:25.216 -> YG 1152 608 19:49:25.216 -> YG 1432 696 19:49:25.216 -> YG 532 676 19:49:25.678 -> YG 432 467180 19:49:25.678 -> YG 380 3028 19:49:25.678 -> YG 1748 276

Buttons not works….

disconnect IR Pins…

Only Buttons

9:52:51.789 -> P 19:52:56.814 -> P 19:53:01.847 -> P 19:53:06.900 -> P 19:53:09.791 -> OK_D 19:53:09.936 -> OK_U 19:53:11.917 -> P 19:53:16.951 -> P 19:53:21.762 -> BI_D 19:53:21.972 -> BI_U 19:53:21.972 -> P 19:53:25.336 -> BD_D 19:53:25.548 -> BD_U 19:53:27.010 -> P 19:53:28.195 -> YI_D 19:53:28.445 -> YI_U 19:53:30.837 -> YD_D 19:53:31.017 -> YD_U 19:53:32.032 -> P 19:53:37.055 -> P

Thanks.

Metanolo76 avatar Jan 29 '19 19:01 Metanolo76

So, yeah it looks like the IR detectors are triggering quite frequently... The way the Arduino is set up it's constantly polling the button states, as soon as a falling edge is detected it stops reading the button and waits for the rising edge. So there's definitely something wrong with your IR detector... What power source are you using? Sometimes the USB chargers provide a very noisy power line that might cause issues You can check the caps at the IR detector in the schematic - I think these should help to stabilize the power input.

The arduino also has a test mode. You enable it by writing "t" to the serial port where it routes the IR inputs to A0 and A2 outputs. Sometimes this helps to see what's happening and if it's working more or less...

swehner avatar Jan 31 '19 20:01 swehner