Output pin only delivering 1v

Hello Friends,

I'm hoping that a fresh set of eyes will see something that has stumped me for the past few hours.

I have an Arduino Micro that's being used to control a bunch of small servos. The Arduino is powered by 5v coming from a DC/DC voltage reducer which receives 12v. All the servos are powered from this 5v source and not the Arduino.

I have one pin (12) set as an output to a relay that sends 12v to another device.

The problem is that pin 12 is only outputting ~1.28v when set to HIGH. On LOW it outputs 0v.

I know the relay is working because when I jump it with 3v it switches.

My 5v pin reads 5v and my 3v pin reads 3v. My VIN pin is receiving 5v.

I've read all the topics on this that I can find and I think I have done everything right to no avail.

If I change this:

int ACrelay = 12   
pinMode(ACrelay, OUTPUT);
 digitalWrite(ACrelay, HIGH); 

To this, there's no change.

pinMode(12, OUTPUT);
 digitalWrite(12, HIGH);

Here is my sketch:

#include <Servo.h>

//Main splitter servos
Servo windscreenServo;
Servo dashServo;
Servo footwellServo;

//Secondary splitter servos
Servo cabinServo;

//AC power relay
int ACrelay = 12;
//#define ACrelay 12

//Air mode switch; "What do you want"
//Grayhill 3 position rotary switch
#define MODE_1_PIN A4
#define MODE_2_PIN A5
#define MODE_3_PIN A6

//Air direction switch; "Where do you want it"
//Grayhill 4 position rotary switch
#define DIRECTION_1_PIN A0
#define DIRECTION_2_PIN A1
#define DIRECTION_3_PIN A2
#define DIRECTION_4_PIN A3

//Fan speed; "How much do you want"
//Grayhill 4 position rotary switch

void setup() {
    //Relay 
  pinMode(ACrelay, OUTPUT);
  
  //Servos
  windscreenServo.attach(5);
  dashServo.attach(6);
  footwellServo.attach(7);
  cabinServo.attach(10);

  //Air direction switch
  pinMode(DIRECTION_1_PIN, INPUT_PULLUP);
  pinMode(DIRECTION_2_PIN, INPUT_PULLUP);
  pinMode(DIRECTION_3_PIN, INPUT_PULLUP);
  pinMode(DIRECTION_4_PIN, INPUT_PULLUP);

  //Air mode switch 
  pinMode(MODE_1_PIN, INPUT_PULLUP);
  pinMode(MODE_2_PIN, INPUT_PULLUP);
  pinMode(MODE_3_PIN, INPUT_PULLUP);

  Serial.begin(9600);
}

void loop() {
//AC-Cabin-Heat Air Switch
  int switch_mode_1_status = digitalRead(MODE_1_PIN);
  int switch_mode_2_status = digitalRead(MODE_2_PIN);
  int switch_mode_3_status = digitalRead(MODE_3_PIN);

  if (switch_mode_1_status == LOW) {  //AC
    cabinServo.write(120);    //Turn on AC and open cabin air valves to recirculate AC air
    digitalWrite(ACrelay, HIGH); // Turn the AC relay on
    delay(200);
    Serial.println("Valve open");
  } else if (switch_mode_2_status == LOW) {  //Cabin air
   cabinServo.write(120);    //Turn off AC and open cabin air valves to recirculate ambient air 
    digitalWrite(ACrelay, LOW); // Turn the AC relay off
    delay(200);
    Serial.println("Valve open 2");
  } else if (switch_mode_3_status == LOW) {  //Heat
    cabinServo.write(0);     //Turn off AC and close cabin air valves to access heated air
    digitalWrite(ACrelay, LOW); // Turn the AC relay off
    delay(200);
    Serial.println("Valve closed");
  } 

//Air Direction Switch
  int switch_direction_1_status = digitalRead(DIRECTION_1_PIN);
  int switch_direction_2_status = digitalRead(DIRECTION_2_PIN);
  int switch_direction_3_status = digitalRead(DIRECTION_3_PIN);
  int switch_direction_4_status = digitalRead(DIRECTION_4_PIN);

if (switch_direction_1_status == LOW) {  //Windscreen only
    Serial.println("Windscreen only");
    windscreenServo.write(90); //Windscreen open
    delay(200);
    dashServo.write(0); //Dash closed 
    delay(200);
    footwellServo.write(0); //Footwell closed
  } else if (switch_direction_2_status == LOW) {  //Windscreen and Footwell
    Serial.println("Windscreen and Footwell");
    windscreenServo.write(90); //Windscreen open
    delay(200);
    dashServo.write(0); //Dash closed 
    delay(200);
    footwellServo.write(90); //Footwell open
  } else if (switch_direction_3_status == LOW) {  //Dash only
    Serial.println("Dash only");
    windscreenServo.write(0); //Windscreen closed
    delay(200);
    dashServo.write(90); //Dash open 
    delay(200);
    footwellServo.write(0); //Footwell closed
  } else if (switch_direction_4_status == LOW) {  //Dash and Footwell
    Serial.println("Dash and Footwell");
    windscreenServo.write(0); //Windscreen closed
    delay(200);
    dashServo.write(90); //Dash open 
    delay(200);
    footwellServo.write(90); //Footwell open
  }
}```

It's extremely unlikely that an arduino pin can source enough current to drive a relay. I think you just proved that it won't do so with your particular relay!

You need a transistor or a relay driver.

2 Likes

This is a 3v relay for Arduinos. When I jump the relay with my 3v pin it works fine. The issue is that my OUTPUT pin (12) isn only sending ~1v to the relay and as such it's no switching.

I don't know why pin 12 is only sending 1v.

Can we have a link to the specs? What's the current requirement for the relay coil?

What's the voltage without the relay connected?

For help, please post some actually useful information, like a wiring diagram (hand drawn, with pins, parts and connections clearly labeled) and links to all the components.

You have almost certainly made a wiring error.

2 Likes

This is the relay

My PCB is here:

It's all about coil resistance.
If the relay (coil) is out of circuit, what's the story on "pin (12)" ?

1 Like

The data sheet says the coil power is 0.36W to 0.45W, so at 3V that is between 120mA and 150mA, way more than any micro controller pin can provide. You also need a diode across the coil otherwise the first time the relay turns off the resulting voltage will kill the pin and possibly the processor, see:

You need a logic level MOSFET to drive the relay. I suggest you build the circuit on breadboard and make sure it works before committing to a PCB.

2 Likes

Post the schematic instead of the PCB image.

But, the obvious design error has already been identified. If the port pin survived that abuse, consider yourself very lucky!

2 Likes

OP's microcontroller might have survived it for now but I would never put it in a production batch for customers.

From experience, abuse can result in a slow killer.

  1. Lightning: Equipment connected to a PC where the PC was connected to a a phone line that was hit by lightning basically killed the PC but the equipment was still working. It started to die slowly after 3 months and was dead after 6 months.
  2. ESD: I did work in the electronics test industry long ago (first job). ESD slowly killed microcontrollers and measuring input leakage on IO pins showed that it increased over time.
2 Likes

Meaning? .. Vin should be 7v or higher.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.