Show Posts
Pages: 1 [2] 3
16  Community / Exhibition / Gallery / Re: Arduino Webserver with Temperature Monitor / Control on: July 24, 2013, 04:09:10 pm
Hello all, congratulations for the project, share code and give attention to all the questions.

I'm from Brazil and I have a system that informs the lack of electricity SMS.

I connected one shild GPRS on a ATMEGA328 (standalone, I made a simple board), it connected two power sensors and temperature.

When power a generator should be fired and then he sends an SMS with this information.

I added a network card that I also have this information via the web.

Did you or anyone have time to help me with this?
Pessimo'm programming ...

Hugs to all.

Sergio
17  Using Arduino / Programming Questions / ds1302 // advancing on: May 01, 2013, 01:43:16 am
Please, I'm using a RTC module like this:
http://playground.arduino.cc/Main/DS1302 with dódigo example below (also tested with others)
But time is always a second more ...

eg

Tuesday 2009-05-19 21:16:37
Tuesday 2009-05-19 21:16:39
Tuesday 2009-05-19 21:16:41
Tuesday 2009-05-19 21:16:43
Tuesday 2009-05-19 21:16:45
Tuesday 2009-05-19 21:16:47
Tuesday 2009-05-19 21:16:49
Tuesday 2009-05-19 21:16:51

Can anyone help me? Jáviram this?

thank you

Code:

/*
Example sketch for interfacing with the DS1302 timekeeping chip.

Copyright (c) 2009, Matt Sparks
All rights reserved.

http://quadpoint.org/projects/arduino-ds1302
*/
#include <stdio.h>
#include <string.h>
#include <DS1302.h>

/* Set the appropriate digital I/O pin connections */
uint8_t CE_PIN   = 5;
uint8_t IO_PIN   = 6;
uint8_t SCLK_PIN = 7;

/* Create buffers */
char buf[50];
char day[10];

/* Create a DS1302 object */
DS1302 rtc(CE_PIN, IO_PIN, SCLK_PIN);


void print_time()
{
  /* Get the current time and date from the chip */
  Time t = rtc.time();

  /* Name the day of the week */
  memset(day, 0, sizeof(day));  /* clear day buffer */
  switch (t.day) {
    case 1:
      strcpy(day, "Sunday");
      break;
    case 2:
      strcpy(day, "Monday");
      break;
    case 3:
      strcpy(day, "Tuesday");
      break;
    case 4:
      strcpy(day, "Wednesday");
      break;
    case 5:
      strcpy(day, "Thursday");
      break;
    case 6:
      strcpy(day, "Friday");
      break;
    case 7:
      strcpy(day, "Saturday");
      break;
  }

  /* Format the time and date and insert into the temporary buffer */
  snprintf(buf, sizeof(buf), "%s %04d-%02d-%02d %02d:%02d:%02d",
           day,
           t.yr, t.mon, t.date,
           t.hr, t.min, t.sec);

  /* Print the formatted string to serial so we can see the time */
  Serial.println(buf);
}


void setup()
{
  Serial.begin(9600);

  /* Initialize a new chip by turning off write protection and clearing the
     clock halt flag. These methods needn't always be called. See the DS1302
     datasheet for details. */
  rtc.write_protect(false);
  rtc.halt(false);

  /* Make a new time object to set the date and time */
  /*   Tuesday, May 19, 2009 at 21:16:37.            */
  Time t(2009, 5, 19, 21, 16, 37, 3);

  /* Set the time and date on the chip */
  rtc.time(t);
}


/* Loop and print the time every second */
void loop()
{
  print_time();
  delay(1000);
}
18  Using Arduino / Programming Questions / can I use variables in function SendSMS? gsm-shield-arduino on: April 17, 2013, 02:31:46 pm
please, I'm learning how to use this (https://code.google.com/p/gsm-shield-arduino) wonderful library and also the arduino. can help me?

I would send an sms but the number and message as a variable so that I can form sentences with if and else and send to multiple numbers in a for

how to use the function gsm.SendSMS (999999999, "text");??

eg number = 999999999 text = test

gsm.SendSMS (number, text);

thank you very much

Sérgio
19  International / Portugues / como fazer ftp de arquivo com sim900 - gprs on: November 13, 2012, 02:19:57 pm
Pessoal, estou com um shild gprs, um sim 900 chines,
alguém já conseguiu enviar arquivos via para um servidor ftp com um desses?

Muito obrigado

Sérgio
20  Using Arduino / Programming Questions / Re: datalog - gps - sdcard on: November 11, 2012, 08:52:02 pm
I found this and it's working.
I'll just change the data

thank you very much

http://arduino.cc/forum/index.php/topic,128847.0.html
21  Using Arduino / Programming Questions / Re: datalog - gps - sdcard on: November 11, 2012, 06:01:16 pm

- Know what it is data

- I have the sd card and ok because I tested with another test pde

