3

My neighbor is having his first child shortly, and in the spirit of "it's never too early to learn programming/electronics" we feel the child should have access to a Raspberry-Pi of his/her own. Meaningful output devices for 1-week olds are fairly limited and I'd prefer to wait until the child has finished teething to install a touchscreen display. A baby mobile seems to be an interesting alternative to the touchscreen.

I'm aware of someone else who is interested in a similar project; however their question hasn't received much attention. I'll try to be a bit more specific about my questions here.

  1. The crux of this device would be a motor that spins the mobile at some slow and variable rate to be determined. It would need to be able to withstand batting by the child. What type of motor would be suitable for this type of application?

  2. We clearly need audio, and there are plenty of examples of how to make this happen in conjunction with user inputs; the playing sounds with buttons example on the adafruit website is what I have in mind. What I'm looking for is an appropriate sound output that is lightweight, robust and suitable for a child (meaning that it doesn't need to be audiophile quality). What sort of audio output device is recommended for this type of application?

  3. Lastly, I'm focusing primarily on the movement and audio of the mobile at the moment, but I can envision adding an IR remote as well as a nanny cam. I'm interested in instructions on how to integrate other features into a baby-friendly Pi.

Update 1

It looks like controlling a DC motor as well as audio is not a trivial task. The PWM and Servo Module from Adafruit apparently interferes with the 3.5mm audio output jack. I'd appreciate any references, instructions on how to operate a motor while also being able to play sound. (Note, I'm still doing research, and haven't actually played with this setup yet, so it may be that I'm dealing with old/false information here.)

2 Answers 2

2
  1. You could go with a stepper motor to get ultimate control over speed, but it probably overkill. I would just go with a DC motor, and some gear-reduction to lower the speed, and increase the torque. You can power the motor, via a transistor, by one of the GPIO pins. You could use PWM to make it move slower.

  2. Just use some cheap, un-amplified speakers. Sound quality is not great, and volume won't go very high. But in you situation, that is no problem.

  3. For IR control, I'd suggest reading the post by yours truly: https://raspberrypi.stackexchange.com/a/7871/7863

For camera, look at what some people have already done with camera-security on their Pi.

Maybe use eye detection, to play music when it wakes up. And stop playback if eyes have been closed for something like 5 minutes.

Perhaps use some PIR-motion sensor, to e.g. detect Sudden infant death syndrome (SIDS).

If you have any other question, feel free to ask.

2
  • Eye detection is a very cool idea. That typically involves some fairly heavy duty image processing. Is that doable and/or available on the RPi already? Aug 12, 2013 at 22:45
  • It's doable. But you'll probably look at a framerate/processrate of something like 2fps. But that would be fine in your case. Check out what others have already done with OpenCV on a Pi.
    – Gerben
    Aug 13, 2013 at 16:29
1

Hey i dont know if you have solved this problem yet (bit of an old question :P) but anyway here is a little solution for you.

Because you dont need perfect timing and control for the DC motor i suggest you try to use software PWM on a different pin (any GPIO pin works with this).

First off you will need to get the wiring pi library

 git clone git://git.drogon.net/wiringPi
 cd wiringPi
 ./build

will install it for you then use this code

import wiringpi
wiringpi.wiringPiSetupSys // For /sys/class/gpio with GPIO pin numbering

wiringpi.softPwmCreate (int pin, int initialValue, int pwmRange)

This creates a software controlled PWM pin. You can use any GPIO pin and the pin numbering will be that of the wiringPiSetup() function you used. Use 100 for the pwmRange, then the value can be anything from 0 (off) to 100 (fully on) for the given pin.

The return value is 0 for success. Anything else and you should check the global errno variable to see what went wrong.

wiringpi.softPwmWrite (int pin, int value) ;

This updates the PWM value on the given pin. The value is checked to be in-range and pins that haven’t previously been initialised via softPwmCreate will be silently ignored.

Then you can run your sound fine through the analogue output :)

2
  • old but still active (I'm a slow hobbyist). Thanks for the suggestion and I'll give it a shot. Sep 6, 2013 at 11:21
  • If the code doesnt work exactly its worth googling the python wrapper for wiringPi as i did this from my head at work so it may not be spot on :P
    – D Mason
    Sep 6, 2013 at 11:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.