Show Posts
Pages: [1] 2 3 ... 5
1  Using Arduino / Project Guidance / Re: Weird teensy + seeedstudio gprs module external power problem on: December 30, 2013, 10:53:15 am
I would guess that having the usb inside caused interrupts that got the arduino out of sleep mode.

does that sound plausible?
2  Using Arduino / Project Guidance / Re: Weird teensy + seeedstudio gprs module external power problem on: December 30, 2013, 10:48:03 am
I dont see how this have anything to do with the code

I run the same code, once with the computer plugged in and once without it.
3  Using Arduino / Project Guidance / Weird teensy + seeedstudio gprs module external power problem on: December 29, 2013, 01:43:43 pm
Hello

So I have a teensy 2++ connected to seeedstudio sim900 gprs shield, when I connect the teensy to the computer via usb everything works perfect.

when I connect it to the computer with a usb cable which V+ is cut off and external power (12v battery through 5v regulator) it works perfect

when I disconnect the usb cable it stops working good and every few seconds I get normal power down.

Does anyone have any idea why?

thanks
4  Using Arduino / Project Guidance / xbee to light a led if communication timeout? on: December 27, 2013, 10:30:58 am
hello all

I was wondering, I have 5 xbee series 2 and would like to achieve the following:

one of the xbees (lets call it xbee_1) is connected to 4 leds,
if xbee_2 is in range then LED_2 is off, if its out of range then LED_2 should light
and similar for all other xbees.
is it possible to achieve without a microcontroller attached?

and if its 30 units?

thanks
5  Using Arduino / Project Guidance / Problems using SIM900 sending data via POST on: December 01, 2013, 02:33:44 pm
hello,
I am using sim900 and I am sending the following AT commands (via terminal)


Quote
OK
AT+SAPBR=3,1,"Contype","GPRS"

OK
AT+SAPBR=3,1,"APN","internet"

OK
AT+SAPBR=1,1

OK
AT+HTTPINIT

OK
AT+HTTPPARA="CID",1

OK
AT+HTTPPARA="URL","http://212.1.208.94/system/ping_post.php"

OK
AT+HTTPDATA=4,10000

DOWNLOAD

OK
AT+HTTPACTION=1

OK

+HTTPACTION:1,200,0

the php page receives a request, but doesn't receive any POST (nor any other $_REQUEST) vars, does any one has any idea what I'm doing wrong?

thanks in advance!

p.s, I am entering a=0; after I receive DOWNLOAD
6  Using Arduino / Project Guidance / Re: which modem should I choose? simcom sim 900 or quectel M95? on: September 28, 2013, 02:44:34 am
Thanks for the reply,

do you use any library? if not, is there any way that you post your code?
7  Using Arduino / Programming Questions / Re: Sending long string via harware serial. on: July 25, 2013, 09:10:23 am
sorry  smiley-red, here is the rest

Code:
#include <Time.h>
#include <Streaming.h>

time_t t;


int8_t answer;
int onModulePin= 9;
HardwareSerial Uart = HardwareSerial();
char data[512];
int data_size;

char aux_str[100];
char aux;
int x = 0;


