Author Topic: Joining a 5v and a 3.3v input pin  (Read 361 times)

any

  • Great Contributor!
  • ***
  • Posts: 360
  • Total likes: 13
  • a.k.a. whythisreason? Niels H.
    • http://www.anyplace.nl
Joining a 5v and a 3.3v input pin
« on: June 08, 2021, 07:34:40 AM »
Ok, as somewhat rambled on in my build thread for the Arduino 'Tap Express' thing, I can seem to find a conclusive answer for this issue,
nor can i find conclusive information on whether the Line6 3.3v logic is 5v tolerant.

I started by creating a resistive divider on the Arduino input pin via a standard 'resistive divider' calculator.
Thing is it didn't do at all what I expected, the voltage came out way lower than the calculator.

I thought it was also due to using bus power over usb, so hooked up a 9v DC supply but a standard resistive divider setup gave
unexpected results. (not the same as calculated)

So next I just hooked up the multi meter and reconfigured resistance until I got about 3.5v
After messing around for a while with a divider, I just ended up with a single 100k resistor to ground on the Arduino input pin.

Can I assume (?) 3.5/3.6v is "safe" to hook up to the Line6 Logic, anyone done something similar?
Also, would there be any potential drawbacks to using this resistor to ground to lower the voltage on the Arduino input?
I mean, everything seems to work ok, as in I can still get the input to recognise the taps, or could it be prone to issues?

Picture is just for no reason other then showing how it's all crammed onto 15x15 holes.  :icon_biggrin:
 

It's supposed to sound that way.

ElectricDruid

Re: Joining a 5v and a 3.3v input pin
« Reply #1 on: June 08, 2021, 08:27:20 AM »
The voltage dividers not working as expected pretty much has to be down to loading. What's the effective resistance of the input pin? Come to that, what's the effective resistance of your meter?!

My experience with digital inputs on uPs has been that they're usually pretty well protected against over-voltage (by diodes to the power rails which limit inputs to Vdd+0.6V) but that you have to watch for over-current situations, since those will fry the protection diodes. For this, you need a resistor in series with the input to ensure the current can't get too high even with whatever the largest likely input voltage is. I've fed 20V into a 5V input like this with no adverse effects!

any

  • Great Contributor!
  • ***
  • Posts: 360
  • Total likes: 13
  • a.k.a. whythisreason? Niels H.
    • http://www.anyplace.nl
Re: Joining a 5v and a 3.3v input pin
« Reply #2 on: June 08, 2021, 02:32:36 PM »
Also, the pin is configured as input_PULLUP on the Arduino, does that mean it already has a 20k resistance between the input and 5v?

Cheers
It's supposed to sound that way.

ElectricDruid

Re: Joining a 5v and a 3.3v input pin
« Reply #3 on: June 08, 2021, 05:24:16 PM »
Also, the pin is configured as input_PULLUP on the Arduino, does that mean it already has a 20k resistance between the input and 5v?

Effectively, yes. In practice, it won't be implemented on the chip as a simple resistor (probably a current source from what I understand) but for our purposes, we can treat it like a "normal" pull-up. So yeah, if the pin has a pull-up, that's going to throw any voltage divider calculations out by a mile.

What exactly are you trying to do? You were talking about feeding some signals to a Line6 pedal that uses 3.3 or 3.6V, but now we're talking about Arduino inputs? Sorry, I'm getting a bit lost.

any

  • Great Contributor!
  • ***
  • Posts: 360
  • Total likes: 13
  • a.k.a. whythisreason? Niels H.
    • http://www.anyplace.nl
Re: Joining a 5v and a 3.3v input pin
« Reply #4 on: June 08, 2021, 05:49:02 PM »
Also, the pin is configured as input_PULLUP on the Arduino, does that mean it already has a 20k resistance between the input and 5v?

