Simple multi-tasking

Hello everyone. I'm starting a simple project (in concept) for my wife. A music box. It's been a few years since I have used Arduino and have been out of the loop for a bit, so I am looking for some hardware recommendations for the project.

As I said, it's a music box and it is to have a rotating doll. Possibly up to Barbie size.

The base will have two control buttons (for two stored audio tracks) and a volume potentiometer.
The overhead above the doll will have some LEDs for illumination.

There will be a speaker (thinking 3.5" to 4") installed in the base (aimed down).

So here is my basic thoughts of operation:

Press button 1: - LEDs ramp (PWM) up to level.

  • Doll begins to turn slowly (5-6 rpm).
  • Track 1 plays to end.
  • Doll stops rotation and returns facing forward.
  • LEDs dim (PWM) to off.

Press button 2: - LEDs ramp (PWM) up to level.

  • Doll begins to turn slowly (5-6 rpm).
  • Track 2 plays to end.
  • Doll stops rotation and returns facing forward.
  • LEDs dim (PWM) to off.

Button press (either) during playback: - Track stops.

  • Doll stops rotation and returns facing forward.
  • LEDs dim (PWM) to off.

Speculated hardware (I THINK!):
-I'm guessing at either an Uno or a Mega (not sure which would be better for the application).
-Adafruit Motor/Stepper/Servo Shield Adafruit Motor/Stepper/Servo Shield for Arduino v2 Kit [v2.3] : ID 1438 : $19.95 : Adafruit Industries, Unique & fun DIY electronics and kits
-Stepper Motor Stepper motor - NEMA-17 size - 200 steps/rev, 12V 350mA : ID 324 : $14.00 : Adafruit Industries, Unique & fun DIY electronics and kits
-Adafruit MP3 Shield Adafruit Music Maker MP3 Shield for Arduino (MP3/Ogg/WAV...) : ID 1790 : $29.95 : Adafruit Industries, Unique & fun DIY electronics and kits
-Adafruit 20W Amplifier Stereo 20W Class D Audio Amplifier - MAX9744 : ID 1752 : $19.95 : Adafruit Industries, Unique & fun DIY electronics and kits
-Single speaker and about 5 LEDs to suit.

I do have time for completion (wanting to give it to her for Christmas 2020).
I'm just feeling a little overwhelmed on it at the moment, not being sure which equipment to use.
Once the equipment list is set in place, then I'll feel better about moving forward and studying up on the individual pieces. It's just tough when you don't even know where to begin!

Thank you so much for taking the time to read through all of my madness!

Seems totally doable. It doesn't sound like space is an issue for you since you can stack all those shields onto an Uno. Make sure you get a beefy 12V power supply to drive it all (~1A).

Rather than just regular LEDs, you might look into individually addressible LED strips (W2812 type. Look at adafruit NeoPixels) and then you would be able to do all sorts of patterns, etc. and only use 1 wire for all of them.

Servo motors are said to make less audioble noice. Using a servo shield it is not harder to make them run.

Railroader:
Servo motors are said to make less audioble noice. Using a servo shield it is not harder to make them run.

The adafruit one the OP specified can do either

Look at Robin2’s ‘several things at once’ discussion:
http://forum.arduino.cc/index.php?topic=223286.0

Also:
https://forum.arduino.cc/index.php?topic=525240.0

Thank you so much for the quick replies!

blh64, compactness was certainly a thought, as I will be designing the base around the electronics. And those Neopixels look amazing! I will most definitely be looking into those a bit more!

Railroader, minor noise from the motor is okay, as it will be enclosed within the base. As long as the noise isn't electrical, it should be okay (I THINK!). I will certainly be mocking it all up prior to assembly and I will pay particular attention to this. Thank you for caution!

larryd, thank you so much for the links. They look like they will prove themselves to be rather useful. I do indeed have some reading to do. :slight_smile:

My primary concern at this point was if there was enough pins for me to perform the tasks. I've never utilized shields before and had concerns about stacking more than one (as far as pin availability/assignment goes). I suppose I will be learning much more throughout this process. Damn I love this stuff though. :slight_smile:

I'd use a regular geared-down DC motor. You can buy a "gearmotor" that has the gears attached and runs at a specified (approximate) RPM. You should be able to get-by with a very small motor since you need almost zero torque and gearing-down increases torque. All you need is a MOSFET driver to turn the motor on & off. If you want to start/stop at a certain position you can use some kind of "home sensor".

You'll see the 1.8 degree steps with a stepper motor if you don't gear it down.

