How To Change The Volume On The Touch Board

How To Change The Volume On The Touch Board

A simple change in code will set your Touch Board's volume to the right level

The Touch Board uses an onboard chip to playback MP3 files. This chip has an onboard digital volume control that you can use to adjust the volume to a level that you are happy with. In this tutorial, we'll show you how to adjust this in code.

We love it when you share your projects! Post your project on Instagram, YouTube, or Twitter, and make sure to tag @bareconductive or use #bareconductive. You can also send your videos and photos to info@bareconductive.com so we can post them on our site for the world to see.

You will need:

  • 1 x Touch Board
  • 1 x USB Micro B to USB A or USB C (depending on your computer's USB port type)
  • 1 x Computer running Mac OS, Windows, or Linux
  • 1 x Headphones or speakers

Step 1 Changing the volume

This is an easy, one-step tutorial! First, we're assuming that you have set up Arduino to work with your Touch Board on your computer. If not, follow the link here: Setting up Arduino with the Touch Board, complete that tutorial and come back when you're done.

Changing the volume on the Touch Board is as simple as adding the line: MP3player.setVolume(X,Y); to your code, where X is the left channel volume and Y is the right channel volume. Lower values represent higher volumes, so MP3player.setVolume(0,0); will set the volume to maximum on both channels, and MP3player.setVolume(254,0); will set the left channel to be silent, with the right channel at maximum volume. This can go anywhere in the code, provided that it is AFTER the MP3player.begin(); line.

Don't forget to upload the modified code to the board in order to see the changes.

For the technically minded, the volume units are -0.5dB per count, so a value of 40 sets the volume to -20dB (with respect to maximum).