Show Posts
Pages: [1] 2 3 ... 5
1  International / Software / Libreria avr/sleep.h on: August 12, 2013, 12:09:13 pm
Ciao,
dove posso trovare o scrivere questa libreria avr/sleep.h per tvbgone con Arduino Uno R3?Grazie.
2  International / Generale / Re: Orto verticale con Arduino on: June 12, 2013, 05:55:03 am
Ciao,
prova vedere anche questi seguenti siti:
http://www.instructables.com/id/Garduino-Automated-Gardening-System/
http://www.instructables.com/id/Garduino-Upgrade-Now-with-more-Twitter/
3  International / Hardware / Re: Problema accensione via SMS on: April 30, 2013, 11:12:45 am
Al monitor seriale mi appare questo:

GSM initialized
Message received from:
+39340****** (numero del telefono cellulare)
MESSAGE DELETED

All'uscita del relè ho collegato il cavo blu (NO e COM),ma la luce non si accende.Il codice è questo:
Code:
/*
 SMS heather remote control
 
 This sketch, designed for the GSM shield, allows you to remotely control any
 device connected to your Arduino. By sending an SMS, through certain keywords,
 it's possible, as in this case, to turn on or off a simple heater.
 
 The GSM module, mounted on an Arduino board, processes the message and executes an action.
 Then, it sends a notification message containing the state of the device.
 If the message doesn't contain any valid keyword, the Arduino doesn't execute any
 operation and the message is deleted from the sim card.
 The sketch also manages keywords with uppercase or lowercase.
 
 Circuit:
 * GSM shield and an Arduino board
 * SIM card that can send/receive SMS
 * a relay connected to digital pin 12
 
 based on the ReceiveSMS example by Javier Zorzano / TD
 modified by Federico Vanzati & Alberto Cicchi (03/2013)
 
 */

// include the GSM library
#include <GSM.h>

const int heaterControlPin = 12;

// initialize the library instances
GSM gsmAccess;
GSM_SMS sms;

// Array to hold the number a SMS is retreived from
char senderNumber[20]; 

// String to hold the incoming message
String message = "";

// String that will contain the parsed values from the message
String commandID, deviceID;

void setup()
{
  // set the pin connected to the relay that control the heater as output
  pinMode(heaterControlPin, OUTPUT);

  // initialize serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }

  // connection state
  boolean notConnected = true;

  // Start GSM connection
  while(notConnected)
  {
    if(gsmAccess.begin("1234")==GSM_READY)
      notConnected = false;
    else
    {
      Serial.println("Not connected");
      delay(500);
    }
  }

  Serial.println("GSM initialized");

}

void loop()
{
  char c;

  // If there are any SMS available 
  if (sms.available())
  {
    Serial.println("Message received from:");

    // Get remote number
    sms.remoteNumber(senderNumber, 20);
    Serial.println(senderNumber);

    // An example of message disposal   
    // Any messages starting with # should be discarded
    // usually anonymous messages starts with #
    if(sms.peek()=='#')
    {
      Serial.println("Discarded SMS");
      sms.flush();
    }

    // Read message bytes and print them
    while(c = sms.read())
      message += c;

    // cancella message ricevuto
    sms.flush();
    Serial.println("MESSAGE DELETED");
  }

  // if there is a new message start to parse the command and the device to control
  if(message != "") {

    // put the incoming characters that compose the message to lower case
    message.toLowerCase();

    int i=0;

    // deviceID and commandID are separated by a space
    // find it and store the position in two strings
    while(message.charAt(i) != ' ') i++;

    commandID = message.substring(0,i);
    deviceID = message.substring(i+1, message.length());

    // check the device to control
    if(deviceID == "stufetta")
    {
      //check the command to execute
      if(commandID == "accendi") {
        sendFeedbackSMS(senderNumber, deviceID, "ON");  // send the feedback to the sender
        digitalWrite(heaterControlPin, HIGH);
      }
      if(commandID == "spegni") {
        sendFeedbackSMS(senderNumber, deviceID, "OFF"); // send the feedback to the sender
        digitalWrite(heaterControlPin, LOW);
      }
    }

    // clear the message that has just been processed
    message = "";
  }

  delay(500);
}

