Last Update: : Preliminary information subject to change.
The ARM cpu runs on 3.3V, and inputs are 5V tolerant.
Digital Input Hysteresis
This is handled internally by the ARM cpu hardware.
Digital Input Sampling Option
Each input state can be queried by the host PC at any time. The sampling rate and desired test state can also be set, and the state change event when or if it occurs is sent back to the PC via a USB Interrupt Report.
Connecting a Switch to a Digital Input
How it works: Closing the switch causes the digital input to report TRUE. Be aware that all mechanical switches have fast contact bounce, hence a debounce circuit (typically a resistor and capacitor) is required. An example is shown above. There’s also many other ways to debounce switches, both in hardware or/and in firmware.
Monitoring a Relay State
How it works: A relay switches contacts when the contact coil is energized by an external voltage. This circuit simply connects the digital input to ground == TRUE. Relays have contact bounce like any switch. The relay shown has two sets of contacts electrically isolated from each other, so the upper set (shown) could be switching higher voltages.
Detecting an external voltage with an NPN Transistor
How it works: This simple circuit assumes that the external voltage on the Q1 gate will eventually start Q1 conducting, and the digital input goes Low == TRUE. One use of this is to detect whether a battery voltage (or other voltage source) is at or above a desired level. When the voltage reduces to a level that turns off Q1, the digital input goes High == FALSE, signalling, for example, time to replace a battery. Note that this circuit does not report the battery voltage. If that level of accuracy is required, use an analog input
External Voltage via an N-Channel MOSFET
How it works: The MOSFET is in effect a bidirectional silicon switch normally in a high impedence (i.e. open) state, controlled by the voltage on the input gate. As the voltage rises from zero, the MOSFET will eventually start to conduct. Typical switch on voltages are in the 2-6V range. Once the MOSFET conducts, the digital input goes Low == TRUE.
Use an Optocoupler to isolate a Digital Input
How it works: This circuit is handy to get an input that has its own voltage supply. The LED inside the optocoupler device provides the sensing transistor gate current that controls the transistor. Once it conducts, the collector-emitter voltage approaches zero, and the digital input goes Low == TRUE.
Capacitive Switches
PiXCL 4, 8 or 16 position capacitive switches can be wired directly to the Decaf inputs. The switch module can be powered by 5V, however 3.3V is recommended. The easiest way is connect the panel to 5V through one or two diodes in series.
Related I/O Pages
Copyright © 2025 PiXCL Automation Tech Notes, Canada. All Rights Reserved.