Introduction: Baby High Chair Light Game Arduino

Picture of Baby High Chair Light Game Arduino

It is never easy to keep a baby busy and safe without you looking all the time.

The purpose of this project is to create a playful high chair for kid of all age !

The main project of this tutorial is to setup a game , when the baby press a button the light of the same color turn on and a sound is played

The game can be change to more complicated one very easily ,when your baby grow up they will still have fun

and work their memory!

Step 1: Gather Your Parts and Tools

We won't need much stuff for this project the most expensive part will be the high chair .

We will need:

-Arduino UNO

- 4 arcade button 45mm

-4 color led here

-Speaker 40 ohm

-10uf capacitor

-Wire both of these can be useful here and here

-Resistor 10k Ohms 5% here

-9v battery (or any power supply for arduino)

-Any high chair with a tablet will do fine

-A baby

Step 2: Connecting

Picture of Connecting

In this part we gonna see the simulation of the project before to put everything on the high chair .

For the led the negative is connect to the resistor and positive to the pin.

Once it's working just need to solder everything with the real button and light

Step 3: The Code

I modify the code from this site in order two play only 2 notes when a button is press and also to turn the light on.

Load the code to the arduino

<p>#define NOTE_C3  131<br>#define NOTE_CS3 139
#define NOTE_D3  147
#define NOTE_DS3 156
#define NOTE_E3  165
#define NOTE_F3  175
#define NOTE_FS3 185
#define NOTE_G3  196
#define NOTE_GS3 208
#define NOTE_A3  220
#define NOTE_AS3 233
#define NOTE_B3  247
#define NOTE_C4  262
#define NOTE_CS4 277
#define NOTE_D4  294
#define NOTE_DS4 311
#define NOTE_E4  330
#define NOTE_F4  349
#define NOTE_FS4 370
#define NOTE_G4  392
#define NOTE_GS4 415
#define NOTE_A4  440
#define NOTE_AS4 466
#define NOTE_B4  494</p><p>// notes in the melody: from guitar study by Sor
int melody[] = {
  NOTE_G3, NOTE_G3,
  };</p><p>int melody2[] = {
 NOTE_E3, NOTE_C4,};
</p><p>int melody3[] = {
 NOTE_B3, NOTE_B3,
};</p><p>int melody4[] = {
   NOTE_A3, NOTE_D4,
};</p><p>//Les PIN arduino n*13,12,11,10 sont pour les leds</p><p>int ledPin = 13;
int ledPin2 = 12;
int ledPin3 = 11;
int ledPin4 = 10;
 int inPin = 2;
 int inPin2 = 3;
  int inPin3 = 4;
   int inPin4 = 5;
