Author Topic: Simple circuit for spinning a motor, pausing, then spinning the other way  (Read 9376 times)

0 Members and 2 Guests are viewing this topic.

Offline vranghelTopic starter

  • Contributor
  • Posts: 32
  • Country: de
Hi everyone,

I'm an electronics hobbyist (beginner level) who likes to dabble with building different simple circuits (mostly solar).

Since I do not have the expertise to design my own circuit, and google did not help, I'd pose the question to the highly knowledgeable members of this forum:

I'm looking to build a very simple analog circuit (made of vanilla components, so no specialized chips) that spins a small (3-4V) geared motor one direction, stops for about 15 minutes then spins the other way, stops for 15 minutes and so on. The motor needs to stop in a certain position therefore a limit switch could be used. Preferably, the circuit would be run off a Li-Ion battery or directly from a 5V batter bank. I looked into a H-bridge to control the direction of the motor. The circuit doesn't need to be very accurate in terms of time, and ideally I'd be able to adjust the time with a potentiometer.

This circuit would be used to periodically rotate a small 10 cm tall decorative hourglass once the sand has run out.

Thanks!
 

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 4671
  • Country: nl
An H-bridge needs at least 4 "power" transistors and two smaller transistors to drive them. What's wrong with using something like an A4950? They can be bought cheap on breakout boards.

You can put the end switches directly in series with the motor. That way the motor stops when one of the switches is hit.
But the motor has to be able to run back, even when it's leaning against a switch, so bridge each of the switches with a diode. The diode has to be able to pass the full motor current.

