Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Analog DC-Motor simulator circuit

Status
Not open for further replies.

misterT

Well-Known Member
Most Helpful Member
Long post, but I underlined the main issues I would like to get help with.
I've been working on an analog DC-motor simulator circuit. I'm not sure why, maby it could be usefull for automation students etc.

The system is supposed to work as follows:
Input for the circuit is analog voltage from 0 to 5V. Virtual ground is at 2.5V and it represent 0 volts across the motor. 5V represents max positive voltage across motor, and 0V is max negative voltage across motor armature.

The simulator circuit creates analog signal 0...5V representing the speed of the motor. 2.5V (virtual ground) is zero speed. Voltages below 2.5V are negative speed and above 2.5V positive speed. The circuit also simulates armature current (torque).

The goal is to simulate quadrature encoder also. I have a circuit that does that by taking two inputs; The speed as a frequency (clock signal) and direction information as logic signal.

Between the analog speed information and the quadrature encoder circuit I need a voltage to frequency converter. It does not have to be perfect. The problem I have is how to deal with "near zero speed" situation.. which is analog voltages at ~2.5V. The circuit should have small deadband around the virtual ground.

I have a signal conditioner for V to F converter. The signal conditioner takse the -2.5V...+2.5V (relative to virtual ground) speed information and rectifies it to magnitude information 0V...5V (relative to "real ground") and logic direction signal. I would like to get frequency range near 0Hz to 500kHz over the 0V...5V signal.

So, I need ideas for the voltage to frequency converter? I have found some ICs like AD654 should I just go with that? Could I build one using basic op-amps or 555 etc.?

Any ideas creating small hysteresis/deadband around 0 speed (virtual ground)? Any other comments, ideas, improvements.. or possible mistakes in my design or motor transfer function?

In the attached graph you can see:

- Input voltage to motor (blue)
- Simulated motor speed (green)
- Simulated quadrature decoder output (the digital signals at bottom)
- Rectified speed magnitude signal 0V...5V (red)
- Digital motor direction information

LTSpiceDCmotorSimulator.png LTSpiceDCmotorSimulatorPlot.png
 
Last edited:
Your post is a bit "fuzzy" as to what you need, but from my first glance I wonder why you need V to F converter at all? Freq is the hardest thing for you to work with when using opamps.

Normally working with analogue motor controls you go the other way; your encoder Hz is converted to voltage (F->V), so that voltage is equivalent to the old analogue "tacho" voltage.

Then you compare the reference voltage from the pot, with the feedback tacho voltage, and an opamp adjusts motor power so the two voltages match.
 
Your post is a bit "fuzzy" as to what you need, but from my first glance I wonder why you need V to F converter at all? Freq is the hardest thing for you to work with when using opamps.

Normally working with analogue motor controls you go the other way; your encoder Hz is converted to voltage (F->V), so that voltage is equivalent to the old analogue "tacho" voltage.

Then you compare the reference voltage from the pot, with the feedback tacho voltage, and an opamp adjusts motor power so the two voltages match.

The circuit is a simulator. I want to simulate in hardware the output of a quadrature encoder (and dc motor itself). I need a V->F converter to translate the analog speed signal into a clock signal for 2bit binary counter.. which is then converted to gray code. The AD654 is one option, but it is very expensive chip (close to $10). How fast do you think I can make this circuit work:

350px-VCO.jpg

The V to F converter does not need to be extremely linear etc. but I would like to get at least 100kHz.

The whole Idea of the circuit is that it is not practical to provide 10..20 students a dc motor with all sensor and power amplifiers etc. This simulator is easy and cheap to make and students can connect it easily to any microcontroller. And they can use it easily in computer classroom environment. With the simulator you can practice system identification, closed loop control etc. using real microprocessor. It is also easy to add disturbances and noise into the system.

EDIT: Ok.. I can see the possible confusion here because I am simulating a simulator circuit in LTspice. Try not to get confused. The circuit itself is the analog simulator that I am going to build.
 
Last edited:
OK, thanks for explaining your post #1 simulator circuit is a simulated circuit for a simulator circuit. I finally get it. :)

Well, first I would think about just getting onto ebay or a China supplier and buy 5 or 10 DC little motors with encoders fitted. You should be able to get them for under $10 each. For driving circuits you could use the old L298 h-bridge chips, not hugely efficient but are cheap and common. Costs won't be that high, and even if 2 or 3 students have to share a motor it will be a big benefit seeing the motor in action rather than a PCB making voltages... PSU's won't cost much, 0.5A plug packs are probably enough, and you would need DC power for the other PCB option anyway.

If you still want to go for a "circuit that pretends to be a motor and encoder" then I would just use a PIC or AVR whichever you prefer, and use it to sense the motor drive voltage and reproduce the encoder signals all done in software.

Personally I think real motors and h-bridges will be far superior as a learning experience and also as a more faithful model of the actual performance.
 
Of course a real motor is the best solution, but there are some benefits using this kind of simulator circuit (if it is properly designed). For example if you are designing a self-tuning control algorithm you can easily change the characteristics of the transfer function just by turning trimmer pots. You can even change the transfer function while the algorithm is running and watch how the system performs. It is also easy to inject noise and disturbances into any of the system variables. With real motor you are stuck with the same system, but this simulator allows you to simulate a variety of systems of different characteristics.