int val = 0; 
int vall = 0; </p><p>int valll = 0; 
int vallll = 0; </p><p>// note durations: 4 = quarter note, 8 = eighth note, etc.:
int noteDurations[] = {
  4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2
};</p><p>void setup() {
  pinMode(2, INPUT_PULLUP); // push-button switch on pin 2, use internal pull-up resistor
  
  pinMode(3, INPUT_PULLUP);
  pinMode(4, INPUT_PULLUP);
  pinMode(5, INPUT_PULLUP);</p><p> pinMode(ledPin, OUTPUT);  // declare LED as output</p><p>  PlayTune();               // play tune at start-up
}</p><p>void loop() {</p><p>  
  // play tune again if button on digital pin 2 is pressed
//pinMode(ledPin, OUTPUT);
   if (!digitalRead(5)) {
        
    vallll = digitalRead(inPin4);  // read input value
  if (val == HIGH) {         // check if the input is HIGH (button released)
    digitalWrite(ledPin4, LOW);  // turn LED OFF
 
    
  } else {
    digitalWrite(ledPin4, HIGH);  // turn LED ON
       delay(200);
    digitalWrite(ledPin4, LOW);
  }
  
    
  
  
   void PlayTune();</p><p> {
  // iterate over the notes of the melody:
  for (int thisNote = 0; thisNote < 2; thisNote++) {  //le chffre 2 réprésente le temps que dure la //mélodie</p><p>    // to calculate the note duration, take one second
    // divided by the note type.
    //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.
    int noteDuration = 1500 / noteDurations[thisNote];
    tone(8, melody4[thisNote], noteDuration);</p><p>    // to distinguish the notes, set a minimum time between them.
    // the note's duration + 30% seems to work well:
    int pauseBetweenNotes = noteDuration * 1.30;
    delay(pauseBetweenNotes);
    // stop the tone playing:
    noTone(8);</p><p>    
  }
 }
 }</p><p>   if (!digitalRead(4)) {</p><p>        
    val = digitalRead(inPin3);  // read input value
  if (valll == HIGH) {         // check if the input is HIGH (button released)
    digitalWrite(ledPin3, LOW);  // turn LED OFF
 
    
  } else {
    digitalWrite(ledPin3, HIGH);  // turn LED ON
       delay(200);
    digitalWrite(ledPin3, LOW);
  }
  
    
   void PlayTune();</p><p> {
  // iterate over the notes of the melody:
  for (int thisNote = 0; thisNote < 2; thisNote++) {</p><p>    // to calculate the note duration, take one second
    // divided by the note type.
    //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.
    int noteDuration = 1500 / noteDurations[thisNote];
    tone(8, melody3[thisNote], noteDuration);</p><p>    // to distinguish the notes, set a minimum time between them.
    // the note's duration + 30% seems to work well:
    int pauseBetweenNotes = noteDuration * 1.30;
    delay(pauseBetweenNotes);
    // stop the tone playing:
    noTone(8);
  }
 }
 }</p><p>  
   if (!digitalRead(3)) {</p><p>        
    vall = digitalRead(inPin2);  // read input value
  if (val == HIGH) {         // check if the input is HIGH (button released)
    digitalWrite(ledPin2, LOW);  // turn LED OFF
 
    
  } else {
    digitalWrite(ledPin2, HIGH);  // turn LED ON
       delay(200);
    digitalWrite(ledPin2, LOW);
  }
  
    
   void PlayTune();</p><p> {
  // iterate over the notes of the melody:
  for (int thisNote = 0; thisNote < 2; thisNote++) {</p><p>    // to calculate the note duration, take one second
    // divided by the note type.
    //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.
    int noteDuration = 1500 / noteDurations[thisNote];
    tone(8, melody2[thisNote], noteDuration);</p><p>    // to distinguish the notes, set a minimum time between them.
    // the note's duration + 30% seems to work well:
    int pauseBetweenNotes = noteDuration * 1.30;
    delay(pauseBetweenNotes);
    // stop the tone playing:
    noTone(8);
  }
 }
 }
  
  
  if (!digitalRead(2)) {
    
    val = digitalRead(inPin);  // read input value
  if (val == HIGH) {         // check if the input is HIGH (button released)
    digitalWrite(ledPin, LOW);  // turn LED OFF
 
    
  } else {
    digitalWrite(ledPin, HIGH);  // turn LED ON
       delay(200);
    digitalWrite(ledPin, LOW);
  }
  
    
    
    PlayTune();
  }
 
}</p><p>// a function that plays the tune
void PlayTune()
{
  // iterate over the notes of the melody:
  for (int thisNote = 0; thisNote < 2; thisNote++) {</p><p>    // to calculate the note duration, take one second
    // divided by the note type.
    //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.
    int noteDuration = 1500 / noteDurations[thisNote];
    tone(8, melody[thisNote], noteDuration);</p><p>    // to distinguish the notes, set a minimum time between them.
    // the note's duration + 30% seems to work well:
    int pauseBetweenNotes = noteDuration * 1.30;
    delay(pauseBetweenNotes);
    // stop the tone playing:
    noTone(8);
  }</p><p>}</p>

Step 4: Mounting

Picture of Mounting

Everything is done, just have to do some hole (i used soldering iron maybe not the best) on the table for the button/led and stick the arduino under .

When you place the arduino and the button think carefully for the baby to don't break anything whith his legs , for my part i used some cardboard to protect

Button:

-For the button the wire at the bottom goes to the pin on the arduino and the other one on to the GND

LED:

-For the led i solder the resistor to the LED, then i solder the resistor of all led to one wire connected the GND

-Actually all the GND are solder to the same wire connected to the GND of the arduino

Speaker:

One cable solder to the capacitor connected to the arduino

The other solder to the wire connected to the GND of the arduino

Step 5: Conclusion

The most annoying is the light, they are not bright enough when it's to luminous, i am still looking for a solutions about this .

It was my first instrucables looking forward for your feedback or improvement to the chair !

Step 6: Memory Game

When your kid grow up you can update the game to a more complicated like Simon says.

You don't need the change pin for the button however the speaker and the led are not on the right pin

you can either change the code or change the speaker on pin 13