- I do not know how to take this data and write to the card, I do not plan well.

Thanks
22  Using Arduino / Programming Questions / Re: datalog - gps - sdcard on: November 11, 2012, 05:50:33 pm
no hit programming.
I do not know how to record this data in sdcard.

thanks
23  Using Arduino / Programming Questions / datalog - gps - sdcard on: November 11, 2012, 05:45:40 pm
Hello guys, please
I'm using the sample code TinyGPS, and I can not write the data to an SD card.
Can someone help me?

thanks...Sérgio

-----------------------------
#include <SoftwareSerial.h>
#include <TinyGPS.h>


TinyGPS gps;
SoftwareSerial nss(2, 3);

static void gpsdump(TinyGPS &gps);
static bool feedgps();
static void print_float(float val, float invalid, int len, int prec);
static void print_int(unsigned long val, unsigned long invalid, int len);
static void print_date(TinyGPS &gps);
static void print_str(const char *str, int len);

void setup()
{
  Serial.begin(19200);
  nss.begin(9600);
 
  Serial.print("Testing TinyGPS library v. "); Serial.println(TinyGPS::library_version());
//  Serial.println("by Mikal Hart");
  Serial.println();
  Serial.print("Sizeof(gpsobject) = "); Serial.println(sizeof(TinyGPS));
  Serial.println();
  Serial.println("Sats HDOP Latitude Longitude Fix  Date       Time       Date Alt     Course Speed Card  Distance Course Card  Chars Sentences Checksum");
  Serial.println("          (deg)    (deg)     Age                        Age  (m)     --- from GPS ----  ---- to London  ----  RX    RX        Fail");
  Serial.println("--------------------------------------------------------------------------------------------------------------------------------------");
}

void loop()
{
  bool newdata = false;
  unsigned long start = millis();
 
  // Every second we print an update
  while (millis() - start < 1000)
  {
    if (feedgps())
      newdata = true;
  }
 
  gpsdump(gps);
}

static void gpsdump(TinyGPS &gps)
{
//Serial.println(); 
  float flat, flon;
  unsigned long age, date, time, chars = 0;
  unsigned short sentences = 0, failed = 0;
  static const float LONDON_LAT = 51.508131, LONDON_LON = -0.128002;
 
//Serial.println(); 
//  Serial.println("num de satelites, hdop, lat, lon, age");
  print_int(gps.satellites(), TinyGPS::GPS_INVALID_SATELLITES, 5);
  print_int(gps.hdop(), TinyGPS::GPS_INVALID_HDOP, 5);
  gps.f_get_position(&flat, &flon, &age);
  print_float(flat, TinyGPS::GPS_INVALID_F_ANGLE, 9, 5);
  print_float(flon, TinyGPS::GPS_INVALID_F_ANGLE, 10, 5);
  print_int(age, TinyGPS::GPS_INVALID_AGE, 5);

//Serial.println();
//   Serial.println("data month, day, year, hour, minute, second");
  print_date(gps);
 
//Serial.println();
//  Serial.println("altitude    curso   velocidade  curso  contasd para londres");
  print_float(gps.f_altitude(), TinyGPS::GPS_INVALID_F_ALTITUDE, 8, 2);
  print_float(gps.f_course(), TinyGPS::GPS_INVALID_F_ANGLE, 7, 2);
  print_float(gps.f_speed_kmph(), TinyGPS::GPS_INVALID_F_SPEED, 6, 2);
  print_str(gps.f_course() == TinyGPS::GPS_INVALID_F_ANGLE ? "*** " : TinyGPS::cardinal(gps.f_course()), 6);
  print_int(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0UL : (unsigned long)TinyGPS::distance_between(flat, flon, LONDON_LAT, LONDON_LON) / 1000, 0xFFFFFFFF, 9);
  print_float(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : TinyGPS::course_to(flat, flon, 51.508131, -0.128002), TinyGPS::GPS_INVALID_F_ANGLE, 7, 2);
  print_str(flat == TinyGPS::GPS_INVALID_F_ANGLE ? "*** " : TinyGPS::cardinal(TinyGPS::course_to(flat, flon, LONDON_LAT, LONDON_LON)), 6);

//Serial.println();
//  Serial.println("char????  sentences????? error");
  gps.stats(&chars, &sentences, &failed);
  print_int(chars, 0xFFFFFFFF, 6);
  print_int(sentences, 0xFFFFFFFF, 10);
  print_int(failed, 0xFFFFFFFF, 9);
  Serial.println();
}

static void print_int(unsigned long val, unsigned long invalid, int len)
{
  char sz[32];
  if (val == invalid)
    strcpy(sz, "*******");
  else
    sprintf(sz, "%ld", val);
  sz[len] = 0;
  for (int i=strlen(sz); i<len; ++i)
    sz = ' ';
  if (len > 0)
    sz[len-1] = ' ';
  Serial.print(sz);
  feedgps();
}

