Help designing a simple circuit?(Transistor/Relay)

Good morning,

I’m hoping this isn’t too much to ask but I’m doing a little Arduino with Ruby demo at a future Ruby Users Group meeting and would like to have a neat project setup.

So I’m going to build a simple Barmonkey (to be called Barduino). The idea being, two available windshield washer pumps, controlled by the Arduino to dispense drinks. Here’s what I’m looking at…

I’ll be using two 12V 1A water pumps and here’s what I think the circuit should look like but I’m still somewhat new to electronics…

Arduino digital pin → resistor → transistor (transistor goes to ground and to a relay). The relay will connect to the 5v out on the Arduino as well as the 12V 1A DC power supply (which I think I’ll be using a wallwort for). And the output of the relay will go to the pump which will be using the Arduino’s ground.

There will also be a diode in there to prevent the 12V 1A from going back to the Arduino…

So in theory…

Turn on the digital pin which triggers the transistor to send power to the relay which will then open the 12V to the pump which is grounded in which case will then turn on. Once the digital pin is turned off, everything will stop.

Does this sound right? And this would be done twice, one setup for each pump. So only 2 digital pins will be occupied.

On the Arduino software side I’ll simply be sending serial commands to turn the pins on and off.

How feasible does my circuit sound? The only thing I’m unsure of and I’ll know a little bit later when I scout the local electronics warehouse is the transistor type and relay I’ll need.

I can use a lower power transistor that the Arduino is capable of triggering, correct? And then the relay will need to be capable of 12V 1A?

Any responses will be greatly appreciated. Thanks :slight_smile:

There is a circuit diagram here http://www.arduino.cc/playground/uploads/Learning/solenoid_driver.pdf that should would work for driving your pump without a relay. The pump motor replaces solenoid L1 in that diagram. The suggested components including the TIP102 transistor should be fine for your app if the pump only draws 1 amp.

If you are more comfortable using a relay you can either select one that can operate on 5v at less than 40ma or use the circuit above but replace the pump with the

There is a circuit diagram here http://www.arduino.cc/playground/uploads/Learning/solenoid_driver.pdf that should would work for driving your pump without a relay. The pump motor replaces solenoid L1 in that diagram. The suggested components including the TIP102 transistor should be fine for your app if the pump only draws 1 amp.

If you are more comfortable using a relay you can either select one that can operate on 5v at less than 40ma or use the circuit above but replace the pump with the

Excellent! Thank you very much. That diagram is perfect.

My only concern (not so much a concern but unfamiliarity) is with the power. I need to determine how I'm going to get my 12V 1A power for the pumps. I'm 80% I have a wallwort power supply I can use but if anyone has any suggestion for a smaller battery or something that would be fantastic.

Would there be any alternatives to make this solution more portable? Can you get 12v1A from a USB port if you step it up or would that not be worth the trouble?

Again, thanks for the schematic, that makes a lot of sense and I should easily be able to find the proper transistor (the only reason why I had a relay in the equation was so I could handle the 12V1A, I didn't want to overheat the transistor in case I didn't have an appropriate one).

Thanks again!

12 volts at 2 amps is certainly possible on battery power if the pumps will not be on for long periods of time. You could look on some of the robotics and radio control car web sites for some battery options.

USB power is out of the question for the pumps, but you should be able to find an AC power supply that can handle the 24 watts or so that you need.

Can you get 12v1A from a USB port if you step it up

You can step up the voltage of something with the side effect of reducing the current or step up the current with the side effect of reducing the voltage BUT you can’t do both. The product of voltage and current (called the power) of the input can’t exceed that of the power of the output otherwise you create power for free and violate the laws of Physics (and get very rich)

Voltage from a USB port is 5V, max current from a USB port is 500mA

can somebody give me a guide on how to connect the windshield washer with 12v dc supply and also to the arduino board. Thank You

Something like this: http://www.instructables.com/id/Connecting-a-12V-Relay-to-Arduino/step6/The-Schematic/