I don't actually need this circuit for anything at the moment. One reason for doing this is that I have not ever seen such a circuit and thought it might be useful. Also, I have not done much analog designs for a long time. I also want this to be easy for anybody to build, so I don't want to add a microcontroller when all I need is a V to F converter. I think I go for the simplest VtoF circuit first and see how fast I can make it run. Should be a good learning experience for me.

I would also like to make the simulator more realistic by adding "stall torque" simulation.. or deadband near zero speed. Any ideas for that?
 
Last edited:
For the deadband you can build in some hysteresis in the speed control opamp circuit.

As for "injecting noise and disturbances", sure you can do that on a simulator PCB but what about things like load sag and stability testing? It's great for students in a class to see a real motor, and see how it breaks out unstable when loaded with a fingertip on the shaft or a small brake. Or to tune the PID by checking and adjusting load sag. I'm not sure how you can test any of that in a opamp simulator as a lot will depend on the moment and inertia of the motor and load, vs loop response times. Simulating that is looking more like a complex math model on a PC...
 
Why is it that every time I post a circuit or a design idea and ask how to make it better people start shooting the whole idea down and providing ideas for completely different solution. I'm not looking for alternative solutions, I'm looking ways to make this particular circuit better. I know that a real motor is better than a motor simulator. But I am building a simulator.. deal with it. Next I might build a circuit that simulates something else than a DC motor.. and what I learn from this project is a great help.

Well.. I managed to implement the stall situation (static friction) simulation.
 
Last edited:
hi MrT,

If you are not aware of this LTS user group **broken link removed**

It has a number of motor simulations which may help in your motor simulation development.

Eric

EDIT:


This is my Motor folder for LTS
 

Attachments

  • Motorzip.zip
    25.5 KB · Views: 265
Last edited:
hi MrT,

If you are not aware of this LTS user group **broken link removed**

It has a number of motor simulations which may help in your motor simulation development.

Eric

EDIT:


This is my Motor folder for LTS

Well.. I am designing a simulator circuit. I'm not trying to simulate a DC motor in LTspice. I am trying to design a physical circuit that simulates the transfer function of a DC motor (with nonlinearities like static friction etc.).

But thanks for the motor models.. they will be useful someday :)
 
Last edited:
I thought the LTS formula's and methods might have been helpful if could transpose them;).
 
I thought the LTS formula's and methods might have been helpful if could transpose them;).

Ok.. Good idea. I will look at them and see if they are helpful.
 
Last edited:
I think I have the stall condition at zero speed simulated, but I am not completely sure if this is a good solution. It seems to work in spice, but will there be problems with practical circuit?

The idea is to monitor speed and current. When speed is zero (or near zero) and armature current (torque) is below a set limit, then the current signal is subtracted from the speed integrator.. therefore keeping the speed at zero until the torque reaches a static friction limit.

I have been pondering why this simple solution works and I have not found any (practical) drawbacks, but I feel like there must be something I have not counted for. So I would like somebody to play the "spot the mistake game". The four graphs show some simulations and the circuit that disables the current feed to the speed integrator. The signal called "stallsignal" is just an inverse of the "stalltorque" (I know.. bad name for this signal). It is fed to the speed integrator when a stall condition is valid.. therefore cancelling the torque information.. which leads to stall in motor speed (until torque is high enough).

You can see the "stall torque" acting in the spice simulations.

DCsimulationWithStall.pngDCsimulationWithStall02.pngDCsimulationWithStallCircuit.pngDCsimulationWithStallComparator.png
 
Last edited:
I would like to get frequency range near 0Hz to 500kHz over the 0V...5V signal.
I think such a range is going to be extremely difficult to produce with a relatively simple analogue circuit. Why so high a frequency? Assuming a top motor speed of 12000 rpm and a shaft encoder with, say, 8 segments the encoder would generate a max frequency of 8 x 12000 / 60 = 1.6kHz.
When speed is zero (or near zero) and armature current (torque) is below a set limit, then the current signal is subtracted from the speed integrator.. therefore keeping the speed at zero until the torque reaches a static friction limit.
I don't follow the thinking there. Surely, at speed = zero, current is at maximum (because there is no motor back-emf), torque is at max and greatly exceeds static friction (otherwise the motor would never start to rotate)?
 
Last edited:
I think such a range is going to be extremely difficult to produce with a relatively simple analogue circuit. Why so high a frequency? Assuming a top motor speed of 12000 rpm and a shaft encoder with, say, 8 segments the encoder would generate a max frequency of 8 x 12000 / 60 = 1.6kHz.

The 500Khz was an optimistic target because many encoders are rated at max 500Khz (at least the ones I have used). The actual frequency range is not that important.. The near zero speed (near virtual ground) performance is more important than the maximum rating. Still, it will be good practice for me to try to make that thing run as fast as I can.. just for self education.

I don't follow the thinking there. Surely, at speed = zero, current is at maximum (because there is no motor back-emf), torque is at max and greatly exceeds static friction (otherwise the motor would never start to rotate)?

The current is not maximum at stall condition. There is an AND gate that compares two signals; Speed and Torque. When speed is zero and torque is small that is considered as "stall condition". When torque (armature current) is high enough then the "stall condition" is released and motor starts to speed up. Take a look at the graphs.
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top