-1
\$\begingroup\$

I guess my question was not so clear, so I am editing now. I want to make CNC software. while doing this, I do not want to use any motion controller, PLC, FPGA, etc... I use three items. 1-USB to CAN converter, 2-servo motors, and their drivers, 3-a computer. All calculations will be made in software. The user uploads the G-code file and enters the velocity and acceleration of the first motor. Then my software will be calculated the velocity and acceleration of the second motor, third motor, fourth motor, etc. Then I will send the data to drivers over CANopen communication protocol. Then the motors will move concurrently but different position and different speed and different acceleration. My question is that,

  1. Can a computer do all things? Is enough the power of the processor for this job? (the processor for example i7-9750H)
  2. How much precision can it provide?
\$\endgroup\$
15
  • 1
    \$\begingroup\$ "my question is so clear": huh, how do you know that without knowing the answer? To me, your question makes no sense, because accuracy is not something defined by the controller, but by the motor driver and the motors, and the mechanical aspects of your system. \$\endgroup\$ Commented Aug 4, 2021 at 13:42
  • \$\begingroup\$ Will your servo motors have servo motor controllers? \$\endgroup\$
    – Tyler
    Commented Aug 4, 2021 at 13:49
  • \$\begingroup\$ Clear question. Is it possible? Yes. How much precision? As much as your design skills and budget permit. But you'll have to learn a LOT more than Python. \$\endgroup\$
    – user16324
    Commented Aug 4, 2021 at 13:54
  • \$\begingroup\$ @Tyler servo motors have advanced drivers. Generally, I use Delta ASDA-A2, Lenze i700. they have a complex structure. \$\endgroup\$ Commented Aug 4, 2021 at 14:40
  • 1
    \$\begingroup\$ "work synchronously" is not a requirement to be simply thrown in at the end of a long list of comments. I suspect that should convert any "yes" answer to "no." This question is a mess. \$\endgroup\$
    – user80875
    Commented Aug 4, 2021 at 16:01

3 Answers 3

2
\$\begingroup\$

You need to have some way to connect the computer to the servo.

In the distant past, computers came with GPIO ports. You could write a program saying "set pin 1 high", "set pin 1 low", and that was that. Now, they do not.

In the less-distant past, computers came with serial and parallel ports. Some of the wires on these ports can be used as GPIO. But now, they don't come with these either.

Modern computers don't have those any more. So, you can't. Every interface on your computer is specialized. There is no way that you could directly attach a servo to, for example, a USB port, because the protocol is simply not compatible.

You can get an adapter, though, which plugs into the USB port and has GPIO pins on it. Most servos require PWM signals with accurate timing, however, or they jitter, and computers can't provide that accuracy.

Since you said these servos are controlled by a CAN bus, yes, you could also use a USB to CAN adapter. That will not have timing problems since the adapter will take care of sending the data packets, and the timing of the packets themselves presumably doesn't matter as much.

Many people attach their favourite microcontroller system (such as an Arduino) to the computer, and use that as a GPIO adapter. The microcontroller can do anything that requires accurate timing and the computer can tell it what to do.

\$\endgroup\$
6
  • \$\begingroup\$ what do you think about usb to can converter ? \$\endgroup\$ Commented Aug 4, 2021 at 14:11
  • \$\begingroup\$ @MuhammedSevinçtekin Oh sorry, I didn't realize they were CAN servos. Yes, that should work. \$\endgroup\$ Commented Aug 4, 2021 at 14:15
  • 3
    \$\begingroup\$ If you want to use a USB to CAN converter, remove the "not willing to use any controller" sentence \$\endgroup\$
    – pjc50
    Commented Aug 4, 2021 at 14:16
  • \$\begingroup\$ @pjc50 why, is a converter a controller? \$\endgroup\$ Commented Aug 4, 2021 at 15:18
  • \$\begingroup\$ @MuhammedSevinçtekin yes. As said, a CAN converter needs to be the controller of your bus – it is in charge of timing itself. \$\endgroup\$ Commented Aug 4, 2021 at 15:33
1
\$\begingroup\$

Certainly what you are asking about is possible. The controllers for 3D printers do essentially the same job and with much less computing power. The issue you are likely to have is that embedded systems are designed to have reasonably well-defined latency, whereas a PC running Python (presumably on Linux, Windows etc) will have unpredictable latency (although usually very short). If you intend to instruct two or more motors to move simultaneously to make a cut, you could find that one driver gets the CANopen instruction significantly before the other and so rather than having a diagonal cut you would get an L-shape or other distortion. In this sense the performance of the controlling PC does affect the quality of the work. You might consider using microPython without an OS. Given the few $ overhead, you might be well advised to route packets through a microcontroller so that you can guarantee the timing - you'd need to add some kind of wrapper or additional G-code that would allow you to tell the micro that a group of CANopen packets need to be sent with strict timing constraints.

\$\endgroup\$
2
  • \$\begingroup\$ so if I use multiprocessing, threading, multithreading, or asyncio does the problem still continue? \$\endgroup\$ Commented Aug 5, 2021 at 12:52
  • \$\begingroup\$ DMA might well improve the timing consistency since the transmission of data can be relatively independent of what processes the CPU is running. Multiprocessing and threading can certainly help with average throughput but generally make the timing less consistent since the CPU will be spending non-deterministic amounts of time performing context switching. In a well-designed embedded system the interrupt latency is both short and predictable. If you have a multi-core processor and some way to dedicate one or more cores entirely then you could achieve something very similar. \$\endgroup\$
    – Frog
    Commented Aug 6, 2021 at 20:32
0
\$\begingroup\$

I want to control 10 servo Motor from pc, but I do not want to use any controller

It seems you want to control a servo without a “controller”.

By definition,some method of control is needed, thus the statement is contradictory. Based on the frequency of command rates and therefore the bandwidth of each servo system a controller specifications are defined. it you wish to bit bang calculations for this, then you are doing this the hard way.

Normally the servo must have feedback to null the error of the desired position. There are several control methods.

Analog or digital.

Analog requires sensor position feedback using rotary encoders for incremental position and a home position for recal of 0.

Digital using say stepper motors assumes the mechanical belt or worm-gear to motor pulley has a defined travel per step and excess torque per step to control the load during acceleration.

Old CNC machines (Universal) used quadrature analog motors to encode phase, position resolved to distance with high power analog AC motors effectively used for position control. Modern CNC machines for lower cost, use stepper motors with sinusoidal micro-step, half or full step for faster acceleration. Belt ratios can increase torque but reduce travel maximum velocity. With this arrangement I have achieved 0.1mmm resolution over a 1 m XY range. Mine was with high velocity , but you may easily tradeoff velocity, BW and power for increased resolution.

The choice of controller is hard to define, find, but in the end, the lowest cost of buy/develop and free software using, vs start from scratch, depends on your ability to define the “must have” specs from the “nice to have” restrictions or preferences . So “no controller” is NOT a spec.

Your starting point is to make a list if all the measurable requirements, like, size, speed, range, accuracy, power, cost, time into a least a 1 page point form spec. Then expand on each as you learn more. If you do this before making implementation decisions, you will end up with a better design.

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.