// this function, given a phone number and two strings representing the device and
// its state send a feedback text message to the phone number
void sendFeedbackSMS(char remoteNum[], String devString, String devState) {
  String txtMsg = devString + " " + devState;
  Serial.println(txtMsg);
  Serial.println(remoteNum);

  sms.beginSMS(remoteNum);
  sms.print(txtMsg);
  sms.endSMS();
}
4  International / Hardware / Re: Problema accensione via SMS on: April 27, 2013, 11:19:55 am
Ciao,
si,sto provando con il codice del Playground così com'è, inviando SMS "accendi stufetta" e "spegni stufetta" con relè attaccato a piedino 12.
5  International / Hardware / Re: Problema accensione via SMS on: April 27, 2013, 09:42:14 am
Ho provato ad accendere e spegnere la lampadina senza GSM shield.Ho copiato e modificato questo codice script da
http://www.tinkerkit.com/relay-tutorial/.

Code:
/*
  based on Blink, Arduino's "Hello World!"
  Turns on an LED on for one second, then off for one second, repeatedly.
  The Tinkerkit Led Modules (T010110-7) is hooked up on O0

  created in Dec 2011
  by Federico Vanzati

  This example code is in the public domain.
 */
 
// include the TinkerKit library
#include <TinkerKit.h>

TKLed led(12); // creating the object 'led' that belongs to the 'TKLed' class
// and giving the value to the desired output pin

void setup() {
// TinkerKit 'object' eliminate the need for pin declaration with pinMode()
}

void loop()
{
  led.on();       // set the LED on
  delay(500);    // wait for a second
  led.off();      // set the LED off
  delay(500);    // wait for a second
}

ed ha funzionato.Come faccio con GSM Shield? Ho tolto il PIN della SIM.
6  International / Hardware / Re: Problema accensione via SMS on: April 27, 2013, 09:12:57 am
Ciao,
ho tolto il codice PIN,ma ancora non funziona.
7  International / Hardware / Re: Problema accensione via SMS on: April 27, 2013, 06:03:14 am
Ciao,
ho provato ad inserire la scheda SIM tradizionale,ma non ho ricevuto nessun risultato.Ma la SIM ha il codice PIN,devo modificare lo script?E' dove devo scrivere questo script per fare funzionare? Che cosa devo fare? Grazie.

Code:
/*
 SMS heather remote control
 
 This sketch, designed for the GSM shield, allows you to remotely control any
 device connected to your Arduino. By sending an SMS, through certain keywords,
 it's possible, as in this case, to turn on or off a simple heater.
 
 The GSM module, mounted on an Arduino board, processes the message and executes an action.
 Then, it sends a notification message containing the state of the device.
 If the message doesn't contain any valid keyword, the Arduino doesn't execute any
 operation and the message is deleted from the sim card.
 The sketch also manages keywords with uppercase or lowercase.
 
 Circuit:
 * GSM shield and an Arduino board
 * SIM card that can send/receive SMS
 * a relay connected to digital pin 12
 
 based on the ReceiveSMS example by Javier Zorzano / TD
 modified by Federico Vanzati & Alberto Cicchi (03/2013)
 
 */

// include the GSM library
#include <GSM.h>

const int heaterControlPin = 12;

// initialize the library instances
GSM gsmAccess;
GSM_SMS sms;

// Array to hold the number a SMS is retreived from
char senderNumber[20]; 

// String to hold the incoming message
String message = "";

// String that will contain the parsed values from the message
String commandID, deviceID;

void setup()
{
  // set the pin connected to the relay that control the heater as output
  pinMode(heaterControlPin, OUTPUT);

  // initialize serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }

  // connection state
  boolean notConnected = true;

  // Start GSM connection
  while(notConnected)
  {
    if(gsmAccess.begin()==GSM_READY)
      notConnected = false;
    else
    {
      Serial.println("Not connected");
      delay(500);
    }
  }

  Serial.println("GSM initialized");

}