Replace relay with your washer - if it's some kind of motor. Just be careful to get the right transistor so it doesn't burn out from too much current.

Korman

Korman,

I already done the circuit and I also connect it with 5v relay. I got the picture but I can't upload it here. Can u give me you email add so that I can give u the pic of my circuit because the circuit doesn't work.

Raihan

Upload it to any hosting site (eg 666kb.com rapidshare flickr) and link to it with the or the button in the message editor.

Korman

Here is the link http://noorraihan.wordpress.com/ under title 'my project'. Thanks for your cooperation.

Raihan

and I also connect it with 5v relay.

Where?

That picture doesn't show enough of your circuit and what schematic are you supposed to be following? The two pictures are different circuits. What "doesn't work"?

My relay problem already solved. Can I used 2 (9v battery) in order to turn on my 12v water pump? how to connect the battery to the water pump and to the breadboard?

Can I used 2 (9v battery) in order to turn on my 12v water pump?

Yes it should work for all of 30 seconds. The square 9V batteries can't supply much current.

Wire the relays normally open contacts in series with the pump and the battery to make a circuit. Normally open relay contact -> one pump wire | other pump wire -> battery + | battery - -> common relay contact

I'm very sorry if I got so many question. my water pump got 2 wire which is red n black in colour. Which one do I connect to normally open relay contact? Is it the black wire? Thanks a lot for your information.

Raihan

Normally the red one goes to the positive and the black to the negative. Try connecting it directly to the battery first and see that it works. Then put the relay contacts in series with the pump.

I already connect the circuit as what u told me. But the problem the relay can turn on while the water pump did not turn on. I don’t know what causes this problem, can you help me to solve this problem.

Thank You

Check that:- 1) The pump turns on when you connect it directly to the battery. 2) You have identified the relay contacts correctly. Use a resistance meter to check they make contact when the relay energises.

I already check the pump and it turns out when directly connect to the battery. But I don't have resister meter to check the relay contacts. Is it ok to use 5v relay to turn up the 12v water pump?

Is it ok to use 5v relay to turn up the 12v water pump?

Yes the 5V is the relay coil and has nothing to do with the voltage of the load. If the contacts are up to it you can switch mains voltage from a 5V relay.

But I don't have resister meter to check the relay contacts

Then get one, they are less than $10 from a thrift store. Normally I would recommend that you used a battery, resistor and LED to check continuity but your pump is the equivalent of this. So you have misidentified the relay contact connections. Double check the relay's data sheet.

I already done the relay part and my water pump turn on when it is connected. But I got another problem. My water pump didn't turn on and off followed the coding. Below is my coding:

// int sensorPin = 0; int redPin=5; int yellowPin=6; int greenPin=7; int waterPump = 8;

int sensorValue=0;

void setup() {

Serial.begin(9600);

pinMode(redPin, OUTPUT); pinMode(yellowPin, OUTPUT); pinMode(greenPin, OUTPUT); pinMode (waterPump, OUTPUT); digitalWrite (waterPump, LOW);

}

void loop() {

Serial.println(analogRead(0)); delay(500); sensorValue = analogRead(sensorPin);

if (sensorValue >= 400) { digitalWrite(greenPin, HIGH); delay(1000); digitalWrite(greenPin, LOW); delay(1000); digitalWrite(waterPump, LOW); }

else if (sensorValue>=200) { digitalWrite(yellowPin, HIGH); delay(1000); digitalWrite(yellowPin, LOW); delay(1000); digitalWrite(waterPump, LOW); }

else { digitalWrite(redPin, HIGH); delay(1000); digitalWrite(redPin, LOW); delay(1000); digitalWrite(waterPump, HIGH);

} }

The water pump should be turn off when soil moisture sensor detect the soil in medium or in wet condition. But it turn on all the time and only turn off when I unplug the usb connection. Is there anything wrong with my coding?