I was wondering if anyone could help as I am very new to Arduino.
I have built set up to control x2 relay switches. The code has compiled and is running as it should, triggering relays correctly when running from a power bank via USB or from laptop.
As soon as I plug it into I wall usb socket or power using the power supply via the DC barrel/jack then the set up doesn't work correctly. It is like its running through the code to quickly not stopping to listen for commands but then plug it back into the powerbank via usb and its working correctly again.
The Powerbank is 5V 3A - Works
USB via laptop - Works
USB Wall Chargers 3A/ 2A / 1A - All don't work
12V 13A DC Barrel/Jack - Doesn't Work
9V 3A DC Barrel/Jack - Doesn't Work
7V 2A DC Barrel/Jack - Doesn't Work
I feel like I have tried everything I can think of and I'm stumped. Any help or advice would be greatly received as I have read so many forums and had no luck yet.
Many Thanks in advance
Katie
const int intervelometer = 2;
int RELAY_PIN4 = 7; //to turn on and off first light/mains power
int RELAY_PIN1 = 6; //to turn on and off second light/mains power
void setup() {
// put your setup code here, to run once:
pinMode (intervelometer, INPUT);
pinMode (RELAY_PIN4, OUTPUT); // first light/mains power
pinMode (RELAY_PIN1, OUTPUT); // second light/mains power
}
void loop() {
// put your main code here, to run repeatedly:
int intervelometerState = digitalRead(intervelometer); // read new state
if (intervelometerState == LOW) {
Serial.println("The intervelometer is being pressed");
digitalWrite(RELAY_PIN4, LOW); // turn off first light/mains power on relay
delay (1000); //2 Seconds delay
digitalWrite(RELAY_PIN1, HIGH); // turn on second light/mains power on relay
delay (3000); //3 Seconds delay
digitalWrite (RELAY_PIN1, LOW); //Turn second light/mains power off
delay (1000); //1 Second delay
digitalWrite (RELAY_PIN4, HIGH); //Turn first light/mains power on
}
else
if (intervelometerState == HIGH) {
Serial.println("The intervelometer is unpressed");
digitalWrite(RELAY_PIN4, HIGH); // first light remains on
digitalWrite(RELAY_PIN1, LOW); // second light reamins off
}
}
Hard to say, USB can provide a lot more current than the barrel jack, so my first guess would be a lack of power. However, if a USB wall charger doesn't work, it's a mystery.
I hope I have uploaded my code and image correctly to my post and it helps clarify a few things. From my basic understanding the intervalometer should act no differently to having a button installed, however it is being powered via the 3V on the Arduino.
Arduino runs and powers just relay switches too quickly. I have tried swapping relays out too. All behaves fine on USB powered via powerbank and laptop.
The solid state relays have indicator LEDs on the so can see whats going on but I am stumped. Can you spot anything wrong with my coding or schematic?
Many thanks
I am unsure. How would I go about testing this? Normally it would be powered via CR2025 coin battery when not being powered via the arduino but i wanted to have it powered via the arduino so it never ran out of battery as it triggers the system.
So I have just tried powering the intervelometer via a coin battery instead of the arduino with the arduino powered via my laptop and it made the situation worse as so far I have not had issues powering via the laptop. Plug the intervelometer power back into 3v and ground on the arduino and no issues.
Does this mean it could be a grounding issue somewhere in my circuit causing issues?
I am really trying to power the arduino via usb mains but not having any luck on anything other than a power bank or laptop power. Any ideas what may be causing this?
Thanks for helping
I guess we're not really thinking the same way. I'm looking for some authoritative information about the actual current draw. I assumed you had some reason to be confident about powering it that way. Instead of guesswork, can you provide some link to the device and/or its specifications?
Also, where are the images? We really need to see what you've got there!