# DC Motor Speed Control with Feedback

#### spud1989

Joined Dec 23, 2020
3
Looking for some guidance on where to go next with a project. I've made an automatic feeder for some barn cats. It uses an AC outlet timer to energize a 555 timer once a day for 30 min. I have the RC circuit for the 555 setup such that it runs on initial startup for a certain amount of time depending on potentiometer setting then shuts off for the rest of the 30 min time. This goes through a relay which drives a geared DC motor on an auger.

Functionally it works and have been using it for about 6 months. The problem is the motor speed is not constant. As the hopper empties over time, the load on the motor decreases, so it speeds up, and gives more food as the it empties (over about a 2 week time frame). I don't see a good way to change the hopper design to keep the load constant over time.

I'd like to make a version 2, with these fixes. I'd like to keep the circuitry costs under $20 if possible. I may end up making a few of these for other people and will probably have another$30-40 in motor, AC/DC converters, outlet timer, etc.
1) Feed a fixed amount of food even as load on the motor changes. I could see a few ways of doing this - motor speed with feedback (either rotation counter or back EMF), instead of shutting the motor off after a certain amount of time shut it off after xx motor rotations.
2) It would helpful if I could get rid of the AC outlet timer. It's not critical if the start time drifts day to day.

I need some help understanding what a good option to pursue is. I'm still a beginner for the most part but if can get a general idea of what direction I need to go, can typically get it functioning. I've read a bit on motor speed control (there's tons of options), a bit about PIC's (a bit over my head at this time), and some low cost Aurdinos. The Arduino pro mini is interesting, as I have an Uno and a couple motor drivers and could play on that before buying more hardware.

Joined Feb 20, 2016
3,913

#### Ian0

Joined Aug 7, 2020
3,252
If you could count motor rotations it would avoid having to do any motor power control. It would be fairly easy to do it with no more than a counter IC.

#### LesJones

Joined Jan 8, 2017
3,497
I agree with Ian. I use this method with an automatic feeder for the hedgehogs that visit our garden. I use a PIC16F628 to control the counting. It has an 8 bit dip switch connected to one I/O port so I can easily change the number of revolutions of the auger. (It actually uses 2 pulses per revolution.) At first it was powered from a plug in timer which was set to switch on for one minute at the required time. When power was applied it rotated the motor for the set number of revolutions then stopped. It only starts again after power has been switched off. Here is a picture showing the slotted opto sensor which detects notches cut in an aluminium disk.

I have now replaced the timer with a light level sensor that trigeres the dispenser (After averaging 16 light level readings.) at around sunset. I can provide the schematic and code for the PIC if it is any use to you.

Les.

#### spud1989

Joined Dec 23, 2020
3
You could use a stepper motor as the speed is controlled by the step rate.
These can be easily obtained from old printers that are often tossed.
An Arduino would be my first choice for a controller, and it drives 4 FETs if the stepper is a 5 wire one.
Have you looked at that sort of thing?

EDIT: An example...
https://www.onetransistor.eu/2017/11/unipolar-stepper-motors-arduino-driver.html
Dendad - I've used stepper motors on some other projects asking with motor drivers. If I go the Arduino route, I agree this would be fairly straight forward.

#### spud1989

Joined Dec 23, 2020
3
I agree with Ian. I use this method with an automatic feeder for the hedgehogs that visit our garden. I use a PIC16F628 to control the counting. It has an 8 bit dip switch connected to one I/O port so I can easily change the number of revolutions of the auger. (It actually uses 2 pulses per revolution.) At first it was powered from a plug in timer which was set to switch on for one minute at the required time. When power was applied it rotated the motor for the set number of revolutions then stopped. It only starts again after power has been switched off. Here is a picture showing the slotted opto sensor which detects notches cut in an aluminium disk.
View attachment 241964

I have now replaced the timer with a light level sensor that trigeres the dispenser (After averaging 16 light level readings.) at around sunset. I can provide the schematic and code for the PIC if it is any use to you.

Les.
That sounds more simplistic than what I was thinking. I'd appreciate if you could share the code and schematic.

Joined Feb 20, 2016
3,913
Another way could be to make the gear train to suit the number of turns you need and then add a cam to operate a "stop" switch, a normally closed switch that is in series with the motor, and the cam opens it, much like the home switch on the wipers of a car.
Then, short the switch out with a FET (or a relay) driven by the timer to start the motor.
As long as the start signal is shorter that the run time, and long enough for the stop switch to close, away it will go.

#### drc_567

Joined Dec 29, 2008
1,154
... One more method to count the augur revolutions is to glue a small bar magnet to the augur central shaft, if that is convenient.Then, a suitably placed Hall effect sensor will produce pulse signals when the magnet field traverses it.
... The resulting pulses could provide a measure of rotational velocity, or possibly a cumulative cut-off index.

#### LesJones

Joined Jan 8, 2017
3,497
This is the schematic. Let me know if you want the eagle file as you will have to make some changes to use with a mains motor. (You could just supply it with 12 volts as mine uses a 24 volt motor.)

I am not sure if uploading the source file and the .hex will work. If not I will try again uploading them as a .zip file. You could get rid of the crystal by using a more modern PIC with an internal oscillator.

Les.

#### Attachments

• 6.2 KB Views: 2
• 470 bytes Views: 2