Introduction: Control Peristaltic Pump With TA7291P and an Arduino

Picture of Control Peristaltic Pump With TA7291P and an Arduino

This is my first Instructable and a few evenings invested in trying to understand how to use the TA7291P with a peristaltic pump without frying it convinced me that someone, somewhere, could probably be happy to get this information without loosing too much time.

The objective is to use an Arduino to control a peristaltic pump both in forward and reverse pumping while avoiding the risk of frying everything because of the back EMF generated when stopping the pump.

This project could be used to :

  1. Control the level of fluid in a vessel (that was my primary objective);
  2. Create a temperature-controlled variable flow liquid cooling unit;
  3. Plant watering (scheduled or as needed, if you add a sensor);
  4. Scheduled addition of nutrients (aquariums, hydroponics, etc).

Be imaginative!

It is part of a much bigger project and I will probably post it once it is completed.

Warning : French is my first language. I apologize in advance.

As I hate instructables that don't give you all the necessary details, there is no tricks nor missing secret ingredient in this one. I tried to be as complete as possible but if something could be improved, please comment!

Step 1: Background

If you already know all this stuff or just don't care, please jump to the next section.

For the others...

Back EMF : When you suddenly stop the current flowing in any solenoid (relay, motor, pump, electromagnet, inductor, aka anything with a coiled wire in it), the magnetic field will collapse and create an opposing current (going the wrong way) with a voltage being many times the original voltage. This is likely to fry any IC despite the very short duration of the voltage spike.

As a general rule, never directly connect any circuit to any inductive load without some kind of protection from back EMF. You can find a much detailed explanation here.

Flywheel diode : One of the technique to avoid damage caused by back EMF is to use a flywheel diode that will divert the pulse away from your IC (back into the coil actually).

However, you cannot use the flywheel diode with a peristaltic pump as someone would have to reverse the diode depending if the pump is used in forward or reverse pumping.

You could probably use a MOV (Metal-Oxyde Varistor) instead of the flywheel diode, but to tell you the truth, I don't have any to test and I only thought of it after starting writing this...

If I can get a few of them, I'll make some tests and post and update. If you have some, try it and share your results!

Peristaltic pump : Works like your gut, squeezing a tube to get the stuff out. However, unlike your gut, most of them will simply work in reverse when you reverse polarity (inverting the positive and the negative connection on the pump), so you can fill or empty a vessel with the same pump. Always check the characteristics of your stuff before plugging it (ideally, before buying it!). Also, some pump may or may not be destroyed by "dry pumping" (being used to pump an empty tube).

Current draw : Also called Inrush current, power-on surge, etc. This is the other reason why you want to use a PWM-based control for your pump. Every electric motor doesn't like two things : starting and stalling. When they do so, they will draw a current that is mostly limited to their (very small) internal resistance.

Avoiding Back EMF :

The more sudden the change in the current (if you suddenly "pull the plug"), the more severe will be your back EMF (now, there is a limit to this, but it is way too high anyways for your precious IC...)

The secret is reducing/increasing the current slowly.

And slowly here means a few milliseconds, not minutes...

Now, the easy solution if you have an Arduino is to use 2 PWM pins to slowly increase and decrease the amount of energy in the coil, thus avoiding the back EMF issue as we don't abruptly cut the power (actually, there is always some back EMF, but this way it is within the IC tolerances). By the way, this is a great way to power up or down power transformers or charging supercapacitors, as these little things are thirsty for current and will behave like short circuits. However, this is a completely different story (and Instructable). I'm only throwing it here to tickle your intellect.

Now, I will not start explaining how all that PWM stuff is working, as some great tutorials are already waiting for you.


Step 2: Get the Stuff...

Picture of Get the Stuff...

This project only needs a few basic parts...

Hardware

1- Arduino

I used an Arduino UNO R3 (But you probably could use any of them... as long as 2 PWM pins are free and you can output 5V)

2- TA7291P

It is a 0-20V 1A (2A peak) Bridge Driver. It is quite cheap. I used the through-hole 10 pins version. Available at my local electronic surplus for 3.98$ CDN but close to 2$ at Digikey...

