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

Offline kamelryttarn

  • High Voltage Technician
  • ***
  • Posts: 125
  • 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: Little Bee B Field / Current Probe
[General Chat]
Weston
Today at 07:27:18 AM
post Re: Drsstc tank Cap testing
[Dual Resonant Solid State Tesla coils (DRSSTC)]
Weston
Today at 07:02:44 AM
post Drsstc tank Cap testing
[Dual Resonant Solid State Tesla coils (DRSSTC)]
oneKone
Today at 05:56:46 AM
post Re: Easy to build Polyphonic MIDI Interrupter
[Computers, Microcontrollers, Programmable Logic, Interfaces and Displays]
Max
Today at 12:03:47 AM
post Re: Little Bee B Field / Current Probe
[General Chat]
station240
July 13, 2020, 01:08:35 PM
post Re: Server PSU Hack - HP DPS-800GB A, 12VDC 1000W
[Electronic Circuits]
rikkitikkitavi
July 13, 2020, 08:30:46 AM
post Re: Capacitors and arcs
[Beginners]
Paradox
July 13, 2020, 01:59:09 AM
post Re: Easy to build Polyphonic MIDI Interrupter
[Computers, Microcontrollers, Programmable Logic, Interfaces and Displays]
TMaxElectronics
July 13, 2020, 01:20:59 AM
post Re: compact midi interrupter
[Computers, Microcontrollers, Programmable Logic, Interfaces and Displays]
TMaxElectronics
July 12, 2020, 05:06:10 AM
post Re: Little Bee B Field / Current Probe
[General Chat]
Steve Ward
July 11, 2020, 10:23:24 PM
post Re: DRSSTC with litz-wire primary and 40 x TO247 IGBT H-Bridge
[Dual Resonant Solid State Tesla coils (DRSSTC)]
davekni
July 11, 2020, 09:36:02 PM
post Re: Server PSU Hack - HP DPS-800GB A, 12VDC 1000W
[Electronic Circuits]
Mads Barnkob
July 11, 2020, 07:36:23 PM
post Re: Server PSU Hack - HP DPS-800GB A, 12VDC 1000W
[Electronic Circuits]
Fumeaux
July 11, 2020, 04:45:18 PM
post Server PSU Hack - HP DPS-800GB A, 12VDC 1000W
[Electronic Circuits]
Mads Barnkob
July 11, 2020, 01:26:41 PM
post Re: Little Bee B Field / Current Probe
[General Chat]
Twospoons
July 11, 2020, 07:53:04 AM
post Little Bee B Field / Current Probe
[General Chat]
Weston
July 11, 2020, 06:37:03 AM
post Re: PCB etching, DIY (chemistry mostly)
[Printed Circuit Board]
klugesmith
July 11, 2020, 04:18:29 AM
post Re: PCB etching, DIY (chemistry mostly)
[Printed Circuit Board]
Twospoons
July 11, 2020, 01:35:07 AM
post Re: PCB etching, DIY (chemistry mostly)
[Printed Circuit Board]
klugesmith
July 10, 2020, 11:35:05 PM
post Re: Capacitors and arcs
[Beginners]
Morvandium
July 10, 2020, 11:10:57 PM
post Re: PCB etching, DIY (chemistry mostly)
[Printed Circuit Board]
Morvandium
July 10, 2020, 11:06:07 PM
post Re: Capacitors and arcs
[Beginners]
k42
July 10, 2020, 08:53:06 PM
post Re: XRay Tank- any ideas about what is inside
[Transformer (Ferrite Core)]
HighVoltageRulezz
July 10, 2020, 07:20:48 PM
post Re: Why is Auto-transformer (variac) called transformer??
[Beginners]
Morvandium
July 10, 2020, 04:45:43 PM
post Re: Cathodes in Compact Fluorescent Lamps
[Light, Lasers and Optics]
T3sl4co1l
July 10, 2020, 10:57:29 AM
post Re: Configuration of a half bridge.
[Electronic Circuits]
hammertone
July 10, 2020, 08:55:30 AM
post Re: Configuration of a half bridge.
[Electronic Circuits]
johnf
July 10, 2020, 08:48:33 AM
post Re: Cathodes in Compact Fluorescent Lamps
[Light, Lasers and Optics]
davekni
July 10, 2020, 07:00:13 AM
post Re: Configuration of a half bridge.
[Electronic Circuits]
davekni
July 10, 2020, 06:57:36 AM
post Re: Measuring LED efficiency
[Light, Lasers and Optics]
davekni
July 10, 2020, 05:44:54 AM
post Re: Configuration of a half bridge.
[Electronic Circuits]
johnf
July 09, 2020, 09:23:38 PM
post Re: Easy to build Polyphonic MIDI Interrupter
[Computers, Microcontrollers, Programmable Logic, Interfaces and Displays]
Max
July 09, 2020, 09:09:08 PM
post Re: Cathodes in Compact Fluorescent Lamps
[Light, Lasers and Optics]
klugesmith
July 09, 2020, 07:00:49 PM
post Re: Measuring LED efficiency
[Light, Lasers and Optics]
TMaxElectronics
July 09, 2020, 02:33:38 PM
post Re: Configuration of a half bridge.
[Electronic Circuits]
hammertone
July 09, 2020, 12:16:32 PM
post Re: Configuration of a half bridge.
[Electronic Circuits]
hammertone
July 09, 2020, 11:46:10 AM
post Re: Measuring LED efficiency
[Light, Lasers and Optics]
Twospoons
July 09, 2020, 10:56:18 AM
post Re: Configuration of a half bridge.
[Electronic Circuits]
johnf
July 09, 2020, 08:37:52 AM
post Re: Measuring LED efficiency
[Light, Lasers and Optics]
klugesmith
July 09, 2020, 06:45:18 AM
post Re: Measuring LED efficiency
[Light, Lasers and Optics]
TMaxElectronics
July 09, 2020, 02:36:22 AM
post Re: Configuration of a half bridge.
[Electronic Circuits]
Mads Barnkob
July 08, 2020, 09:43:20 PM
post Re: Welcome new members, come say hello and tell a little about yourself :)
[General Chat]
Morvandium
July 08, 2020, 09:33:35 PM
post Re: Measuring LED efficiency
[Light, Lasers and Optics]
johnf
July 08, 2020, 09:23:14 PM
post Re: Measuring LED efficiency
[Light, Lasers and Optics]
klugesmith
July 08, 2020, 09:16:42 PM
post Re: Configuration of a half bridge.
[Electronic Circuits]
johnf
July 08, 2020, 09:00:04 PM
post Re: Configuration of a half bridge.
[Electronic Circuits]
Mads Barnkob
July 08, 2020, 04:25:53 PM
post Re: Configuration of a half bridge.
[Electronic Circuits]
ElectroXa
July 08, 2020, 10:03:25 AM
post Re: Configuration of a half bridge.
[Electronic Circuits]
hammertone
July 08, 2020, 08:39:10 AM
post Re: Measuring LED efficiency
[Light, Lasers and Optics]
Twospoons
July 08, 2020, 08:34:02 AM
post Re: Measuring LED efficiency
[Light, Lasers and Optics]
davekni
July 08, 2020, 04:39:10 AM

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 
SimplePortal 2.3.6 © 2008-2014, SimplePortal