Raspberry Pi is an ARM architecture processor based board designed for electronic engineers and hobbyists. The PI is one of most trusted project development platforms out there now. With higher processor speed and 1 GB RAM, the PI can be used for many high profile projects like Image processing and Internet of Things.
For doing any of high profile projects, one need to understand the basic functions of PI. We will be covering all the basic functionalities of Raspberry Pi in these tutorials. In each tutorial we will discuss one of functions of PI. By the end of this Raspberry Pi Tutorial Series, you will be able to do high profile projects by yourself. Go through below tutorials:
- Getting Started with Raspberry Pi
- Raspberry Pi Configuration
- LED Blinky
- Raspberry Pi Button Interfacing
- Raspberry Pi PWM generation
- Controlling DC Motor using Raspberry Pi
- Stepper Motor Control with Raspberry Pi
- Interfacing Shift Register with Raspberry Pi
In this tutorial, we will Interface an ADC (Analog to Digital Conversion) chip to Raspberry Pi. We know all the parameters of analog, means there vary continuously over time. Say for an instance temperature of the room, the room temperature varies with time continuously. This temperature is provided with decimal numbers. But in digital world, there are no decimal numbers, so we need to convert the Analog value to Digital value. This conversion process is done by ADC technique. Learn more about ADC here: Introduction to ADC0804
ADC0804 and Raspberry Pi:
Normal controllers have ADC channels but for PI there are no ADC channels provided internally. So if we want to interface any analog sensors we need an ADC conversion unit. So for that purposes we are going to Interface ADC0804 with Raspberry Pi.
ADC0804 is a chip designed to convert analog signal into 8 bit digital data. This chip is one of the popular series of ADC. It’s an 8bit conversion unit, so we have values or 0 to 255 values. With a measuring voltage of maximum 5V, we will have a change for every 19.5mV. Below is the Pinout of ADC0804:
Now another important thing here is, the ADC0804 operates at 5V and so it provides output in 5V logic signal. In 8 pin output (representing 8bits), every pin provides +5V output to represent logic’1’. So the problem is the PI logic is of +3.3v, so you cannot give +5V logic to the +3.3V GPIO pin of PI. If you give +5V to any GPIO pin of PI, the board gets damaged.
So to step-down logic level from +5V, we will be using voltage divider circuit. We have discussed Voltage Divider Circuit previously look into it for further clarification. What we will do is, we use two resistors to divide +5V logic into 2*2.5V logics. So after division we will give +2.5v logic to PI. So, whenever logic ‘1’ is presented by ADC0804 we will see +2.5V at the PI GPIO Pin, instead of +5V.
Here we are using Raspberry Pi 2 Model B with Raspbian Jessie OS. All the basic Hardware and Software requirements are previously discussed, you can look it up in the Raspberry Pi Introduction, other than that we need:
- Connecting pins
- 220Ω or 1KΩresistor (17 pieces)
- 10K pot
- 0.1µF capacitor (2 pieces)
- ADC0804 IC
- Bread Board
It works on supply voltage of +5v and can measure a variable voltage range in 0-5V range.
For more detail: Raspberry Pi ADC Tutorial