Output giving 1.5 Volts constantly and wiring relay inquiry

Hello, I am working on a project and have a bit of a mystery. I have 6 relays controlling 3 DC motors for a 3-axis motion (2 relays per motor, 1 relay per direction.) The relays are being controlled by output pins 3, 5, 6, 9, 10 and 11. Each output is turned on by the same "tag" which is an integer value. The tag is called com_sum. If com_sum == 1 output 3 = HIGH, if com_sum == 2 output 5 = HIGH, so on and so forth. On some of my pins I am always getting around 1.5 volts irregardless if I have set the output to low or high. I have done some forcing of outputs and monitoring in serial monitor to make sure that the if statement is true, so I highly doubt it is a programming error. Shot me straight is my board done? Also I have attached a picture of my wiring would you mind having a look and telling me if this is an appropriate way to wire my outputs to the relays. Thanks for your time.

Sorry forgot to add the picture, here it is.

Untitled.png

It could be a wiring error or a programming error. In other words, anything.

That is not a picture of your wiring. That's not even a schematic. It's useless. You need to give details. What relays are you using? Are they part of a preassembled module? Are you using an external driving circuitry? What exactly is wired to what?

What is your sketch?

Thanks for the input, it is ugly as hell but it sure as s**t is a schematic it is most primitive form. I have determined it is a problem with pins. Went through the code and change

int y_fwd = 5; pinMode(y_fwd,OUTPUT);

to

int y_fwd = 7; pinMode(y_fwd,OUTPUT);

and hey look at that all the problems are gone.

The relays are just pure relays (8-pin, using the 2 N.O. contacts), no driver/circuit board additional part jazz. Just pure relays. They can be heard clicking when voltage is applied however are not moving the motors. I'm no fool and know for a fact that everything is correctly wired correctly, it would appear that the voltage being applied to the relays from the board is just a little to low because if I jump the relays with a 9V battery there is no problem. It is odd however that they click when the arduino sends out voltage. Weird stuff right.

I hope you didn't connect a relay directly to a pin. That will fry the pin in no time. Arduino pins are small signal pins, not power pins. 20mA is the max current they should be sourcing or sinking.

Use relay drivers (transistors) with (1k) base resistor and a diode across the relay coil. Or relay modules, with all those parts already on the board.

Arduino's 5volt supply/pin also shouldn't power 6 relays. You likely need a dedicated supply.

Provide a drawing, and/or pictures if you want proper advice. Leo..

Hi,

Hello,
I am working on a project and have a bit of a mystery.
I have 6 relays controlling 3 DC motors for a 3-axis motion (2 relays per motor, 1 relay per direction.)
The relays are being controlled by output pins 3, 5, 6, 9, 10 and 11.
Each output is turned on by the same “tag” which is an integer value.
The tag is called com_sum.
If com_sum == 1 output 3 = HIGH, if com_sum == 2 output 5 = HIGH, so on and so forth.
On some of my pins I am always getting around 1.5 volts irregardless if I have set the output to low or high.
I have done some forcing of outputs and monitoring in serial monitor to make sure that the if statement is true, so I highly doubt it is a programming error.
Shot me straight is my board done?
Also I have attached a picture of my wiring would you mind having a look and telling me if this is an appropriate way to wire my outputs to the relays.
Thanks for your time.

OPs diagram
7d00566e0dcd778e2fe597c9a3eafd1a34796927.png
(EDIT.Well image was there until original image changed/moved… :o)
Sorry but your original post was hard to read.

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.

What are the relays. part number, link to data?
Tom… :slight_smile:

7d00566e0dcd778e2fe597c9a3eafd1a34796927.png

Post your code please. All of it. Use code tags.

Hopefully you are using relay modules, not just relays? The modules would have a coil driver circuit built in. An Arduino output cannot drive a relay coil directly.

Shot me straight is my board done?

Can you phrase that in better English please?

My best guess at this point is that you have not set the pins as OUTPUT, and you are measuring a floating value with your multimeter. However, setting an input to HIGH should cause a change in the reading, and you say you are not seeing that.

it is ugly as hell but it sure as s**t is a schematic it is most primitive form.

No it is not in any way a schematic. If I were being kind I would say it was a "block diagram" but one that you would be hard pressed to show any less information.

michaelszabo: I'm no fool

The evidence suggests otherwise.

and know for a fact that everything is correctly wired correctly

Just because everything is wired the way you intended to wire it does not mean it's wired correctly.

It is odd however that they click when the arduino sends out voltage. Weird stuff right.

It is only odd if you're ignorant.