Datasheet : TA7291P

Link to Digikey : Part number TA7291PO-ND

3- 12V Peristaltic pump

I selected the 12V peristaltic pump from Adafruit for two reasons :

1- I really needed a peristaltic pump

2- It only draws 300-400mA

It is not cheap, but it works as advertised. You could probably pay less on Ebay... Just don't use any heavy duty 12V pump here... Remember, your bridge is rated 1A...

4- LED (your choice of color)

Completely optional... Just for debugging. Absolutely no other use, and please remove it if you want to reduce your energy usage. You could also use the LED already on your Arduino...

5- Resistor

The mandatory resistor if you use an external LED. Value is not critical, just make sure no more than 20mA will get through your LED. I used a 330 Ohm resistor.

6- A bunch of wires

To connect everything...

7- A 12V battery

8- The USB cable to upload your sketch and power the Arduino

9- Obviously, a breadboard!

Software

1- Arduino IDE

I'm assuming it is already installed, working, and that you know how to upload a sketch... If not, go straight to www.arduino.cc and you will get some great tutorials!

Step 3: Connect All the Stuff...

Picture of Connect All the Stuff...

On a breadboard, place the TA7291P in any convenient spot.

Connect according to the following :

  1. Arduino GND (any of them) to TA7291P pin 1 and 12V GND
  2. Arduino (+)5V to TA7291P pin 7 (Vcc)
  3. Arduino D5 to TA7291P pin 5 (IN1)
  4. Arduino D6 to TA7291P pin 6 (IN2)
  5. Arduino D13 to R1 (if the optional external LED is used)
  6. R1 to (+) leg of LED
  7. (-) leg of LED to GND
  8. TA7291P pin 2 (OUT1) to (+) terminal of your pump
  9. TA7291P pin 4 (Vref) and pin 8 (Vs) to (+)12V
  10. TA7291P pin 10 (OUT2) to (-) terminal of your pump
  11. TA7291P pin 3 and 9 are not used

Step 4: Upload the Sketch...

Here is a (very) basic sketch to test your pump. No libraries, nothing complicated... The code is self-explaining, just read the comments.

What you are supposed to get is a pump that starts, stays at maximum speed for ten seconds, slow down to a complete stop, then reverse the pumping action to pump back the fluid.

If you installed the optional LED, you will see it increasing/decreasing its luminosity, shadowing the speed of the pump.

Step 5: In the End... to Heat Sink or Not to Heat Sink... That Is the Question!

Picture of In the End... to Heat Sink or Not to Heat Sink... That Is the Question!

My biggest concern was more related to the thermal effect of powering the pump for a few minutes or even hours. With a pumping rate of 100ml/min, I would realistically need to power it for up to 10-15 minutes at a time (each few hours in the worst conditions, each other day typically) for my project. When they are not in use, both pump and bridge will have plenty of time to cool down to room temp.

As the pump is rated for continuous use, 10-15 minutes is not an issue, but this is something you really have to check, especially with relays, solenoids and pumps! The real problem is the TA7291P heating up...

According to the datasheet, the P version I used as a power dissipation of 12.5 W at room temp (25 degrees Celsius). Now, this is called lab conditions and it relies on an interesting concept, the infinite heat sink. It doesn't in any way reflects real life, where ambient air temperature, humidity, air circulation, definite heat sink capabilities, phase of the moon, etc, will influence your circuit. However, as our pump only draws 300-400 mA, we are sitting right in the middle of the comfort zone here, far from the 1 A max. However, according to the datasheet, power dissipation drops to less than 2.5 W (a mere 200 mA) when the bridge is used without heat sink, but it doesn't say if it is for burst (less than 1 minute), short usage (1-5 minutes) or long term (more than an hour). The safe design would add a heat sink. But I was wondering if we could go without one.

As I got two TA7291P, testing one without a heat sink was worth a try... As the absolute operating temperature is 75 degrees Celsius, I decided to push the test to a maximum of 65 degrees, with complete cool down between the experiments.