For a 15 minute delay something like a NE555 will be difficult (maybe you can go that far with the CMOS version, but it would require high value resistors, and low leakage electrolytic capacitors. 15 minutes = 900 seconds, so 1Mega Ohm and 1000uF may get you there.

Something like a CD4060 is much better for longer times. It can easily reach a day or two.

But there is a potential problem here. You may damage your motor driver transistors if you put switches between the transistors and the motor. Putting a TVS over the motor may help here




 

Offline SmallCog

  • Frequent Contributor
  • **
  • Posts: 315
  • Country: au
Good excuse to play with a 555 timer for the interval timing. There’s a bunch of other options but if you’ve not experimented with a 555 before then now’s as good a time as any.

If you’ve not played with 74 series logic then chuck some of that in there to toggle between directions with the clock pulses from the 555

OR a few lines of code in an arduino

 

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 4671
  • Country: nl
Instead of an H-bridge you can also use a DPDT relay.

So a motor, two end switches, two diodes, a relay, and that just leaves the power supply and timing.
Having a relay on for 50% of the time will drain the battery though. Maybe using two relays or a latching relay is a better option.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13848
Any long-period discrete analog time-keeping function should be avoided at nearly any cost.   Your 15 minute period implies either the baroque complexity of a digital divider chain built out of discrete components i.e. Eccles Jordan bistable (flip-flop) circuits with steering diodes, to get the oscillator frequency up to a more reasonable range, or a RC time constant of approx. 1000 (exact value depends on voltage thresholds.   The math says a 1 Meg resistor and a 1000 uF capacitor would do the job, but the math doesn't allow for leakage currents.   With a 5v supply, on average the resistor is only going to be passing a couple of uA, but an electrolytic capacitor of that value is likely to be specified to have a max. leakage current of a few tens of uA, so unless you are very lucky and pick a capacitor that's at the extreme low leakage end of the bell-curve, the leakage current will dominate, leading to grossly incorrect timing, or even total failure to reach the end of the timing period.

Also analog timing circuits aren't known for their low power consumption.  The quiescent current drawn from the battery by the timing circuit is likely to be greater than the average motor current as it has such a low duty cycle.

Nowadays, even with the supply chain issues, any sane engineer would say "Use a MCU."   Even the lowliest 8 pin PIC or AVR, or one of  Padauk's sub $0.04 MCUs can do the job with code space and pins to spare.  It comes down to availability and cost of development tools.  If you don't already have any sort of MCU experience and tools, €5.49 will get you a Digispark Rev 3 clone with an ATtiny85 MCU on it, self-programmable over USB  using the Arduino IDE. 

Back in the day, before cheap easily reprogrammable MCUs, this would have been a job for 4000 series CMOS logic.  The chip of choice would be the CD4060 (or one of its many second source equivalents) which has an on-chip oscillator suitable for RC timing, crystals and resonators + a 14 stage binary divider chain.  To toggle the final output with a 30 minute period, (so it can directly be used to control the H-bridge for a motor wired with diode across its limit switches so it stops at each limit till the drive voltage to it is reversed), would require its oscillator to run at fractionally over 9 Hz, entirely practical for a RC timing circuit with reasonable resistor and capacitor values.   Nowadays one might choose the 74HC4060, which is better for 5V and lower supply voltages.

Go back 50 years or so before RCA added the CD4060 to their new 4000 series CMOS product range (launched in 1968), and there was a short window of probably less than a decade when a fairly large board full of transistor flip-flops and logic would have been the preferred solution.  Before that, a chain of Decatron counters dividing down the mains line frequency would have been the preferred electronic implementation, but in nearly all cases an electromechanical solution of a high reduction ratio synchronous gearmotor driving a cam operated switch would have been preferred, because it was far far smaller, cheaper, lower power and more reliable than a chassis full of 30 Decatrons!
 

Offline vranghelTopic starter

  • Contributor
  • Posts: 32
  • Country: de
I've looked at CD4060 and might be the chip i need for timing: https://www.build-electronic-circuits.com/4000-series-integrated-circuits/ic-4060/
However, I do not know how to integrate the chip into the H-bridge circuit with diodes.
Would you be able to draw a quick and dirty schematic?

EDIT: I have found CD4040 in my parts bin, which apparently is a CMOS 12-Stage Ripple-Carry Binary Counter/Divider, very similar to the CD4060 which is a CMOS 14-Stage Ripple-Carry Binary Counter/Divider and Oscillator
« Last Edit: May 30, 2022, 12:11:19 pm by vranghel »
 

Offline themadhippy

  • Super Contributor
  • ***
  • Posts: 4228
  • Country: gb
The CD4040 requires a clock to make it work,the cd4060 has a built in "clock" so only needs a couple of resistors and a capacitor added to get it running.
 

Offline vranghelTopic starter

  • Contributor
  • Posts: 32
  • Country: de
The CD4040 requires a clock to make it work,the cd4060 has a built in "clock" so only needs a couple of resistors and a capacitor added to get it running.

Oh, I see now;
I have CD4017, which, according to the datasheet https://www.ti.com/lit/ds/symlink/cd4017b.pdf?ts=1653912905120&ref_url=https%253A%252F%252Fwww.ti.com%252Fproduct%252FCD4017B%253FkeyMatch%253DCD4017, I think also has a clock?
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3838
  • Country: us
Use the CD4060 to provide the 15 minute clock signal to the 4017.

This page describes how to get long timing periods out of the 4060:

https://www.gadgetronicx.com/how-to-build-24-hours-timer-circuit-cd4060/
« Last Edit: May 30, 2022, 12:34:08 pm by ledtester »
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13848
Like the CD4040, the CD4017 requires an external clock.  It also only divides by 10, useless for the timing part of your application.  However if clocked once every three minutes, it could be useful to drive a discrete complimentary MOSFET H-bridge from its '0' and '5' decoded outputs, without risk of shoot-through;)

How to drive an H-bridge from a CD4060 depends on what control inputs the H-bridge has, and for your application, depends on how you implement the limit switches.    If you use logic level limit switches its considerably more complex than if they are beefy enough to carry the motor current.
 Read https://www.eevblog.com/forum/beginners/my-12v-dc-motor-is-not-turning/ starting at reply #18 noting my comments to get an idea of how simply reversing the motor supply can make it run till it stops at the limit switch.  If you've only got ONE limit switch and want the mechanism to do a (nearly) complete rotation, it must be DPST-NC (or DPDT) so electrically it can be wired as-if it was two separate switches.

Tell us about your H-bridge or ask us to help you pick or design one.
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3838
  • Country: us
I can imagine that the CD4017 would be useful for implementing the state of the application. It is a flexible way of programming a cycle of up to 10 states.

The OP's application only requires 4 states:

state 0: drive the motor forward
state 1: turn off the motor
state 2: drive the motor backwards
state 3: turn off the motor

Once an H-bridge has been selected we can figure out how to use the outputs of the 4017 to drive the inputs of the H-bridge.
 

Offline vranghelTopic starter

  • Contributor
  • Posts: 32
  • Country: de
Like the CD4040, the CD4017 requires an external clock.  It also only divides by 10, useless for the timing part of your application.  However if clocked once every three minutes, it could be useful to drive a discrete complimentary MOSFET H-bridge from its '0' and '5' decoded outputs, without risk of shoot-through;)

