Optical encoders

Hello all hope you are well. I am only very new to the Arduino community and I am very appreciative of any assistance given. I am seeking guidance as to how to control a DC motor speed with optical encoders on the X and Y axis of a Longarm Quilting machine. The machine is mounted on rollers on the X and Y axis and is pushed around manually to achieve the desired sewing effect. An encoder on each axis detects movement and the motor is speed up or stopped as required. Encoders rotate both ways but the motor does not . All that matters is the total distance moved to ensure correct stitches per inch are achieved. Question is can someone please point me to a sketch that I can use as a basis to commence development. None of the examples for motor control I can see seem to fit the bill. There currently doesn't appear to be any existing feedback on the actual motor speed. I am at a loss on how to start and will appreciate any help given.
Thanks Mark

Finding the error in a quilting machine was an early job 35 years ago….

What exactly is the motor doing, the one You want to apply speed control to? Is it the needles movement, up and down?

yes its the main and only motor that drives the machine needle.

Every controll system has it limits. If I understand You the rigg is moved around by hands and the poor needle motor is supposed to coop with that? One way could be to alarm if the movements are too Quick for the controller.

I worked on a stepper moved rigg. I assume the movement of the rigg was controlled to give the needle a chance to manage.

You are starting on a very complex project, and you going to need to break the project down into small pieces. There is a good tutorial here on planning and Arduino project
https://forum.arduino.cc/index.php?topic=261445.0

Here's some possible small bites of coding.

Learn how to read the quadrature encoders.
Learn how to calculate distance from the x,y readings from the two encoders.
Learn how to determine movement speed from the distance over time.
Learn how to control the motor speed and how stiches per second relate to the motor speed.
Learn how the movement speed can control the motor speed.
Learn how to deal with the fine details of stopping with the needle up, dealing with speeds too fast for the motor,etc.

Since you are new to Arduino, I would recommend that you use a library to read the encoders. Paul Stoffregen's Encoder.h is a good one. It is available through the library manager. Some reference material is here Encoder Library, for Measuring Quadarature Encoded Position or Rotation Signals

What encoders(ppr?) do you have? What Arduino do you have? What speed do you move the quilter? These questions relate to whether or not the amount of interrupt pins available to you on the Arduino is a factor.

Thanks guys just the sort of info I needed. The machine currently operates like this but the current board is dying hence the need to replace it. The encoders are US digital 5V I am going to use Arduino hall effect sensors to replace the current shaft rotation sensors. I was planning to use a Uno. As to the speed hard to say really Its generally fairly smooth and flowing with some forwards and backwards making loops and patterns and the like. its not overly quick due to the inertia of the machine requiring careful operator control. One quick supplemental is the arduino library the only repository for libraries? And thanks again.

You need to know well the situations to handle. Libraries are not any magical wizards that fixes all the unknown. How to use them is essential.

@markv3082, your long paragraphs that deal with multiple thoughts are very difficult to read. See how a little white-space makes things much clearer

Hello all hope you are well. I am only very new to the Arduino community and I am very appreciative of any assistance given.

I am seeking guidance as to how to control a DC motor speed with optical encoders on the X and Y axis of a Longarm Quilting machine.

The machine is mounted on rollers on the X and Y axis and is pushed around manually to achieve the desired sewing effect.

An encoder on each axis detects movement and the motor is speed up or stopped as required.

Encoders rotate both ways but the motor does not .

All that matters is the total distance moved to ensure correct stitches per inch are achieved.

Question is can someone please point me to a sketch that I can use as a basis to commence development. None of the examples for motor control I can see seem to fit the bill. There currently doesn't appear to be any existing feedback on the actual motor speed. I am at a loss on how to start and will appreciate any help given.

A good test of readability is to read your text out loud to yourself.

...R

One quick supplemental is the arduino library the only repository for libraries?

Most Arduino libraries are archived and available through Git Hub, but the download and install process is not as simple as with using the Library Manager of the ide.

The encoders are US digital 5V I am going to use Arduino hall effect sensors to replace the current shaft rotation sensors.

Please explain more? What are the "shaft rotation sensors"? Does that relate to the needle speed or the axis movement? Are you trying to replace existing quadrature encoders with some arrangement of hall effect sensors?

You can use the zip import feature to install any library as far as I know. Just download the file and point the IDE zip library file at the file, where ever you placed it in your file system (downloads in Windows).

Thanks people. The shaft rotation sensors are hall effect. They detect the main shaft movement and are adjusted to fix the needle up/down position. I'm starting to think that they must be used as a feedback for shaft movement too. Every rotation is a stitch.
Thanks very much for the feedback guys I have enough to go and do some work now. No doubt I will be back with a few questions down the track. Cheers