void loop()
{
  char c;

  // If there are any SMS available 
  if (sms.available())
  {
    Serial.println("Message received from:");

    // Get remote number
    sms.remoteNumber(senderNumber, 20);
    Serial.println(senderNumber);

    // An example of message disposal   
    // Any messages starting with # should be discarded
    // usually anonymous messages starts with #
    if(sms.peek()=='#')
    {
      Serial.println("Discarded SMS");
      sms.flush();
    }

    // Read message bytes and print them
    while(c = sms.read())
      message += c;

    // cancella message ricevuto
    sms.flush();
    Serial.println("MESSAGE DELETED");
  }

  // if there is a new message start to parse the command and the device to control
  if(message != "") {

    // put the incoming characters that compose the message to lower case
    message.toLowerCase();

    int i=0;

    // deviceID and commandID are separated by a space
    // find it and store the position in two strings
    while(message.charAt(i) != ' ') i++;

    commandID = message.substring(0,i);
    deviceID = message.substring(i+1, message.length());

    // check the device to control
    if(deviceID == "stufetta")
    {
      //check the command to execute
      if(commandID == "accendi") {
        sendFeedbackSMS(senderNumber, deviceID, "ON");  // send the feedback to the sender
        digitalWrite(heaterControlPin, HIGH);
      }
      if(commandID == "spegni") {
        sendFeedbackSMS(senderNumber, deviceID, "OFF"); // send the feedback to the sender
        digitalWrite(heaterControlPin, LOW);
      }
    }

    // clear the message that has just been processed
    message = "";
  }

  delay(500);
}

// this function, given a phone number and two strings representing the device and
// its state send a feedback text message to the phone number
void sendFeedbackSMS(char remoteNum[], String devString, String devState) {
  String txtMsg = devString + " " + devState;
  Serial.println(txtMsg);
  Serial.println(remoteNum);

  sms.beginSMS(remoteNum);
  sms.print(txtMsg);
  sms.endSMS();
}
8  International / Hardware / Re: Problema accensione via SMS on: April 26, 2013, 04:27:24 pm
Devo provare ad inserire la SIM tradizionale del telefono cellulare per esempio Vodafone.E se non funziona che altre SIM posso usare?
9  International / Hardware / Re: Problema accensione via SMS on: April 26, 2013, 11:19:10 am
Si uso la SIM movistar che ho ricevuto insieme allo shield.
10  International / Hardware / Re: Problema accensione via SMS on: April 26, 2013, 06:52:32 am
Ciao,
chi mi può aiutare come inviare SMS per accendere e spegnere?Grazie Il codice è questo:

Code:
/*
 SMS heather remote control
 
 This sketch, designed for the GSM shield, allows you to remotely control any
 device connected to your Arduino. By sending an SMS, through certain keywords,
 it's possible, as in this case, to turn on or off a simple heater.
 
 The GSM module, mounted on an Arduino board, processes the message and executes an action.
 Then, it sends a notification message containing the state of the device.
 If the message doesn't contain any valid keyword, the Arduino doesn't execute any
 operation and the message is deleted from the sim card.
 The sketch also manages keywords with uppercase or lowercase.
 
 Circuit:
 * GSM shield and an Arduino board
 * SIM card that can send/receive SMS
 * a relay connected to digital pin 12
 
 based on the ReceiveSMS example by Javier Zorzano / TD
 modified by Federico Vanzati & Alberto Cicchi (03/2013)
 
 */

// include the GSM library
#include <GSM.h>

const int heaterControlPin = 12;

// initialize the library instances
GSM gsmAccess;
GSM_SMS sms;

// Array to hold the number a SMS is retreived from
char senderNumber[20]; 

// String to hold the incoming message
String message = "";

// String that will contain the parsed values from the message
String commandID, deviceID;

void setup()
{
  // set the pin connected to the relay that control the heater as output
  pinMode(heaterControlPin, OUTPUT);

  // initialize serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }

  // connection state
  boolean notConnected = true;

  // Start GSM connection
  while(notConnected)
  {
    if(gsmAccess.begin()==GSM_READY)
      notConnected = false;
    else
    {
      Serial.println("Not connected");
      delay(1000);
    }
  }

  Serial.println("GSM initialized");

}