Effectively, yes. In practice, it won't be implemented on the chip as a simple resistor (probably a current source from what I understand) but for our purposes, we can treat it like a "normal" pull-up. So yeah, if the pin has a pull-up, that's going to throw any voltage divider calculations out by a mile.

What exactly are you trying to do? You were talking about feeding some signals to a Line6 pedal that uses 3.3 or 3.6V, but now we're talking about Arduino inputs? Sorry, I'm getting a bit lost.

Sorry if it was unclear, here's the gist of it.

This particular version of what I'm building will be built into the Line6 M5 so it's always connected.
The Line6 M5 already has a 'tap' footswitch for the tempo, so my intention is to 'leech' the signal going low
(I've checked, and the tempo on the Line6 is set by a 3.3v pin tapped to ground) on the Line6 footswitch
by splicing the tempo input for the Arduino onto the same (Line6 tap footswitch) line.

That way I get the same tempo for both circuits off a single footswitch, or at least, that's the plan.  :icon_biggrin:

So I just want to make sure that splicing the 5v line from the Arduino onto the 3.3v Line of the Line6 doesn't
fry anything on the Line6 side.
It's supposed to sound that way.

FiveseveN

Re: Joining a 5v and a 3.3v input pin
« Reply #5 on: June 08, 2021, 07:46:30 PM »
The signal is pulled to 3.3 V by the M5, so why would you need INPUT_PULLUP?
When you were talking about dividers I thought the point was to output a 0-3.3 V signal from the Arduino to an ADC on the M5 and got confused when you mentioned inputs.
A 5 V input will accept any voltage from 0 to 5 V, which of course includes 3.3 V. Current doesn't flow out of the input (unless you add things like pullup resistors) and hardly any into it, so the thing generating the 3.3 V signal doesn't care what it's attached to.
Now whether the Arduino will register that 3.3 V as a HIGH is a separate matter: the datasheet says the threshold is 0.6 * VCC = 0.6 × 5 = 3 V, so it should be fine.

If you have to send signals the other way (5 V output to 3.3 V input), then you would use a resistive divider.
For more complex communication between devices on different rails use a proper bidirectional level shifter IC.
Does the circuit sound better when oriented to magnetic north under a pyramid?

any

  • Great Contributor!
  • ***
  • Posts: 360
  • Total likes: 13
  • a.k.a. whythisreason? Niels H.
    • http://www.anyplace.nl
Re: Joining a 5v and a 3.3v input pin
« Reply #6 on: June 08, 2021, 07:56:07 PM »
The signal is pulled to 3.3 V by the M5, so why would you need INPUT_PULLUP?
When you were talking about dividers I thought the point was to output a 0-3.3 V signal from the Arduino to an ADC on the M5 and got confused when you mentioned inputs.
A 5 V input will accept any voltage from 0 to 5 V, which of course includes 3.3 V. Current doesn't flow out of the input (unless you add things like pullup resistors) and hardly any into it, so the thing generating the 3.3 V signal doesn't care what it's attached to.
Now whether the Arduino will register that 3.3 V as a HIGH is a separate matter: the datasheet says the threshold is 0.6 * VCC = 0.6 × 5 = 3 V, so it should be fine.

If you have to send signals the other way (5 V output to 3.3 V input), then you would use a resistive divider.
For more complex communication between devices on different rails use a proper bidirectional level shifter IC.

Thanks, well that's the thing, both inputs (M5 and Arduino) are pulled high and active when pulled low. So in their idle state they are both at their respective logic high.
Just want to make sure any current flowing from the Arduino's input doesn't damage the Line6's input.
Obviously I only want to tap the tempo once for both circuits, hence tying the inputs together on the same switch.

Cheers,
It's supposed to sound that way.

potul

Re: Joining a 5v and a 3.3v input pin
« Reply #7 on: June 09, 2021, 02:39:13 AM »
But you can disable the input pullup in Arduino by configuration. This way you avoid any conflict between the pullup of the M5 and the arduino.

FiveseveN

Re: Joining a 5v and a 3.3v input pin
« Reply #8 on: June 09, 2021, 03:57:16 AM »
both inputs (M5 and Arduino) are pulled high
But you haven't answered why you think this must be so.
Like I said, anything over 3 V is HIGH for the Arduino, so it will be HIGH unless the button is pushed, by the grace of the M5's pullup. There is no need for "their respective logic high".
Does the circuit sound better when oriented to magnetic north under a pyramid?

ElectricDruid

Re: Joining a 5v and a 3.3v input pin
« Reply #9 on: June 09, 2021, 07:50:27 AM »
I think Potul and FiveSeven are right. If you disable the pull-up on the Arduino input pin, you should be safe to just tie the two pins together, and then a hang a switch to ground off it for tapping the tempo.

With the Arduino pull-up enabled, you've got a problem, because it's trying to drag the Line6 input up to a level it won't like.

any

  • Great Contributor!
  • ***
  • Posts: 360
  • Total likes: 13
  • a.k.a. whythisreason? Niels H.
    • http://www.anyplace.nl
Re: Joining a 5v and a 3.3v input pin
« Reply #10 on: June 10, 2021, 12:23:22 AM »
Yep, i did a face palm :icon_lol:

I thought in my novice wisdom that the only way to get an input pin to trigger on a low would be to specify it as input_pullup. I now understand that it is totally fine to just specify it as input and have it high (by the 3.3v from the line6) is totally fine. I’ll have to confirm this in practice (haven’t actually hooked it up yet) but it makes total sense now. Yay for logic.
It's supposed to sound that way.

any

  • Great Contributor!
  • ***
  • Posts: 360
  • Total likes: 13
  • a.k.a. whythisreason? Niels H.
    • http://www.anyplace.nl
Re: Joining a 5v and a 3.3v input pin
« Reply #11 on: June 11, 2021, 07:13:18 AM »
Heh, and then i realised why the arduino input needs to be pulled up and can’t rely on the Line6 Tap button to pull it up. When performing a ‘preset select’ it also pulls the tap button low, potentially throwing off the tempo, so i have to prevent the Arduino input from going low during this action. I used a spare switch on the 4066 to temporarily disconnect the Arduino pin during that action, but without a pullup itwould still go low when disconnected.

So i guess i’m back to using input_pullup with an added resistor to ground to get the required 3.3v...
It's supposed to sound that way.

ElectricDruid

Re: Joining a 5v and a 3.3v input pin
« Reply #12 on: June 11, 2021, 09:00:31 AM »
When performing a ‘preset select’ it also pulls the tap button low

Why does it do this, and can you not just disable this action?

any

  • Great Contributor!
  • ***
  • Posts: 360
  • Total likes: 13
  • a.k.a. whythisreason? Niels H.
    • http://www.anyplace.nl
Re: Joining a 5v and a 3.3v input pin
« Reply #13 on: June 11, 2021, 04:27:42 PM »
When performing a ‘preset select’ it also pulls the tap button low

Why does it do this, and can you not just disable this action?

Dont think so, the M5 switches to the preset menu by pressing ‘tap’ and ‘fx’ simultaneously.
So as long as the Arduino’s tempo pin is connected it will go low as well. It only switches to presets directly over midi (as opposed to the preset select menu) so i’ll have to emulate the ‘double footswitch’ buttonpress. Bit of a unique tight spot I’m working myself in to eh? ;-))