Arduino pins are not very strong. For one of the AVR-based ones, it's recommended to keep the current from each pin below 20 mA. 40 mA is the absolute maximum. That's enough to light up an indication LED, not to power a relay coil. You're damaging your Arduino pins by overdriving them like this. Search for a transistor switch circuit to learn how to control larger amounts of current than an Arduino pin itself can supply.

Okkey,
here is the machina, code and orientation of the relays to the outputs. Each relay is fed by it own designated output (originally directly but have added intermediate step of transistor with a 9 volt battery on the collector pin and the respected output pin feeding the base and the emitter connected to one lead of the relay.) The 2 pins that were acting wanky are just damaged (I can only assume as I have changed nothing in the code and just chose a different pin.) You will notice in the code some odd items such as com_1, and com_sum. My uno was limited with I/O so i needed more and had another uno laying around so my secondary uno is an input board that sends a binary coded signal to the other board and based on that summation of bits I know which input is being used (keeping cost down literally not spending another $ on this thing.) I believe something like this can be achieved by using the rx tx pins but I will require my serial connection on the first board for a SCADA system. Don’t worry about the encoder section wip removing debounce (not true encoders just push buttons on the end of the shaft to count rev.) Thanks for the input but everything is working without fail right now just adding more code for computer operated capabilities. As for you jig-ninja, I’m not much for internet trash talk however I do live in Stoney Creek, Ontario Canada if you live near by maybe we could meet up sweet heart. :wink:

Machine.PNG

Master_Code.ino (4.31 KB)

I apologize, I should note that the section in the code designated to the outputs feeding the relays is:

// Output configuration //================

Cheers

Hi,
OPs pics
Machine.PNG
Electrical_Panel.PNG

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks… Tom… :slight_smile:

Hi,
For a project as complicated as that you must have a circuit diagram, a hand drawn circuit with labels and showing power supplies will make troubleshooting so much easier.

Can you please post a copy of your sketch, using code tags?
They are made with the </> icon in the reply Menu.
See section 7 http://forum.arduino.cc/index.php/topic,148850.0.html

Thanks… Tom… :slight_smile:

Hi Tom, Thank you for your interest. Unfortunately I don't have any electrical drawling this has all been done from my head (and yes my brain is as much a mess as this wiring.) I have solved all of the previously posted problem. I don't know how to make this discussion "solved."

BTW "Everything runs on smoke, let the smoke out, it stops running...." love it!!

Again thank you good sir and a karma point for you.

Hi, OPs code

int x_pos = 0;
int y_pos = 0;
int z_pos = 0;
int x1 = 0;
int y1 = 0;
int z1 = 0;
int x2 = 0;
int y2 = 0;
int z2 = 0;
int x3 = 0;
int y3 = 0;
int z3 = 0;
int x4 = 0;
int y4 = 0;
int z4 = 0;
int x5 = 0;
int y5 = 0;
int z5 = 0;
int x6 = 0;
int y6 = 0;
int z6 = 0;
int x7 = 0;
int y7 = 0;
int z7 = 0;
int x8 = 0;
int y8 = 0;
int z8 = 0;
int cur_pos = 0;
unsigned long de_tm = 0;

void setup() {
  // put your setup code here, to run once:
Serial.begin(9600);
}

