# Resin dosing

Hello Everyone,

For my scale model hobby I make parts out of 2 component resin. The A & B components need to be measured out on a scale to the required total weight, using the right A to B ratio. I would like to automate the dosing of the resin with 2 peristaltic pumps, driven by two stepper motors + drivers I have laying around from a previous CNC project. The mixing part will be done by a static mixer.

Now the hard part for a beginner like me; - I would like to be able to set the speed and ratio of the two steppers + pumps (rotary encoder + display?) - Also a way to run the steppers independently back and forwards (prime and drain the pumps) - At first just push button operation, but maybe later a way to set desired quantity.

Where to start? couldn't find a real example project with 2 two step drivers coupled by a set ratio.

Thanks,

JB

Driving two steppers in parallel with different speeds is relatively easy. Suppose you want one motor to make 100 steps and the other to make 37. Use a for loop that counts up to 3700 (100 * 37) and every 37th iteration cause the faster motor to step and every 100th iteration cause the slower motor to step.

...R

jbos: Where to start? couldn't find a real example project with 2 two step drivers coupled by a set ratio.

If you control the motor steps directly then you can directly control the ratio between them. The problem is very similar to the problem of plotting a straight line across a display, or moving a CNC head in a straight line, and the algorithms for that are well known. In effect you will manage 'X' and 'y' coordinates separately and run some simple algebra to work out which coordinate to increment next. To understand the algorithm I suggest you start by researching Bresenham's line algorithm.

Do you use a number of set ratios or do you need a continuous range? i.e. will you need a pot to select the mix or some buttons?

Set ratios would be sufficient for now. The two most used ratios at this moment are 100:100 and 100:86. Not really a problem to change it if I need a new ratios I guess.

The accelstepper library would be sufficient for this I guess?

Thanks for all the input so far.

jbos: The accelstepper library would be sufficient for this I guess?

The AccelStepper library is really more appropriate when you're dealing with mechanical inertia and need to accelerate and decelerate masses. I think in this case you would be better off managing every step explicitly in your code by controlling the steppers directly.

This sounds like something you won’t use too often, so you could always just use your PC and Serial interface to enter your data. It would make having to build a display unnecessary. That being said, you might want to build a display because you can. It is just one of those less complicated short cuts that is easily hacked together in Arduino.

PeterH: To understand the algorithm I suggest you start by researching Bresenham's line algorithm.

If you just want one motor to make (say) 86 steps while the other makes 100 the Common Multiple arrangement is simple and needs no research. Just multiply the two numbers together to get 8600 as the count in a for loop and step one motor every at every 86th iteration and the other every at every 100th iteration.

...R

Robin2:

PeterH:
To understand the algorithm I suggest you start by researching Bresenham’s line algorithm.

If you just want one motor to make (say) 86 steps while the other makes 100 the Common Multiple arrangement is simple and needs no research. Just multiply the two numbers together to get 8600 as the count in a for loop and step one motor every at every 86th iteration and the other every at every 100th iteration.

…R

Or the 43rd and 50th.

Henry_Best:
Or the 43rd and 50th.

Provided you also divide the loop count by 2 to give 4300.

…R

Robin2:

Henry_Best:
Or the 43rd and 50th.

Provided you also divide the loop count by 2 to give 4300.
…R

Yep. I forgot about that part.

Are the densities the same?- OP says ratio is by weight but presumably a peristaltic pump will deliver by volume?

Sharp! I’ve already converted those to volumetric ratio’s The 100:86 ratio for instance is from a resin that would be 100:100 by weight. The other resin’s components have the same density, so it will stay 100:100.

Thanks everyone for the input!