How to drive an H-bridge from a CD4060 depends on what control inputs the H-bridge has, and for your application, depends on how you implement the limit switches.    If you use logic level limit switches its considerably more complex than if they are beefy enough to carry the motor current.
 Read https://www.eevblog.com/forum/beginners/my-12v-dc-motor-is-not-turning/ starting at reply #18 noting my comments to get an idea of how simply reversing the motor supply can make it run till it stops at the limit switch.  If you've only got ONE limit switch and want the mechanism to do a (nearly) complete rotation, it must be DPST-NC (or DPDT) so electrically it can be wired as-if it was two separate switches.

Tell us about your H-bridge or ask us to help you pick or design one.

Thanks Ian. Seems I have to order a CD4040. I read your comment in the other thread and I think I get the general idea: Wire the NC switch with a diode, so even when the switch is open, the diode allows it to conduct the other way, so it can reverse until it opens the other NC switch.

As for the H bridge, I do not have one in mind, so I'm definitely open to ideas/suggestions, and how to combine the 2 circuits and the switches. The motor running will require low current, most likely under 100mA
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13848
*NO* order a '4060', not a '4040' e.g CD4060, MC14060, HEF4060, NTE4060 etc. or a 5V logic version of it, e.g. any brand of 74HC4060 or 74HCT4060, because you *WANT* that built in oscillator to keep the circuit simple.

If a running brushed DC motor draws 100mA, odds are its stall current, which it will transiently draw if starting from standstill or reversing will be of the order of 1A.

What junk bin power transistors do you have capable of handling >1A?  N.B. you need 2x PNP + 2x NPN, or 2x PMOS and 2x NMOS.  If using MOSFETs, they must have a min. Vgs threshold voltage <2.5V to ensure you can turn them fully on from only 5V level logic signals.
If the answer is none or not enough, you'll probably be best off buying a H-bridge chip or module.
« Last Edit: May 30, 2022, 01:10:39 pm by Ian.M »
 

Offline vranghelTopic starter

  • Contributor
  • Posts: 32
  • Country: de
*NO* order a '4060', not a '4040' e.g CD4060, MC14060, HEF4060, NTE4060 etc. or a 5V logic version of it, e.g. any brand of 74HC4060 or 74HCT4060, because you *WANT* that built in oscillator to keep the circuit simple.

If a running brushed DC motor draws 100mA, odds are its stall current, which it will transiently draw if starting from standstill or reversing will be of the order of 1A.

Ah sorry, I meant 4060, but wrote it wrong, since I was looking at both datasheets side by side.

I am wondering is there is a way to create an H bridge out of only 2 switches and diodes as seen here: https://en.wikipedia.org/wiki/H-bridge#/media/File:H_bridge_operating.svg
Using the adjustable timer section circuit of the page: https://www.build-electronic-circuits.com/4000-series-integrated-circuits/ic-4060/ might work, but I need the timer to reset itself after each run, so when the motor trips the switch


 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13848
No.  A H-bridge needs min. four switching elements.  It may also need four diodes to handle the back-EMF from the motor.

You don't need the counter/timer to reset after each run.  Use a MOSFET H-bridge which draws negligible current when ON in either direction, with the motor disconnected, use limit switches that disconnect the motor till its drive is reversed, and let the counter/timer free-run, simply reversing the H-bridge direction once every 15 minutes.
 

Offline vranghelTopic starter

  • Contributor
  • Posts: 32
  • Country: de
