Home
Prox / RFID
Verichips
Ladder Logic
[interfacing] †
Tube Joints
Key Code From Photo
SolveSpace (3d CAD)
SketchFlat (2d CAD)
Photographs
Miscellany
Resume / Consulting
Contact Me

LDmicro Forum - PWM output

(you are viewing a thread; or go back to list of threads)

PWM output (by Mauro )
Hello all.

I'm working in acircuit to stop a pulley in distances of 3, 4 and 10 meters. My customer would like it stops this way:

-In a distance of 3 meters, the motor must run in low speed until stops;
-In a distance of 4 or 10 meters, the motor must run in high speed an reduce the velocity until stop.

I tried to configurate a PWM output, but I could'n it. What I forgot or made wrong? Any help will be wellcome.
Sat Apr 24 2021, 10:14:37, download attachment TIRO TESTE.ld
Trajectory (by Ziggy)
How do you control motor speed? PWM to a DC voltage, thn DC voltage to control motor speed?

To alter PWM you need to keep continuously modifying the PWM coefficient.
SO think about the trajectory of the pulley
At a distance say between 4 and 3m you need to continuously calculate PWM coefficient and send it to PWM function so that at 4meters the motor starts at zero...PWM coefficient increases quickly to accelerate the pulley and then decrease PWM in a planned fashion so that pulley slows down and drive is killed when pulley is at 3 m You have to calculate this pulley trajectory and pass the PWM value to pwm function on each pass through the ladder.
Same goes for the 10 and 4 m positions.
Sat Apr 24 2021, 21:10:15
PWM output (by Mauro )
I thought control the motor directly from the microcontroler, loading a value in the PWM output, relationed to the position gave from the comparators. If it don't be possible, I'll try use other way to obtain the speed control.
Sun Apr 25 2021, 12:10:56
(no subject) (by MGP)
You cannot use 2 different frequencys, either both 3kHz or both 1kHz.

CDIST is not reset at any point, it always adds up?
Mon Apr 26 2021, 05:15:22
(no subject) (by MGP)
Also rung 0004 is always false and does not work, if you want a window then use >= or <=
Mon Apr 26 2021, 06:20:34
(no subject) (by Paulino)
try to do this and you can do or modify whatever you want on the lines.
If you want to set timers, so that the speed changes,
1st soft start
2nd stay at speed (X)
3rd slow down and stay at that speed
4th progressive stop until reaching (0) ETC.


intenta hacer esto y puedes hacer o modificar lo que quieras en los renglones.
si quieres pon temporizadores, para que cambie la velocidad,
1º arranque progresivo
2º se mantenga a una velocidad (X)
3º disminuir velocidad y mantenerse a esa velocidad
4º paro progresivo hasta alcanzar (0) ETC.
Mon Apr 26 2021, 12:13:35, download attachment pwm.ld
PWM output (by Mauro ) (by DanielH)
@Mauro:

What kind of motor do you intend to control?
A (little or big) stepper motor, a 3 phase motor, a (little or big) brush DC motor, a brushless motor?
Each type of motor can be drived using different metods and drivers.

As example, you can drive a 3 phase motor (using grid power) through a variable frequency driver (VFD), and control the speed modifying its output frequency.

This is achievable by converting the PWM output signal generated by the microcontroller in an analog output 0-10V or 0(4)-20mA, using an interface (dedicated hardware), and connecting this analog output to the analog input of VFD, sharing all grounds as reference.
The analog output will vary its value according the duty cycle variable in LDmicro's PWM instruction.

You can also control the start/stop of motor, movement direction, and perhaps a third function offered by a particular VFD (i.e. fast braking), using digital outputs of the microcontroller connected to digital inputs of VFD, through an appropiated interface.

I've developed the OVF module for my OSIMPLC (Open Hardware + Free Software PLC for Technical Schools and Professional Training Centers) to control different FVDs, using theirs three digital input and their analog input...
All the digital outputs of the microcontroller are isolated by optocouplers, the analog output can be configured as 0-10V or 0(4)-20mA using jumpers in OVF module.

You can freely download the schematics for the microcontroller unit and the OVF module from https://osimplc.com/docs/es/downloads/Schematics/mcu.pdf and https://osimplc.com/docs/es/downloads/Schematics/ovf.pdf
, and adapt this schematics for your own project; all of them are under Creative Commons BY - Share Alike license (CC BY-SA).

I've tested the analog output of OVF module using different base frequencies for PWM, reaching 1.25 MHz using a PIC16F887 with 20 MHz crystal oscillator...
Of course, if you intend to use an ATmega micrcontroller, the base frequency is established by the formula Fosc = F(I/O) / (N * 256), being N = 1, 8, 64, 256 or 1024 factor, and
F(I/O) the microcontroller operating frequency (cystal, RC circuit, internal oscillator).

Of course, yo can measure the distance already traveled using different metods, as example installing various magnets in the circumference of the pulley and read them through an Hall effect transistor, or a reed switch; or by marking notchs or installing protuding objects in the pulley, and read them using an inductive (if metal) or capacitive (not metal) sensor.

NOTE: You can NOT read the quantity of pulses generated by PWM output in a digita input, using LDmicro.

Another alternative, if you intend to control the pulley using a strong stepper motor and a driver, is to implement the PULSER instruction in LDmicro. Of course, you also must measure the distance already traveled, because stepper motors can suffer of "slippering" due high acceleration rates driving heavy loads...

Good luck!
Best regards,
DanielH
Wed Apr 28 2021, 16:19:56
Post a reply to this comment:
Your Name:
Your Email:
Subject:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):