Skip to content

II. Electronic and Programming

The pumps we used, have an operating voltage of 24V. Since we want to use only one power supply, we needed a StepDown converter for powering the Arduino with 5V.
To be able to operate the pumps with the Arduino, Relay Modules were needed to turn the pumps on and off. The machine should start to operate with a push on a button.
I had the idea to play the Tequila Song from The Champs with a buzzer, during or after mixing the drink.

To realize our ideas, we used the following electrical parts:

  • 1x Arduino Nano with Proto-Shield
  • 1x Push Button
  • 1x Buzzer
  • 3x Relay Modules
  • 3x Peristaltic Pumps
  • 1x StepDown Converter
  • 1x 24V Power Supply /w DC Jack

The heart of the machine is an Arduino Nano with a proto-shield. The components are connected as shown in the following fritzing diagram. It shows an Arduino UNO, this is also good for the project.

Here is a connection table

Part Arduino Pin
Buzzer D4
Button D6
Relay 1 D8
Relay 2 D10
Relay 3 D11

The code is quite simple, with a press on the button, the pumps will be turned on for a specific time, one after one and when there done, the song will play.

The Arduino code is available on the group assignment page. There, the code is described how it works, too.

The emergence of the song

To play the Tequila Song I searched the web for the score and found it here: https://musescore.com/user/14940711/scores/5198109

To adapt this to the Arduino, I found a github repo from robsoncouto. There are many songs inside this repository, but no Tequila song.
I used his Arduino sketch as a template for the score I’ve found.

Here is a code snippet

//#define NOTE_C4  262
#define NOTE_D4  294
#define NOTE_E4  330
#define NOTE_F4  349
#define NOTE_G4  392
#define NOTE_A4  440
//#define NOTE_B4  494
#define NOTE_C5  523
//#define REST      0

// change this to whichever pin you want to use
int buzzer = 4;


void setup() {
  }


void loop() {

  tone(buzzer, NOTE_D4);
  delay(75);
  noTone(buzzer);
  delay(75);

  tone(buzzer, NOTE_F4);
  delay(75);
  noTone(buzzer);
  delay(250);

  tone(buzzer, NOTE_F4);
  delay(75);
  noTone(buzzer);
  delay(100);
  tone(buzzer, NOTE_E4);
  delay(75);
  noTone(buzzer);
  delay(100);

  tone(buzzer, NOTE_G4);
  delay(100);
  noTone(buzzer);
  delay(100);

  tone(buzzer, NOTE_E4);
  delay(100);
  noTone(buzzer);
  delay(250);

  tone(buzzer, NOTE_F4);
  delay(75);
  noTone(buzzer);
  delay(250);

  tone(buzzer, NOTE_D4);
  delay(100);
  noTone(buzzer);
  delay(750);

The full sketch can be downloaded HERE