Book Image

Learning Beaglebone Python Programming

Book Image

Learning Beaglebone Python Programming

Overview of this book

Table of Contents (19 chapters)


Another option for user input is to use the ADC to read the position of a potentiometer. Let's revisit some of the things you learned in Chapter 4, PWM and ADC Subsystems, to make our program a bit more interesting.

For this circuit, you will need:

  • Breadboard

  • 2x potentiometers

  • 1x 5 mm LED

  • 1x CdS photocell (also known as photoresistor / light-dependant resistor / LDR)

  • 2x 10 kΩ resistor

  • 1x 4.7 kΩ resistor

  • 1x 68 Ω resistor

  • 1x 2N3904 NPN transistor

  • 1x LM358 (or similar rail-to-rail op-amp)

  • Jumper wires

Put it all together on your breadboard, as shown in the figure:

This circuit might look a lot more complicated than what we've done so far, but really it's just a combination of a few of the earlier circuits. The only difference is the configuration of the op-amp.

Here it is being used to buffer the output of a 2:1 voltage divider across the 3.3 V rail, which creates a 1.65 V reference voltage. Let's take a look at the following diagram:

This 1.65 V reference is then being used by the two potentiometers...