void setup(){
  Uart.begin(19200);
  pinMode(onModulePin, OUTPUT);
  Serial.begin(115200);   

  Serial.println("Starting...");
  power_on();

  delay(3000);
sendATcommand("AT+IPR=19200","ok",2000);

  while (sendATcommand2("AT+CREG?", "+CREG: 0,1", "+CREG: 0,5", 2000) == 0);

  //    answer = sendATcommand("AT+IPR=?", "OK", 10000);
  sendATcommand("AT+SAPBR=3,1,\"Contype\",\"GPRS\"", "OK", 2000);
  sendATcommand("AT+SAPBR=3,1,\"APN\",\"internet\"", "OK", 2000);
  //    sendATcommand("AT+SAPBR=3,1,\"USER\",\"\"", "OK", 2000);
  //    sendATcommand("AT+SAPBR=3,1,\"PWD\",\"\"", "OK", 2000);
  answer= sendATcommand("AT+SAPBR=2,1", "+SAPBR: 1,1", 2000);
  if(answer!=1)
    while (sendATcommand("AT+SAPBR=1,1", "OK", 20000) == 0)
    {
      delay(5000);
    }


}
void loop(){
  // Initializes HTTP service

  answer = sendATcommand("AT+HTTPINIT", "OK", 10000);
  if (answer == 1)
  {
    // Sets CID parameter
    answer = sendATcommand("AT+HTTPPARA=\"CID\",1", "OK", 5000);
    if (answer == 1)
    {
      // Sets url
      answer = sendData();
      if (answer == 1)
      {
        // Starts GET action
        answer = sendATcommand("AT+HTTPACTION=0", "+HTTPACTION:1,200", 10000);

        if (answer == 1)
        {
          x=0;

          sprintf(aux_str, "AT+HTTPREAD=%d,100", x);
          if (sendATcommand2(aux_str, "+HTTPREAD:", "ERROR", 30000) == 1)
          {
            data_size = 0;
            while(Uart.available()==0);
            aux = Uart.read();
            do{
              data_size *= 10;
              data_size += (aux-0x30);
              while(Uart.available()==0);
              aux = Uart.read();       
              Serial.print(aux);
            }
            while(aux != 0x0D);


            if (data_size > 0)
            {
              while(Uart.available() <= data_size);
              Uart.read();

              for (int y = 0; y < data_size; y++)
              {
                data[x] = Uart.read();
                x++;
              }
              data[x] = '\0';
            }
            else
            {
              Serial.println("Download finished");   
            }
          }
          else if (answer == 2)
          {
            Serial.println("Error from HTTP");
          }
          else
          {
            Serial.println("Error getting the url");
            data_size = 0;
          }

          Serial.print("Data received: ");
          Serial.println(data);
        }
        else
        {
          Serial.println("Error getting the url");
        }
      }
      else
      {
        Serial.println("Error setting the url");
      }
    }
    else
    {
      Serial.println("Error setting the CID");
    }   
  }
  else
  {
    Serial.println("Error initializating");
  }

  sendATcommand("AT+HTTPTERM", "OK", 5000);



}

void power_on(){

  uint8_t answer=0;

  // checks if the module is started
  answer = sendATcommand("AT", "OK", 2000);
  if (answer == 0)
  {
    // power on pulse
    digitalWrite(onModulePin,HIGH);
    delay(3000);
    digitalWrite(onModulePin,LOW);

    // waits for an answer from the module
    while(answer == 0){ 
      // Send AT every two seconds and wait for the answer   
      answer = sendATcommand("AT", "OK", 2000);   
    }
  }

}


int8_t sendATcommand(char* ATcommand, char* expected_answer1, unsigned int timeout){
int i;
  uint8_t x=0,  answer=0;
  char response[100];
  unsigned long previous;

  memset(response, '\0', 100);    // Initialize the string

  delay(100);

  while( Uart.available() > 0) Uart.read();    // Clean the input buffer

    Uart.println(ATcommand);


    x = 0;
  previous = millis();

  // this loop waits for the answer
  do{
    if(Uart.available() != 0){   
      response[x] = Uart.read();
      x++;
      // check if the desired answer is in the response of the module
      if (strstr(response, expected_answer1) != NULL)   
      {
        answer = 1;
      }
    }
    // Waits for the asnwer with time out
  }
  while((answer == 0) && ((millis() - previous) < timeout));   
  Serial.println(response);
  return answer;
}



int8_t sendATcommand2(char* ATcommand, char* expected_answer1,
char* expected_answer2, unsigned int timeout){

  uint8_t x=0,  answer=0;
  char response[100];
  unsigned long previous;

  memset(response, '\0', 100);    // Initialize the string

  delay(100);

  while( Uart.available() > 0) Uart.read();    // Clean the input buffer

  Uart.println(ATcommand);    // Send the AT command


    x = 0;
  previous = millis();

  // this loop waits for the answer
  do{       
    if(Uart.available() != 0){   
      response[x] = Uart.read();
      x++;
      // check if the desired answer 1 is in the response of the module
      if (strstr(response, expected_answer1) != NULL)   
      {
        answer = 1;
      }
      // check if the desired answer 2 is in the response of the module
      if (strstr(response, expected_answer2) != NULL)   
      {
        answer = 2;
      }
    }
    // Waits for the asnwer with time out
  }
  while((answer == 0) && ((millis() - previous) < timeout));   
  Serial.println(response);
  return answer;
}





