5v into prop pin
John Board
Posts: 371
G'day,
Am I able to hook 5v into a propeller pin safely? I want it to read 1 if 5v is getting inputted, and 0 if there is no voltage applied.
Do I have to use some kind of level shifter or voltage divider? Ideally I'd like to be able to use any basic parts, i.e. resistors, caps, nothing fancy.
Thanks,
-John
Am I able to hook 5v into a propeller pin safely? I want it to read 1 if 5v is getting inputted, and 0 if there is no voltage applied.
Do I have to use some kind of level shifter or voltage divider? Ideally I'd like to be able to use any basic parts, i.e. resistors, caps, nothing fancy.
Thanks,
-John
Comments
There was a thread that went through a huge debate about the right value and I thiink it arrived at no less than 3.9K. But there is nothing wrong with having a margin of safety and using a value that is more handy as 10k is very often used for pullup resistors.
I actually went out and purchased 3.91K 1% resistors, but darned if I can find them.
There are others. Here's a list of the ones I have.
AN001 - Propeller Counters
AN002 - Real-time GPS Data Reception and Parsing
AN003 - Implementing Abstract Data Structures with Spin Objects
AN004 - Getting Started with VGA and Terminal Output
AN005 - Simple VGA Menus
AN006 - FAT16/FAT32 Full File System Driver + Code
AN007 - Soft Loading an Application Image into the Propeller P8X32A via XBee Transceivers
AN008 - Sigma-Delta Analog to Digital Conversion
AN009 - Code Execution Time on the P8X32A
AN010 - Low-cost Bidirectional Mixed-voltage Interfacing
AN011 - Simple Multicore Template for the Propeller P8X32A
AN012 - Interfacing the Propeller to External SRAM with SPI
AN013 - Menus and Messaging with the Propeller Window Manager Framework
AN014 - Coroutines in Propeller Assembly Language
AN015 - Creating Schmitt-Triggered Inputs on the Propeller P8X32A
AN018 - Communication with a PC Application
AN019 - Measuring Stack Space for Parallel Processes
Sandy
1. Using a series limit resistor like 10K Ohms will limit your ability to monitor the input to the Propeller pin with an Oscilloscope Probe in "Normal" 10X mode. A series resistor like 10K in value will seriously limit your scope probe bandwidth and NOT represent what is actually seen by the Propeller when the scope probe is not connected. Basically, the series resistor in conjunction with the probe form a low-pass filter. This may not be an issue with very slow signals, but it is more likely it will be an issue.
2. Simply switching your scope probe to 1X does not help. 10X/1X switchable probes are optimized for bandwidth in 10X mode. Switching to 1X seriously limits your scope bandwidth. For example, a Rigol 150 MHz rated probe is specified at 150 MHz only in 10X mode. The specification goes down to around 7 MHz in 1X mode. This has nothing to do with the Oscilloscope, it is all about the probe. This is a complex subject, there's more on the Web - ask your favorite search engine.
3. You can increase the measured bandwidth at the Propeller pin somewhat by reducing the series limiting resistor from the likes of 10K to something like 2K Ohms. But I would only do this for one or a few pins. Many devices have current limits for some groups of pins or all pins in parallel that have their protection diodes turned on by the 5V signal. I'm not sure about this when it comes to the Propeller V1.
4. Using a voltage divider may be a "better" way to interface a 5V source to a 3.3V device input when you need to see what's happening with "Signal Integrity" at the 3.3V device's input pin, as long as the series leg of the divider has a lower resistance. This depends on how much current the 5V source output pin can handle. The ground leg also provides a termination, which may not be an ideal match for the 5V device's output impedance, but with short leads, sufficient. But this is only for test/development purposes as typically you would not go to production with a voltage divider interface that uses so much current.
This is much about Oscilloscope probes and monitoring signal integrity directly on the Propeller pin(s). If you use the likes of a separate dedicated-hardware Logic Analyzer device, much of what I said may not apply. But with a Logic Analyzer, you will not really be able to see the "analog" signal seen by the Propeller's input pin(s).
I've found that most OPs only want to know the KISS answer because they will ask another question or perhaps even the right question if need be. Also I find that 10K is all I need in general and it's not a problem for most signals, even higher speed signals (as long as you don't try to scope it at the Prop pin). Those with scopes are normally well aware of the operation of the scope, especially the probe capacitance although you are quite correct in all your statements especially regarding the optimized for 10X mode bit.
Thanks all for the help! This is only being used to interface a normal leaf switch into my propeller. I made a small module which had a 5v pin, but I forgot to put a 3.3v pin on it, nor was it practical to pull apart the board and resolder it, so I was just looking for a quick fix I can easily solder onto the module.
I only have a 22k resistor, will that work? Alternatly I could go 6k8.
-John
Is the switch switching between "on" and "off" (SPST) or is it switching between high and low (SPDT)? ie do you have a pullup or a pulldown resistor? This might end up being relevant if you had a pullup/down resistor with a value greatly different to the current protection resistor - you might end up with a voltage divider which was outside the High and Low values for the propeller.
Not an issue normally, but possibly if you only own two resistors *grin*
What you don't want is to be switching between 5V and open circuit, because the open circuit could be anything and it would most likely be an AC voltage from nearby power mains and give you spurious readings.
If I only had a 6K8 and a 22k resistor and the input was 5V to a propeller, I'd have to think about which one would be the current protection and which would be the pulldown.
Do you already have a pullup or pulldown on the switch?
22k would work, - and you will likely also need a pull-down.
Since you need it anyway, it is somewhat cleaner to put the pulldown, on the Prop side and make a 5:3.3 divider, if that can fit.
That gives a better switching threshold for 5V drive, and you avoid any injection current effects on the clamp 'diodes'.
The other way to put 5V into a Prop pin is through a green LED which will drop 1.8V (5->3.2v) and then you just need a pulldown resistor of almost any lower value such as 6K8.