Arduino Synth V3

by Arnov Sharma in Circuits > Arduino

1025 Views, 5 Favorites, 0 Comments

Arduino Synth V3

Arduino Piano Synth
IMG_20220707_002106.jpg
15 (63).gif

Hey guys what's up!

So this is my Arduino Synth V3 which is a DIY Synth powered by an Arduino Nano.

It has 12 push switches along with two ON/OFF switches for changing modes and two potentiometers that change pitch and tempo.

By changing the Pitch Potentiometer, we can change the output waveform that makes cool sci-fi sounds by pressing any 12 buttons. It works pretty much like a normal keyboard synth.

I've been making synths for a while now, made two synths that work identically to this one but they all use Mozi Library to run but this one uses simple code that modulates output by the state of buttons and switches.

Links for previous versions-

https://www.instructables.com/Arduino-Atari-Synth/

https://www.instructables.com/Arduino-Based-Synth-With-Mozzi-Library/

https://www.instructables.com/Neko-Punk-Synth-V2/

This Instructables is about the whole built process of this synth so let's get started.

Supplies

Following were the things I used in this build-

  • Custom PCB
  • Arduino Nano
  • Potentiometer
  • ON-OFF SWITCH
  • Push Buttons
  • Speaker 4 Ohms
  • Header Pins Female

SCHEMATIC

SCH_page-0001 (21).jpg

The schematic of this Board is a simple one, Arduino Nano is connected with 12 Push Buttons. each of the Push Buttons is connected with an IO Port, when we press any button, it pulls down the IO Port to GND.

The same is with two ON-OFF Switch but when we press them, they keep the IO Pin pulled down for a longer duration. then two Pots are connected with A4 and A5.

PAM8403 Module is connected with output Pin A2, it amplifies the signal and makes it louder.

PCB Design

Capture.PNG

After finalizing the Schematic, I exported the netlist and started working on the PCB Design.

As for the shape, I took the aesthetics and overall looks from a generic keyboard, Arduino Nano is placed on the TOP right corner, and the speaker is placed on the TOP left side.

I've added a few fake keys in the design as well, I placed buttons on these fake keys. maybe the future version will have actual capacitive touch keys.

Also, I've removed soldermask from fake keys so the copper area will be unfilled which will give a super cool silver look as the board will be covered by HASL.

Getting PCBs From PCBWAY

Capture2.PNG
01 (77).gif
02 (77).gif
IMG_20220705_224759.jpg

After finalizing the PCB, I send the Gerber data to PCBWAY for samples.

I choose white soldermask with black silkscreen as white PCB looks cool in general if we add silkscreen patterns in black color.

I received the PCBs in a fast week. As for the PCB Quality, it was superb.

Been using their service for a while and I have to say, it's pretty decent for getting started.

Just see the intricate design of mine, I placed many unusual patterns on the PCB like irregular outline and shape of soldermask which is hard to make but they did an awesome job of making the PCBs with no problem whatsoever.

Checkout PCBWAY from here- https://www.pcbway.com/

PCB ASSEMBLY

03 (73).gif

Before starting the PCB Assembly, we need to gather all the components we will use in this project.

Adding Header Pins, Switches, and Pots

04 (77).gif

We start first by adding Header Pins for Arduino Nano, switches, and pots in their place.

Adding Push Buttons

05 (76).gif

Next, we add 12 Push Buttons in their place one by one.

Soldering the Components

06 (74).gif

After placing all the switches and header pins in their place, we solder their terminals to the PCB by using a regular soldering iron and solder wire.

Adding PAM8403 Module

08 (72).gif
09 (68).gif

Next, we add the PAM8403 Module in its place by using some male header pins, we add male header pins on the PCB and then add PAM8403 on the header pins.

at last, we solder the pins and secure the module in its place permanently.

Adding Speaker

10 (74).gif
11 (74).gif
12 (69).gif

At last, we add a speaker in its place.