int8_t getClock(){
  int  second, minute, hour, dayOfWeek, dayOfMonth, month, year;
  int timeout=1000;
  uint8_t x=0,y=0,  answer=0;
  char response[100];
  unsigned long previous;
  answer=0;
  memset(response, '\0', 100);    // Initialize the string

  delay(100);

  while( Uart.available() > 0) Uart.read();    // Clean the input buffer

  Uart.println("AT+CCLK?");    // Send the AT command

  y=0;
  x = 0;
  previous = millis();

  // this loop waits for the answer

  x=0;
  do{
    if(Uart.available() != 0){   
      response[x] = Uart.read();
      x++;
      // check if the desired answer is in the response of the module
      if(x >37)answer=1;
    }
    // Waits for the asnwer with time out
  }
  while((answer== 0) && ((millis() - previous) < timeout));   



  year=(response[20]-48)*10+(response[21]-48);
  month=(response[23]-48)*10+(response[24]-48);
  dayOfMonth=(response[26]-48)*10+(response[27]-48);
  hour=(response[29]-48)*10+(response[30]-48);
  minute=(response[32]-48)*10+(response[33]-48);
  second=(response[35]-48)*10+(response[36]-48);


  setTime(hour,minute,second, dayOfMonth,month,year);
  Serial.println(response);
  return answer;
}


int8_t sendData(){
  char* expected_answer1="OK";
unsigned int  timeout=5000;
int i;
  uint8_t x=0,  answer=0;
  char response[100];
  unsigned long previous;

  memset(response, '\0', 100);    // Initialize the string

  delay(100);

  while( Uart.available() > 0) Uart.read();    // Clean the input buffer





Uart.print("AT+HTTPPARA=\"URL\",\"http://212.1.208.94/system/ping.php?id=1&data");
delay(500);
Uart.print("=1;1000;2000;1;0;1;2;0;0;0;1;1000;2000;1;0;1;2;0;0;0;1;0;10;1;0;1;2;0;0;0;1;0;10;1;0;1;2;0;0;0;1;0;10;1;0;1;2;0;0;0;1;0;10;1;0;1;2;0;0;1;1;0;1;2;0;0;0;1;1000;2000;1;0");
delay(500);
Uart.println(";1;2;0;0;0;1;0;10;1;0;1;2;0;0;0;1;0;10;1;0;1;2;0;0;0;1;0;10;1;0;1;2;0;0;0;1;0;10;1;0;1;2;0;0;\"");


    x = 0;
  previous = millis();

  // this loop waits for the answer
  do{
    if(Uart.available() != 0){   
      response[x] = Uart.read();
      x++;
      // check if the desired answer is in the response of the module
      if (strstr(response, expected_answer1) != NULL)   
      {
        answer = 1;
      }
    }
    // Waits for the asnwer with time out
  }
  while((answer == 0) && ((millis() - previous) < timeout));   
  Serial.println(response);
  return answer;
}
8  Using Arduino / Programming Questions / Re: Sending long string via harware serial. on: July 25, 2013, 08:51:00 am
I dont see how posting the entire code would help in this particular case but..

 
Code:
int8_t sendData(){
  char* expected_answer1="OK";
unsigned int  timeout=5000;
int i;
  uint8_t x=0,  answer=0;
  char response[100];
  unsigned long previous;

  memset(response, '\0', 100);    // Initialize the string

  delay(100);

  while( Uart.available() > 0) Uart.read();    // Clean the input buffer





Uart.print("AT+HTTPPARA=\"URL\",\"http://212.1.208.94/system/ping.php?id=1&data");
delay(500);
Uart.print("=1;1000;2000;1;0;1;2;0;0;0;1;1000;2000;1;0;1;2;0;0;0;1;0;10;1;0;1;2;0;0;0;1;0;10;1;0;1;2;0;0;0;1;0;10;1;0;1;2;0;0;0;1;0;10;1;0;1;2;0;0;1;1;0;1;2;0;0;0;1;1000;2000;1;0");
delay(500);
Uart.println(";1;2;0;0;0;1;0;10;1;0;1;2;0;0;0;1;0;10;1;0;1;2;0;0;0;1;0;10;1;0;1;2;0;0;0;1;0;10;1;0;1;2;0;0;\"");


    x = 0;
  previous = millis();

  // this loop waits for the answer
  do{
    if(Uart.available() != 0){   
      response[x] = Uart.read();
      x++;
      // check if the desired answer is in the response of the module
      if (strstr(response, expected_answer1) != NULL)   
      {
        answer = 1;
      }
    }
    // Waits for the asnwer with time out
  }
  while((answer == 0) && ((millis() - previous) < timeout));   
  Serial.println(response);
  return answer;
}