void loop()
{
  char c;

  // If there are any SMS available 
  if (sms.available())
  {
    Serial.println("Message received from:");

    // Get remote number
    sms.remoteNumber(senderNumber, 20);
    Serial.println(senderNumber);

    // An example of message disposal   
    // Any messages starting with # should be discarded
    // usually anonymous messages starts with #
    if(sms.peek()=='#')
    {
      Serial.println("Discarded SMS");
      sms.flush();
    }

    // Read message bytes and print them
    while(c = sms.read())
      message += c;

    // cancella message ricevuto
    sms.flush();
    Serial.println("MESSAGE DELETED");
  }

  // if there is a new message start to parse the command and the device to control
  if(message != "") {

    // put the incoming characters that compose the message to lower case
    message.toLowerCase();

    int i=0;

    // deviceID and commandID are separated by a space
    // find it and store the position in two strings
    while(message.charAt(i) != ' ') i++;

    commandID = message.substring(0,i);
    deviceID = message.substring(i+1, message.length());

    // check the device to control
    if(deviceID == "stufetta")
    {
      //check the command to execute
      if(commandID == "accendi") {
        sendFeedbackSMS(senderNumber, deviceID, "ON");  // send the feedback to the sender
        digitalWrite(heaterControlPin, HIGH);
      }
      if(commandID == "spegni") {
        sendFeedbackSMS(senderNumber, deviceID, "OFF"); // send the feedback to the sender
        digitalWrite(heaterControlPin, LOW);
      }
    }

    // clear the message that has just been processed
    message = "";
  }

  delay(1000);
}

// this function, given a phone number and two strings representing the device and
// its state send a feedback text message to the phone number
void sendFeedbackSMS(char remoteNum[], String devString, String devState) {
  String txtMsg = devString + " " + devState;
  Serial.println(txtMsg);
  Serial.println(remoteNum);

  sms.beginSMS(remoteNum);
  sms.print(txtMsg);
  sms.endSMS();
}
11  International / Hardware / Problema accensione via SMS on: April 25, 2013, 05:40:43 am
Salve,
ho provato ad accendere e spegnere la lampadina con Arduino Uno R3 e Arduino GSM shield inviando via SMS off (spegni) e on (accendi).Per alimentare la lampadina ho usato questo relè TinkerKit Modulo Relay.All'entrata ho collegato il filo neutro (blu) al NO e il secondo (blu) al COM.L'uscita i tre cavetti ho collegato all'Arduino GSM shield il cavetto nero alla massa (GND), il cavetto rosso all'alimentazione (5V) e il cavetto arancione al PIN 12.Il codice ho copiato da Arduino Tutorial Wired  SMSHeather http://playground.arduino.cc/Italiano/TutorialWired#SMSHeather.Mi potete indicarmi che cosa devo scrivere nel codice.
Qui ho inserito il mio numero di telefono cellulare
Code:
// String to hold the incoming message
String message = "";

o devo inserire il numero della SIM di Arduino GSM Shield.Grazie.
12  International / Software / Re: Problema sensore di temperatura on: April 20, 2013, 07:25:36 am
La temperatura interna mi segnala 27.90°C, come posso avere la temperatura corretta?
13  International / Software / Re: Problema sensore di temperatura on: April 20, 2013, 07:09:37 am
Code:
void loop() {
  // main program loop
  if (millis() - lastConnectionTime > connectionInterval) {
    // read a value from the pin
    int sensorValue = analogRead(A3);
    float voltage = sensorValue * (3.3 / 1023.0);
    float temperature = (3.24 - .48828125) * 100;
    Serial.println("sensorValue");

Così va bene o ho sbagliato?
14  International / Software / Problema sensore di temperatura on: April 20, 2013, 06:37:06 am
Ciao,
ho fatto questo misuratore di temperatura con questo sensore LM335Z e ho collegato con Arduino Uno R3 con Arduino GSM Shield che invia dati a Cosm
https://cosm.com/feeds/8526 vedi sensor_reading.Ma il codice della temperatura del sensore mi da errati dati.Che cosa devo fare?Grazie.

Code:
/**
 * Cosm Arduino sensor GSM client example.
 *
 * This sketch demonstrates connecting an Arduino to Cosm (https://cosm.com),
 * using the new Arduino library to send and receive data and the new GSM library.
 *
 * Requirements
 *   * Arduino with (Telefonica-designed) GSM shield
 *   * Arduino software with version >= 1.0
 *   * An account at Cosm (https://cosm.com)
 *
 *   * A temperature sensor connected to pin 3
 *
 * Adapted 1 April 2013 by Dan Appelquist from a sample program
 * created 8th January, 2013 using code written by Adrian McEwen with
 * modifications by Sam Mulube
 *
 * Full cosm tutorial available here: https://cosm.com/docs/quickstart/arduino.html
 *
 * This code is in the public domain.
 */

#include <Cosm.h>
#include <HttpClient.h>
#include <GSM.h>

#define API_KEY "XXXX" // your Cosm API key
#define FEED_ID XXXX // your Cosm feed ID

// PIN Number
#define PINNUMBER "" // your sim PIN number if you have one (most don't)

// APN data
#define GPRS_APN       "bluevia.movistar.es"  // replace your GPRS APN
#define GPRS_LOGIN     ""     // replace with your GPRS login
#define GPRS_PASSWORD  ""  // replace with your GPRS password

// initialize the library instance:
GSMClient client;
GPRS gprs;
GSM gsmAccess;

// Analog pin which we're monitoring (0 and 1 are used by the Ethernet shield)
int sensorPin = A3;

unsigned long lastConnectionTime = 0;                // last time we connected to Cosm
const unsigned long connectionInterval = 500;      // delay between connecting to Cosm in milliseconds

// Initialize the Cosm library

// Define the string for our datastream ID
char sensorId[] = "sensor_reading";

CosmDatastream datastreams[] = {
  CosmDatastream(sensorId, strlen(sensorId), DATASTREAM_FLOAT),
};

// Wrap the datastream into a feed
CosmFeed feed(FEED_ID, datastreams, 1 /* number of datastreams */);

CosmClient cosmclient(client);

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);

  Serial.println("GSM Cosm Sensor Client Example");
  Serial.println("==============================");

}