Servos come with a built-in driver so they are easy to wire-up, but a servo is an "angle motor" and a regular servo doesn't rotate 360 degrees.

You don't "need" a 20W amplifier. 1W is probably enough. And with a regular single-ended amplifier it takes more than 25 VDC to get the ~9 VRMS required for 20W into a 4-Ohm speaker. (With a bridge amplifier you can get-by with about half that.)

These might be warranted, 28YBJ-48 DC 5V 4 Phase 5 Wire Stepper Motor With ULN2003 Driver Board.

Many discussions here on the forums, search for them.

I was thinking of the same 28byj-48 stepper. Can turn a small doll just fine, is compact, and runs on 5V so all you need to power the project is an old mobile phone charger. It's geared down to 4096 (micro)steps per rotation, giving pretty smooth action. A small, seriously geared down DC motor is another good option.

You don't need to count steps; just have the stepper make steps at regular intervals to get to the required rpm (one step every 3 ms gives you just over 5 rpm - this can be done in the loop but a timer interrupt becomes an interesting option if only for the learning aspect, you have plenty of time for that).

Add a magnet and hall effect sensor so you can easily detect when the doll is facing forward (or you lose orientation the moment you cut the power and it's not in it's forward position). So also when powering up your device it should check whether it's in position, if not start rotating until the magnet is detected.

For MP3 player, have a look at the DF Player Mini (or a clone of the same). It's barely larger than a micro SD card.

20W is serious power for audio. There are cheap and really small 3W amplifiers out there, probably good enough for your application. A pair of small speakers and you'll be good. I assume you're not looking for Hi-Fi quality sound or particularly high volume for this project.

LEDs: yes WS1812B aka Neopixels (that's Adafruit's name for the things) are great. The FastLED library allows for all kinds of really cool effects with minimal programming effort.

Now to get started: do this step by step.
Get the stepper motor - make it work.
Get the hall effect sensor - learn how to detect a magnet with it.
Get the button working - switch the built-in LED based on your button so you know you can detect the press.

Combine the above: upon button press the motor switches on, and after one rotation (upon detection of the magnet) it stops and waits for the next button press. Note: you'll likely have to move good number of steps, or some time, before the magnet is out of range. You have to allow for this in your code, or it'll stop instantly.

Implement the above as finite state machine.

By the time you did this you're very far along and the rest will become easier and easier. You can expand your finite state machine to have it play MP3 tracks and do fun things with the LEDs, and to have it react to the second button. Of course you'll be writing small sketches to test out each individual one.

wvmarle:
I was thinking of the same 28byj-48 stepper. Can turn a small doll just fine, is compact, and runs on 5V so all you need to power the project is an old mobile phone charger. It's geared down to 4096 (micro)steps per rotation, giving pretty smooth action. A small, seriously geared down DC motor is another good option.

The stepper motor has the distinct advantage that it can be operated at a specific speed with full torque. The speed of a DC motor will vary if the load varies.

...R

OP wants to rotate a small doll - if a DC motor slows down significantly due to increased torque there's probably a bigger issue with the project :slight_smile:

Wow. I gotta tell you guys that I am absolutely LOVING the feedback in here!
To be honest, I was expecting it to take a few days to get a somewhat helpful reply.
These responses are great!

Now, I suppose it would help for a bit more detail (maybe?).

I am recreating the music box from the movie Labyrinth for my wife (she is a MAJOR fan).

My iteration is going to be scaled up significantly (doll being Barbie-sized) which should give me plenty of room in the base for components.

The doll being the size it is, I think a reasonable max weight assumption of .25 lbs should be safe (including doll, bulky dress, platform...).
That being said, anyone feel that I could get away with NOT using a "motor shield"? I don't need the speed to be variable, per se. Just wanting the final rotation speed to be in the ballpark of 5-6 rpm.
I think reduced gearing sounds like a TERRIFIC idea. Definitely wouldn't want to be seeing the individual steps from a slow-turning stepper motor. So I suppose I'm actually looking for a reduced-drive stepper motor, capable of turning more than .25 lbs (safety margin!) at a rate of 5-6 rpm with a given voltage. To me, low-speed / reasonable torque ought to translate into a fairly smooth rotation. Maybe I could get away with running it off of a relay?

I realize 20W is WAY overkill for this project, but there is the reason for my power madness:
My wife is a huge Labyrinth and David Bowie fan.
The two songs the music box will be able to play is:
-Button One: Music box version of Button Two. Sounds like an actual music box.
-Button Two: Full song of "As The World Falls" Down by David Bowie.
Clarity and reasonable volume are desired here. This is why I am also adding a volume potentiometer to the base, so she can adjust the volume to her liking (she IS the type to turn things up a bit, close her eyes, and get lost in it).

