I could use some ideas on a problem I am having with my circuit.
I am running my arduino with three digital inputs. They receive voltage via a pull up 10k resistor. When a mechanical switch is flipped the circuit is grounded and the input pins go to zero where a programmed response is waiting.
All works fine typically. I can switch the mechanical switches and the response is per program/expectation. The issue is if I leave the whole system powered up a response will happen without any mechanical switches being flipped. Sometimes this happens after 1/2 hour sometimes after 2 hours. Never as soon as the system is powered up.
I checked the circuit with my multimeter and voltage at the source is 4.91V. After the pull up resistor is it 4.5V. I found this odd, but not sure if it is an indication of anything wrong.
I am looking for any ideas on what I should check to diagnose the problem. Because the problem is random and not time dependant I can't seem to catch it in the act.
masterofunk:
I checked the circuit with my multimeter and voltage at the source is 4.91V. After the pull up resistor is it 4.5V. I found this odd, but not sure if it is an indication of anything wrong.
How long is the wire? Did you fish it out of the trash?
Can you please post a copy of your sketch, using code tags?
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png or pdf?
A pictureis worth a thousand words and can save a thousand ill informed posts, can you post a picture of your project.
It could be interference from outside. Do you perhaps have some fluorescent tubes around or some other electrical equipment that could conceivably cause electrical noise?
Hi,
if using the info in your first post, then you have a drop of 4.91v - 4.5V = 0.41V
So current is 0.41 / 10,000 = 0.000041 A
or 41uA.
Quotes the internal pullups as 20K.
If we go a step further, input voltage 4.5V, input current 0.000041A
Input Impedance V / I = 4.5 / 0.000041 = 109756 Ohms
Spec quotes 100K for analog input, can't find a figure when in digital mode.
Sound OK to me.
The following is the code for the arduino. Also attached is a schematic of the diagram. Sorry don't have CAD. Had to use SnagIt. I tried to answer all the questions posed in the messages.
[/#include <SoftwareSerial.h>
#include <MP3.h>
/** define mp3 class */
MP3 mp3;
int pin10=1;
int pin11=1;
int pin12=1;
int pin13=1;
int sequence = 3;
void setup()
{
// define pins
pinMode(2, OUTPUT);
digitalWrite(2,HIGH);
pinMode(3, OUTPUT);
digitalWrite(3,HIGH);
pinMode(4, OUTPUT);
digitalWrite(4,HIGH);
pinMode(5, OUTPUT);
digitalWrite(5,HIGH);
pinMode(6, OUTPUT);
digitalWrite(6,HIGH);
pinMode(9, OUTPUT);
digitalWrite(9,LOW);
pinMode(10, INPUT);
pinMode(11, INPUT);
pinMode(12, INPUT);
pinMode(13, INPUT);
//Serial Monitor if needed
Serial.begin(9600);
//Setup sound
mp3.begin(MP3_SOFTWARE_SERIAL); // select software serial
mp3.volume(0x1F);/** set volum to the MAX */
mp3.set_mode(MP3::SINGLE);/** set MP3 Shield CYCLE mode */
}
void blinkinglights()
{
//declare variables
unsigned char i;
//Start playing music
mp3.play_sd(sequence);
//LED light show
digitalWrite(2,LOW);
digitalWrite(3,LOW);
digitalWrite(4,LOW);
digitalWrite(5,LOW);
digitalWrite(6,LOW);
digitalWrite(9,HIGH);
delay(3000);
digitalWrite(2,HIGH);
digitalWrite(3,HIGH);
digitalWrite(4,HIGH);
digitalWrite(5,HIGH);
digitalWrite(6,HIGH);
for (i=0; i<30; i++)
{
digitalWrite(sequence, LOW);
delay(i*i/2);
digitalWrite(sequence, HIGH);
delay(i*i/2);
}
delay(6000);
digitalWrite(3, LOW);
if (sequence > 3)
{
digitalWrite(4, LOW);
}
if (sequence > 4)
{
digitalWrite(5, LOW);
}
if (sequence > 5)
{
digitalWrite(6, LOW);
}
delay(4000);
digitalWrite(9,LOW);
sequence = sequence + 1;
//End playing music
mp3.stop();
delay(100);
}
void loop()
{
// Define loop to trigger light show
if (digitalRead(10)==LOW && pin10 == 1)
{
pin10=0;
blinkinglights();
}
if (digitalRead(11)==LOW && pin11 == 1)
{
pin11=0;
blinkinglights();
}
if (digitalRead(12)==LOW && pin12 == 1)
{
pin12=0;
blinkinglights();
}
if (digitalRead(13)==LOW && pin13 == 1)
{
pin13=0;
blinkinglights();
}
}code]
No 7805 regulator. The hardware is 120VAC to 5VDC converter, arduino Uno, MP3 Shield, three switches. The switches are rather unique. They are 120VAC switches. Did it for the appearance since this is for a prototype game.
Today I experimented and removed the MP3 shield. The circuit tripped around 1 hour later. I'll remove other hardware tonight.
TomGeorge:
If we go a step further, input voltage 4.5V, input current 0.000041A
Input Impedance V / I = 4.5 / 0.000041 = 109756 Ohms
Spec quotes 100K for analog input, can't find a figure when in digital mode.
Sound OK to me.
Tom....
Analog inputs are extremely high resistance, that 100k is in the signal path to the sample/hold capacitor, not to ground IIRC.
If there was 100k to ground on an analog input, they wouldn't float, but they do float.
I don't think you have got the idea of what a pull up resistor is. It should go from the input pin to the supply voltage. The concept of measuring the voltage after the pull up does not make any sense if the pull up is wired correctly.
I have seen many bad circuit schematics but yours wins the prize for being the most useless one I have ever seen.
A good way to damage your arduino is to pullup your inputs to the Vin pin instead of the 5V pin. Why ?
Because the Vin pin is invariably a higher voltage than the 5V pin and the maximum allowed voltage on an input pin is 5V. Ergo , your "schematic" , if I may be so reckless as to call it that, is a recipe for disaster.
Start over. Disconnect everything and learn how to do it correctly , BEFORE doing it.
Found the problem. Had a ground issue in one of the circuits. After time somewhere the ground would eventually connect and the quick grounding dropped all the lines to below the LOW threshold for the pin. Once that connection was fixed, all is working as expected.
raschemmel:
Thanks for the advice on changing the input voltage for the pins.
I also agree this isn't much of a schematic.
However, I have to respectfully disagree with your last point. Electronics are so cheap now. This project is just for me, so the only risk is damaging the electronics. I've burned many electronics and expect to burn out many more. We learn from our mistakes.
masterofunk:
However, I have to respectfully disagree with your last point. Electronics are so cheap now. This project is just for me, so the only risk is damaging the electronics. I've burned many electronics and expect to burn out many more. We learn from our mistakes.
Yes, we will expect to occasionally make mistakes, possibly bad ones, but burning things out is a terribly inefficient way to learn compared to adequately researching and learning the lessons in advance.
Hi,
Just out of interest, reply 10, asks why all those pins to control one relay?
I think we all would like to know.
Can you post a picture of your project please.
I didn't pluralize correct. The 6 pins go to an 8 channel relay board. Since the writing I increased it to 7. So 7 channels for 7 relays. (side note, this site taught me I could use the analog pins for as digital input/output, so kudos for that.).
I would post a pic, but the wiring is very raw since I was just trying to get it working.
The following is a pic of the LED board. 5 relays go to the board. 1 goes to the CFL light fixture to turn it off/on. 1 final relay controls another light.
However, I have to respectfully disagree with your last point.
FYI, as expert consultants here on the forum we have a responsibility to recommend ONLY the right (proper) way to do things. We could no more advise newbies to just hook up the wires "any old which way, the worst that can happen is you burn everything up. Electronics is cheap. Get over it.and order more..." than we could tell people how to build a bomb. (although that is a gross exaggeration). Comments like that would get someone banned from the forum and the length of the ban could vary from 24 hours to forever depending on the nature of the comment(s). There is a right way and a wrong way. Clearly , you method of reckless experimentation is the wrong way, and in my experience it is born out of impatience and the dread of actually studying tutorials and documentation, which to some is boring. Just out of curiosity, do you actually know how to draw a schematic and post a photo of it or did you post that diagram because you don't ? There are many tutorials online on how to draw schematics and the symbols.
Often people who say that they only learn by making mistakes and blowing things up are fooling themselves. In fact they never learn anything and keep blowing things up.