Arduino Audio Control Unit

by Kimanzi254 in Circuits > Arduino

911 Views, 10 Favorites, 0 Comments

Arduino Audio Control Unit

audioselect.PNG
IMG-20220709-WA0005.jpg
IMG-20220709-WA0008.jpg

Ever wanted to build a simple audio control unit which consists of a digital volume control, input audio select buttons and a screen for visuals? Then this is it. The brains of the unit being the arduino pro mini (you can use any type of arduino). The unit can be employed in a music system in which we have multiple inputs in this case only four but can be increased with changes in hardware and software. The rotary encoder paired with the digital potentiometer (X9C10X) are used for controlling the volume of the audio source, while the tactile switches switch between the sources of audio. Each button is assigned its audio source and only one source can selected at one time. The display, in this case the 128x32 oled and leds are used for visual feedback.

Supplies

  • 1 x Arduino Pro Mini (Any version of Arduino will work)
  • 1 x Rotary Encoder
  • 1 x Oled 128x32 0.91 inch
  • 2 x 104 Capacitor
  • 4 x Tactile switches
  • 4 x Led
  • 1 x X9C10X Digital Potentiometer
  • 12 x 10kOhm
  • Connecting Wires

Connecting the Circuit

audioselect.PNG
IMG-20220709-WA0009.jpg

The circuit diagram was designed on EayEDA as shown. The rotary encoder has incremental movement and the direction, position can be determined. Basically the encoder has a disk with evenly spaced contact zones that are connected to the common pin/ connection and two other separate pins. When the disk starts rotating step by step, the two pins will start making contact with the common pin and the two square wave output signals will be generated accordingly. Any of the two pin outputs can be used for determining the rotated position if the pulses of the signal are counted. However, if the rotation direction is to be determined, both signals have to be considered at the same time.

The push buttons are connected to pullup resistors. As seen from the circuit diagram some of the analogue pins were used as digital pins which works okay as normal digital pins.

Digital Potentiometer, the X9C103 was used, it works as a normal potentiometer but in this case the arduino pro mini with the help of the rotary encoder controls it.

Coding

controlcircuitarduino.PNG

The Arduino IDE software was used. Several libraries were used in this case. Libraries were mainly for the Oled screen. The code is fairly easy to understand. The code can be modified to include more features depending on ones liking and the hardware used. As mentioned, any type of arduino can be used, and incase the Digital pins are not enough, worry not, Analogue pins can be used as digital pins. The code is attached.

Downloads

Summary

The control unit does work but its not perfect in terms of the software and a bit of contribution from the hardware side. For example, to avoid bouncing especially from the rotary encoder do not forget to include the capacitor and resistor series connection. Bouncing can also be solved by software by using delays or the bounce library in the Arduino IDE. The digital potentiometer does work but from experience and datasheet it was not designed to work with microcontrollers. If you won't need the display then this is perfect for you. The digital potentiometer does not use any communication protocol with the arduino eg I2C or SPI so mapping the resistance to volume values did prove impossible especially that in this case its dealing with fluctuating AC signals in the mV range which is music. But when dealing with a constant DC voltage it is possible to map the resistances. Future works, I want to try out different digital potentiometers eg the MCP4151 which uses SPI to communicate with the microcontroller, so mapping the resistance to the volume value will be easy. I intend to continue working on the code, improve it and add more features. Any changes to the code and suggestions will be highly appreciated.

HAPPY BUILDING!