Might just add the resistor to ground to the Arduino input_Pullup enabled pin to make it a resistive divider and take the plunge as i did get it at close to 3.3v and the tap button still worked fine.
It's supposed to sound that way.

FiveseveN

Re: Joining a 5v and a 3.3v input pin
« Reply #14 on: June 11, 2021, 05:18:33 PM »
Bit of a unique tight spot I’m working myself in to eh? ;-))
I don't know if I've grasped all the intended functionality of your project, but looking at the M5's MIDI implementation now it looks like you can do everything that way, no modifications to the M5 required. Phil says it also sends the appropriate tap tempo CC so you have the bidirectional communication you're looking for.
Does the circuit sound better when oriented to magnetic north under a pyramid?

ElectricDruid

Re: Joining a 5v and a 3.3v input pin
« Reply #15 on: June 11, 2021, 06:17:16 PM »
Why does it do this, and can you not just disable this action?

Dont think so, the M5 switches to the preset menu by pressing ‘tap’ and ‘fx’ simultaneously.
So as long as the Arduino’s tempo pin is connected it will go low as well. It only switches to presets directly over midi (as opposed to the preset select menu) so i’ll have to emulate the ‘double footswitch’ buttonpress. Bit of a unique tight spot I’m working myself in to eh? ;-))

