5V input Voltage on digital pins

Short version: Can the digital pins handle 5V input?

Longer version: I hooked my new Spark Core into my existing Arduino project by making my Arduino think the Spark Core was a button. I connected a Spark Core digital pin to an UNO pin configured as INPUT_PULLUP (an input pin with pullup resistor enabled, which supplies low amperage 5V). Sure enough, if I set the Spark pin to output/LOW, the Arduino thinks the button has been pressed. When I set it to HIGH, it thinks the button is released.

I was very happy to see this work, but then I realized I should make sure the digital pins on the Spark Core can handle the 5V I’m feeding it. Hopefully this question makes sense?.. Thanks. Loving the Spark Core, and am totally blown away by the cloud functionality out of the box.

@Jerware,

ALL Digital pins are 5v tolerant except D2

Additional information: ALL Analog pins are NOT 5V tolerant

Documented here:

http://docs.spark.io/hardware/#spark-core-datasheet-pins-and-i-o

:slight_smile:

1 Like

Thanks! I read through the whole docs but somehow I missed that bit. Great info.

1 Like

Just in case anybody needs to have bi-directional high frequency low current level shifting between 5 and 3.3 volts this circuit is cheap (>20p), tested and works:

It would not work for analogue, I presume a voltage divider and diode would be required for analogue inputs (with the addition of a transistor for outputs) but have not tested that yet.
If you had numerous 5 volt sensors the 74HC4050 will level down shift 6 inputs at a reasonable price. I am sure there are cheap bi-directional ics somewhere but have yet to find them.

Hi,

With a couple of slightly different parts, you can convert this to a bidirectional converter, that is safe (actually designed) for I2C and 1Wire.

Adafruit has a simple 4 bit assembly to do this, but it is based on a Phillips/NXP app note that they reference on the Adafruit page. Take a look at: http://www.adafruit.com/products/757

After running into some drive issues with the Shield Shield, I’ve had to switch to using this approach to properly drive my I/O devices and retain the flexibility of the pin assignment mechanism.

Later,

johnbo

Looking at the datasheet for the STM32F103CB, I don't see any "pin circuit diagrams" (a la Microchip PICs) indicating whether the A/D pins have blocking diodes or not, so I have a question. Is it electrically permissible to connect an A/D line through 47K to a line that can go up to 5v? I fully understand that the A/Ds won't read higher than 4095 if taken beyond 3.3v...but if the pins have blocking diodes, they simply won't go much above 3.3v. Obviously, if forced, the blocking diodes (and input) will be damaged.

What's A/D? My understanding that it should not be alllowed over 3.3V but i can find more information :wink:

I'm referring to the analog to digital converter inputs.

EDIT: "pin circuit diagrams." Here's one (of many) from a datasheet of a Microchip PIC16F747. This one clearly has blocking diodes both ways on OSC2/CLKO

Here’s what i found…

As long as this maximum is not violated.

1 Like

OK...my question: Are there internal blocking diodes on the I/O line to try to prevent the line from going beyond VDD+0.3v? Or is that my responsibility, external to the Core?

No clue. Someone else might have a better answer but the way i understand:

pins not labeled FT are not going to tolerate a voltage higher than Vdd+0.3V as shown in the datasheet.

Did a quick test. With 100K to +5v, the voltage on A4 reads 3.6v. The Core’s internal regulator is 3.3v. So…I am assuming that if the pin is NOT rated as 5v tolerant, it will have blocking diodes preventing the pin from going over 3.6v, and from going below 0.3v. That is, unless the diodes blow. Now, if it’s 5v tolerant…well…I don’t have a clue what it’ll do. FWIW, I do recall a reference in the STM32 datasheet indicating that “weak pullups should be disabled if a 5v tolerant input is taken to 5v.”

Ok, the STM32F103CB ref says:

I would not exceed 3.3v on the analog pins as recommended by Particle.

I’m using these SparkFun Logic Level Converter - Bi-Directional to interface my Core with an AC unit that uses 5V logic and they work great. I’m able to read a serial line clocked at 120Hz via that level converter.

1 Like

Well, I inadvertently tested the A5 input pin beyond spec. My bad…a 2.2K resistor is no substitute for a 22K resistor, especially from 12vDC. But at least I can report my findings:

Basically, the circuit was a resistor bridge, 2.2K (whoops!) from 12v to the A5 pin, and 1.8K from A5 to GND. Basically, a resistor divider calculated to read 40+v DC. That is, with a 22K resistor on top :cold_sweat:.
OK, what did I notice? The code to read the pin wasn’t working. I don’t know what value the pin was reading (and don’t want to try again to find out!), but it was definitely >700 A/D counts (12-bit range of 0-4095). Taking the top of the resistor divider to 0v did not bring the A/D reading below 700; I suspect that it was “stuck” at full scale. Replacing the top resistor with a 22K resistor (watch that third band!) restored proper functionality–the pin appears to be undamaged :relieved:. The Core was powered off during the change, so I suspect that a reset “freed” A5.

With a meter (and the 2.2K resistor), I measured 3.9v on A5…that’s when I realized that the problem was circuit-based, not code-based! There was some resistance from the Core to that voltage, as the resistor divider would have otherwise outputted 5.85v. My guess is that the total current sunk by A5 was below 5mA.