9  Using Arduino / Programming Questions / Re: Sending long string via harware serial. on: July 25, 2013, 07:29:02 am
I checked that and the arduino is actually sending the variables properly, so I now have to find a different approach..

I am using sim900, How can I send a long command to it? maybe separate it to two commands? I tried print("string"); delay(500); print("second part of string");
and it didn't work well..

any ideas?
10  Using Arduino / Programming Questions / Re: Sending long string via harware serial. on: July 08, 2013, 12:19:14 am
That is possible, I will connect it to another arduino and do some testings, anyway the device is sim900.
11  Using Arduino / Programming Questions / Re: Sending long string via harware serial. on: July 07, 2013, 04:11:54 pm
I want to send lots of variables that all of them are changing, I am using Teensy 2++ (and before I used mega where that also happened) so I dont actually clog the memory.

I changed the buffer size at HardwareSerial.cpp (I should have mentioned it is compiling the teensy lib) at arduino-1.0.4\hardware\teensy\cores\teensy\ where i use #define TX_BUFFER_SIZE 1024.

do you have other ideas for sending lots of data (I have about 30 integers) over sim900 gprs? I am sending them every 10 seconds or so.
12  Using Arduino / Programming Questions / Sending long string via harware serial. on: July 07, 2013, 12:46:46 pm
Hello,

I am trying to send the following string:

HardwareSerial Uart = HardwareSerial();

...

Uart.println("AT+HTTPPARA=\"URL\",\"http://123.456.123.456/system/ping.php?id=1&data=1;1000;2000;1;0;1;2;0;0;0;1;1000;2000;1;0;1;2;0;0;0;1;0;10;1;0;1;2;0;0;0;1;0;10;1;0;1;2;0;0;0;1;0;10;1;0;1;2;0;0;0;1;0;10;1;0;1;2;0;0;1;1;0;1;2;0;0;0;1;1000;2000;1;0;1;2;0;0;0;1;0;10;1;0;1;2;0;0;0;1;0;10;1;0;1;2;0;0;0;1;0;10;1;0;1;2;0;0;0;1;0;10;1;0;1;2;0;0;");

But the Uart doesnt pass all the data and truncate the string. however the Serial.println does work perfectly. the TX buffer is very big (I changed it to 512 or 1024), anybody has a solution to this problem?

thanks
13  Using Arduino / Project Guidance / which modem should I choose? simcom sim 900 or quectel M95? on: May 07, 2013, 03:07:30 am
Hey all,

I am doing a project in which I want to make a query to a webpage every ~10 secs, running on battery and solar power, which should I choose? the sim 900 (over seeedstudio's shield) or the quectel M95 using probably click gsm2 adapter.

price is not the issue, power consumption is, and should be the lowest as possible.

also, right now I am using sim 900, what I do is I "set up" a connection and afterwards just send a CIP command after every 10 seconds or so. do you think it is possible to save some power with sleep mode or will it reset my modem and I will have to connect to the network again?

thanks in advance,
14  Using Arduino / General Electronics / what is the best solution for many IO? on: April 03, 2013, 03:21:58 pm
Hello, I am doing a project and I want the user to be able to connect about 12X3 wires (12 wires, each wire has 3 internal wires)
in each wire there are 3 wires, red white and black when all the whites should but shorted and all the blacks should be shorted,

What is the best way for me to connect it? I have a friend with a 3D printer so I thought about making an arduino box which will have the terminals (with screws) in them and then connect it to the arduino board (my own PCB) with some sort of cable, the cable should be able to transfer up to 0.5A for short bursts (100mS).

any suggestions?

thanks.
15  Using Arduino / General Electronics / Small 4700u capacitor on: February 12, 2013, 02:56:15 am
Hello
Im searching for either a short or thin 4700uf capacitor formy project, does anyone have any recomendations?
Pages: [1] 2 3 ... 5