Do I need pullup resistors?

Started by tempus, March 24, 2018, 10:36:29 AM

Previous topic - Next topic

tempus

Hey all;

I've been working with running my guitar through a laptop using ampsims and VST effects for my live rig. To implement this, I'm designing a pedalboard that will allow me to switch my guitar effects in and out remotely. I can interface with the laptop via a USB keyboard, so I'm programming the pedalboard such that each footswitch will correspond with a certain keystroke, which will in turn select a different effect (or set of effects) on the laptop. To accomplish this, I've hacked an old USB keyboard and am just using the control board, connecting the various pin combinations to different footswitches. So far so good. But, I also want visual indication of which effects are on. To do this, I'm using a PIC. When a switch is closed, it will send the correct keystroke to the laptop (thus selecting the effect) and will command the PIC to turn an LED on at the pedalboard. To do this, I've got one of the USB keyboard pins (the +5v one) connected to a PIC input pin (thus setting the input pin high), and the other connected to ground, so that when I step on a switch, it grounds the PIC input pin momentarily.

Do I need to connect the +5v keyboard pin to the PIC through a pullup resistor, or would there already be one somewhere in the USB keyboard circuitry? Since the keyboard switches are just shorted to generate the keystroke, do I need a pullup resistor at all, i.e., does the PIC input pin need the pullup resistor, or is it just there to prevent a dead short when the interfacing switch is pressed?

Thanks

R.G.

The short answer is "maybe". It depends on the USB keyboard's internal circuitry, and on exactly which PIC and which pin on the PIC. A truly accurate answer needs answers to both of these, in detail.

On the other hand, a pullup resistor of maybe 100K would not hurt the PIC, and probably not the keyboard. It would take only a few seconds to solder on a pullup and see if it works.

I highly suggest just trying it and seeing. It's much faster than the typing needed to ask the internet and sort through the conflicting and uninformed responses to get to an answer.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

tempus

Sorry R.G., I should have included this in my original post - when I switch with no pullup, the LED goes on, and the proper keystroke goes to the laptop. With anything higher than a 2.2K pullup, the LED goes on, but nothing gets to the laptop. My concern is not whether or not things will actually function properly with no pullup, but whether  the PIC itself will be damaged with no pullup, which as I said, I should have made clear in my original post.

ElectricDruid

No, the PIC should be fine with no pull-up. If the voltage level coming from the keyboard is well-defined (e.g. not floating) and within a safe range (0V to Vdd) then there's no problem at all.
You only *need* the pull-up on the PIC when there's nothing else connected to the pin when your switch-to-ground is open (otherwise the pin would float).
You're telling us that you've got 5V from the keyboard, so that's not the case here.

Tom

tempus

Thanks for your reply ED

Doesn't the current flowing into the pin of the PIC need to be limited by a resistor though?

ElectricDruid

It's a logic input, so it doesn't need current limiting. You wouldn't stick series resistance on an 74HCxxx input.

The exception to this would be if it's exposed to the outside world and you don't know what might get connected to it. In that situation, either protect it with everything you've got available or accept that a PIC might get fried occasionally.

tempus

OK thanks for clearing that up for me. Based on this, if I were to connect an output pin from 1 PIC to an input pin on a 2nd PIC I would not need a resistor to limit current (especially from the 1st PIC)?


ElectricDruid

No, I don't see why. As long as one PIC's IO pin is set to output and the other PIC's IO pin is set as an input, there shouldn't be any problem.

If you have two PICs both set to output and they're driving different levels, you might fry something (I've tried this!) but otherwise you'll be fine.

T.