Chat freely about anything...

User avatar
By rudy
#61311
DonFrench wrote:Ok, so by high resistance, you mean what? And why did you pick the pins you did?


GPIO pins 0, 2, and 15 have must be in a particular state for the mode of operation the module is in. This is sensed at start up. Resistors are used to pull the pin to the required state.

For example D12 usually has a 10k Ohm resistor connected to circuit ground. If you had a resistor in series with the pin you would have a voltage divider and the pin would see this voltage. Say you had a 10k resistor in series with D15, and you had a 5 volt input, then the voltage at the pin would only be 2.5 volts. That may or may not be high enough to produce a logic high level.

You could determine a series resistor value that would give you the right high voltage at the pin if you took into account the existing resistance, and you were confident about the voltage level from the module. Let's say the module output voltage was 4.9 volts and an acceptable level of 3.0 volts was our target input level, and if the existing input resistance was 10k.

4.9-3.0 gives us 1.9 volts we want to drop on our series resistor. So the resultant resistance is 1.9 / (3.0 / 10k) = 6.3k and a close nominal resistance value would be 6.2k Ohms. So what if you didn't have a 6.2k resistor? Use a different port pin that doesn't have additional stuff connected to it.

On startup D12, D13, and D14 have pull ups enabled but that when our code is allowed to run the pull ups are disabled. In that case we can consider the port pin to be a very high resistance input, let's say 1M Ohm. Then if we were to put 10k in series with it the resultant voltage on the input is pretty much the same as what we started with. But typically logic chips have some protective circuitry that kicks in when there is a higher voltage present. But we want to limit the current into the pin so that is why we use the series resistor.

And that works fine in most case. I have only experience once when it caused an issue. And that was when I did this into a number of a/d inputs on a Microchip micro-controller. The over voltage in one channel was affecting the reading on other channels that were in the measurement range.
User avatar
By DonFrench
#61323 Oh that's good to know, but I also have other sensors in mind that are similar in that they have the same three pins and are all nominally 5V and I have to design the circuit to work for all of them. Maybe they will all work with 3V3 which would be great. Time to start testing them. But if not, I guess I will have to supply 5V and experiment with resistors to see if I can find one value that works with all the different sensors.
User avatar
By DonFrench
#61445 Thank you, Rudy! I appreciate all the effort you went to to answer me!

rudy wrote:
DonFrench wrote:Ok, so by high resistance, you mean what? And why did you pick the pins you did?


GPIO pins 0, 2, and 15 have must be in a particular state for the mode of operation the module is in. This is sensed at start up. Resistors are used to pull the pin to the required state.

For example D12 usually has a 10k Ohm resistor connected to circuit ground. If you had a resistor in series with the pin you would have a voltage divider and the pin would see this voltage. Say you had a 10k resistor in series with D15, and you had a 5 volt input, then the voltage at the pin would only be 2.5 volts. That may or may not be high enough to produce a logic high level.

You could determine a series resistor value that would give you the right high voltage at the pin if you took into account the existing resistance, and you were confident about the voltage level from the module. Let's say the module output voltage was 4.9 volts and an acceptable level of 3.0 volts was our target input level, and if the existing input resistance was 10k.

4.9-3.0 gives us 1.9 volts we want to drop on our series resistor. So the resultant resistance is 1.9 / (3.0 / 10k) = 6.3k and a close nominal resistance value would be 6.2k Ohms. So what if you didn't have a 6.2k resistor? Use a different port pin that doesn't have additional stuff connected to it.

On startup D12, D13, and D14 have pull ups enabled but that when our code is allowed to run the pull ups are disabled. In that case we can consider the port pin to be a very high resistance input, let's say 1M Ohm. Then if we were to put 10k in series with it the resultant voltage on the input is pretty much the same as what we started with. But typically logic chips have some protective circuitry that kicks in when there is a higher voltage present. But we want to limit the current into the pin so that is why we use the series resistor.

And that works fine in most case. I have only experience once when it caused an issue. And that was when I did this into a number of a/d inputs on a Microchip micro-controller. The over voltage in one channel was affecting the reading on other channels that were in the measurement range.
User avatar
By DonFrench
#61482
DonFrench wrote:I want to attach an audio sensor like this one to my WeMOS D1 mini. But it runs on 5V and I assume the digital output is 5V as well. Can I attach this directly to a WeMOS GPIO? Or do I need to do something to convert that signal to 3V3?


I went with 3V3 supply to the sensor but decided to make the input a rising interrupt rather than a digital input. Thanks for the help!