FIRST TIMER - can't get simple code to turn on a peristaltic pump

Hey!

I’ve just started to learn Arduino and decided to start learning by programming a peristaltic pump. I thought that would be super simple (just to turn it on), but turns out I’m having some issues :frowning: bc when I run the code nothing happens. I’ve attached a photo and video so you can see the arduino setup too. Any ideas what I’m doing doing wrong? Any suggestions would be very appreciated!

This is the code I’m using:

int motorPin = 11 ;

void setup() {

}

void loop() {
digitalWrite(motorPin, HIGH);
}

I don’t think it’s a problem with the way I’ve set up the electronics because the motor runs when I hook it up to the power supply pins, and all I’ve done is move the 5v and GND (from the power supply pins) to the ~11 and GND of the Digital/Analog pigs.

You have not set the pinMode() of the pin to OUTPUT

Can you post a clear schematic of your circuit - I can’t see what buffer device you have between the pump and Uno.

And, what UKHeliBob said.

Whoops, thanks!

I just updated my code, but nothing is happening...

Here's the updated code:

int motorPin = 10 ;

void setup() {
pinMode(motorPin,OUTPUT);
}

void loop() {
digitalWrite(motorPin, HIGH);
}

You may as well put the digitalWrite in setup.

Is your Uno getting hot?

TheMemberFormerlyKnownAsAWOL:
Can you post a clear schematic of your circuit - I can’t see what buffer device you have between the pump and Uno.

And, what UKHeliBob said.

Sorry about that…here’s a better picture

TheMemberFormerlyKnownAsAWOL:
You may as well put the digitalWrite in setup.

Is your Uno getting hot?

Thanks for the suggestion, will do!

So far it doesn't feel hot..

Also - since I'm a new user the forum only lets me respond 5 min after my last post, so just a heads up I might be delayed in responding..

You have the motor directly connected to motorPin?

Idahowalker:
You have the motor directly connected to motorPin?

It’s not connected directly…I put a rectifier diode and transistor between motorPin and the positive part of the motor. I don’t think I need the transistor, but I was told to keep the diode in because if the motor is running and I shut off the arduino, it could destroy the uno…

rectifier diode:

(NTE Electronics, Inc. - 1N4007 - Rectifier Silicon, 1000V, 1 A, DO-41 Case, Solder Leads, 1N Series - Allied Electronics & Automation)

louisg1:
Sorry about that...here's a better picture

OP's circuit photo.

The transistor appears to have only two pins connected. :cry:

The diode is in series with the motor. :cry:

The motor is powered off the Arduino board. :cry: The motor should have its own power supply.

There's no ground to the breadboard. :cry:

Here are some typical output connections to compare to yours.

louisg1:
I don’t think I need the transistor

You absolutely do need a transistor, or some sort of motor driver. If you connect a motor directly to one of the Arduino’s IO pins, you will damage or destroy the Arduino.

You are never going to get a reliable electrical connection by poking jumper wires through the terminals of the motor and bending them over. You need to buy soldering equipment and learn to use it correctly.

Yeah, you forgot this part

Motor driver

I run a mess of those same pumps using these.

-jim lee

Thanks for all your tips! I don't think it's a hardware problem since I'm able to get the motor to turn on when I plug the motor directly into the arduino's power ports. That works every time... long term, I know I'll need to learn to solder, but if I'm able to get the motor running wouldn't that indicate it's a problem with the code?

You most definitely do have multiple hardware problems, as dougp has already pointed out. It is true that your current method of connecting the wires to the motor can provide a low quality, unreliable connection, so you might get away with that, but the issues dougp pointed out are absolutely critical.

You need to understand that the 5V pin on your Arduino is much different from the digital pins on your Arduino. The 5V pin can provide hundreds of milliamps of current, which may be sufficient to power the motor. The circuitry that provides power to the 5V pin is reasonably resilient to a load drawing more current than is available or giving flyback voltage spikes from an inductive load. None of this is the case with the IO pins on your Arduino. The absolute maximum current limit of your IO pins is 40 mA. Even drawing that much current from them for any length of time will damage your Arduino (it's best to limit yourself to 20 mA or less). That motor is drawing far more than 40 mA. The pins are also very sensitive to voltage spikes. There is a good chance you have already damaged your Arduino with this wiring. That was very unnecessary because there are so many tutorials that show how to correctly control a DC motor from an Arduino. Your wiring demonstrates that you didn't follow any of these tutorials.