All posts by admin

Sunfounder ADC0834 Analog to Digital Chip Library for the Raspberry Pi

We will be using the Sunfounder Ultimate Raspberry Pi kit in all these lessons. You can pick your kit up HERE. In order to use the ADC0834 Analog to Digital converter in your projects, you must have the following library installed on your system. In order to do this, you need to copy the code below. Then create a new program on your Raspberry Pi, and paste the code. Then the code should be saved as ‘’ in the SAME folder you will be running your main python program from. Also, you may save the program in the default python library file on the raspberry pi. To do this, you can save the file to:


Note the above includes the path and the file name. Using this is a better option, as any program on python3.7 should find the library here.


Reading Analog Signals with the Raspberry Pi and the ADC0834

Unfortunately the Raspberry Pi has no built in Analog to Digital converters for reading analog voltage values. So, what was a very easy task on the arduino becomes a more difficult task on the Pi. However, many applications and projects on the pi require reading analog values. In order to do this, we must interface to a ADC0834 Analog to Digital Converter chip. The video above provides in depth description of how to do this, but the resources below should also help you.

This diagram shows to to connect the ADC8034 to the Raspberry PI

You can click on the image for a closer view of the diagram.

In order to use the chip, you will need to install a python library on the raspberry pi. Create a python file on your raspberry pi, and name it:

You must name it exactly that. Note the 0 in the above file name is a zero. Now copy and paste the following code into the file:

This file,, should then be put in the following directory:


Moving or copying the file to that directory might require use of Sudo if you get a permissions error.

Now the following code will allow you to read the analog value coming from the potentiometer in the above circuit diagram:


Raspberry Pi LESSON 13: Set Color of RGB LED with Push Buttons

In this video lesson we show how you can use pushbuttons and PWM (Pulse Width Modulation) to mix colors and create any color you want in an RGB LED. We are using the most excellent Sunfounder Ultimate Raspberry Pi kit, which you can snag HERE.

You will need to start by connecting up the following circuit. You will find all the components you need in the Sunfounder kit.

RGB LED on Raspberry PI
Circuit Diagram for connecting an RGB LED to a Raspberry PI

You can click on the circuit diagram for a bigger view. In the video above, we explain in detail the coding but for your convenience, we include the finished code below:



Using an Arduino with Python LESSON 17: Controlling Paddle Position with a Joy Stick

In this video lesson we show how to control the position of a game paddle in Python using data from a joystick controlled by Arduino. the data is passed from Arduino to Python, and then the position of the game paddle is dynamically adjusted in real time. On the arduino side, this is the code which we developed:

And on the Python side, this is the code which we used:


Using an Arduino with Python LESSON 16: Connecting and Using a Joystick with Arduino


In this video lesson we are working towards creating a 3D version of the classic Pong arcade game. In this session, we show how to read data from the joystick using the arduino.

The arduino code developed in this video is included for your convenience below:


Also, this is the vPython 3D simulation we have developed thus far: