Optical encoders with DC motors

More
08 Apr 2018 22:41 #108632 by tommylight
The Z axis uses PWM output, that controls the pressure motor (small DC one) through a darlington transistor.
The spindle needs 20,000 to 35,000 RPM to run properly, it can be slower but that would imply lowering the feed speed.
Dmap2gcode with some modifications is the software i use.
The pressure/spindle head assembly is a bit tricky to make and adjust properly, and the X/Y acceleration must be set pretty high ( at least 3000, preferably 5000).
There is a thread on this forum about this, will find it tomorrow. Need sleep badly.
The following user(s) said Thank You: rodw

Please Log in or Create an account to join the conversation.

More
27 Aug 2020 15:03 #179692 by Skec
Dear wizards,

I would like to share my experience with dc+encoders using LinuxCNC and ask you some question..if I may.

As already many, I have tried to run Etch example from LinuxCNC sample list to control small DC with encoder. Unfortunately, the DC+encoder I got from old DVD rom is noting similar to those, which I can find online. The motor is simple, however, the encoder is what makes my head spin. As I could not find its spec sheet on google, I did not know which leg is which. With the idea from #linuxcnc, I got 1 LED, and start to poke around..

I decided that the input should be on the leads, that go into resistors.. and another two must be ground and signal. After connecting to 5V, I put LED on ground and signal wires (please see my art_diagram...). Shortly after, I noticed that the LED start to blink, when I slowly turn the DC motor wheel.. I considered it as success, and decided to wire all into parallel port (pins once again can be seen in the diagram).

I have modified *hal and *ini files from the Etch example..

Now the interesting/strange part:
1. In LinuxCNC program, when I press "+" or "-" (continuous), at the beginning DC spins just a bit, and then it starts running like crazy (even though I do not press continuous)..
2. To stop motor from spinning, I have to press opposite to "+" or "-", depending on what I pressed first.
This behavior I did not notice when testing stepper motor. The motor would spin as long as I press "+" or "-" in continuous mode..

3. If I would choose 1 mm or 0.5 mm turn (not continuous), at the beginning motor would spin just a bit, I would click once again "+" and then it would continue spinning forever (more than 10 seconds, after which I stop it with estop)..

My question would be:
Does it has something to do with my wiring (maybe I wrongly assumed, which wires from encoder to wire into parallel port), or it is *hal and *ini file configuration.. I must honestly say, that I do not know how to set PID numbers, nor scale in this case..

Does blinking LED connected blindly to two wires indicates that we have GND and SIGNAL?

Is it possible to get such system to spin the motor 1 revolution, when I press "+" or "-"? (assuming I put the scale = 1)? - I guess I would need to know how many holes are in the disk to have it spin 360? And where should I put this number in the *ini file?

I would be grateful for your time, comments or suggestions.

Sincerely,

Simonas
Attachments:

Please Log in or Create an account to join the conversation.

More
27 Aug 2020 18:41 #179716 by andypugh

1. In LinuxCNC program, when I press "+" or "-" (continuous), at the beginning DC spins just a bit, and then it starts running like crazy (even though I do not press continuous)..


This indicates that the encoder feedback and motor disagree on which way is "+"

Edit the HAL to make the encoder scale a negative number and you should see more appropriate behaviour.

Please Log in or Create an account to join the conversation.

More
27 Aug 2020 19:00 #179722 by Skec
Hi, maybe I described not 100% clear...
but when I press "+", the motor "thinks" and then starts spinning CW.
When I press "-", the motor "thinks" and then starts spinning CCW. So I think the motor knows which direction it should go.. its just "crazy" speed up and continuous spinning what makes me worry. I thought maybe scale is wrongly set..then of course I did not configure at all (do not know how) how many holes there is in the disc (so linuxcnc knows what is one turn).

In #linuxcnc some smart guys suggested that the encoder I have is not quadrature, because it does not have A and B phases (just A). Here is the diagram they managed to draw according my explanations of the light gate..
Attachments:

Please Log in or Create an account to join the conversation.

More
27 Aug 2020 21:25 #179743 by tommylight
That is not an encoder, that is an optical sensor so that will not work for feedback.
The encoder needs two sensors at 90 degrees from each other to be usable.
There is the possibility of using two of those sensors and adjusting the placement of one of them until you get roughly 90 degree signals from them.

Please Log in or Create an account to join the conversation.

More
28 Aug 2020 13:29 #179833 by Skec
Understood! Thank you.
The following user(s) said Thank You: tommylight

Please Log in or Create an account to join the conversation.

More
31 Aug 2020 16:44 #180185 by Skec
Is there a way to control DC motor without encoder using L298N?

There are enable pin, and 2 pins that determine rotation direction. Speed could be controlled manipulating enable pin..I suppose the majority is controlled with pulses. But still dare to ask..

Best!

Please Log in or Create an account to join the conversation.

More
31 Aug 2020 17:55 - 31 Aug 2020 17:55 #180198 by tommylight

Is there a way to control DC motor without encoder using L298N?

Yes using PWM, but there would be no speed control.
Last edit: 31 Aug 2020 17:55 by tommylight. Reason: typo

Please Log in or Create an account to join the conversation.

More
31 Aug 2020 17:59 #180200 by Skec
Meaning motor would spin at MAX? or is it possible to set some constant velocity?

Please Log in or Create an account to join the conversation.

More
31 Aug 2020 18:03 #180202 by tommylight

Meaning motor would spin at MAX? or is it possible to set some constant velocity?

No, it would adjust the speed OK but would not keep the sped when the load changes, and that speed would be dependant on the voltage supply to the drive depending on the motor KV value.

Please Log in or Create an account to join the conversation.

Time to create page: 0.170 seconds
Powered by Kunena Forum