4.5 V on an HIGH output

Hi everybody,
any idea why I get 4.5 V from an output pin? I should drive one of those relay shields but 4.5V is on the edge and the coil is not activated fine.

I'm powering the board with an external 12 V power supply, so supply voltage shouldn't be an issue..

what I am missing?
Thanks

What forum members are missing is a wiring diagram, showing what is connected to the output, a link to the connected gizmo, and the code, posted using code tags.

For posting instructions, have a look at the "How to get the best out of this forum" post.

2 Likes

You have not spent any time researching Arduino hardware. Get a copy of the Arduino Cookbook and read it, it will answer your questions. The following should help:
Gil's Crispy Critter Rules for Processor Hardware:

  1. Rule #1: An Arduino is NOT a Power Supply!
  2. Rule #2: Never connect anything inductive (motors, speakers, relays) directly to an Arduino!
  3. Rule #3: Avoid connecting or disconnecting wires while the power is on.
  4. Rule #4: Do not apply power to any pin unless you are certain of what you're doing.
  5. Rule #5: Do not exceed the maximum voltage ratings.
  6. Rule #6: Many Arduinos cannot power transmitters directly.
  7. Rule #7: Before powering your project, take a break and double-check the wiring.

LaryD’s Corollaries:

  1. Coro #1: When starting out, add a 220Ω resistor in series with both input and output pins to protect against shorts.
  2. Coro #2: Invest in a Digital Multi-Meter (DMM) to measure voltages, currents, and resistance.

Note: Violating these rules can turn your Arduinos into crispy critters. For optimal performance, keep your wires under 25 cm (10 inches).

Additional Tips:

  • The L293 motor driver, though common, is inefficient as it can lose around 3V as heat when driving both legs of a motor. Consider using a motor driver with MOSFET outputs to reduce heat loss and conserve battery power.
  • For more on powering Arduino boards, explore this guide: Powering Alternatives for Arduino Boards.
2 Likes

Quite a bit.

I'm unfamiliar with "one of those relay shields". Could you provide a link to the one that you're using?

If you're driving a relay coil directly from an Arduino output pin, you have of course checked to see that the coil in question draws less than the recommended maximum output for an output pin, which is 20 mA for an R3 board, but only 8mA for an R4 board. And you have used a flyback diode across the coil, correct?

Oh, and from the RA4M1 datasheet:

So anything from 4.2V up would be considered a valid output high.

That would be a valid logic-high.

I haven't looked at the specs for whatever chip is used on the R4, but for the AVR chip on the R3, 0.6Vcc (3V) or more is read as logic high and 0.3Vcc or less is read as logic low. in-between is undefined and might read high or low. (1)

Those are the input (read) numbers. I don't remember the output numbers but they are more strict so that if you write a high you are certain to read high and if you write low you are certain to read low.

I'm pretty sure you aren't directly driving a relay coil. An I/O pin can't put-out enough current to drive a coil. The voltage would be much lower (no longer a valid "1") and you'd be over-stressing the chip.

(1) This is sort-of the "magic" of digital. The results will be perfect as long as you can tell the difference between a 1 and a 0 and as long as they don't get mixed-up.

1 Like

thank you, that's good to know. I expected the high level to be closer to 5 V but it's my fault.

this is the relay shield, I'm not driving the coil directly

I don't have the link, I bought it long time ago , this should be the schematic:

so I guess the issue is on the output current of the microcontroller.. the software logic is correct because the LED on the relay board turns on/off when it should, but the relay does not switch.
I assumed (wrongly) that the output current would be the same as on arduino uno r3, but now that I checked the datasheet I saw that it's maximum 8 mA :melting_face:
I will try to power the relay coil separately from the control input.
Thanks again for the input!

The diagram suggests the UNO R3/R4 GPIO would be sinking (inputting) not outputting current. The Arduino 5V pin is quite capable of supplying the current with the jumper in place for a normal relay's coil perhaps drawing 50-200mA. The In1 would be connected to a digital output from the UNO which would turn the optoisolator's LED on when it's low. Is that how you're connecting it? What's the value of R1?

BTW, the UNO R3 runs at 5.0V from USB but R4 runs at 4.7V on due to a schottky diode.

It's not the most riveting viewing but for current sourcing I did some tests a while back for GPIO and 5V on a variety of boards including the UNO R4 (WiFi). Some intentionally go (briefly) beyond the 8mA GPIO recommended limit.

1 Like

If 5V voltage to relay Vcc/JDVcc is coming from arduino digital pin, the setup is wrong independently if you have R4 or R3. With the difference that with R3 it might turn on the relay and might take more time to damage arduino.

why is it wrong? because it uses the arduino output to drive the coil?
if this is the case, I don't really understand why they give the user the possibility to use that jumper on the relay module... ok , it's a cheap chinese module, but why building something that could damage the arduino..

anyway, the post is 2 weeks old, in the meantime I solved the issue by connecting an external power supply which powers both the arduino and the relay module, so the output pin just drives the optocoupler.

correct, I connected exactly as in the schematic, i.e. in1 to the digital output and the 5v to arduino 5v. and yes, active low.
anyway I solved the issue by connecting an external power supply which powers both the arduino and the relay module

Exactly.

That jumper is useful in certain setups and not related to your error. Just simply connect arduino 5V pin to relay Vcc-JDVcc instead of digital pin.

1 Like

kmin, could you add more detail on why the Arduino UNO R3 and R4 5V pins should not be used to power the relay coils of one (or two) of these relays? I've found a datasheet (which might be the right one!) and it has the relay coil resistance as 70 ohms.

For comparison Arduino sell a relay shield and this does not appear to need an independent external power supply for the relay coils.

You CAN use the pin labeled 5V to power a relay module but not the digital pins.

2 Likes

vaka85 confirmed in post #10 that was the case for connectivity. A mystery remains here as to why the R4 performs differently to the R3 with this relay module board.

If wired and powered correctly, they behave the same.

Jumper on place JDVcc-Vcc

GND to arduino GND
Vcc to arduino 5V pin
In1 to arduino digital pin

Obviously arduino needs to be powered correctly in the first place.
If you power it let's say 5V to VIN pin or 5V to barrel, it would not work.