Arduino Uno R3.
I have a somewhat simple circuit of buttons and lights in which I've complicated by increase distances and added components. Basically a user presses a button which triggers a light to flash and a buzzer to sound in another room. Everything is hard hard wired in and out of a junction box. On the breadboard everything had worked fine. However now that I've installed it in a real-world setting, I'm getting the light to flash and the buzzer to sound spontaneously. Now I don't believe in ghosts, but this has got me perplexed.
What do you think my first courses of action to be to check out. Issue with the Arduino, other hardware, code? I thought maybe it may be a wire connection on one of the lights. But this unit is controlling 3 different lights and they all will do it sporatically. There is no pattern when it does it. I'd say it probably will spontaneously trigger once or twice an hour without any interaction or pressing buttons.
You didn't say which IDE you are using but if its 1.6.12 then there is a very simple test you can do to see how much noise is in and around your Arduino.
Simply plug in a UNO or MEGA especially clones.
Load up the AnalogReadSerial sketch from examples and make sure nothing is plugged into the board.
Go to Tools on the IDE and select Serial Plotter.
keep your body parts at least a foot away from it and let the readings settle for a couple of moments.
then slowly move your hand towards and close to the Arduino and watch the serial plotter.
Oh and those numbers on the left side...that's mostly noise of the electrical type.
there are lots of things you can do to minimise it but I leave that to the real electrical guys here as I understand it but they have so much more knowledge than I do on the matter or give google a whirl for electrical noise but it may frighten you as it is a law and topic all by itself. so safer here unless you are awesome with that sort of thing.
Oh and the difference between a real and a clone in this regard...
OK seems it doesn't like google drive URLs so just right click where the pic is supposed to be and open in a new tab
I was wondering about the electrical noise as a possibility. The wire lengths are a tad long. My two switch units are about 50 feet away each from the Arduino. I'm using a standard 22gauge (22/4) 'alarm wire.' It's not shielded. And the Arduino is located in a plastic box.
You could try change to a shielded cat5 or cat6 cable to see if that helps.
Its a cheap way to make a quick change
If the project is for anything serious there are ruggedised Arduinos available from a couple of suppliers but they come at a slight premium for the extra that goes into them.
That's quite a long cable run but should be ok if you get the circuit right. I don't think you should need special cables etc.
What pull-up / pull down resistors are you using?
From the sounds of everything here, I'm believing it is an electrical noise issue. I'm considering changing the wire runs to Cat 6. To answer your question, I'm using 1/2 watt, 2.2k resistors for each button(not sure if it matters but the resistors are mounted closer to the arduino rather than the button end). Yes i'm using the digital inputs
Ballscrewbob:
You didn't say which IDE you are using but if its 1.6.12 then there is a very simple test you can do to see how much noise is in and around your Arduino.
Simply plug in a UNO or MEGA especially clones.
Load up the AnalogReadSerial sketch from examples and make sure nothing is plugged into the board.
Go to Tools on the IDE and select Serial Plotter.
keep your body parts at least a foot away from it and let the readings settle for a couple of moments.
then slowly move your hand towards and close to the Arduino and watch the serial plotter.
Oh and those numbers on the left side...that's mostly noise of the electrical type.
there are lots of things you can do to minimise it but I leave that to the real electrical guys here as I understand it but they have so much more knowledge than I do on the matter or give google a whirl for electrical noise but it may frighten you as it is a law and topic all by itself. so safer here unless you are awesome with that sort of thing.
Oh and the difference between a real and a clone in this regard...
OK seems it doesn't like google drive URLs so just right click where the pic is supposed to be and open in a new tab