School project

im currently working on a school project (ROV), and we are having some issues with it.

issue: The arduino wont give 5v out to the relay (it gives 3.5v)

im currently using Arduino 168 in the program “Proteus”

Source code:

int motorf1 = 7;
int btn1 = 4;

void setup()
{ // put your setup code here, to run once:
pinMode(motorf1, OUTPUT);
pinMode(btn1, INPUT_PULLUP);

}

void loop()
{ // put your main code here, to run repeatedly:

if (digitalRead(btn1) == LOW){
digitalWrite(motorf1, HIGH);
} else {

digitalWrite(motorf1, LOW);
}

picture of the masterwork:

Any advice or solution? :confused:

Arduino outputs are logic outputs not power outputs that can drive things like LEDs. Best advise is use an optically coupled relay board they are made for Arduino. This requires you to feed the relay coil directly with 5 volts and the key is this power is fed in series with an opto coupler which isolates the Arduino outputs from relay coils and back emf problems. The Arduino output feeds a little LED inside the optoc black box and in the case of a 4n25 a phototransistor inside black box detects the LED light and turns on allowing power to the relay. On those type of relay interface boards there is usually a jumper that allows to to use the same 5volt supply as the Arduino is getting or remove jumper you supply a separate supply. To better understand this topic do a research on opto couplers as some are photo transistor, resistors, triacs, scrs,etc. A typical name for triac type is a solid state relay AC only.

Following that, if Proteus does not make a ready made relay module available to you, then use a transistor and a 1k base resistor to drive the relay. What incidentally was the specification of the relay (coil resistance etc.).

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.
OPs circuit
p16cjSN.png

Thanks… Tom… :slight_smile:

6v6gt:
Following that, if Proteus does not make a ready made relay module available to you, then use a transistor and a 1k base resistor to drive the relay. What incidentally was the specification of the relay (coil resistance etc.).

thanks for the help, Proteus only have ready made relays etc. But i have a small issue with the relays. They wont work on 5V. If i put the relays to go on 3v on proteus, everything works. But if i set them to 5v ( what i want them to go on) they wont work.

any solution/advice?

thanks for the help:)

They wont work on 5V. If i put the relays to go on 3v on proteus, everything works.

That is just wrong, so I suspect you are not fully explaining what is happening. Also from your schematic, you can not connect a relay directly to an output pin. You also need a diode across the relay coil to protect the rest of the circuit.

Grumpy_Mike:
That is just wrong, so I suspect you are not fully explaining what is happening. Also from your schematic, you can not connect a relay directly to an output pin. You also need a diode across the relay coil to protect the rest of the circuit.

ive made a new post " https://forum.arduino.cc/index.php?topic=524165.0 "

there with picture and code. ive made some changes from this schematic. but ill test with diode on the relay

thanks - Stormpiggly

Stormpiggly:
ive made a new post " https://forum.arduino.cc/index.php?topic=524165.0 "

Don’t double Post.

I have already suggested to the Moderator to delete the other one thinking you had double posted by accident.

…R

Moderator: duplicate removed

Stormpiggly:
ive made a new post " https://forum.arduino.cc/index.php?topic=524165.0 "

there with picture and code. ive made some changes from this schematic. but ill test with diode on the relay

Please post updates here, we don't allow duplicate posts on this forum.