Go Down

Topic: School project (Read 140 times) previous topic - next topic

Stormpiggly

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:

https://imgur.com/a/RamTy


Any advice or solution?  :smiley-confuse:

rogertee

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.

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.).

TomGeorge

#3
Jan 14, 2018, 09:33 am Last Edit: Jan 14, 2018, 09:35 am by TomGeorge
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


Thanks.. Tom.. :)
Everything runs on smoke, let the smoke out, it stops running....

Go Up