Baby Clib Mobile

by annamarialali123 in Circuits > Arduino

129 Views, 2 Favorites, 0 Comments

Baby Clib Mobile

WhatsApp Image 2021-12-02 at 11.14.41 AM.jpeg
IMG_4024.jpg

This project is an electronic baby mobile, that rotates and plays music when you start it pressing a button

Supplies

The list of tools used in this project is:

ELECTRONIC TOOLS:

Botón ON/OFF RL3111G2BKBKP4 (1 PC)

Altavoz Visaton K50WP 16 Hz (2’’) (1 PC)

Battery Snap-ON Connector Clip 9 V (1 PC)

Módulo ArduinoNano V3 con Atmel ATmega 328P, controlador USB CH340G, ensamblado/ 5V/16MHz (1 PC)

NPN Transistor PN2222 (1 PC)

DC Motor RS-550 DC 9V (1 PC)

Tie-Points Breadboard (30x70 mm) (1 PC)

Female-to-Male Dupont Wire (3 Outputs) (1 PC)

Female-to-Male Dupont Wire (4 Outputs) (1 PC)

USB to Mini USB (1 PC)

MATERIAL USED:

Big Wood Support 10 mm

Small Fix Close Female (8 PC)

Cartoon White Box (where all the electronic devices will be)

Decoration (colour painting…)

Hook

Cardboard box

Write the Code

Use the attached file with the code (also you can copy-paste it) that we have used for the program, it comments in each section what it does and what you have to edit to customize it.

The CODE used:

//BABY CRIB MOBILE - program to make a baby crib mobile work that includes an speaker, a button (to switch it on and off) and a motor. This program is set to make all of this items work together and at the same time.

//SPEAKER

#include "pitches.h"//Include the speaker

// notes in the melody defined with their respective frequency: float DO=523.2511; float SOL=783.9909; float LA=880; float FA=698.46; float MI=659.3551; float RE=587.3295;

//list of notes in order of the melody we want to include, in this case twinkle twinkle little star int melody[] = { DO, DO, SOL, SOL, LA, LA, SOL, FA, FA, MI, MI, RE, RE, DO, SOL, SOL, FA, FA, MI, MI, RE, SOL, SOL, FA, FA, MI, MI, RE, DO, DO, SOL, SOL, LA, LA, SOL, FA, FA, MI, MI, RE, RE, DO };

// note durations: 4 = quarter note, 8 = eighth note, etc.: int noteDurations[] = { 4, 4, 4, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 2 };

//BUTTTON int pushButton = 2;//Declare the pin you want to use

//motor int motor=11; //pin used for the motor int brightness = 200; // how fast it works int fadeAmount = 5; // how fast it accelerates

void setup() { // put your setup code here, to run once: pinMode(motor, OUTPUT); }

void loop() { // put your main code here, to run repeatedly: //motor comands to ensure it works, these depend on the items declared before pinMode(motor, OUTPUT); analogWrite(motor, brightness); delay(30);

//so the song plays repeatedly for (int thisNote = 0; thisNote < 42; thisNote++) {

// 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 = 1000 / noteDurations[thisNote]; tone(8, melody[thisNote], noteDuration);

// 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); } }

Downloads

Connect the Electronic Components

In this step you will connect the electronic components to the board.

Attached document displays inputs and outputs, wiring connections, and board-to a speaker, a DC motor and a on off button.

Downloads

Product Assembly

In this section you can see where we place each component to develop the assembly of the project.

At first we made sketches of the structure, then we make the Autocad files for the laser cut in the 3mm wood board. You have all the wood components on the file (clouds, flowers, stars, moons…). Then you have to make the wood platform to tie the wooden figures (the circle platform mesure: 28,5cm diameter)

When you have all the wood components, you can paint the figures in the colors you like most.

The second step is to tie the figures and then screw the small fix close female in the wood platform. Finally you tie the figures in the platform.

Next step is paste the DC motor in a hook, so the mobile rotates over it self.

All the electronic components go inside the cardboard box. That is placed in a safe spot where children can’t touch it and must be above the hook so the motor wire doesn’t get tangled over itself.

Chose the Song

Captura de pantalla 2021-12-02 a las 15.16.54.png

Chose the song and search the frequency (Hz) of each note.