2

enter image description hereI have a fairly simple code to turn a relay on-off every 2 seconds When i attach the USB of the arduino Uno to the laptop, it goes into a frenzy and the relay triggers on off for 6 times within 3-4 seconds and then it settles down. This however doesnt happen when connecting directly to the power output.

Is there something that needs to be wired to stop this happening ?

I am using an arduino Uno with a relay JQC-3FF-S-Z connected directly to the arduino pins.

const int ONOFF_TRIGGER_PIN = 2;
void setup() {
 // put your setup code here, to run once:
 pinMode(ONOFF_TRIGGER_PIN, OUTPUT);
}
void loop() {
 // put your main code here, to run repeatedly:
 digitalWrite(ONOFF_TRIGGER_PIN, LOW);
 delay(2000);
 digitalWrite(ONOFF_TRIGGER_PIN, HIGH);
 delay(2000);
}
asked Oct 15, 2020 at 21:14
9
  • The code is so simple, this has to be a hardware problem. Please add a schematic or a wiring diagram to your question. Commented Oct 15, 2020 at 22:32
  • Thanks @Jrobert ive added a fritzing image. Couldnt find the the exact same relay component i have JQC-3FF-S-Z Commented Oct 15, 2020 at 22:44
  • Put a voltmeter on the pin and to ground while the Uno is starting up with the relay detached. Note any fluctuations. Now, connect the relay with the voltmeter still attached, and restart the Uno. Do you see any difference with the voltage behaviour of the pin? Commented Oct 15, 2020 at 23:14
  • 1
    @hcheung - Ive tried it on both 5v and 3v. it works on both. Commented Oct 16, 2020 at 1:48
  • 1
    @hcheung but after the first 3-4 seconds (which i assume is the arduino booting up or something), it starts to work as per the program, So its just the initial phase. Also, when hooking the arduno to a powersupply, the relay pins are still connected to the arduino. So maybe the arduino i have is corrupted somehow Commented Oct 16, 2020 at 2:48

1 Answer 1

2

The markings on your relay suggest the coil is for 5VDC. But you have the coil supply wired to 3V3. Move the coil supply to 5V, and try again.

answered Oct 16, 2020 at 5:00
1
  • I agree with @Seamus. We don't know what might be going on with the 3v supply during boot up, but going to be marginal for a 5v even at steady state. At least try this and find out. Commented Oct 16, 2020 at 17:12

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.