Would 74HC4060 (https://www.ti.com/lit/ds/symlink/sn74hc4060.pdf) work as a drop in replacement for CD4060?
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13848
Sure, up to abs. max. 6V supply.   Above that voltage, odds are it would let the magic smoke out!
 

Offline vranghelTopic starter

  • Contributor
  • Posts: 32
  • Country: de
Any suggestion of an H bridge circuit to use with 4060?
 

Offline vranghelTopic starter

  • Contributor
  • Posts: 32
  • Country: de

What junk bin power transistors do you have capable of handling >1A?  N.B. you need 2x PNP + 2x NPN, or 2x PMOS and 2x NMOS.  If using MOSFETs, they must have a min. Vgs threshold voltage <2.5V to ensure you can turn them fully on from only 5V level logic signals.
If the answer is none or not enough, you'll probably be best off buying a H-bridge chip or module.

Since it might be easier, I will order L293D: https://www.ti.com/lit/ds/symlink/l293d.pdf?ts=1653919565123&ref_url=https%253A%252F%252Fwww.ti.com%252Fproduct%252FL293D
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13848
*DON'T* buy a L293D.  Its a bipolar H-bridge and has excessive voltage drop for low voltage use.  See its datasheet section 6.5 Electrical Characteristics.  Voh is typ. 1.4V below Vcc and Vol typ. 1.2V above ground, and you'll loose a bit more in the diodes to permit reversing out of the limit  across your limit switches, leaving you with 2V or less at the motor with 5V Vcc.  Also note its Icc1 and Icc2 supply currents, which IMHO make it unsuitable for a long-duration low power battery powered application.

Discrete complimentary BJTs can be driven hard enough to get the total voltage drop under 1V, so suitable for a 5V motor, but the drive circuit quiescent current will be excessive for a battery application

You need either a CMOS fully integrated H-bridge IC (beware of H-bridge controllers that need you to add external MOSFETs) or four low Vgs threshold MOSFETs, two each N channel, and P channel.
 

Online RoGeorge

  • Super Contributor
  • ***
  • Posts: 7888
  • Country: ro
This circuit would be used to periodically rotate a small 10 cm tall decorative hourglass once the sand has run out.

To turn an hourglass it would be enough only one direction, so no need for a H-bridge.

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13848
Possibly, but that depends on the hourglass mechanism permitting continuous rotation.  It would certainly be simpler - drive the motor with a low-side transistor,  controlled by a 4060 output.  The limit switch would be capacitively coupled to the 4060 RST pin, to reset the 4060, turning off the motor and restarting the timer when the limit position is reached.
 

Offline Terry Bites

  • Super Contributor
  • ***
  • Posts: 2954
  • Country: gb
  • Recovering Electrical Engineer
Here's a simple bridge. https://thecodeprogram.com/h-bridge-circuit-and-control-a-dc-motor The diodes are essential or back emf will kill the transistors- 1N4148s will do. What current do you expect/ measure does your motor need? A little gear motor would work well here. It redcues the current requirment for a given torque and reduces shock on your motor and glassware.
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 21886
  • Country: gb
  • 0999
I'd just use a DPDT relay, as it's a low current motor.

VDD can be connected to +V and 0V to VSS. The circuit is drawn with them separate, so the motor can be isolated from the control circuit if necessary.

D1 and D2 need to be rated to the motor's current.

D3 can be smaller, but it might as well be the same as D1 & D2 to simplify the parts list.

The input goes to the 4060's output. The 4060 should be set for a period of 30 minutes. SW1 and SW2 are limit switches, which again need to be able to pass the motor's full current. Check pushing the appropriate switch prevents the motor from rotating in the direction which would cause it to stall when limit it reached. It's probably easier to swap the motor connections if it's wrong.

K1 is a DPDT (Double Pole Double Throw) relay with the appropriate coil voltage for the control circuit and contact rating for the motor current.

It's possible to do this with transistors, but it's more complicated.

« Last Edit: May 30, 2022, 03:13:13 pm by Zero999 »
 

Offline vranghelTopic starter

  • Contributor
  • Posts: 32
  • Country: de
*DON'T* buy a L293D.  Its a bipolar H-bridge and has excessive voltage drop for low voltage use.  See its datasheet section 6.5 Electrical Characteristics.  Voh is typ. 1.4V below Vcc and Vol typ. 1.2V above ground, and you'll loose a bit more in the diodes to permit reversing out of the limit  across your limit switches, leaving you with 2V or less at the motor with 5V Vcc.  Also note its Icc1 and Icc2 supply currents, which IMHO make it unsuitable for a long-duration low power battery powered application.

Discrete complimentary BJTs can be driven hard enough to get the total voltage drop under 1V, so suitable for a 5V motor, but the drive circuit quiescent current will be excessive for a battery application

You need either a CMOS fully integrated H-bridge IC (beware of H-bridge controllers that need you to add external MOSFETs) or four low Vgs threshold MOSFETs, two each N channel, and P channel.

I have cancelled the order  ;D

This circuit would be used to periodically rotate a small 10 cm tall decorative hourglass once the sand has run out.

To turn an hourglass it would be enough only one direction, so no need for a H-bridge.

You're totally right, it only needs to spin in one direction, trip the switch so it stops, wait 15 minutes, do half a turn and stop when it trips the switch.

Possibly, but that depends on the hourglass mechanism permitting continuous rotation.  It would certainly be simpler - drive the motor with a low-side transistor,  controlled by a 4060 output.  The limit switch would be capacitively coupled to the 4060 RST pin, to reset the 4060, turning off the motor and restarting the timer when the limit position is reached.
This sounds like the most elegant and simplest solution. What do you mean when you say 'The limit switch would be capacitively coupled to the 4060 RST pin', what does 'capacitively coupled' mean?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf