Tank Journal Archive

Rob

Member
Apr 26, 2012
743
424
Thanks, Just ordered another Arduino Mini, which is probably the same size (never looked at Teensy). Although the mini does not have a USB port, you use a USB/Serial adapter to program then disconnect. Paid $5.00 for the Arduino mini from modtronics in NSW they posted same day so hope to get it soon. They also seem to have a very good 1wire adapter board for $12.00.

Have now decided not to have display, Ill just program the arduino to dispense 1 ml on power up then wait 1 minute dispense another ml etc. That way I can use a simple external 240VAC timer/12VDC adapter or my profilux.
 

Rob

Member
Apr 26, 2012
743
424
OK Finally got it together. Had trouble tuning the arduino stepper motor library so found someone who stepped the motor manually within some code. Works better and has more torque. It ended up just fitting, very lucky I found a stepper driver board that was smaller and soldered directly onto the arduino mini.

had trouble with the Arduino mini download function and found I had to push the arduino reset button just after compile then it downloaded the sketch just fine. This mini arduino is the one where you need an external USB->Serial converter.

I have it set to dose ~1.7ml per "powerup". That way I will turn it on twice a day to dose just under my current 4ml. From the testing I did tonight works great and is very very repeatable. Once it has dosed the 1.7ml there is a small switch where you can retract the plunger to refill. Its turned out to be a pretty good protoype so will print a lid tomorrow and set it running. Maybe in a couple of weeks I'll get inspired and do a mkII. (I have a feeling this unit may end up to be someones lanthanum dosing unit). I do really need a stop function so when its empty the motor wont tear its gearbox apart. I planned to use a reed switch and magnet on the plunger plate but couldn't be bothered fitting this to my first unit.



photo 5.JPG


Kind of embarrassed about this code but this is currently whats running it
Code:
// This Arduino example demonstrates bidirectional operation of a
// 28BYJ-48, using a ULN2003 interface board to drive the stepper.
// The 28BYJ-48 motor is a 4-phase, 8-beat motor, geared down by
// a factor of 68. One bipolar winding is on motor pins 1 & 3 and
// the other on motor pins 2 & 4. The step angle is 5.625/64 and the
// operating Frequency is 100pps. Current draw is 92mA.
////////////////////////////////////////////////

//declare variables for the motor pins
int motorPin1 = 6;    // Blue   - 28BYJ48 pin 1
int motorPin2 = 7;    // Pink   - 28BYJ48 pin 2
int motorPin3 = 8;    // Yellow - 28BYJ48 pin 3
int motorPin4 = 9;    // Orange - 28BYJ48 pin 4
                      // Red    - 28BYJ48 pin 5 (VCC)
int sw_fwd = 2;       // Manual Toggle Switch
int sw_rev = 3;       // Manual Toggle Switch

int motorSpeed = 1200;// variable to set stepper speed
int count = 0;        // count of steps made
int countsperrev = 1050; // number of steps per DOSE
int lookup[8] = {B01000, B01100, B00100, B00110, B00010, B00011, B00001, B01001};



//////////////////////////////////////////////////////////////////////////////
void setup() {
  //declare the motor pins as outputs
  pinMode(motorPin1, OUTPUT);
  pinMode(motorPin2, OUTPUT);
  pinMode(motorPin3, OUTPUT);
  pinMode(motorPin4, OUTPUT);
  pinMode(sw_fwd, INPUT);
  pinMode(sw_rev, INPUT);
  digitalWrite(sw_fwd, HIGH);  // turn on pullup resistors
  digitalWrite(sw_rev, HIGH);  // turn on pullup resistors
  Serial.begin(9600);
  delay (10000);               //Startup delay
}

//////////////////////////////////////////////////////////////////////////////

void loop(){
{if(count < countsperrev || (digitalRead(sw_fwd) == LOW))
    dose();
}
  {if (digitalRead(sw_rev) == LOW)
    retract();
  }
}



//////////////////////////////////////////////////////////////////////////////
//set pins to ULN2003 high in sequence from 1 to 4
//delay "motorSpeed" between each pin setting (to determine speed)
void dose()
{count++;

  for(int i = 0; i < 8; i++)
  {
    setOutput(i);
    delayMicroseconds(motorSpeed);
  }
}

void retract()
{
  for(int i = 7; i >= 0; i--)
  {
    setOutput(i);
    delayMicroseconds(motorSpeed);
  }
}

void setOutput(int out)
{
  digitalWrite(motorPin1, bitRead(lookup[out], 0));
  digitalWrite(motorPin2, bitRead(lookup[out], 1));
  digitalWrite(motorPin3, bitRead(lookup[out], 2));
  digitalWrite(motorPin4, bitRead(lookup[out], 3));
}
EDIT -just realised you can get 5vdc and 12vdc versions of this motor, I really want the 12VDC version now so I do not have to install a voltage regulator, I already have an industrial 12VDC supply that powers my dosing pumps and profilux,, electric actuator etc etc. So this is definitely MkI. Pitty I purchased 4 x 5VDC versions
 

Attachments

Last edited:

MagicJ

Moderator
Jul 11, 2011
9,650
3,761
Hobart, Tasmania
@Rob, I gather that you currently have a 5V regulator to power both the motors and the Arduino?? If you had the 12V versions I also assume you would look to use the 12V to run the Arduino? Sorry , I am making lots of assumptions here :rolleyes

If so, I would not recommend running the Arduino off 12V - the on board regulator can get pretty warm when run off a 10V supply so 12V would be a bit worse.
 

Rob

Member
Apr 26, 2012
743
424
Voltage:
@MagicJ I have noticed some specs state 6-9VDC and some 6-12VDC for the raw voltage to the arduino mini. I know what you mean loosing 7VDC is alot to drop across a regulator to provide 5VDC output.

Torque
Im having a more serious issue at the moment, seems that 30ml syringe if not depressed for a while takes a lot of force to move the plunger, ir maybe that the syringe body shrinks around the internal plunger if it is stationary for a long time. Thus to get the plunger to move it requires quite a bit of starting torque. the motors are capable of it however the motor has an internal gearbox which incorporates a slip clutch and the internal clutch is slipping

I have lubricated the plunger and its 1000 times easier to depress the syringe plunger. If this does not work I may have to cut the rear seal out of the plunger, the plunger has two seals molded into the end.

Disappionted that the 12VDC version has no more torque than the5VDC version, it must be the gearbox and clutch assembly which dictates this.
 

Rob

Member
Apr 26, 2012
743
424
Now installed and tested. I did have to cut the rear seal ring out of the syringe plunger. the two seals was too great a force for the gearbox to overcome and it was slipping as posted previous. All looks good and has tested great with a water tests today.

I took a quick and dirty Video of it in operation just prior to me filling with NoPox. Its dosing 1.5ml in the Vid which is the default whenever its powered up.




Final Code.. As I cannot edit my previous post :( I need to become a real Reefuge member !

Code:
// SYRINGE DOSING PUMP
// Rob Conway, 25-05-2014 Rev1
//
// DESCRIPTION
// The Syringe pump uses 2 x 30ml syringes energised by a geared stepper motor 28BYJ-48
// Designed with Tinkercad 3D Modelling software
// Body of unit (without syringes) measures 110mm Wide x 75mm Long x 42mm High
// 3DPrinted in ABS with Makerstoolworks MendelMax 2

// USAGE
// Used to Dose any liquid in an aquarium however will be used for Carbon Dosing.

// OPERATION
// Normal operation is applying power to the unit it will dispense xx ml
// then will not dose again until power is re-applied.
// On powerup if the toggle switch is held ON (prime or retract) it will not dose,
// however run the motor forward (Prime) or reverse (retract).
// If retract is toggled the motor will back off the plunger plate 5mm to enable the
// syringe to be withdrawn from the unit.

// MOTOR DETAILS
// This Arduino example demonstrates bidirectional operation of a
// 28BYJ-48, using a ULN2003 interface board to drive the stepper.
// The 28BYJ-48 motor is a 4-phase, 8-beat motor, geared down by
// a factor of 68. One bipolar winding is on motor pins 1 & 3 and
// the other on motor pins 2 & 4. The step angle is 5.625/64 and the
// operating Frequency is 100pps. Current draw is 92mA.


//declare variables
int motorPin1 = 6;    // Blue   - 28BYJ48 pin 1
int motorPin2 = 7;    // Pink   - 28BYJ48 pin 2
int motorPin3 = 8;    // Yellow - 28BYJ48 pin 3
int motorPin4 = 9;    // Orange - 28BYJ48 pin 4
int sw_prime = 2;     // Manual Toggle Switch arduino pin 2
int sw_retract = 3;   // Manual Toggle Switch arduino pin 3
int count_d = 0;      // internal counter -steps DOSE
int count_r = 0;      // internal counter -steps RETRACT
int lookup[8] = {B01000, B01100, B00100, B00110, B00010, B00011, B00001, B01001};

// Tuning Parameters
int motorSpeed = 1100;     // variable to set stepper speed
int countsdose = 1050;     // number of steps per DOSE amount (1050 steps = 1.5 ml)
int countsretract = 20000;  // number of steps to retract to enable removal of syringe


// Setup I/O Channels
void setup() {
  pinMode(motorPin1, OUTPUT); //declare the motor pins as outputs
  pinMode(motorPin2, OUTPUT);
  pinMode(motorPin3, OUTPUT);
  pinMode(motorPin4, OUTPUT);
  pinMode(sw_prime, INPUT);     //declare toggle switch as inputs
  pinMode(sw_retract, INPUT);
  digitalWrite(sw_prime, HIGH); // turn on pullup resistors
  digitalWrite(sw_retract, HIGH);
  Serial.begin(9600);
  delay (2000);              // Startup delay 2 seconds
}

// Main Continuous Loop //

void loop(){
{if (digitalRead(sw_prime) == LOW)  // Check switch to PRIME
    prime();
    }
{if (digitalRead(sw_retract) == LOW)  // Check Switch to RETRACT
    retract();
    }
{if(count_d < countsdose)         // Will DOSE once on powerup.
    dose();
    }
}

// Subroutines //
void dose(){
  count_d++;
  for(int i = 0; i < 8; i++)
  { setOutput(i);
  delayMicroseconds(motorSpeed);
}}
void prime(){
  for(int i = 0; i < 8; i++)
  { setOutput(i);
  delayMicroseconds(motorSpeed);
  count_d =countsdose + 1; // Disables DOSE in main loop
}}
void retract() {
  {while (count_r < countsretract)
    for(int i = 7; i >= 0; i--)
    {setOutput(i);
    delayMicroseconds(motorSpeed);
   count_r++;;
  }
count_r =0;               // Reset RETRACT counter
count_d =countsdose + 1;  // Disables DOSE in main loop
}}
void setOutput(int out)  {
  digitalWrite(motorPin1, bitRead(lookup[out], 0));
  digitalWrite(motorPin2, bitRead(lookup[out], 1));
  digitalWrite(motorPin3, bitRead(lookup[out], 2));
  digitalWrite(motorPin4, bitRead(lookup[out], 3));
}
 
Last edited:

Rob

Member
Apr 26, 2012
743
424
Must admit was having trouble with motor torque as the internal clutch within the stepper motor was still slipping. A quick fix seems to be a rubber band from the front of the unit to around the back of the plunger plate. this seems a lot better as the motor does not need to overcome the friction of the syringe plunger. So the syringe travel is now really powered by the rubber bands, the motor simply turns the shaft which in turn winds down the plunger plate. A lot less stress on the motor as the threaded rod wants to turn under the force of the rubber bands.

I could also get a more powerfull stepper howver at the moment Futurlec are out of stock. The motor I use is 34mN/M which is dictated by the clutch inside the stepper, other motors without a gear box have 3-5x the torque in a similar size. I'll probably stick with the bands for these protypes and when the stronger motors are back in stock I'll give them a try. These stepper motors are like $3.00 each.

I have updated a new body with some cutouts to hold the rubber bands. You maybe able to see the small square cutout to the inside of the syringe at the front and under the rear where the rubber band is located on each syringe. The rubber bands cannot be a long term solution.
Have now incorporated a hanging point, thanks @macca_75
The wiring exists the rear a lot better than under the syringe body
Also have some 20ml syringes now and they are a lot easier to depress than the 30ml ones. Ill stick with the rubber band powered 30ml for now as it provides a longer running time and wait for a stronger motor in hopefully a months time.

The model below is done in tinckercad, a free cloud based 3D program. I should move on however this is soo easy and requires zero learning time.

syringe r2.png
 

Sam Parker

Moderator
May 6, 2013
4,802
2,397
Geelong
Rob - I have a friend that would like to buy one (I would like one too actually!) Let me know if you would sell them and what you'd need for two?

Thanks,
Sam
 

Rob

Member
Apr 26, 2012
743
424
I actually did another design and await a better motor assembly. When i get the right combo happy to print out a few for reefuge members at minimal costs