Raspberry Pi GPIO Analogue Exercises
The aim of this exercise is to show students how to program the Raspberry Pi to “measure” the state of one of its GPIO pins as a digital input, how the Raspberry Pi may be used in conjunction with an Analogue to Digital Converter (ADC) to measure an analogue voltage, and how the Raspberry Pi may be used in conjunction with a Digital to Analogue Converter (DAC) to generate an analogue signal.
The exercise is split in to three “Steps” of increasing complexity
Step 1 introduces the student to the IDLE integrated development environment and to the Python programming language by asking them to enter commands directly at the Python prompt. The concept of a single digital input representing a single “bit” of data in introduced.
Step 2 introduces the concept of creating a file containing a series of Python commands, saving this file as a “computer program”, and “running” the program. The difference between a digital and an analogue signal is discussed and it is shown how an Analogue to Digital Converter (ADC) may be used to enable analogue signals to be measured. The concept of serial and parallel data interfaces is introduced and the Raspberry Pi is configured to use the I2C protocol. Students will also use the “apt-get” command to download and install software packages from the Debian repository. Basic data transfer between the Raspberry Pi and peripheral hardware is demonstrated by reading data from the ADC chip, and in Python, the “while” loop is introduced.
Read More: Raspberry Pi GPIO Analogue Exercises