Author Topic: Closed loop control of DC motor  (Read 443 times)

Offline kamelryttarn

  • High Voltage Experimenter
  • **
  • Posts: 97
  • Karma: +0/-0
    • View Profile
Closed loop control of DC motor
« on: February 28, 2018, 09:41:26 AM »
A while ago I started a build of a simple (or so I thought) magnetic stir plate. I ordered a cheap motor on ebay and a friend helped me to 3d-print a holder for the neodymium magnets. I use and arduino with a mosfet to get speed control by PWM.

The problem was that the magnets locked on to the screws I used to mount the motor in the plastic case so it took quite a bit of force to get it to start so I thought I could use a closed loop to control the speed of the motor. I bought a new motor with a built in magnetic encoder that sends pulses when the motor spins. I wrote a small program for my arduino and connected the pulse output from the motor to one of the hardware interrupt pins. When I tried it I got very erratic behavior that I believe may be caused by the inertia of the rotating axel . Would you agree and do you have any good ideas what I can do to remedy the problem?

To understand the pictures better I will try to explain the code I used. Every time I got a change (either rising or falling edge) from the encoder, the mosfet channel is turned off and the arduino resumes the regular loop that has a pause time (to regulate speed) and the turns the mosfet on again. In the pictures channel 0 is the encoder on the motor and channel 1 is the mosfet driver. The last screenshot is from a test I did where i let the motor spin for a few seconds and the turned the mosfet off to see how long after the power was cut to the motor it still turned.

High Voltage Forum

Closed loop control of DC motor
« on: February 28, 2018, 09:41:26 AM »

 


* Recent Topics and Posts

