Our Raspberry Pi supports several ways of interacting with other systems. As we have to develop electronic circuits to interact with the environment we have to use the gpio connector (see image at http://learn.adafruit.com/adafruits-raspberry-pi-lesson-4-gpio-setup/overview). Gpio means "general purpose input output". This is the easiest way to control other circuits (output) or to get feedback from them (input) into the software running on the Raspberry Pi.
What is easy to me? Easy means that output-pins of the connector can be switched on or off by software commands. Current flows or not, there is nothing in between. In the same way input pins can only measure whether current is off or on. This is quite useful when we develop circuits because we can easily simulate active and inactive pins by using a micro-switch. Pushing the switch lets the current flow and releasing it stops the flow. So we are able to build and test circuits without them being really connected to the Raspberry Pi. Connecting the Pi and replacing our manual control by proper software can be done later.
But what about values between on and off - for example the speed of a motor we want to control or the distance to a barrier we want to measure? Those values have to be translated by using more than one pin. This technique is called analog-digital-converting. If we want to control 4 levels of speed (of a motor) we have to use two pins: 0% (00), 33.3% (01), 66.6% (10), 100% (11). If this is not as accurate as needed we can add another pin: 0% (000), 14.3% (001), 28.6% (010), 43% (011), 57.3% (100), 71.6% (101), 86%, 100% (111). As you can see this procedure needs a lot of pins and the number of available pins is limited. So we have to see whether we need a work around or not (for example a port expander).
Keine Kommentare:
Kommentar veröffentlichen