Skip to content

Arduino basic binary input

Pekka Nikander edited this page May 24, 2013 · 4 revisions

a simple ON/OFF switch or a button

Connect THIS WAY (a pic of a debounced button). A button is usually connected between the input pin and logic ground and debounced connecting a small condensator in parallel. The switching event is in reality not that smooth, as the voltage may cross hysteresis border several times. Capacitor debouncing is the standard way of dealing with it but a software-only-debouncing is also doable. Read the pin state several times and process.

Digital logic-level input from other devices

As the Ellduino development board is mostly a 3,3V it may be necessary to do some logic level voltage transfers when connecting external circuits. Identify the operating voltage levels for 0 and 1 input. Most common foreign voltages are 5V CMOS logic, which can be dealt with using a level transfer circuit or a simple resistor divider like so. (a pic of the two)

Pulse-input or other timing critical input

For time-critical external events, the Elduino STM32F051 is equipped with timer input hardware internally connectable to many of its pins. The connections are usually as per the two previously discussed connections. Sometimes a different approach is necessary, please refer to the external chip datasheet for its requirements. The timer input pins can be configured to generate an interrupt at leading or following edge, or to calculate a length of pulse and generate the interrupt after a pulse is captured. Design your own pulsed circuits with your software in mind and vice versa.

Clone this wiki locally