It is easy to modify the sketch to make the pump work for a longer period. Using an infrared thermometer (a nice gadget to have by the way, put it on a wish list for a Birthday present!) I was able to verify that without heat sink, in an environment of 18.5 degrees Celsius, and only with natural convection (no fan) the bridge would stay at less than 20 degrees Celsius after 10 minutes pumping 25 degrees Celsius water. This gives you an idea of the real performances, but these numbers will likely change depending of your local temperatures and if the bridge is enclosed in a case, reducing the natural convection.

Here is a small graph of temperature vs time of the bridge in two different experiments.

For me, in the end, it seems unnecessary to add a heat sink.Time will tell if I was right. I'll keep you posted!

And by the way, no, the graph was not reversed by mistake. In both experiments, it looks like the temperature was slowly drifting down. That makes no sense, but as it is within the error margins of the infrared thermometer, I disregard it as noise until I get more time to investigate!

Step 6: What Can Go Wrong?

Common mistakes (at least I made them)...

1- You have to tie your Arduino GND to the PIN 1 of your bridge AND to the 12V Battery GND.

2- Don't increase the value of PIN 5 and PIN 6 at the same time. One should stay at 0. If not, it is like pushing the brakes on your pump. Look at table FUNCTION on page 3 of the Datasheet.

3- PIN 2 (OUT1) on your bridge goes to the (+) terminal of your pump and PIN 10 (OUT2) goes to the (-) negative terminal. Don't connect the second pump terminal to GND! However, you can switch terminals. The pump will work in reverse, at least for the model I tested.

4- Don't use a flywheel diode, unless you will not use the reverse pumping. Using one will create a short when the pump is switched in reverse pumping. This is why you slowly increase/reduce the current using PWM pins to reduce the negative impact of back EMF.

5- Don't pull the plug suddenly. Doing so will create a back EMF that could probably fry your bridge and/or your Arduino. Always bring the pump to a full stop (PIN 5 and PIN 6 LOW, not HIGH which is full brakes!). This is why in the sketch, I inserted a pause, so you can plug or unplug everything during that time.

Step 7: Conclusion

I hope you have a working peristaltic pump by now and that you learned a few things along the way. I'll try to answer comments and questions to the best of my knowledge and in a timely manner. This being said, I'm quite busy, so do not despair if you don't get a reply within the hour.

Comments

wp444 (author)2017-07-11

Hi, I'm wondering how exactly to power the pump - I can't tell from the photos. I have a 12V AC/DC adapter; would that work, and if so, how? Thanks a lot!

fmarquis (author)wp4442017-07-16

The power is coming from the IC. This is why you can attach a heatsink to it. Please refer to the ic datasheet form max power.

rogu10 (author)2017-07-06

Hi, nice tutorial.

I know that this post is a bit old, but I'm currently working woth some of these pumps and I would like to know if you can control their speed, or it's just ON and OFF.

Thanks for your help!

fmarquis (author)rogu102017-07-06

I only used them as on/off, varying time to get a specific volume. I would suspect it could be controlled by pwm but you could run into torque issue and not being able to pump you fluid against gravity or if you have elevated resistance or high viscosity.

JoãoM41 (author)2015-11-01

Hey thanks for the tutorial. I have a couple of these pumps to run a washing system of a cells in a microscope at the lab. I'm running a 12V power source through the pumps and with those resistances it is really hard to slow them down. Could I use the TA7291 to do so but using a potentiometer? Any other circuit that would allow me to do this? Thanks!

fmarquis (author)JoãoM412015-11-01

When you say "resistance" you are talking about the fluid being pumped or the electrical resistance? When you say "washing system" what is important? A constant flow? Pulse flow?

JoãoM41 (author)fmarquis2015-11-01

I need a PWM right?

fbeissel (author)JoãoM412016-12-09

A common trick even on high end equipment is to split the fluid flow. put on a t or y splitter and clamp the wash line to restrict flow mechanically. Divert the other large volume flow back to the wash reservoir and you will have little waste. A 0.2 micron filter inline would also help keep everything sterile.

