Pages: [1]   Go Down
Author Topic: Arduino restarts sketch before completion.  (Read 375 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello all,

I'm very new to Arduino. I've assembled some simple circuts with success, (motion detectors, motors, ect.), just as experiments, and I decided I was ready for an actual project.  I have an antique telegraph sounder that works perfectly, and I wanted to use the Arduino to generate some random ticking noises.  At the moment the sketch is just a bunch of "Dot" and "Dash" functions (both glorified "blink" sketches in function format) repeated to make it tap out "Hello World." 

I have the telegraph sounder hooked up to the 3v3 pin (it needs about 3v to work) through a physical relay connected to pin 12.  This setup works perfectly the first time through, but as it repeats, the test LED (pin 13) flashes, and the entire sketch seems to restart.  It usually gets about as far as the "e" in "hello" before  restarting.  When the telegraph sounder is replaced with a normal LED everything works fine. What does the Arduino not like about the sounder? Is it drawing too much current from 3v3?

This seemed a bit more like a problem with the Arduino than just "Project Guidance", so I'm putting it here.  Sorry if it's in the wrong place.

Thanks!
Logged

Queens, New York
Offline Offline
Faraday Member
**
Karma: 65
Posts: 2929
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Please post pictures and your FULL code.
Logged

Created Libraries:
NPV2 (NewPasswordV2),  TFT_Extension, OneWireKeypad, SerialServo.
Will provide libraries if asked in PM or forum.

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24322
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I have the telegraph sounder hooked up to the 3v3 pin
...which is good for about 50mA.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 508
Posts: 31431
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you a reverse biased diode across the relay? - You need one.
Are you using a transistor to drive the relay, if not what current does it take?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've attached a close up of the Arduino and the breadboard, containing the relay.

@ Grumpy_Mike:  Yes, I have a diode across the relay.  I'm not sure how much current it takes.

Here's the code.  The main program is in void setup() because I only want it to happen once.  The same problem occurs if it is in void loop() as well.
Code:
int led = 12;
void dot(){
    digitalWrite(led,HIGH);
    delay(100);
    digitalWrite(led,LOW);
    delay(300);
}
void dash(){
  digitalWrite(led,HIGH);
  delay(400);
  digitalWrite(led,LOW);
  delay(300);


void setup() {               
  pinMode(led, OUTPUT);
  dot();
  dot();
  dot();
  dot();
  delay(600);
  dot();
  delay(600);
  dot();
  dash();
  dot();
  dot();
  delay(600);
  dot();
  dash();
  dash();
  delay(600);
  dash();
  dash();
  dash();
  delay(600);
  dot();
  dash();
  dot();
  delay(600);
  dot();
  dash();
  dot();
  dot();
  delay(600);
  dash();
  dot();
  dot();
}

void loop() {
 


* DSCN3052.JPG (3119.69 KB, 4608x3456 - viewed 23 times.)
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 508
Posts: 31431
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

That is not an arduino is it. So do you know the specification of the current capability of the 3V3 supply?

I asked:-
Quote
Are you using a transistor to drive the relay, if not what current does it take?
No answer. It will help to know if you are killing your board by pulling too much current out of the pin to drive the relay.

How much current does your telegraph sounder take. That is most likely your problem.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quick note: I've also noticed that when it resets, the test LED flashes exactly as if I had pressed the reset button.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@ Grumpy_Mike Sorry, got the names messed up.  I'm not using a transistor.  It's a DKduino, which is exactly the same, just a bit cheaper and with a few extra pins. (As far as I know.) I'm trying to find out how much current is going through it, but my multimeter is acting up.  If that is my problem, is there a simple way to solve it, or will I need a much more complicated circuit?

Thanks for all the help.
Logged

0
Offline Offline
Tesla Member
***
Karma: 114
Posts: 8919
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
No answer. It will help to know if you are killing your board by pulling too much current out of the pin to drive the relay.

I don't think the OP "gets it".  smiley-roll
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 508
Posts: 31431
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
It's a DKduino, which is exactly the same,
No it is not exactly the same, it is a different board and has different proprieties.

Quote
I'm trying to find out how much current is going through it, but my multimeter is acting up
Arh!!!
You should know how much current a thing draws BEFORE you connect it up not after!!!
So how do you know you are not drawing too much from the Arduino. This is a very good way to fry it.

When you remove the telegraph sounder and just here the click of the relay does it still reset?
Do not do the experiment until you can confirm that the relay when connected directly across 5V and ground draws no more than 40mA.
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
DSCN3052.JPG (3119.69 KB, 4608x3456 - viewed 16 times.)

That's a 3 Mb download just to show a picture of your board. As a courtesy to forum users, you could resize down to a more reasonable size, like 100Kb.
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
What does the Arduino not like about the sounder? Is it drawing too much current from 3v3?

Probably. You might save some money by getting your meter fixed and measuring the current drain before hooking it up to your board.
Logged

Pages: [1]   Go Up
Jump to: