Project showcase
Baby Merry-Go-Round

Baby Merry-Go-Round © LGPL

This project is saving time for all parents who hate to change batteries or other mechanisms for the merry-go-round above their baby's bed.

  • 812 views
  • 2 comments
  • 4 respects

Components and supplies

28BYJ-48 Stepper Motor
×1
ULN2003 Driver
×1
A000066 iso both
Arduino UNO & Genuino UNO
×1

Apps and online services

About this project

I saved myself 2 hours of quality time each day with this project because it has all the attention of my baby. You may say I am a bad parent, but my baby enjoys watching each turn of this crazy merry-go-round. Nothing special in this project: one step motor randomly rotating at random speed. The box for stepper and driver is from some cosmetics, hand made. You may use whatever you have instead. I add a little cat bell, too, just to get the baby's attention. See the video below!

Code

Code for driving the baby marry-go-aroundC/C++
Program is choosing the direction of the rotation and then chose a speed (rounds per turn).
#include <Stepper.h>



long randNumberSMER;

// -------------------------STEPPER MOTOR
int bluePin = 2;    //IN1 on the ULN2003 Board, BLUE end of the Blue/Yellow motor coil
int pinkPin = 3;    //IN2 on the ULN2003 Board, PINK end of the Pink/Orange motor coil
int yellowPin = 4;  //IN3 on the ULN2003 Board, YELLOW end of the Blue/Yellow motor coil
int orangePin = 5;  //IN4 on the ULN2003 Board, ORANGE end of the Pink/Orange motor coil

//Keeps track of the current step. 
int currentStep = 0;

//One circle count
int oneCircleNo;



// =====================

void setup(){
  Serial.begin(9600);

// STEPPER MOTOR
  pinMode(bluePin, OUTPUT);
  pinMode(pinkPin, OUTPUT);
  pinMode(yellowPin, OUTPUT);
  pinMode(orangePin,OUTPUT);
  
  digitalWrite(bluePin, LOW);
  digitalWrite(pinkPin, LOW);
  digitalWrite(yellowPin, LOW);
  digitalWrite(orangePin, LOW);


}

void loop() {
  // print a random number from 0 to 299
  randNumberSMER = random(100);
  Serial.println(randNumberSMER);  

        if (randNumberSMER > 50){
          damperOpen();
        }
        if (randNumberSMER < 50){
          damperClose();
        }

  delay(1000);
}

void damperOpen(){     // clockwise subroutine 1 turn
      int fullcircleSteps = 2048;
        Serial.println(fullcircleSteps);
      long timeOpen = random(2,10); // chosing the speed
        Serial.println(timeOpen);
          while (fullcircleSteps > 0){
            switch(currentStep){
              case 0:
                digitalWrite(bluePin, HIGH);
                digitalWrite(pinkPin, LOW);
                digitalWrite(yellowPin, LOW);
                digitalWrite(orangePin, LOW);
                break;
              case 1:
                digitalWrite(bluePin, LOW);
                digitalWrite(pinkPin, HIGH);
                digitalWrite(yellowPin, LOW);
                digitalWrite(orangePin, LOW);
                break;
              case 2:
                digitalWrite(bluePin, LOW);
                digitalWrite(pinkPin, LOW);
                digitalWrite(yellowPin, HIGH);
                digitalWrite(orangePin, LOW);
                break;
              case 3:
                digitalWrite(bluePin, LOW);
                digitalWrite(pinkPin, LOW);
                digitalWrite(yellowPin, LOW);
                digitalWrite(orangePin, HIGH);
                break;
            }
          currentStep = (++currentStep < 4) ? currentStep : 0;
          delay(timeOpen);
          fullcircleSteps--;
          }
}

void damperClose(){     // count clockwise subroutine 1 turn
      int fullcircleSteps = 2048;
         Serial.println(fullcircleSteps);
      long timeClose = random(2,10);// chosing the speed
         Serial.println(timeClose);
          while (fullcircleSteps > 0){
            switch(currentStep){
              case 0:
                digitalWrite(bluePin, LOW);
                digitalWrite(pinkPin, LOW);
                digitalWrite(yellowPin, LOW);
                digitalWrite(orangePin, HIGH);
                break;
              case 1:
                digitalWrite(bluePin, LOW);
                digitalWrite(pinkPin, LOW);
                digitalWrite(yellowPin, HIGH);
                digitalWrite(orangePin, LOW);
                break;
              case 2:
                digitalWrite(bluePin, LOW);
                digitalWrite(pinkPin, HIGH);
                digitalWrite(yellowPin, LOW);
                digitalWrite(orangePin, LOW);
                break;
              case 3:
                digitalWrite(bluePin, HIGH);
                digitalWrite(pinkPin, LOW);
                digitalWrite(yellowPin, LOW);
                digitalWrite(orangePin, LOW);
                break;
            }   
          currentStep = (++currentStep < 4) ? currentStep : 0;
          delay(timeClose);            
          fullcircleSteps--;
          }
}

Schematics

Arduino PINs setup
Standard connection 6 wires pinout:
Digital pins 2,3,4,5
5V
GND
F288qrocs2px55edav7t

Comments

Similar projects you might like

Crying Baby Detector Using 1Sheeld

Project tutorial by Kirollos Magdi Sobhy

  • 4,508 views
  • 7 comments
  • 25 respects

Automatic Baby Rocker!

Project showcase by SindreKragsrud

  • 996 views
  • 0 comments
  • 7 respects

Cool Baby Piano

Project showcase by Team cool guys

  • 1,136 views
  • 0 comments
  • 1 respect

Toggle LED with NFC Tag and PIN

Project showcase by vincent wong

  • 12,823 views
  • 9 comments
  • 40 respects

Arduino: Switching ON/OFF Appliances Using IR Remote

Project showcase by Naman Chauhan

  • 8,507 views
  • 0 comments
  • 117 respects

What to Wear? Twitter Button

Project showcase by Arduino “having11” Guy

  • 2,754 views
  • 0 comments
  • 6 respects
Add projectSign up / Login