static void print_float(float val, float invalid, int len, int prec)
{
  char sz[32];
  if (val == invalid)
  {
    strcpy(sz, "*******");
    sz[len] = 0;
        if (len > 0)
          sz[len-1] = ' ';
    for (int i=7; i<len; ++i)
        sz = ' ';
    Serial.print(sz);
  }
  else
  {
    Serial.print(val, prec);
    int vi = abs((int)val);
    int flen = prec + (val < 0.0 ? 2 : 1);
    flen += vi >= 1000 ? 4 : vi >= 100 ? 3 : vi >= 10 ? 2 : 1;
    for (int i=flen; i<len; ++i)
      Serial.print(" ");
  }
  feedgps();
}

static void print_date(TinyGPS &gps)
{
  int year;
  byte month, day, hour, minute, second, hundredths;
  unsigned long age;
  gps.crack_datetime(&year, &month, &day, &hour, &minute, &second, &hundredths, &age);
  if (age == TinyGPS::GPS_INVALID_AGE)
    Serial.print("*******    *******    ");
  else
  {
    char sz[32];
    sprintf(sz, "%02d/%02d/%02d %02d:%02d:%02d   ",
        month, day, year, hour, minute, second);
    Serial.print(sz);
  }
  print_int(age, TinyGPS::GPS_INVALID_AGE, 5);
  feedgps();
}

static void print_str(const char *str, int len)
{
  int slen = strlen(str);
  for (int i=0; i<len; ++i)
    Serial.print(i<slen ? str : ' ');
  feedgps();
}

static bool feedgps()
{
  while (nss.available())
  {
    if (gps.encode(nss.read()))
      return true;
  }
  return false;
}
24  International / Portugues / Re: enviar sms - numero como variavel on: November 11, 2012, 10:49:47 am
Pessoal, obrigado a todos.
Consegui com o código abaixo.

char Vrsms = 1234567890;

char FtResp(String tMsg){
  mySerial.print("\r");
  delay(1000);               
  mySerial.print("AT+CMGF=1\r"); 
  delay(1000);
  Serial.print(mySerial.print("AT+CMGS=\""));
  Serial.print(mySerial.print(Vrsms));
  Serial.print(mySerial.println("\""));
  delay(1000);
  mySerial.print(tMsg);
  delay(1000);
  mySerial.write(26);
  delay(20000);
}
25  Using Arduino / Programming Questions / Re: please, compare two variables on: November 09, 2012, 02:42:10 pm
thank you  very much
26  Using Arduino / Programming Questions / Re: please, compare two variables on: November 09, 2012, 12:15:58 pm
thank you very much.
27  Using Arduino / Programming Questions / Re: please, compare two variables on: November 09, 2012, 12:03:28 pm
thanks for the help
but lacked information on my part.

have:

Vrsms char [13] = "011983000000" / / phone number
String VTRec / / phone number

I get a sms and store the phone number that sent the sms

Serial.println (String (info));
VNumData = String (String (info));
VTRec = (VNumData.substring (32.44));

and need to do:

if (Vrsms == VTRec) {
  SMS sends the response only to Vrsms
else if
  SMS sends the response only to Vrsms and VTRec
}

Can you help me?

Thank very you.
28  Using Arduino / Programming Questions / please, compare two variables on: November 09, 2012, 11:41:43 am
please doubts basic,

how to compare the value of two variables?

eg

var1 = 1
var2 = 2

if (var1 == var2) {
do something;
Else if} {
do something;
}

Can you help me?

thank you

Sergio
29  International / Portugues / enviar sms - numero como variavel on: October 28, 2012, 08:38:20 pm
Ola pessoal,
estou usando o código abaixo para enviar sms. Mas preciso usar o numero de telefone como uma variável e não consigo.
Tentei algo como criar a variável. String numero =  "+551198151034"; e substituir a linha do telefone   mySerial.print("AT+CMGS=\"+5511981510340\"\r");  por

mySerial.print("AT+CMGS=\"");
mySerial.print(numero);
mySerial.print("\"\r");

mas o sms não sai.
Alguém já conseguiu algo parecido?

obrigado

 -----------codigo

#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3); //8 TX, 7 RX

void setup()
{
  mySerial.begin(4800);               
  Serial.begin(19200);
}
 
void loop()
{
  mySerial.print("\r");
  delay(1000);               
  mySerial.print("AT+CMGF=1\r"); 
  delay(1000);
  mySerial.print("AT+CMGS=\"+5511981510340\"\r"); 
  delay(1000);
  mySerial.print("SIM900 and Arduino say Hi!\r");
  delay(1000);
  mySerial.write(26);
}
30  Using Arduino / Programming Questions / arduino - remote activation by sms on: October 17, 2012, 09:44:18 am
Dear, someone has some example code on the arduino remote activation by sms?
I have a shild with SIM900.
thank you very much

Have a nice day.

Sergio
Pages: 1 [2] 3