Oh, ok. I'd understood it was the *Arduino* that was pulling the input low, and that's the firmware that you have control over. Clearly if it's the M5 that's pulling it low, that's something you have to live with or work around since we can't easily alter that firmware. Ouch! Like you say, a tight spot.

Quote
Might just add the resistor to ground to the Arduino input_Pullup enabled pin to make it a resistive divider and take the plunge as i did get it at close to 3.3v and the tap button still worked fine.

I'd have to consider the consequences of this a bit to decide if I think this is ok or not. The internal pull-up is most likely a current source, not an actual resistor, so it's not immediately obviously to me how that responds. Those better versed in such things might be able to offer more informed advice.

any

  • Great Contributor!
  • ***
  • Posts: 360
  • Total likes: 13
  • a.k.a. whythisreason? Niels H.
    • http://www.anyplace.nl
Re: Joining a 5v and a 3.3v input pin
« Reply #16 on: June 11, 2021, 07:57:58 PM »
Bit of a unique tight spot I’m working myself in to eh? ;-))
I don't know if I've grasped all the intended functionality of your project, but looking at the M5's MIDI implementation now it looks like you can do everything that way, no modifications to the M5 required. Phil says it also sends the appropriate tap tempo CC so you have the bidirectional communication you're looking for.

Well, yes and no... you can call up the preset list over midi, just individual preset numbers directly. But that said for my M9 i’m going to implement midi alongside of the ldr to expression pedal and it’ll be external.
It's supposed to sound that way.

amz-fx

Re: Joining a 5v and a 3.3v input pin
« Reply #17 on: June 16, 2021, 09:23:15 AM »
Logic level voltage conversion can be performed with a simple mosfet transistor.

Here are some good examples:

https://circuitdigest.com/tutorial/bi-directional-logic-level-controller-using-mosfet

Best regards, Jack

any

  • Great Contributor!
  • ***
  • Posts: 360
  • Total likes: 13
  • a.k.a. whythisreason? Niels H.
    • http://www.anyplace.nl
Re: Joining a 5v and a 3.3v input pin
« Reply #18 on: Yesterday at 11:54:09 PM »
Ok, well... good news and bad news.

Good news first? Line6 M5 (and likely M9, M13 etc..) are 5v tolerant.  :D
Why do I know? well I accidentally connected them and nothing blew up.. heh
Tap tempo button works fine on the Line6 with the 5v spliced in AND sets tempo for both
simultaneously. So that's good.

Bad news is I'm probably making a real rookie mistake here, but the CD4066 is not doing what I
wanted it to do... sound familiar?

I just wanted to use the switch to shunt the 5v from the tap button and the 3.3v from the effect on/off to ground.
But that's not happening? I'm getting about a .2v voltage drop when the switch is closed.
(so to be clear 5v supply to the 4066. 5v on one side of a switch, ground on the other, supplying a 5v 'high' signal to the switch control)

I've tried to find a post/article that explains why this doesn't work, but all i can find are these
'button hack' tutorials that have the same setup so what am I missing here?

Image is how I wired it up, but that's clearly wrong... lol


It's supposed to sound that way.