ATmega32 controller ouputs random button presses despite working on Windows
-
Raspberry Pi 4b+
Retropie version 4.7.19
(I borrowed the above from an old post, but I don't believe I've updated anything since)Hello, I have been building my own DDR dance mat to accompany Outfox running on my Raspberry Pi 4 (along with all of the other games and systems I am running with retropie). No matter the libraries I use, and no matter how well the system works on my machine, all of the inputs into the Raspberry Pi are random.
I have tried setting up the arduino as a keyboard, as well as a HID controller. The pi recognized the arduino as a HID controller properly, and I am writing 4 buttons on the arduino and there are only 4 buttons changing on the pi. However, when doing jstest the 4 buttons just randomly turn on and off (and the same deal when the arduino is set to be a keyboard). It works perfectly when plugged into my windows laptop, but on the pi it freaks out.
I have tried plugging the arduino into a powered USB bus, a USB 3.0 port, and a USB 2.0 port. I have looked everywhere for anyone having a similar problem, but I can't find anything online. Do any of you know about an issue like this, or anything that I can try? I'm at somewhat of a dead end from things I can figure out myself. -
With the information given could be anything.
If the "only" change is pi+RaspiOS vs x86+Windows (ie. wiring and cabling is exactly the same) I assume it it power related.There is a limit how much current can be drawn in total from the Pi4 USB ports
https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#maximum-power-outputI would try to run the arduino with an own power supply via its GPIO headers. That would remove any current stress of off the Pi.
I guess your concern is better suited for an arduino tinkering forum.
-
@Lolonois Thanks for the reply. I would think that the powered USB hub would provide all the power demands necessary for the Arduino. Also, when no buttons are being pressed, the Arduino should consume an inconsequential amount of power, however random inputs are being made without any input from me at all.
I'll ask around on an Arduino tinkering forum, thanks for you help!
-
It's been a while since I took another look into this, but I have a lead that this forum could possibly help with. On a side note, the Arduino forum was not very helpful at all. The only thing that I could think of was if the Arduino was being driven too much power (or if the power is inconsistent somehow), and the switched I have in the dance mat are acting as capacitors and letting some current through. I haven't done any measurements or math to look into this, but it seems very unlikely to me.
Asking chatgpt, I got lead to check permissions of the usb device, and even giving the decide all permissions does not help. However, I decided to check the dmesg log, and noticed something. I am transcribing this from a photo I took of the text on a CRC tv, so I apologize if there's errors.
[ 153.053753] usb 1-1.1.3 New USB device strings Mfr=1, Product=2 SerialNumber=3 [ 153.053758] usb 1-1.1.3 Product: Arduino Leonardo [ 153.053763] usb 1-1.1.3 Manufacturer: Arduino LLC [ 153.053768] usb 1-1.1.3 SerialNumber: HIDAF [ 153.067997] input: Arduino LLC Arduino Leonardo as /devices/platform/scb/61500000.pcie/pci0000:00/0000:00:00.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.2/0003:2341:0036.0003/input/input4 [ 153.068204] hid-generic: 0003:2341:8036.0003: input.hidraw2: USB HID v1.01 joystick (Arduino LLC Arduino Leonardo) on usb-0000:01:00.0-1.1.3/input2 [ 154.009506] cdc_acm 1-1.1.3:1.0: ttyACM0: USB ACM device [ 154.092227] usbcore: registered new interface driver cdc_acm [ 154.092232] cdc_acm: USB Abstract Control Model driver for USB *[illegible]* and USB adapter
A couple things I noticed here: The arduino is being read as an input into input 4, and it is being read as a HID joystick into input 2, and it is being read as an ACM device. Do any of you think that being registered as multiple inputs/systems could cause the issues I am seeing? And if so, how can I make Debian only recognize the arduino as one device? I am not linux savvy enough to know how to do that.
Thanks!
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.