I added a hole on the PCB, the goal here was to add a speaker from the backside through this hole. Speaker is glued to the PCB and then we connect the terminals of the speaker with PAM8403 CON2 Port through two jumper wires.

After doing this, the PCB is completed.

Result of PCB ASSEMBLY

13 (71).gif

Here's the result so far, all the components are soldered and the board is completed. It looks pretty much like an Arduino Nano Sheild or addon board.

The next step is to add Arduino Nano to this board and flash the main sketch into the MCU.

Main CODE

14 (62).gif
15 (63).gif

Here's the main Sketch that I used.

int C  = 2;
int CS = 3;
int D  = 4;
int DS = 5;
int E  = 6;
int F  = 7;
int FS = 8;
int G  = 9;
int GS = 10;
int A  = 11;
int AS = 12;
int B  = 13;
int octabajo = 0;
int octarriba = 1;
int tiempo = analogRead(A4);
int pitch_bend = analogRead(A5);


int c  = 262;
int cs = 277;
int d  = 294;
int ds = 311;
int e  = 330;
int f  = 349;
int fs = 370;
int g  = 392;
int gs = 415;
int a  = 440;
int as = 466;
int b  = 494;

void setup() {
  // INPUT CONFIG
  pinMode(C, INPUT_PULLUP);
  pinMode(CS, INPUT_PULLUP);
  pinMode(D, INPUT_PULLUP);
  pinMode(DS, INPUT_PULLUP);
  pinMode(E, INPUT_PULLUP);
  pinMode(F, INPUT_PULLUP);
  pinMode(FS, INPUT_PULLUP);
  pinMode(G, INPUT_PULLUP);
  pinMode(GS, INPUT_PULLUP);
  pinMode(A, INPUT_PULLUP);
  pinMode(AS, INPUT_PULLUP);
  pinMode(B, INPUT_PULLUP);
  pinMode(octabajo, INPUT_PULLUP);
  pinMode(octarriba, INPUT_PULLUP);
  pinMode(A4, INPUT_PULLUP);
  // OUTPUT CONFIG
  pinMode(A2, OUTPUT);
  // start serial port
  Serial.begin(9600);
}



