Baby Crib Mobile - Powered by Alexa
As a mother, I was inspired to create something that would help new mothers of newborns. New mothers are tired and babies cry. Often, they just need a little bit of soothing.
MINDSTORMS and Alexa together provide the perfect solution. With MINDSTORMS, you can easily construct a mobile to hang over the crib. This mobile can be customized to fit the decor of the room or personality of the child. When the baby starts to cry, all the mother has to do is ask Alexa to play the baby music. Alex will play gentle music and make the mobile elements spin according to the beat of the music. In addition, the lights of the EV3 brick blink to entertain the baby.
This project can be built with parts in the LEGO MINDSTORMS Edu set plus two large EV3 Motors. Extra dangling elements and animal designs may be substituted with anything small you have on hand that fits with your baby room. The design I started with is a Quadcopter flipped 180 degrees. In addition, the gearing was reversed so that the motors slow down (rather than speed up) for this particular project. The build instructions are very simple and require repeating the same step four times. This makes this project very accessible to beginners.
The project was designed to be as simple as possible. The software is based on the starter code provided by Amazon Alexa. The code has been customized for this project so that four motors on the mobile will turn. The rate of movement has been slowed down to be made more appropriate for a baby mobile. The blinking lights in the code provided was kept. This project was kept simple and reuses the core code provided so that it can be easily recreated by a beginner.
- Setup your environment using the LEGO MINDSTORMS Voice Setup
- Complete Mission 1 to get your EV3 Brick connected to your Amazon device.
- Complete Mission 2 so that you learn how to have your EV3 motors react (dance) to music.
- Add two more motors since the basic code was only for two motors.
self.left_motor = LargeMotor(OUTPUT_A)
self.right_motor = LargeMotor(OUTPUT_B)
self.top_motor = LargeMotor(OUTPUT_C)
self.bottom_motor = LargeMotor(OUTPUT_D)
- Find the code for motor movements. Slow it down. I changed it from a constant to something that is related to the tempo of the music.
motor_speed = 2*bpm
- Change the movement such that it goes in one direction for longer so that it will be more pleasing for a baby.
milli_per_beat = min(8000, (round(60000 / bpm)) * 4.65)
- Apply this motion to all 4 motors instead of the default fixed duration that was very jerky.
How it works:
When the mother hears the baby crying, she asks Alexa to play baby music. This also activates the MINDSTORMS Baby Mobile.