If you think anything I have said is mental or if I am off in left field about anything, feel free to tell me! It has been YEARS since I have done anything like this and I was JUST starting to get into Arduino, so I am very excited about opening that door again. I feel like a dry sponge and will try to soak up anything you wonderful folks have to offer!

Thank you all for your wonderful input!

If you think anything I have said is mental

Not at all, I worked on this project:-

anyone feel that I could get away with NOT using a "motor shield"

Sure shields are just a convenient way of adding electronics to an Arduino. I very seldom use them but make all the extra drivers and such on strip board.

Larry's circuit in reply #7 involves just one IC and will fit onto a very small board.

You don't want any "shield". It's going to be too bulky for your base.

You're going to want to solder everything firmly and securely on protoboard or perfboard. A Nano or Pro Mini is a much more sensible form factor than an Uno (keep that one for your experimenting, they're great for that, not so much for permanent projects).

The ubiquitous 28byj-48 stepper will get the job done just fine. It's not weight that counts, it's torque. A doll balanced properly straight on top of the axis will need very low torque to move. A simple geared down DC motor just the same - get one with a gearbox that gets it to the speed you want, or a little higher. It'll have massive torque at that speed. Look for a 5V motor, so you can stick to a single 5V power supply. Makes it simpler.

You don't need a motor controller, all you need for a DC motor is a single MOSFET switch. You need only one direction (and one speed, though you can still vary that if you want). For the stepper a standard ULN2003 driver and you can go both directions and have speed control at the same time.

Most of the bulk is probably going to be the speakers (better quality usually means bigger size).

gmh5760:
Wow. I gotta tell you guys that I am absolutely LOVING the feedback in here!
To be honest, I was expecting it to take a few days to get a somewhat helpful reply.
These responses are great!

That's what happens to posters who did their homework :slight_smile:

Grumpy_Mike:
Not at all, I worked on this project:-
https://www.youtube.com/watch?v=Nn5E0htREFE

That's cool! Encoder for the "wind-up" screw, magnets in that transparent disk?

Encoder for the "wind-up" screw, magnets in that transparent disk?

Yes that's right. I made the windup bit and the magnet reader head. I helped my pal Lewis Sykes who designed the concept and did most of the mechanical construction.
Here is a picture of my CNC project milling the PCB for the read head.

@G F
Whow, You run an MF70. So do I. I roasted the first spindle motor and with lots of trouble I got a replacement motor and fit it. Then steppers have then been attached. With help from this Forum I have a temperature sensor reading UNO that is monitouring the motor temperature. If the temperature reaches alarm level the other UNO controlling the CNC will halt execution, raise the tool out of the workpiece and then cut of the MF70 power until the motor has cooled down some 20 degree C. The MF70 power, Z axes position restored and the CNC work will continue.

Would it be okey to use private message for some chat about the MF70?

Sorry. @G M......

Sorry about the gap in communication everyone.

Our company has been SUPER busy trying to get everything together for Shot Show next week.

I will no doubt be busy with some more research and trying to put together some well thought out questions for you fine folks in the weeks to come.

I can't thank all of you enough for your outstanding feedback. I absolutely LOVE a challenge accompanied by intelligent conversation!

Okay, I am completely on board with the 28BYJ-48 stepper, which looks like it is well complimented by the ULN2003 driver.
(Combo setup of the stepper/driver.)
It looks like it will require 4 pins from the Arduino (thinking Nano at this point). I'll have to see the pin requirements in their totality once all components have been selected.

As far as component selection goes, this leaves me with still selecting components for MP3 playback (either from SD card or hard-stored), possibly amplification (wanting audio for music box to be of reasonable volume and clear) and a means for some LED lighting from above the rotating doll.

Saving the audio playback to figure out last and focusing on the LEDs, I see that the I/O pins are limited to 40mA each. Looking at Superbrightleds.com I see that most component white LED specifications are looking around 3.5v at 20mA (example LED). This limits me to the PWM of a single LED? I was initially thinking 4 (under doll overhang, 90° apart). With what I am seeing (as far as driving the LEDs directly from the Nano) I would have to either limit myself to a single LED, or use four separate pins. Four of the above-specified LEDs in series would require 14v (pins are limited to 5), but in parallel would require 80mA (pins are limited to 40). I feel like I am missing something here. Thoughts? Would I be looking at needing to use a solid state relay or something (like this)?