and the led on the pin 8 , 9 , 10 , 11.

#include <br>Tone speakerpin;
int starttune[] = {NOTE_C4, NOTE_F4, NOTE_C4, NOTE_F4, NOTE_C4, NOTE_F4, NOTE_C4, NOTE_F4, NOTE_G4, NOTE_F4, NOTE_E4, NOTE_F4, NOTE_G4};
int duration2[] = {100, 200, 100, 200, 100, 400, 100, 100, 100, 100, 200, 100, 500};
int note[] = {NOTE_C4, NOTE_C4, NOTE_G4, NOTE_C5, NOTE_G4, NOTE_C5};
int duration[] = {100, 100, 100, 300, 100, 300};
boolean button[] = {2, 3, 4, 5}; //The four button input pins
boolean ledpin[] = {8, 9, 10, 11};  // LED pins
int turn = 0;  // turn counter
int buttonstate = 0;  // button state checker
int randomArray[100]; //Intentionally long to store up to 100 inputs (doubtful anyone will get this far)
int inputArray[100]; </p><p>void setup()
{
  Serial.begin(9600);
  speakerpin.begin(12); // speaker is on pin 13</p><p>  for(int x=0; x<4; x++)  // LED pins are outputs
  {
    pinMode(ledpin[x], OUTPUT);
  }
 
  for(int x=0; x<4; x++)
  {
    pinMode(button[x], INPUT);  // button pins are inputs
    digitalWrite(button[x], HIGH);  // enable internal pullup; buttons start in high position; logic reversed
  }</p><p>  randomSeed(analogRead(0)); //Added to generate "more randomness" with the randomArray for the output function
  for (int thisNote = 0; thisNote < 13; thisNote ++) {
     // play the next note:
     speakerpin.play(starttune[thisNote]);
     // hold the note:
     if (thisNote==0 || thisNote==2 || thisNote==4 || thisNote== 6)
     {
       digitalWrite(ledpin[0], HIGH);
     }
     if (thisNote==1 || thisNote==3 || thisNote==5 || thisNote== 7 || thisNote==9 || thisNote==11)
     {
       digitalWrite(ledpin[1], HIGH);
     }
     if (thisNote==8 || thisNote==12)
     {
       digitalWrite(ledpin[2], HIGH);
     } 
     if (thisNote==10)
     {  
       digitalWrite(ledpin[3], HIGH);
     }
     delay(duration2[thisNote]);
     // stop for the next note:
     speakerpin.stop();
     digitalWrite(ledpin[0], LOW);
     digitalWrite(ledpin[1], LOW);
     digitalWrite(ledpin[2], LOW);
     digitalWrite(ledpin[3], LOW);
     delay(25);
    }
  delay(1000);
}</p><p>void loop()
{  
  for (int y=0; y<=99; y++)
  {
    //function for generating the array to be matched by the player
    digitalWrite(ledpin[0], HIGH);
    digitalWrite(ledpin[1], HIGH);
    digitalWrite(ledpin[2], HIGH);
    digitalWrite(ledpin[3], HIGH);
 
    for (int thisNote = 0; thisNote < 6; thisNote ++) {
     // play the next note:
     speakerpin.play(note[thisNote]);
     // hold the note:
     delay(duration[thisNote]);
     // stop for the next note:
     speakerpin.stop();
     delay(25);
    }
   
    digitalWrite(ledpin[0], LOW);
    digitalWrite(ledpin[1], LOW);
    digitalWrite(ledpin[2], LOW);
    digitalWrite(ledpin[3], LOW);
    delay(1000);
 
    for (int y=turn; y <= turn; y++)
    { //Limited by the turn variable
      Serial.println(""); //Some serial output to follow along
      Serial.print("Turn: ");
      Serial.print(y);
      Serial.println("");
      randomArray[y] = random(1, 5); //Assigning a random number (1-4) to the randomArray[y], y being the turn count
      for (int x=0; x <= turn; x++)
      {
        Serial.print(randomArray[x]);
     
        for(int y=0; y<4; y++)
        {
     
          if (randomArray[x] == 1 && ledpin[y] == 8)
          {  //if statements to display the stored values in the array
            digitalWrite(ledpin[y], HIGH);
            speakerpin.play(NOTE_G3, 100);
            delay(400);
            digitalWrite(ledpin[y], LOW);
            delay(100);
          }</p><p>          if (randomArray[x] == 2 && ledpin[y] == 9)
          {
            digitalWrite(ledpin[y], HIGH);
            speakerpin.play(NOTE_A3, 100);
            delay(400);
            digitalWrite(ledpin[y], LOW);
            delay(100);
          }
 
          if (randomArray[x] == 3 && ledpin[y] == 10)
          {
            digitalWrite(ledpin[y], HIGH);
            speakerpin.play(NOTE_B3, 100);
            delay(400);
            digitalWrite(ledpin[y], LOW);
            delay(100);
          }</p><p>          if (randomArray[x] == 4 && ledpin[y] == 11)
          {
            digitalWrite(ledpin[y], HIGH);
            speakerpin.play(NOTE_C4, 100);
            delay(400);
            digitalWrite(ledpin[y], LOW);
            delay(100);
          }
        }
      }
    }
    input();
  }
}</p><p>void input() { //Function for allowing user input and checking input against the generated array</p><p>  for (int x=0; x <= turn;)
  { //Statement controlled by turn count</p><p>    for(int y=0; y<4; y++)
    {
     
      buttonstate = digitalRead(button[y]);
   
      if (buttonstate == LOW && button[y] == 2)
      { //Checking for button push
        digitalWrite(ledpin[0], HIGH);
        speakerpin.play(NOTE_G3, 100);
        delay(200);
        digitalWrite(ledpin[0], LOW);
        inputArray[x] = 1;
        delay(250);
        Serial.print(" ");
        Serial.print(1);
        if (inputArray[x] != randomArray[x]) { //Checks value input by user and checks it against
          fail();                              //the value in the same spot on the generated array
        }                                      //The fail function is called if it does not match
        x++;
      }
       if (buttonstate == LOW && button[y] == 3)
      {
        digitalWrite(ledpin[1], HIGH);
        speakerpin.play(NOTE_A3, 100);
        delay(200);
        digitalWrite(ledpin[1], LOW);
        inputArray[x] = 2;
        delay(250);
        Serial.print(" ");
        Serial.print(2);
        if (inputArray[x] != randomArray[x]) {
          fail();
        }
        x++;
      }</p><p>      if (buttonstate == LOW && button[y] == 4)
      {
        digitalWrite(ledpin[2], HIGH);
        speakerpin.play(NOTE_B3, 100);
        delay(200);
        digitalWrite(ledpin[2], LOW);
        inputArray[x] = 3;
        delay(250);
        Serial.print(" ");
        Serial.print(3);
        if (inputArray[x] != randomArray[x]) {
          fail();
        }
        x++;
      }</p><p>      if (buttonstate == LOW && button[y] == 5)
      {
        digitalWrite(ledpin[3], HIGH);
        speakerpin.play(NOTE_C4, 100);
        delay(200);
        digitalWrite(ledpin[3], LOW);
        inputArray[x] = 4;
        delay(250);
        Serial.print(" ");
        Serial.print(4);
        if (inputArray[x] != randomArray[x])
        {
          fail();
        }
        x++;
      }
    }
  }
  delay(500);
  turn++; //Increments the turn count, also the last action before starting the output function over again
}</p><p>void fail() { //Function used if the player fails to match the sequence</p><p>  for (int y=0; y<=2; y++)
  { //Flashes lights for failure
   
    digitalWrite(ledpin[0], HIGH);
    digitalWrite(ledpin[1], HIGH);
    digitalWrite(ledpin[2], HIGH);
    digitalWrite(ledpin[3], HIGH);
    speakerpin.play(NOTE_G3, 300);
    delay(200);
    digitalWrite(ledpin[0], LOW);
    digitalWrite(ledpin[1], LOW);
    digitalWrite(ledpin[2], LOW);
    digitalWrite(ledpin[3], LOW);
    speakerpin.play(NOTE_C3, 300);
    delay(200);
  }
  delay(500);
  turn = -1; //Resets turn value so the game starts over without need for a reset button
}

Comments

Swansong (author)2016-09-27

This is such a fun idea! These were my favorite kind of games when I was really little. I'd love to see some progress photos of how you put it together.

Thomas sxt (author)Swansong2016-09-27

Thanks for your comment ! I will update the tutorial

About This Instructable

1,088views

18favorites

License:

More by Thomas sxt:IOT Farm + Timelapse Cayenne Arduino/RaspberryCocktail Machine With GUI RaspberryAuto Coffee machine bluetooth arduino + android app
Add instructable to: