Show Posts
Pages: 1 ... 3 4 [5] 6 7 ... 18
61  Using Arduino / Programming Questions / How can an Arduino crash? on: June 14, 2011, 03:32:42 pm
Hy

The title maybe a bit strange but I got following problem:

My device has some LEDs with an GPS and GSM modem.
The LEDs just light up when the GPS has a Fix otherwise they switch off.
With a call to the Arduino I get the actual GPS position. Now after testing it for
several month!!! The Arduino got stuck the first time.
That means that even if I put int into a room the LEDs for the GPS fix still stays on
and when I call it I won't get anything.

So I checked my code and there is no while loop where the program could stop.

So I'm asking myself how this could happen. What are other possibilities???

thx
Andy


62  Using Arduino / Programming Questions / Re: Arduino does a self reset on: May 11, 2011, 12:49:18 pm
hmm tryed to use the sketch from
http://www.arduino.cc/en/Reference/PROGMEM
Code:
/*
 PROGMEM string demo
 How to store a table of strings in program memory (flash),
 and retrieve them.

 Information summarized from:
 http://www.nongnu.org/avr-libc/user-manual/pgmspace.html

 Setting up a table (array) of strings in program memory is slightly complicated, but
 here is a good template to follow. Setting up the strings is  a two-step process.
 First define the strings.

 */

#include <avr/pgmspace.h>

char string_0[] PROGMEM = "String 0";   // "String 0" etc are the strings to store - change them to your text.
char string_1[] PROGMEM = "String 1";
char string_2[] PROGMEM = "String 2";
char string_3[] PROGMEM = "String 3";
char string_4[] PROGMEM = "String 4";
char string_5[] PROGMEM = "String 5";


// Then set up a table to refer to your strings.

PGM_P PROGMEM string_table[] =    // change string_table to anything you wish
{
  string_0,
  string_1,
  string_2,
  string_3,
  string_4,
  string_5 };

char buffer[30];    // make sure this is large enough for the largest string it must hold

void setup()
{
  Serial.begin(19200);
      Serial.println( "Test" );
}


void loop()
{
  /* Using the string table in program memory requires the use of special functions to retreive the data.
   The strcpy_P function copies a string from program space to a string in RAM. Make sure your receiving string
   in RAM is large enough to hold whatever you are retreiving from Program space.
   There is some neccessary casts and dereferencing going on, just follow the template.  */

  for (int i = 0; i < 6; i++)
  {
    strcpy_P(buffer, (char*)pgm_read_word(&(string_table[i])));
    Serial.println( buffer );
    delay( 500 );
  }
}
 

but when I look into the Serial Monitor it does always reset after the Setup routine has called.
So I just see my "Test" in the serial monitor....

I do use Arduino 0022 and an Arduino Mega 1280...
What's wrong with the code?

thx
63  Using Arduino / Programming Questions / Re: Arduino does a self reset on: May 07, 2011, 05:37:12 pm
I would like to be more precise of course but my research shows that I can't force the reset by sending a huge message or with lots of special characters so it's kinda random....
Code:
while(Serial1.available() > 0){
  if(unlock_sms==0){
    bufferReadGSM[0]=Serial1.read();
    if(debug > 1)
      Serial.print(bufferReadGSM[0]);

    if(bufferReadGSM[0]=='\n' || bufferReadGSM[0]=='*' || bufferReadGSM[0] == '+'){
      unlock_sms=1;
    }
  }
  else{
    bufferReadGSM[counter]=Serial1.read();
    if(debug > 1)
      Serial.print(bufferReadGSM[counter]);
    if(bufferReadGSM[counter] == '\r'){
      unlock_sms=0;


      if (strncmp(bufferReadGSM, "*121*",5) == 0){
        char *parseptr_read = bufferReadGSM+5;
        int cou = 0;
        int value = int(parseptr_read[0])-48;   

        switch (value){
        case 1:
          sms_senden = 1;
          break;
        case 2:
          SmsMeldungOff = 1;
          if(debug > 0)
            Serial.println("-> SMS senden werden abgestellt");
          break;
        case 3:
          GSMoffStart = 1;
          if(debug > 0)
            Serial.println("-> GSM wird abgestllt, vor dem Start");
          break;
        case 4:
          wichtigeVariablen = 1;
          sms_senden = 1;
          if(debug > 0)
            Serial.println("-> Wichtige variablen werden gesendet");
          break;
        }
      }
      if (strncmp(bufferReadGSM, "Call Ready",10) == 0) {
        Serial.println("-> GSM Ready!");
      }

      if (strncmp(bufferReadGSM, "0",1) == 0){
        if(debug > 0)
          Serial.println("-> OK");
      }
      if (strncmp(bufferReadGSM, "+CRING:",7) == 0 && calling < 1){
        if(debug > 0)
          Serial.println("-> ding dong");
      }

      if (strncmp(bufferReadGSM, "3",1) == 0){
        Serial.println("-> NO CARRIER");
        calling = 0;
      }
      if (strncmp(bufferReadGSM, "4",1) == 0){
        Serial.println("-> ERROR");
      }
      if (strncmp(bufferReadGSM, "6",1) == 0){
        Serial.println("-> NO DIALTONE");
      }
      if (strncmp(bufferReadGSM, "7",1) == 0){
        Serial.println("-> BUSY");
      }
      if (strncmp(bufferReadGSM, "8",1) == 0){
        Serial.println("-> CONNECT OK / NO ANSWER");
      }

      for(int a=0; a<=counter; a++){
        bufferReadGSM[a]=0;
      }
      counter=0;
    }
    else{
      counter++;
      if (counter == bufferSize){
        counter = 0;
        if (debug > 1)
          Serial.println("-> Buffer uerblauf");
        Serial1.flush();
      }
    }
  }
}
64  Using Arduino / Programming Questions / Re: Arduino does a self reset on: May 07, 2011, 05:20:49 pm
thx for the advice,

I will post some code as soon as possible.
I use a Arduino Mega 1280 so should have some more RAM.
Can I determine how much RAM is used during a sketch is running?

Thx
Andy
65  Using Arduino / Programming Questions / Arduino does a self reset on: May 07, 2011, 07:19:33 am
hy

I got a GSM Module hooked up to the arduino. I do parse the SMS
that get in from the Module and do some things afterwards.

Sometimes it can happen that a message does come in and the
Arduino does self reset and starts again in the void Setup().

Why does this happen? It can't be a buffer overflow I got a big
buffer and a routine to determine when a buffer does overflow...

Thx
Andy
66  Using Arduino / Networking, Protocols, and Devices / Re: GPS Satellite problem on: April 07, 2011, 12:17:36 am
I do use the Antenna Antenna GPS Embedded SMA http://www.sparkfun.com/products/177 from Sparkfun...
Are there better antennas in the same size range?

Thx
Andy
67  Using Arduino / Networking, Protocols, and Devices / GPS Satellite problem on: April 06, 2011, 12:30:57 pm
Hy

Got a GPS (Copernicus Module from Sparkfun) connected to an Arduino. Everything works find that means that I get
the NMEA sentence but it won't find any satellites.
But when I touch the Antenna or a metal part it does discover immediately the
satellites.
What's the problem?

Thx
Andy
68  Using Arduino / General Electronics / Re: measure battery voltage on: March 08, 2011, 01:11:51 am
Do you have a link to that DC/DC converter? I'm wondering if it could be an isolated converter (no ground continuity from input to outout) ?  If not, can you use a ohm better and see if the negitive in and out pins show continuity?

 The first way you showed it wired up should work if it's not a isolated converter. Not sure about it being a noise issue or not, only a scope would verify that or not.


Lefty


The converter is this one.
http://www.bodhilabs.com/vpackbareaaa.html

Do you know a better one?
69  Using Arduino / General Electronics / Re: measure battery voltage on: March 07, 2011, 04:23:41 pm


R1=56k
R2=15k

Battery is 4.1V
Arduino gives me back: 1.94V this would mean =7.24V?????

(If I calculated right the Arduino should read 0.866V or am I wrong?)
70  Using Arduino / General Electronics / Re: measure battery voltage on: March 07, 2011, 04:13:14 pm
Hope this helps...
71  Using Arduino / General Electronics / measure battery voltage on: March 07, 2011, 04:04:16 pm
Hy

At the moment I'm running an Arduino with an 1S LiPo (3.7V) with an
5v Step-Up regulator. Now I like to monitor also the lipo voltage with
an Analoge input. But when I do connected the battery to an Analog
Input it always reads ~5V.

How can I get the real value of around 4V?

I know this question has alredy been asked in the old forum but the solution didn't worked...

Thx
Andy
72  Using Arduino / Programming Questions / Re: String to int on: March 06, 2011, 04:37:58 pm
The largest number an int can hold is 32767, if that answers your question. Trying to go larger turns on the sign bit and it becomes negative.

How could I forget that of course that was the mistake!
Thx a lot!

Andy
73  Using Arduino / Programming Questions / String to int on: March 05, 2011, 06:31:49 pm
Hy

I got a problem with the atoi() command. Sometimes it does work and sometimes not...
example
I do process 360 values which i get through the serial.
The first column isn't a problem but as you can see in the second sometimes a "-" sign appears and
the value is completely wrong. Why does this happen?

Code:
217,31515
218,31721
219,31940
220,32172
221,32417
222,32676
223,-32587
224,-32299
225,-31995
226,-31676
227,-31340
228,-30920
229,-31935
230,32653
231,31767
232,30937
233,30158
234,29425
235,28737

Thx Andy
74  Using Arduino / LEDs and Multiplexing / Re: TLC5940 Woes on: February 10, 2011, 04:55:57 am
I got a similar problem with my project. I use a cable length of about 1m but when I do this
the TLC5940 draws 1.2A from my 2A power supply what for me looks like a short cut. But when
the cable is shorter ~20cm all works fine.
What can I do to prevent this "short"? Do I have to put caps in between?

PS: Sometimes it even draws 300mA without an LED connected (I did even change the Chip same result)

Thx
Andy
75  Forum 2005-2010 (read only) / Troubleshooting / Re: SoftwareSerial problem.. on: August 21, 2008, 10:20:55 am
So I got this little prog with the Software Serial but it doesn't show
anything!
Code:
#include <string.h>
 #include <ctype.h>
 #include <AFSoftSerial.h>

AFSoftSerial mySerial =  AFSoftSerial(3, 2);

 int ledPin = 13;                  // LED test pin
 int byteGPS=-1;
 char linea[70] = "";
 char comandoGPR[7] = "$GPGGA";
 char latdms[9], londms[10], latdir[1], londir[1] = "";
 int latdd, londd, heading = 0;
 int cont=0;
 int bien=0;
 int conta=0;
 int indices[13];
  
 void setup() {
   pinMode(ledPin, OUTPUT);       // Initialize LED pin
   pinMode(rxPin, INPUT);
   pinMode(txPin, OUTPUT);
   Serial.begin(4800);
   for (int i=0;i<70;i++){       // Initialize a buffer for received data
     linea[i]=' ';
   }  
   mySerial.begin(4800);
  }
 void loop() {
   digitalWrite(ledPin, HIGH);
   byteGPS=mySerial.read();        
   if (byteGPS == -1) {           // See if the port is empty yet
     delay(100);
   } else {
     linea[conta]=byteGPS;        // If there is serial port data, it is put in the buffer
     conta++;                      
     if (byteGPS==13){            // If the received byte is = to 13, end of transmission
       digitalWrite(ledPin, LOW);
       cont=0;
       bien=0;
       for (int i=1;i<7;i++){     // Verifies if the received command starts with $GPR
         if (linea[i]==comandoGPR[i-1]){
           bien++;
         }
       }
       if(bien==6){               // If yes, continue and process the data
         for (int i=0;i<70;i++){
           if (linea[i]==','){    // check for the position of the  "," separator
             indices[cont]=i;
             cont++;
           }
           if (linea[i]=='*'){    // ... and the "*"
             indices[12]=i;
             cont++;
           }
         }
           Serial.print(linea);  // This is the important line :)
       }
       conta=0;                    // Reset the buffer
       for (int i=0;i<70;i++){    //  
         linea[i]=' ';  
       }                
     }
   }
 }

Geko
Pages: 1 ... 3 4 [5] 6 7 ... 18