I am building a custom controller using a Raspberry Pi Pico paired with an ADS1115 analog-to-digital converter. In this guide, I will walk you through the process of connecting three linear potentiometers, a potentiometer with an on/off switch, four push buttons, and three rotary encoders with push buttons to your Raspberry Pi Pico.
The primary motivation for selecting the ADS1115 is the absence of an Analog-to-Digital Converter (ADC) on the standard Raspberry Pi. Additionally, the Raspberry Pi Pico, while offering ADC capabilities, is limited to only three analog inputs. However, our design calls for four analog inputs, making the ADS1115 an ideal choice. Moreover, the decision to employ ADS1115 has an eye on the future, as it allows for the straightforward transfer of Python code from the Pico to the host Raspberry Pi. Furthermore, the Raspberry Pi Pico presents itself as an HID (Human Interface Device), opening the door to its use as a keyboard input device. Lastly, ADS1115 modules are readily available, ensuring ease of procurement.
Before diving into the assembly and programming steps, let's first gather the components required for this project:
- Raspberry Pi Pico.
- ADS1115 analog-to-digital converter.
- Three 10K linear potentiometers.
- One 10K linear potentiometer with an on/off switch.
- Four push buttons.
- Three rotary encoders with push buttons.
Wiring the Components
Now, let's proceed with connecting the components:
ADS1115 Setup: Begin by linking the ADS1115 to your Raspberry Pi Pico via I2C communication. The Pico has I2C pins on GPIO 0 (SCL) and GPIO 1 (SDA).
Potentiometers: Connect the three 10K linear potentiometers to the analog inputs on the ADS1115. Wire the center pin of each potentiometer to an analog input on the ADS1115. For the remaining two pins on each potentiometer, connect one to GND and the other to the 3.3V on the Pico.
Potentiometer with On/Off Switch: Establish connections for the potentiometer with the on/off switch in a similar manner. The on/off function will be employed to control the power state of the entire device.
Push Buttons: Link the four push buttons to GPIO pins on the Pico. Ensure you use appropriate pull-up or pull-down resistors to prevent floating inputs.
Rotary Encoders: Connect the three rotary encoders to GPIO pins as well. Each encoder comprises two outputs (A and B) that generate pulses during rotation. Additionally, they are equipped with a push button which can be connected to another GPIO pin.
Programming the Raspberry Pi Pico
Now that the hardware setup is complete, you need to program the Raspberry Pi Pico to:
- Read analog values from the potentiometers via the I2C interface.
- Interpret the potentiometer values as control inputs for your SDR software.
- Configure the push buttons to trigger specific actions in your SDR software, such as mode selection or preset switching.
- Monitor the pulse outputs of the rotary encoders to detect rotations and use push button presses to initiate additional functions. You may consider implementing a rotary encoder library to streamline this process.
In the upcoming sections, we'll provide you with detailed code and instructions to execute each of these tasks.
Stay tuned for the continuation of this guide, where we'll delve into the programming and software integration aspects of building your custom SDR controller with the Raspberry Pi Pico and ADS1115.