JoãoM41 (author)fmarquis2015-11-02

Ordered a couple of 10usd pwm with all that. It would be ore expensive to make one with a timer or h-bridge and mosfers so I opted the ready to go option. Thanks!

JoãoM41 (author)fmarquis2015-11-01

I meant current sorry. I would need a rheostat with a lot of heat dissipation. So I have one of those pumps going from a tube with media to the plate and another pump to take out the media from the plate to a waste tube. both pumps work at the same rate. however I have like 40ml/min now, and I need to reduce the flow. I need to control the rate of flow. meaning dropping the voltage. I tried to use a resistance I had laying around to do a voltage dropper (parallel to the pumps) but the resistors fumed :p. So the idea is to control the voltage I guess. I didn't want to change from the 12V power source. This is kinda my system now (I only have two 3.6 resistors in parallel now, they can handle the current draw.

fmarquis (author)JoãoM412015-11-02

Yes, you need some PWM control for that. There is a lot of easy schematics using a 555 chip on the net. Try one of them to control a MOSFET (ideally through a MOSFET driver). I should work without an Arduino.

ShubapradhaR (author)2016-05-13

Hi, Could you please tell me how to control the flow of water using this pump?

fmarquis (author)ShubapradhaR2016-05-16

Hi,

This type of pump is not designed to have a flow control. It can only be on (full power) or off. The amount of water being pumped is related to the activation time.

If you happen to have such a pump (and don't expect your typical cheap-from-ebay-pump to be one, then the control strategy will depend of the motor type. Read the datasheet... If your pump is good enough to be flow-controlled, the manufacturer will tell you how!

gkepets (author)2016-04-05

Hi, I also have this part and I'm using it to build a bubble tube. (pumping air into water to make bubbles) However it pumps very little amount of bubbles and relatively slowly. Are there better Arduino controllable parts or is there a way to fix this? Thanks

Ye7ia (author)2016-02-15

Thank you for this :)

whitefeatherhunter (author)2015-09-28

Have you built a pump system using two pumps before? One to pump in and one set up in reverse to pump out?

I did. But I am not using an arduino. I'm trying to install a PWM to reduce the pump flow. I have two pumps one putting liquid and another taking it out. I tested it for a while and they both work at exactly the same rate. the pumps are in parallel, so the pump rate should be the same.

Unfortunately, no. Tell me if it works!

YokiJ (author)2015-09-30

can you help me. i make the same system with this. have you tested the stability of that system ? please help me. you can send to my email. yokiyogijanuardi@gmail.com

fmarquis (author)YokiJ2015-11-01

The stability was only tested for a few minutes. The limiting factor being the pump, not the chip. If your pump is rated for continuous work or only for a fraction of duty cycle...

fmarquis (author)YokiJ2015-10-01

Hi !

This was more some kind of preliminary test that I did, it never got tested in a real life inside another project. However, I don't see why you should have any problem as long as you don't exceed your pump specifications (a lot of them are not made for continuous usage for example)

jaydique (author)2015-10-13

Hello! Nice work on the 'ible.

Can you please help me modify the code to make it run as you have it. But for 127 (half) speed cycles first.

then one quarter speed cycles? please!

I am using to push fluid through a very small plane so i would probably need to use PWM values of 20 or less but if you can help me with the code for half speed cycles then quarter i think I can modify it to suit.

jaydique (author)2015-09-16

Hey I was wondering if I could get some help with this project. I have sent you a PM

nedders (author)2015-05-25

how about a video or final pic of it all working

craftclarity (author)2014-06-05

Nicely written 'ible. Thanks for sharing this!

About This Instructable

43,001views

62favorites

License:

Bio: A crazy mix between a physician and a mad scientist...
More by fmarquis:Laser Cut Stand for DIY LED Seed StarterInstalling a heater on a VESA compatible articulated LCD screen supportBlack Garlic - Probably the Easiest Way to Make It at Home!
Add instructable to: