I'm a civil engineer, hiker, and hobby photographer. I am trying to build a little device that gently turns a small motor on every x seconds, keep it on for y seconds, and stop it for z seconds. For example, Set the motor to run every 30 seconds, have it run for 45 seconds, and stop it for 37 seconds. In addition, the movement of the motor must be such to minimize vibration on the camera that it will support.

Above all this device must be portable in a regular backpack.

I have played with the raspberry pi a little bit (I don't own one) and have dabbled in electronics a touch

  • 3
    \$\begingroup\$ If every 30 seconds it runs for 45, it's running all the time, but you probably mean stop for 30 seconds after running. A very simple micro with a PWM to a servo drive can do that easily. Certainly overkill for a PI. \$\endgroup\$ – kenny Oct 20 '12 at 10:53
  • \$\begingroup\$ @kenny True, I reflected your comment in my question \$\endgroup\$ – dassouki Oct 20 '12 at 10:55
  • \$\begingroup\$ What's the purpose? \$\endgroup\$ – starblue Oct 20 '12 at 10:58
  • \$\begingroup\$ Overkill for a Pi yes, but perhaps not wildly extravagant for a total newbie to buy a Pi + IO board + follow one of the tutorials to wire a motor to it & control it from Python script or something. Certainly more likely to yield a result than trying to learn micros from scratch. \$\endgroup\$ – John U Dec 3 '13 at 22:19
  • 1
    \$\begingroup\$ What voltage and current (power) requirements are we talking about here, ie what´s the motor? In any case, you could start by looking at the 555 timer. Plenty of circuits out there if you search around a bit. \$\endgroup\$ – F. Bloggs May 20 '15 at 16:21

Even after your edit the data on timing don't make sense: you can't run a motor for 45 seconds every 30 seconds. But the pattern isn't important for the solution.

I would use a small microcontroller like the PIC10F200, which doesn't need any external components to create the on/off pattern. You can have the 10F200 in a DIL package (left), or a 3 mm long SOT23-6 package.

enter image description here enter image description here

The microcontroller can't drive a motor directly, so use an output pin to control a transistor which drives the motor:

enter image description here

You don't say anything about RPM, but this small geared DC motor is available gear-ratios from 4.4:1 to 499:1 for 2020 RPM down to 12 RPM. For even slower you can add an extra gearbox.

Stepper motors are also often used with microcontrollers because you can control their position very accurately, but they require more complex control signals than the simple on/off, and especially at low RPMs don't run smoothly: they're not called "steppers" for nothing.

  • \$\begingroup\$ Much better to use a small low threshold NFET than a bipolar transistor, but the basic idea holds. \$\endgroup\$ – Chris Stratton Sep 14 at 22:09

Pi may be an overkill, but that can be justified. Pi is a development platform that the O.P. already has some familiarity with. It fulfills the portability requirements. The resulting gadget is a one off (as opposed to mass production), so I would think that cost of parts is not so critical.

On the opposite (low) end of complexity is the venerable 555 timer. If it's wired in the astable circuit with variable R1 and R2, it can produce a square wave with variable frequency and duty cycle.

enter image description here

Like microcontroller, 555 can't drive the motor directly. It will require a BJT arrangement similar to one in the post by @stevenh, or a MOSFET.


I recommend using a 555 timer for your 30-second intervals. It's not terrifically accurate, but I imagine it will be close enough:

555 timer

You can calculate the on-time (t1) and off-time (t2) using the values for Ra, Rb, and C.

You'll need to drive the motor through a transistor though. Make sure you choose a transistor that not only can handle enough current to properly run the motor, but that can also be driven by the 555 timer.

[This answer have arrived to this thread as a result of a merge.]


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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