Warnings

While most of these circuits may interface directly to the RPi, the use of a buffered interface (such as the one supplied by the Gertboard) is recommended which will help protect against damage. Alternatively, experiment with one of the Alternative Test Platforms.

Extreme caution should be exercised when interfacing hardware at a low level, you may damage your RPi, your equipment and potentially yourself and others. Doing so is at your own risk!

Aims

Note:
Until RPi devices are available, I can not confirm this will work on a real RPi.
For now, I shall be using the TI LaunchPad (see Alternative Test Platforms
for details) to test the hardware on (as it is cheap and the logic levels similar).

The Hardware

Theory

Work in progess...

The GPIO pin on the RPi when defined as an Input allows the state of the pin to be read as with HIGH or LOW. This allows us to use a simple switch to set the state of the pin and the software can read this and respond to the change (i.e. change the audio volume output or light an LED wired to another pin).

Logic Levels

For the GPIO pin to determine if an input level is HIGH or LOW it has to detect that the voltage on the pin is above or below a set level, you should aim to set the pin to 10% of the logic voltage (HIGH for the RPi this is 3.3V - so 2.97V to 3.3V, LOW is 0V to 0.33V).

If the pin voltage is somewhere between 2.97V and 0.33V then the system may not reliably determine if a HIGH or LOW value is set (particularly as you get closer to 1.65V (halfway)).

If you drive voltages over 3.3V or negative voltages then you will risk damaging the internal GPIO circuits and perhaps even killing the RPi (which is why using extra components to protect and buffer inputs is recommended).

PullUp/PullDown

When a GPIO pin is disconnected and set as an input, the voltage is considered floating since there is no defined voltage level being applied to the pin. Therefore a good input circuit needs to apply either a HIGH voltage or a LOW voltage.

This is covered in a lot more detail here (although note the logic level here is 5V!) [2].