Issue while driving three single 5v relay modules from Attiny2313

Hello,

As per my requirement I would like to turn on and off 3 single relay modules in 5 seconds interval. I have written simple program to achieve the same.

For this I am using ATtiny2312 MC, after executing the below program I observed weird results.

  1. I connected pin#4 with relay module 1 - working fine. (single relay module)
  2. Now, I connected pin#5 with relay module 2 then the both relay module LED's are blinking continuously and relay1 is turned OFF (connected two relays with 4 and 5 respectively.)
  3. Now, I connected relay module1 with pin#4, relay module 2 with pin#5 and relay module 3 with pin 6. Now, the same scene repeated as mentioned in point#2.
  4. I tested the all the above scenarios with arduino usb power 5v.
  5. Now I realized that the usb power is not sufficient to drive all relay modules, so I connected with external 5v 1.5amp power supply for ATtiny2313 and all the relay modules.
  6. The worst part is the same scene repeated with external power supply as well.

I am really not sure what's wrong with my connections.

This is the relay module which I am using..

Below is the program

// Pin definitions
const int RELAY1 = 4;
const int RELAY2 = 5;
const int RELAY3= 6;
const int BLINKLED = 13;

void setup() {
  pinMode(RELAY1, OUTPUT);
  pinMode(RELAY2, OUTPUT);
  pinMode(RELAY3, OUTPUT);
  
  pinMode(BLINKLED, OUTPUT);
  
  digitalWrite(RELAY1, LOW); // Ensure START_RELAY is off initially
  digitalWrite(RELAY2, LOW); // Ensure START_RELAY is off initially
  digitalWrite(RELAY3, LOW); // Ensure STOP_RELAY is off initially
  digitalWrite(BLINKLED, LOW); // Ensure dry run LED is off initially

}

void loop() {
  digitalWrite(BLINKLED, HIGH); // Ensure dry run LED is off initially
  delay(1000);
  digitalWrite(BLINKLED, LOW); // Ensure dry run LED is off initially
  delay(1000);
 
    // Activate RELAYS
    digitalWrite(RELAY1, HIGH); // Turn on START_RELAY
    digitalWrite(RELAY2, HIGH); // Turn on START_RELAY
    digitalWrite(RELAY3, HIGH); // Turn on START_RELAY

delay(5000);
   digitalWrite(RELAY1, LOW); // Turn on START_RELAY
    digitalWrite(RELAY2, LOW); // Turn on START_RELAY
    digitalWrite(RELAY3, LOW); // Turn on START_RELAY
}

please help me on this.

Arduino has no on-board power. It must always be supplied with power. Did you mean to say that the servo is being powered through USB cable by PC/laptop?

yes. you are right.

Perhaps document them - here.

That is a typo i guess.

What core are you using ?

and what pinout ?
ATtiny2313
4, 5 & 6 are physical pins 6, 7 & 8 when using the most common core.

Posting an annotated schematic would make solving this much easier. Be sure the grounds are all connected together and the arduino ground and relay ground connect at the power supply. This keeps the relay current from passing through the Arduino.

On-board power of what?
Can you provide some information about this board you are using

sorry for the confusion. I modified my post. To answer your question, on-board power means USB power which is supplied to the arduino board.

There is no arduino board with an ATtiny2313.
Can you provide some more information about this board you are using

USB, depending, can be good for 1/2 to 2A.

I tried with 5v 3Amp. external power supply for both MCU and all relay modules. But still all relay output led's are dim its brightness and continuously blinking

See post #9

What is your problem? The way you have written codes will make the relays chattering continuously!

The folowing two diagrams should be kept side-by-side; where, FIg-2 shows the DPin-# for the IO pins/line if ATTinyCore is used.


Fig-1:

image
Fig-2:

If I try to trigger multiple relay modules at a time then the relay module power is going down. I tried to connect with external power supply rated 5v and 3Amp. Still issue persists.

See post #9

Connect Relay1 with the MCU and turn it in the setup function. Get 5V and GND of the Relay1 from the Host Arduino. Check that onBoard LED of Relay1 is on and the Realy1 is not chattering.

How are you programming your MCU -- using Arduino as ISP or AVR Programmer?

Yes I did the same. Relay1 is working fine if I connect with the arduino power. Problem with triggring two relays at a time either with arduino usb power or external power supply. I am using ATtiny2313 microcontroller.

See post #9

I am using arduino uno as host controller board and connected ATtiny through ISP on breadboard.

Your program is OK.
The issue is probably caused by bad wiring on your breadboard and/or unconnected grounds
The ATtiny ground, the relay grounds and the power supply grounds must all be connected together

1 Like