void loop() {

// Communication Inputs From "Slave" Arduino And Their Data Storage
//=================================================================

int w = 0;
int x = 0;
int y = 0;
int z = 0;
int pin_w = 0;
int pin_x = 1;
int pin_y = 2;
int pin_z = 3;
w = analogRead(pin_w); // Comm Bit 1 Read
x = analogRead(pin_x); // Comm Bit 2 Read
y = analogRead(pin_y); // Comm Bit 3 Read
z = analogRead(pin_z); // Comm Bit 4 Read
int com_1 = 0;
int com_2 = 0;
int com_3 = 0;
int com_4 = 0;
int com_sum = 0;

// 2nd Function
//=============

int v = 0;
int mult_fun = 6;
pinMode(mult_fun,INPUT); // 2nd Function Read
v = digitalRead(mult_fun);
int com_5 = 0;

// Encoder Configure
//==================

int x_toggle = 0;
int y_toggle = 0;
int z_toggle = 0;
int x_enc = 2;
int y_enc = 4;
int z_enc = 12;
pinMode(x_enc,INPUT); // X-axis Encoder Read
pinMode(y_enc,INPUT); // Y-axis Encoder Read
pinMode(z_enc,INPUT); // Z-axis Encoder Read
x_toggle = digitalRead(x_enc);
y_toggle = digitalRead(y_enc);
z_toggle = digitalRead(z_enc);

// Output Configuration (PMW)
//===========================

int y_fwd = 3;
int y_rev = 9;
int x_fwd = 10;
int x_rev = 11;
int z_fwd = 7;
int z_rev = 13;
pinMode(y_fwd,OUTPUT); // Y-axis +ve
pinMode(y_rev,OUTPUT); // Y-axis -ve
pinMode(x_fwd,OUTPUT); // X-axis +ve
pinMode(x_rev,OUTPUT); // X-axis -ve
pinMode(z_fwd,OUTPUT); // Z-axis +ve
pinMode(z_rev,OUTPUT); // Z-axis -ve

// Communication/2nd Function Input To Storage Bit + Binary To Decimal Conversion
//==================================================================

if (w > 100)
  {
    com_1 = 1;  
  }
else
  {
    com_1 = 0; 
  }

if (x > 100)
  {
    com_2 = 2;  
  }
else
  {
    com_2 = 0; 
  }

if (y > 100)
  {
    com_3 = 4;  
  }
else
  {
    com_3 = 0; 
  }

if (z > 100)
  {
    com_4 = 8;  
  }
else
  {
    com_4 = 0; 
  }

if (v == HIGH)
  {
   //com_5 = 16;  
  }
else
  {
    com_5 = 0; 
  }

com_sum = com_1 + com_2 + com_3 + com_4 + com_5;

// Motor Control From Com Bits
//============================

if (com_sum == 1) // Joy Stick Up
  {
    digitalWrite(y_fwd,HIGH);
  }
else
  {
    digitalWrite(y_fwd,LOW);
  }

if (com_sum == 2) // Joy Stick Down
  {
    digitalWrite(y_rev,HIGH);
  }
else
  {
    digitalWrite(y_rev,LOW);
  }

if (com_sum == 3) // Joy Stick Left
  {
    digitalWrite(x_fwd,HIGH);
  }
else
  {
    digitalWrite(x_fwd,LOW);
  }

if (com_sum == 4) // Joy Stick Right
  {
    digitalWrite(x_rev,HIGH);
  }
else
  {
    digitalWrite(x_rev,LOW);
  }

if (com_sum == 5) // Tool Up
  {
    digitalWrite(z_fwd,HIGH);
  }
else
  {
    digitalWrite(z_fwd,LOW);
  }

if (com_sum == 6) // Tool Down
  {
    digitalWrite(z_rev,HIGH);
  }
else
  {
    digitalWrite(z_rev,LOW);
  }

// Encoder Count/Position + Debounce
//==================================

if (y_toggle == HIGH && com_sum == 1)
  {
    de_tm = millis();
  }

if ((millis() - de_tm) > 50)
  {
    
  }

if (y_toggle == HIGH && com_sum == 1)
  {
    y_pos = y_pos+1;
    delay(100);
  }

if (y_toggle == HIGH && com_sum == 2)
  {
    y_pos = y_pos-1;
    delay(75);
  }

if (x_toggle == HIGH && com_sum == 4)
  {
    x_pos = x_pos+1;
    delay(50);
  }

if (x_toggle == HIGH && com_sum == 3)
  {
    x_pos = x_pos-1;
    delay(50);
  }

// Teach Position
//===============

if (com_sum == 7 && cur_pos == 0)
  {
    x1 = x_pos;
    y1 = y_pos;
    z1 = z_pos;
    cur_pos = cur_pos+1;
    delay(50);
  }

if (com_sum == 7 && cur_pos == 1)
  {
    x2 = x_pos;
    y2 = y_pos;
    z2 = z_pos;
    cur_pos = cur_pos+1;
    delay(50);
  }

if (com_sum == 7 && cur_pos == 2)
  {
    x3 = x_pos;
    y3 = y_pos;
    z3 = z_pos;
    cur_pos = cur_pos+1;
    delay(50);
  }
Serial.println(x_pos);
Serial.println(y_pos);
Serial.println(x1);
Serial.println(y1);
Serial.println(z1);
Serial.println(x2);
Serial.println(y2);
Serial.println(z2);
Serial.println(x3);
Serial.println(y3);
Serial.println(z3);
Serial.println("================");

//7 = teach
//8 = run routine










}

You pinMode statements should be in the void setup() part of the program.

Tom... :)

Thank you Tom I will make this revision. I couldn't help but notice that you are a controls engineer. This project is actually my final project for school. Finishing up my electrical engineering technology - control degree. Any advise for a young lad coming into the field?

Any advise for a young lad coming into the field?

Learn to draw a schematic first and then wire from that.

Super! thanks grumpy mike, one day you'll cheer up.