post Re: Offgrid 48V solar to 24V battery setup
[Electronic circuits]
Mads Barnkob
Today at 11:24:46 AM
post Re: ZVS Mazzilli circ with active gate driver - what causes ringing?
[Electronic circuits]
flyrod
Today at 03:22:54 AM
post Re: Are bleeder resistors necessary if I can easily discharge my capacitor?
[Spark gap Tesla coils]
profdc9
Today at 03:18:52 AM
post Re: Help for people buying the "12-48 Volt 1800/2500 Watt ZVS induction Heater"
[Electronic circuits]
petespaco
May 18, 2019, 10:48:59 PM
post Re: Is one of these good?
[Dual Resonant Solid State Tesla coils]
Golddustpeak
May 18, 2019, 04:19:11 PM
post Re: Help for people buying the "12-48 Volt 1800/2500 Watt ZVS induction Heater"
[Electronic circuits]
petespaco
May 17, 2019, 10:57:17 PM
post Are bleeder resistors necessary if I can easily discharge my capacitor?
[Spark gap Tesla coils]
jpb133
May 17, 2019, 09:41:56 PM
post Re: Is one of these good?
[Dual Resonant Solid State Tesla coils]
Uspring
May 17, 2019, 12:41:17 PM
post ZVS Mazzilli circ with active gate driver - what causes ringing?
[Electronic circuits]
82026
May 16, 2019, 04:15:58 PM
post Re: Identification of unknown embedded computer, help needed.
[Computers, Microcontrollers, Programmable Logic, Interfaces and Displays]
Fumeaux
May 16, 2019, 02:19:39 PM
post Re: Is one of these good?
[Dual Resonant Solid State Tesla coils]
Golddustpeak
May 16, 2019, 01:50:44 PM
post Re: Is one of these good?
[Dual Resonant Solid State Tesla coils]
Uspring
May 16, 2019, 12:17:01 PM
post Re: Identification of unknown embedded computer, help needed.
[Computers, Microcontrollers, Programmable Logic, Interfaces and Displays]
Fumeaux
May 16, 2019, 08:45:15 AM
post Re: Identification of unknown embedded computer, help needed.
[Computers, Microcontrollers, Programmable Logic, Interfaces and Displays]
Mads Barnkob
May 15, 2019, 11:49:59 PM
post Re: Identification of unknown embedded computer, help needed.
[Computers, Microcontrollers, Programmable Logic, Interfaces and Displays]
Hydron
May 15, 2019, 10:51:33 PM
post Identification of unknown embedded computer, help needed.
[Computers, Microcontrollers, Programmable Logic, Interfaces and Displays]
Mads Barnkob
May 15, 2019, 09:35:41 PM
post Re: Is one of these good?
[Dual Resonant Solid State Tesla coils]
Golddustpeak
May 15, 2019, 05:07:20 PM
post Re: Mounting LCD CFL's around DRSSTC?
[Dual Resonant Solid State Tesla coils]
Mads Barnkob
May 15, 2019, 12:46:33 PM
post Re: General Oscilloscope Probing Techniques for (DR)SSTC h-bridge
[Beginners]
Mads Barnkob
May 15, 2019, 10:08:11 AM
post Re: Is one of these good?
[Dual Resonant Solid State Tesla coils]
Mads Barnkob
May 15, 2019, 10:04:59 AM
post General Oscilloscope Probing Techniques for (DR)SSTC h-bridge
[Beginners]
L_Mangold
May 15, 2019, 12:42:46 AM
post Re: Help for people buying the "12-48 Volt 1800/2500 Watt ZVS induction Heater"
[Electronic circuits]
hightemp1
May 14, 2019, 11:28:43 PM
post Re: Help for people buying the "12-48 Volt 1800/2500 Watt ZVS induction Heater"
[Electronic circuits]
badpeter
May 14, 2019, 09:58:28 PM
post Re: Help for people buying the "12-48 Volt 1800/2500 Watt ZVS induction Heater"
[Electronic circuits]
hightemp1
May 14, 2019, 08:35:28 PM
post Re: Help for people buying the "12-48 Volt 1800/2500 Watt ZVS induction Heater"
[Electronic circuits]
badpeter
May 14, 2019, 07:41:48 PM
post Re: Help for people buying the "12-48 Volt 1800/2500 Watt ZVS induction Heater"
[Electronic circuits]
hightemp1
May 14, 2019, 06:05:25 PM
post Is one of these good?
[Dual Resonant Solid State Tesla coils]
Golddustpeak
May 14, 2019, 04:21:07 PM
post Re: X ray Transformer Offer
[X-ray]
Mads Barnkob
May 14, 2019, 02:20:27 PM
post Re: One model of L2 can run at several different frequencies. But which is the best?
[Dual Resonant Solid State Tesla coils]
Uspring
May 14, 2019, 12:58:30 PM
post Re: Gate Resistor Calculation
[Dual Resonant Solid State Tesla coils]
coil1002
May 14, 2019, 06:35:32 AM
post Re: One model of L2 can run at several different frequencies. But which is the best?
[Dual Resonant Solid State Tesla coils]
VNTC
May 14, 2019, 01:20:37 AM
post Mounting LCD CFL's around DRSSTC?
[Dual Resonant Solid State Tesla coils]
fafler
May 13, 2019, 07:58:25 PM
post Re: One model of L2 can run at several different frequencies. But which is the best?
[Dual Resonant Solid State Tesla coils]
Uspring
May 13, 2019, 03:24:34 PM
post Re: Just how large?
[Dual Resonant Solid State Tesla coils]
Fumeaux
May 13, 2019, 03:17:50 PM
post Just how large?
[Dual Resonant Solid State Tesla coils]
Golddustpeak
May 13, 2019, 03:04:50 PM
post Re: Gate Resistor Calculation
[Dual Resonant Solid State Tesla coils]
Hydron
May 13, 2019, 11:17:38 AM
post Re: One model of L2 can run at several different frequencies. But which is the best?
[Dual Resonant Solid State Tesla coils]
VNTC
May 13, 2019, 04:45:13 AM
post X ray Transformer Offer
[X-ray]
Joshua Guertler
May 13, 2019, 04:08:13 AM
post Re: Gate Resistor Calculation
[Dual Resonant Solid State Tesla coils]
profdc9
May 13, 2019, 03:05:03 AM
post Re: Gate Resistor Calculation
[Dual Resonant Solid State Tesla coils]
coil1002
May 13, 2019, 01:49:00 AM
post Re: Gate Resistor Calculation
[Dual Resonant Solid State Tesla coils]
Mads Barnkob
May 12, 2019, 10:17:22 PM
post Re: My first DRSSTC on bricks
[Dual Resonant Solid State Tesla coils]
Laci
May 12, 2019, 09:49:02 PM
post Re: Gate Resistor Calculation
[Dual Resonant Solid State Tesla coils]
Uspring
May 12, 2019, 06:42:53 PM
post Re: Gate Resistor Calculation
[Dual Resonant Solid State Tesla coils]
profdc9
May 12, 2019, 05:41:02 PM
post Re: One model of L2 can run at several different frequencies. But which is the best?
[Dual Resonant Solid State Tesla coils]
Uspring
May 12, 2019, 03:38:12 PM
post Re: One model of L2 can run at several different frequencies. But which is the best?
[Dual Resonant Solid State Tesla coils]
VNTC
May 12, 2019, 03:17:01 AM
post Gate Resistor Calculation
[Dual Resonant Solid State Tesla coils]
coil1002
May 12, 2019, 02:50:11 AM
post Re: adventures in homemade flyback bobbins.
[Transformer (ferrite core)]
dexter
May 12, 2019, 12:40:56 AM
post Re: Help for people buying the "12-48 Volt 1800/2500 Watt ZVS induction Heater"
[Electronic circuits]
petespaco
May 12, 2019, 12:18:58 AM
post Re: Help for people buying the "12-48 Volt 1800/2500 Watt ZVS induction Heater"
[Electronic circuits]
Mads Barnkob
May 11, 2019, 08:34:31 PM

Sitemap 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30