AnalogRead sets Pin to output maybe?

Hello all,

I got a little problem I don't understand.

I got a "Arduino" Pro Micro. It is basically a very little Arduino Clone that's detected as "Arduino Leonardo". I want to detect if my digital Piano is on and I am trying to use the Midi Out Port of the Piano.

I measured with nothing connected and found that if off I get 0.2V and if it is on I get 3.2V on one Pin.

So I bought a Midi 5 pin port and a Midi cable and connected everything up. I just connect the ground and the VCC Pin from the Midi connector were I measured 3.2V. But as soon as I connect that Pin to the "Arduino" the Voltage rises to 3.3V and my Arduino measures "1023" even when the Piano is off.

Can anyone explain that behavior? I honestly don't get it, but maybe I don't see the obvios?.

When you want to read a voltage, you can add a protection resistor in the signal line, 4k7 or 10k.

The microcontroller of the Pro Micro has internal ESD diodes to protect it against electrostatic voltage peaks. When a voltage is put on a (input) pin, the current flows via the ESD diodes to the VCC and the Pro Micro starts working.


Did you connect the GNDs ?

I just connect the ground and the VCC Pin from the Midi connector

MIDI connectors don't have a "VCC" pin. You need an opto-isolated MIDI circuit on any incoming MIDI connection.

Draw a circuit if you want to clearly communicate your circuit. Words are a very poor way to describe a circuit.

And no, analogRead() doesn't make a pin an output, how could it work?

Thank you two for the answers.

I actually know that there should not be any VCC Pin on the Midi connector, but it’s a Yamaha and they actually got a accessory that enables Bluetooth Midi and is just connected to the Input- and Output-Midi Ports, so there has to be some sort of VCC in that connector.
I just tried to measure the Ports and found one pair of pins were one seems to be vcc and one ground. Or at least the one is outputting a static 3.2V if the Piano is on.

I actually thought off a opto-isolated circuit as well but I also thought there has to be a way to make this work, the behavior just didn’t make any sense to me.

I’ll try the protection resistor and if that doesn’t work I’ll have to do the opto circuit.

Yes the grounds are connected.

I have attached my circuit diagram.

Okay, I couldn't really get it to work. Not with the current limiting resistor and also not with an opto-isolator.

However, my piano also has a "USB-Midi" Port and I got it to work with my original circuit using that usb port.