void loop() {
 
  // put your main code here, to run repeatedly:
  digitalRead(0);
  digitalRead(1);
 
  Serial.println(analogRead(A4));

  if (!digitalRead(C)) {
    tone(A2, c+(analogRead(A5)/5));
    delay(analogRead(A4));
    digitalRead(C);
  }
  if (!digitalRead(C)&&!digitalRead(octabajo)) {
    tone(A2, c/2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(C);
  }
  if (!digitalRead(C)&&!digitalRead(octarriba)) {
    tone(A2, c*2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(C);
  }


  digitalRead(CS);
  if (!digitalRead(CS)) {
    tone(A2, cs+(analogRead(A5)/5));
    delay(analogRead(A4));
    digitalRead(CS);
  }
  if (!digitalRead(CS)&&!digitalRead(octabajo)) {
    tone(A2, cs/2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(CS);
  }
  if (!digitalRead(CS)&&!digitalRead(octarriba)) {
    tone(A2, cs*2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(CS);
  }

  digitalRead(D);
  if (!digitalRead(D)) {
    tone(A2, d+(analogRead(A5)/5));
    delay(analogRead(A4));
    digitalRead(D);
  }
  if (!digitalRead(D)&&!digitalRead(octabajo)) {
    tone(A2, d/2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(D);
  }
  if (!digitalRead(D)&&!digitalRead(octarriba)) {
    tone(A2, d*2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(D);
  }

  digitalRead(DS);
  if (!digitalRead(DS)) {
    tone(A2, ds+(analogRead(A5)/5));
    delay(analogRead(A4));
    digitalRead(DS);
  }
  if (!digitalRead(DS)&&!digitalRead(octabajo)) {
    tone(A2, ds/2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(DS);
  }
  if (!digitalRead(DS)&&!digitalRead(octarriba)) {
    tone(A2, ds*2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(DS);
  }

  digitalRead(E);
  if (!digitalRead(E)) {
    tone(A2, e+(analogRead(A5)/5));
    delay(analogRead(A4));
    digitalRead(E);
  }
  if (!digitalRead(E)&&!digitalRead(octabajo)) {
    tone(A2, e/2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(E);
  }
  if (!digitalRead(E)&&!digitalRead(octarriba)) {
    tone(A2, e*2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(E);
  }

  digitalRead(F);
  if (!digitalRead(F)) {
    tone(A2, f+(analogRead(A5)/5));
    delay(analogRead(A4));
    digitalRead(F);
  }if (!digitalRead(F)&&!digitalRead(octabajo)) {
    tone(A2, f/2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(F);
  }
  if (!digitalRead(F)&&!digitalRead(octarriba)) {
    tone(A2, f*2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(F);
  }

  digitalRead(FS);
  if (!digitalRead(FS)) {
    tone(A2, fs+(analogRead(A5)/5));
    delay(analogRead(A4));
    digitalRead(FS);
  }
  if (!digitalRead(FS)&&!digitalRead(octabajo)) {
    tone(A2, fs/2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(FS);
  }
  if (!digitalRead(FS)&&!digitalRead(octarriba)) {
    tone(A2, fs*2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(FS);
  }

  digitalRead(G);
  if (!digitalRead(G)) {
    tone(A2, g+(analogRead(A5)/5));
    delay(analogRead(A4));
    digitalRead(G);
  }
  if (!digitalRead(G)&&!digitalRead(octabajo)) {
    tone(A2, g/2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(G);
  }
  if (!digitalRead(G)&&!digitalRead(octarriba)) {
    tone(A2, g*2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(G);
  }

  digitalRead(GS);
  if (!digitalRead(GS)) {
    tone(A2, gs+(analogRead(A5)/5));
    delay(analogRead(A4));
    digitalRead(GS);
  }
  if (!digitalRead(GS)&&!digitalRead(octabajo)) {
    tone(A2, gs/2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(GS);
  }
  if (!digitalRead(GS)&&!digitalRead(octarriba)) {
    tone(A2, gs*2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(GS);
  }

  digitalRead(A);
  if (!digitalRead(A)) {
    tone(A2, a+(analogRead(A5)/5));
    delay(analogRead(A4));
    digitalRead(A);
  }
  if (!digitalRead(A)&&!digitalRead(octabajo)) {
    tone(A2, a/2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(A);
  }
  if (!digitalRead(A)&&!digitalRead(octarriba)) {
    tone(A2, a*2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(A);
  }

  digitalRead(AS);
  if (!digitalRead(AS)) {
    tone(A2, as+(analogRead(A5)/5));
    delay(analogRead(A4));
    digitalRead(AS);
  }
  if (!digitalRead(AS)&&!digitalRead(octabajo)) {
    tone(A2, as/2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(AS);
  }
  if (!digitalRead(AS)&&!digitalRead(octarriba)) {
    tone(A2, as*2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(AS);
  }

  digitalRead(B);
  if (!digitalRead(B)) {
    tone(A2, b+(analogRead(A5)/5));
    delay(analogRead(A4));
    digitalRead(B);
  }
  if (!digitalRead(B)&&!digitalRead(octabajo)) {
    tone(A2, b/2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(B);
  }
  if (!digitalRead(B)&&!digitalRead(octarriba)) {
    tone(A2, b*2+((analogRead(A5)/5)));
    delay(analogRead(A4));
    digitalRead(B);
  }
  
  noTone(A2);
 } 


We first add Arduino Nano in its place and then flash it with the code, result will be a working synth playing random humms, we can alter the sound by pressing buttons or modulating the potentiometers or ON/OFF Switch.

RESULT

Arduino Piano Synth
16 (60).gif

Here's the overall result, watch the video for the demo.

This is it for today folks, stay tuned and I'll be back with a new project soon.

Special thanks to PCBWAY for supporting this project, Check them out for getting great PCB Service for less cost.

Peace