Create a Raspberry Pi Light Show With Analog Inputs

Raspberry Pi Light Show
(Image credit: Tom's Hardware)

The Raspberry Pi may be a great platform for learning, but one major thing it can’t do out of the box is use analog electronic components. That leaves everything from analog joysticks to potentiometers off limits by default, but fortunately adding an expensive chip solves the problem. The MCP3008 ADC (Analog to Digital Converter) is used to connect analog electronics to the Raspberry Pi’s 40 GPIO pins, enabling you to use all kinds of additional components. 

To show you how to take advantage of analog-to-digital conversion and how to make a fun light show, we’ve created a project that will read three potentiometers and use these dials to control the color of an Adafruit NeoPixel. Here’s how to create a colorful Raspberry Pi light show using analog input.

Les Pounder
Associate Editor

Les Pounder is an associate editor at Tom's Hardware. He is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training program "Picademy".

  • SonoraTechnical
    You need to enable the SPI Interface in the RaspberryPI as well. The omission of any mention of SPI in this article is odd.... It's what allows the 'I/O' expansion in this tutorial, that is the ability to accept analog inputs. The MCP3008 is an A/D converter, which relays the info back to the RaspberryPi over the SPI Interface.... similar to what you might do for I/O expansion over an UART or I2C interface.
    Reply
  • biglesp
    SonoraTechnical said:
    You need to enable the SPI Interface in the RaspberryPI as well. The omission of any mention of SPI in this article is odd.... It's what allows the 'I/O' expansion in this tutorial, that is the ability to accept analog inputs. The MCP3008 is an A/D converter, which relays the info back to the RaspberryPi over the SPI Interface.... similar to what you might do for I/O expansion over an UART or I2C interface.
    Hello, thanks for your comment.
    We are using the GPIO Zero Python 3 module to handle communication with the MCP3008 and this has two SPI modes.
    A software SPI which is always available and needs no further configuration, but it is much slower than hardware.
    A hardware SPI which is enabled when the SPI kernel module is enabled via raspi-config or the GUI Raspberry Pi configuration tool.GPIO Zero Documentation for SPI
    https://gpiozero.readthedocs.io/en/stable/api_spi.html
    I hope that this clears the issue for you. Many thanks for reading.
    Reply