Project tutorial
Arduino Organ with Kinder Surprise

Arduino Organ with Kinder Surprise © CC BY-NC

Build an Arduino organ with Kinder Surprise, some resistors and wires and learn how to play music with the electrical capacity of your body.

  • 1,137 views
  • 1 comment
  • 3 respects

Components and supplies

Apps and online services

About this project

(Translated with DeepL)

In this project you build an organ which you play by touching Kinder Surprise. You only need a few resistors, cables and a very important "component": your own body. ๐Ÿ™‚

With the help of the library CapacitiveSensor you measure the electrical capacity of your body. If you touch one of the surprise eggs (or its aluminium foil), the measured value increases and you can play a sound based on it.

This project leaves you plenty of room for experimentation: You can use different resistors and play around with the threshold of the measured data. With the right combination you don't even have to touch the surprise eggs - then you just approach your hand and the Arduino organ starts to play.

The construction of the Arduino organ

You can set up your organ in a few minutes. In the following diagram the 5 purple wires are for the eggs. Simply insert their ends through the foil into the egg - if necessary, you can fix them to the aluminium foil with some glue. Of course you can also use any other foil or five metal bodies if you don't have any Kinder Surprise at hand, or if you have already eaten them. ๐Ÿ™‚

One more note: If you use a speaker instead of a piezo buzzer, you still need a resistor in the range of 100ฮฉ. This resistor must be connected between pin 11 and the speaker to prevent damage to your Arduino.

The sketch

Before you can get started, you need the library CapacitiveSensor by Paul Badger. If it is not yet installed on your system, you can do so via the library manager in your Arduino IDE. For more information about this library and its features, please visit the Arduino Playground.

First, include the library in your sketch and define the pin for the speaker and some variables:

#include <CapacitiveSensor.h>
#define speaker 11
int sensitivity = 3000;
int threshold = 5000;

The variable sensitivity determines how many samples are used for the measurement. Theoretically, the more the better - but you should play around with the value a bit to find the right setting for your "organ keys".

This also applies to the threshold variable. Here you determine which measurement value must be exceeded in order for a sound to be played. You can find the appropriate setting by observing the values in your serial monitor while you play the Arduino organ.

Next you define the pins where the eggs are hanging:

CapacitiveSensor   cs_2_4 = CapacitiveSensor(2, 4);
CapacitiveSensor cs_2_5 = CapacitiveSensor(2, 5);
CapacitiveSensor cs_2_6 = CapacitiveSensor(2, 6);
CapacitiveSensor cs_2_7 = CapacitiveSensor(2, 7);
CapacitiveSensor cs_2_8 = CapacitiveSensor(2, 8);

As you can see in the schematic structure above, every Kinder Surprise hangs on digital pin 2. The measurement is started via this pin. But each egg has its own pin for the input of the measured values - the digital pins 4 to 8.

In the function void setup() you only start the serial monitor with a baudrate of your choice.

The loop

In the function void loop() you first perform a measurement for each Kinder Surprise. The number of samples is in the variable sensitivity. The results are stored in the variables sensor4 to sensor8.

long sensor4 =  cs_2_4.capacitiveSensor(sensitivity);
long sensor5 = cs_2_5.capacitiveSensor(sensitivity);
long sensor6 = cs_2_6.capacitiveSensor(sensitivity);
long sensor7 = cs_2_7.capacitiveSensor(sensitivity);
long sensor8 = cs_2_8.capacitiveSensor(sensitivity);

These 5 sensor values are printed in the Serial Monitor (code in the whole sketch below), so you can find a suitable value for the variable threshold. If you touch a an egg, the value will jump up, but how far up depends on the material and must be checked individually by you.

Once you have found a value, you can start with the music:

if (sensor4 > threshold) tone(speaker, 440); // A
if (sensor5 > threshold) tone(speaker, 523); // C
if (sensor6 > threshold) tone(speaker, 587); // D
if (sensor7 > threshold) tone(speaker, 659); // E
if (sensor8 > threshold) tone(speaker, 784); // G

With the tone() function you play a certain frequency over the piezo buzzer. In principle, all possible tones are available here, but in this project we use the A minor pentatonic - i.e. the tones A - C - D - E - G.

The trick is that almost everything sounds reasonably good, even if you're not an experienced musician. ๐Ÿ™‚

Finally, you need a query as to when your piezo buzzer should be silent - namely when you are not touching any egg. Again, the variable threshold is used.

if (sensor4 <= threshold  &  sensor5 <= threshold & sensor6 <= threshold  &  sensor7 <= threshold &  sensor8 <= threshold) {
noTone(speaker);
}

And that should be it. As I said, the fine-tuning of your Arduino organ will take you some more time, but then you can get started!

In case you need it read the german text on pollux labs.

Code

Gist
https://gist.github.com/polluxlabs/67a200eadbcb030a163b51bf40d0374b.js

Schematics

Arduino Organ with Kinder Surprise
Orgel arduino mjb2zg4ov2

Comments

Similar projects you might like

LOL Surprise Doll Hotel Elevator controled by mobile phone

Project in progress by Dkovacic74

  • 1,668 views
  • 0 comments
  • 10 respects

MKR1000 Surprise Room Decoration

Project tutorial by Muhammad Afzal

  • 1,670 views
  • 1 comment
  • 2 respects

Telegram Bot with ESP8266

Project tutorial by Shebin Jose Jacob

  • 44,794 views
  • 44 comments
  • 78 respects

Touch Controlled Light Using Arduino

Project tutorial by Amal Mathew

  • 15,087 views
  • 5 comments
  • 13 respects

Thirst Alert Plant Alarm

Project tutorial by Patchr

  • 6,236 views
  • 3 comments
  • 41 respects

Proximity Lamp Using Arduino

Project tutorial by Amal Mathew

  • 5,159 views
  • 2 comments
  • 14 respects
Add projectSign up / Login