Having a baby is great! It is cute, it is sweet, makes a lot of fun, and - it requires your attention almost every second of the day (and night) [spoiler alert]. This can be quite demanding. Especially when you need a few moments to yourself - and may it even be to eat the smallest bite. Our baby literally waits perfectly calm until we sit down to have dinner - deciding that it is just about time to request some entertainment from us. Luckily smart guys invented baby bouncer chairs, which calm babies with soothing bouncy rocking motion - almost like in mommy's belly.
We bought such a thing and its performance is great. It rocks the baby and Emil really seems to like it (even while we eat). However, it is still necessary to bounce it manually. We even ended up attaching ropes to our feet to keep our hands free. Long story short: I needed to invent some solution to this.
What we needed was a mechanism that performs an oscillating motion more or less matching the Eigen-frequency of the chair, since this requires only a small amount of power while having great effect. That only being a complicated way to say: It needed to bounce the baby well.
Finding the components
Since quite some time I had a PIC development board StartUSB by Mikroelektronika lying around, intended for another project. It is a very basic 8-bit RISC micro-controller, but perfectly feasible for this kind of project. A big plus is also that it is programmable over USB and the microC C-Compiler by MikroElektronika is free-to-use for small projects (fully functional, but limited to 2K of ROM lines). So it was time that it finally got to work.
For the actuation the first thing I considered was a quite powerful RC servo. Servos are well integrated and steer the requested angle autonomously by internal feedback loop. Is is, however, a bit messy to provide them with enough power, especially like in this case where quite a bit of power is sometimes needed. They pull just as much as they need, which in this case was more than all my power supplies could deliver. As a result of this my first prototype often reseted itself, when the servo was pulling too much. Pushing the micro-controller into a brown-out reset. Some clever placement of capacitors close to the control board or some scheme to limit the power to the servo would have fixed that, but it was also very noisy and not fast enough.
Consequently I was looking for something else and found it in form of a stepper motor. I never really came to actually using the stepper motors I bought few years back (again for another project :) ). Funny enough, I had even some stepper motor driver modules so I could start experimenting right away.
The stepper controllers by Pololu have the big advantage that they limit the output current to a pre-defined value, which resolved my voltage drop-out issues and on top of that support mirco-stepping (which I come to in a minute for noise reduction). I took a 12V power supply as direct driving source for the stepper and a small step-down converter for supplying the logic. Both modules are from Pololu. The stepper module A4988 and as step-down converter a D24V6ALV.
Connecting the three components was really simple. The schematics is straight forward without big surprises. It is recommended to connect a large capacitor close to the Pololu A4988 to catch big voltage jumps generated by the switching, but it was working also without it for quite some time before I finally introduced it.
I wanted to keep the soldering as simple as possible, which is why I added just one button. One was at least necessary to control the speed of the pulling as well as the pull distance. Since I found no decent way to control both parameters at run time, I introduced a setup phase in the software that is entered when the button is pressed during boot time of the PIC.
As control mechanism for the stepping I leverage one of the numerous timers of the PIC 18F2550 and do the stepping in an interrupt context. This way the inter step-periods are equidistant and the stepping is smooth.
My project code is available on GitHub and contribution highly welcome. https://github.com/mstaflex/pic_step_motor_controller
The version in the video is an earlier stage-prototype where the noise generation is quite noticeable. Our baby was not really irritated by it - maybe it is even soothing - but for us it was too loud for longer periods of time.
The spring visible in the picture and the video plays an unexpected important role. It decouples the motion of the motor from the bouncer and equalizes forces. Without it, this version with stepper motor would actually not work at all. Dimensioning the spring can be somewhat a challenge. It plays together with the attachment point of the pull rope on the actuator arm. Either the attachment point is close to the axis (can bear higher torque) and the spring is harder, or the other way around. In the end it is important that the motor can produce the necessary strength without loosing steps.
Fine tuning the noise
One major problem in the early prototypes was noise. Due to the discrete steps of the stepper motor and the attached wooden actuator arm, the construction had a very prominent and characteristic sound during operation. In the beginning it was just so loud that we had to pump up the volume of the TV in order to follow the news. This was of course unsatisfying and I started to search for solutions.
One thing that can be easily done is using micro stepping in the stepper controller. This way one discrete step of the motor is broken down into smaller virtual steps by applying PWM signals to the stepper coils. This reduces the strength of the motor quite a bit but at the same time reduces also the generation of noise. Another big improvement came with the way I attached the motor to the chair. By isolating it with soft materials, the noise went down another few dB. Now it is relatively subtle and acceptable.
GitHub project files
As mentioned above, the code to this project is available on Github. https://github.com/mstaflex/pic_step_motor_controller