void loop() {
  // main program loop
  if (millis() - lastConnectionTime > connectionInterval) {
    // read a value from the pin
    int sensorValue = analogRead(A3);
    float voltage = sensorValue * (3.3 / 1023.0);
    float temperature = (3.24 - .48828125) * 100;
    // initialize GPRS connection
    Serial.println("Initializing network");

    // connection state
    boolean notConnected = true;
 
    // After starting the modem with GSM.begin()
    // attach the shield to the GPRS network with the APN, login and password
    while(notConnected)
    {
      if((gsmAccess.begin(PINNUMBER)==GSM_READY) &
          (gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD)==GPRS_READY))
        notConnected = false;
      else
      {
        Serial.println("Not connected");
        delay(1000);
      }
    }
    Serial.println("Network initialized");
    Serial.println();

    // send it to Cosm
    sendData(temperature);

    // disconnect the GPRS connection
    Serial.println("Network disconnected"); 
    client.stop(); 

    // update connection time so we wait before connecting again
    lastConnectionTime = millis();
  }
}

// send the supplied value to Cosm, printing some debug information as we go
void sendData(float sensorValue) {
  datastreams[0].setFloat(sensorValue);

  Serial.print("Read sensor value ");
  Serial.println(datastreams[0].getFloat());

  Serial.println("Uploading to Cosm");
  int ret = cosmclient.put(feed, API_KEY);
  Serial.print("PUT return code: ");
  Serial.println(ret);

  Serial.println();
}

// get the value of the datastream from Cosm, printing out the value we received
// not used for this sample but useful if you want to get data back from cosm
void getData() {
  Serial.println("Reading data from Cosm");

  float ret = cosmclient.get(feed, API_KEY);
  Serial.print("GET return code: ");
  Serial.println(ret);

  if (ret > 0) {
    Serial.print("Datastream is: ");
    Serial.println(feed[0]);

    Serial.print("Sensor value is: ");
    Serial.println(feed[0].getFloat());
  }

  Serial.println();
}   
15  International / Hardware / Re: Principiante con Arduino Uno R3 e GSM shield con antenna integrata on: April 06, 2013, 09:13:15 am
Ho avviato l'applicazione Arduino 1.0.4 e ho seguito lo sketch degli esempi GSM --->Tools----> BandManagement per selezionare tipo di rete GSM ed ho seguito monitor seriale.Prima ho attivato tramite BlueVia e andato tutto bene.Ma la SIM card non aveva bisogno del PIN perché non aveva il codice.Alla fine ce l'ho fatta.Grazie.
Pages: [1] 2 3 ... 5