TiDiGino Contest

By on July 13, 2011

 


 The Contest is close, visit the TiDiGino page

The project TiDiGino

We developed a new GSM remote control called TiDiGino. The name recalls the initials (TDGxx) of our previous GSM remote control and is also based on the Arduino project. All the details of this circuit can be found below, but no the sketch, because this is your assignment.

The contest
You have to write the firmware for this project.  The device must perform all the functions of the past GSM remote control: TDG133 (remote 2IN 2 OUT)TDG134 (gate remote control), TDG139 (GSM thermostat) and TDG140 (DTMF remote control). Before you start thinking about the new firmware it is therefore necessary to understand what are the functions performed by various GSM remote control  proposed in the past and understand how you can get anything from a single circuit: the TiDiGino!

How to participate

To write the sketch you must have a TiDiGino device. Don’t worry, we’ll give away 10 TiDiGino’s to candidates chosen by the community. If you want to engage in firmware developing and get one GSM remote control, you have to send an your professional or academic experience and send us at least one project you made ​​with the Arduino platform. We’ll post the projects in this blog to showcase your works and give the opportunity to pick the 10 candidates who will receive the remote control for free.

Send your projects, experience and also idea until the end of August 2011 using the contact form. In September we’ll nominate the candidates with most votes and we’ll send them the GSM remote control TiDiGino. Warning: our remote control does not include the SIM card. By the end of September, the best firmware wins a handheld oscilloscope HPS50 by Velleman. Obviously, anyone can participate in the Contest by sending the firmware developed.

Send now your request for participation using the contact form (registration are closed) Thank you.

You can  attach a zip file (max. 5 MB) containing:

- Your personal details and a brief description of your experience (max. 1 page);

- A complete project made ​​with Arduino, including a description of the circuit, the circuit diagram, PCB (in the case of shield), the sketch and one or more photos in jpg format.

 

 The Projects: GSM remote control TiDiGino

TiDiGino is based on a ATMEGA2560 chip, some of his pins are used to manage the GSM module, these ports are not used from the original Arduino MEGA 2560, so for this reason it is necessary replace the file pins_arduino.c located under the IDE installation folder (eg C: \ Program Files \ arduino-0022 \ hardware \ arduino \ cores \ arduino) with the file content in this folder: pins_arduino.zip

This allow to use any additional shield. Therefore you can use sketches already made for the original Arduino Board  to control a particular shield with TiDiGino.

The file GSM_TDGINO.zip contains the library to manage the GSM of TDGINO. This library is derived from one developed by HWKitchen but has been adapted to our hardware. In particular, we use the second serial of the ATMEGA2560 to manage the GSM module SIM900. Decompressing the zip in the folder of the Arduino libraries (eg C: \Program Files \ arduino-0022 \ libraries) the library is immediately usable.

The library is similar to the GSM SHIELD library. And for this shield Marco Martines developed the GPRS functions that you can implement in this library.

By copying the library, are automatically installed the examples that we have developed to manage the various devices. In order to test these examples you need to connect to the USB port TiDiGino and provide an external power supply of about 12V 1A. This creates a virtual COM will be used to program the remote control. Select Board “Arduino Mega 2560″ and from the menu File-> Examples-> GSM_TDGINO choose the example you want to load on the telecontrol.

 

The examples available are:

TDGINO CALL

This sketch allows you to understand how the library control the GSM module. The status of the call, or if there is a call in progress, or no incoming call is send to the serial port. The sketch reads the first 10 phone numbers found on the SIM and if a SMS arrives it send the data on the serial port.

/* TDGino example
Sketch to test the call function

 created 2011
 by Boris Landoni

 This example code is in the public domain.

http://www.open-electronics.org


http://www.futurashop.it

 */

#include <GSM.h>
//for enable disable debug rem or not the string       #define DEBUG_PRINT
// definition of instance of GSM class
GSM gsm;

// Set pin numbers:
const int powergsm =  77;
const int ctsgsm   =  39;
const int rtsgsm   =  29;
const int dcdgsm   =  27;
const int dtrgsm   =  28;
const int reset    =  35;
const int ring     =  34;
const int ld1      =  25;
const int ld2      =  26;
const int stato    =  76;
const int rele1    =  36;
const int rele2    =  37;
const int sda      =  20;
const int scl      =  21;
const int in1      =  84;
const int in2      =  83;
const int stddtmf  =  14;
const int q1dtmf   =  72;
const int q2dtmf   =  73;
const int q3dtmf   =  74;
const int q4dtmf   =  75;
const int puls     =  62;
const int sonda    =  63;

void setup() {
  // set the digital pin as output:
  pinMode(powergsm, OUTPUT);
  pinMode(rtsgsm, OUTPUT);
  pinMode(dtrgsm, OUTPUT);
  pinMode(reset, OUTPUT);
  pinMode(ld1, OUTPUT);
  pinMode(ld2, OUTPUT);
  pinMode(rele1, OUTPUT);
  pinMode(rele2, OUTPUT);
  pinMode(sda, OUTPUT);
  pinMode(scl, OUTPUT); 

  // set the digital pin as input:
  pinMode(ctsgsm, INPUT);
  pinMode(dcdgsm, INPUT);
  pinMode(ring, INPUT);
  pinMode(stato, INPUT);
  pinMode(in1, INPUT);
  pinMode(in2, INPUT);
  pinMode(stddtmf, INPUT);
  pinMode(q1dtmf, INPUT);
  pinMode(q2dtmf, INPUT);
  pinMode(q3dtmf, INPUT);
  pinMode(q4dtmf, INPUT);
  pinMode(puls, INPUT);
  pinMode(sonda, INPUT); 

  // start serial port at 9600 bps:
  Serial.begin(9600);
  //Serial1.begin(115200);
  Serial.println("system startup");
  //gsm.InitSerLine(115200);   //initialize serial 1
  gsm.TurnOn(115200);              //module power on
  gsm.InitParam(PARAM_SET_1);//configure the module
  gsm.Echo(1);               //enable AT echo
}

void loop()
{
  int response=0;
  char phone_num[20]; // array for the phone number string
  char string[160];
  // if we get a valid byte, read analog ins:

  if (digitalRead(in1) == 0 ) {
    digitalWrite(ld1,HIGH);
    digitalWrite(rele1,HIGH);
  }
  else
  {
    digitalWrite(ld1,LOW);
    digitalWrite(rele1,LOW);
  }

  if (digitalRead(in2) == 0 ) {
    digitalWrite(ld2,HIGH);
    digitalWrite(rele2,HIGH);
  }
  else
  {
    digitalWrite(ld2,LOW);
    digitalWrite(rele2,LOW);
  }

  if (digitalRead(puls) == 0 ) {
    Serial.println("pulsante premuto");
     digitalWrite(rele1,HIGH);
     delay(2000);
     digitalWrite(rele2,HIGH);
     delay(2000);
     digitalWrite(rele1,LOW);
     delay(2000);
     digitalWrite(rele2,LOW);
     delay(2000);

    response=gsm.DeleteSMS(1);
    Serial.print("Response del ");
    Serial.println(response); 

    for (int i=0; i<=10; i++)
    {
        if (1 == gsm.GetPhoneNumber(i, phone_num))
        {
          // valid phone number on SIM pos. #1
          // phone number string is copied to the phone_num array
          #ifdef DEBUG_PRINT
            sprintf(string, "DEBUG position %i phone number:", i);
            gsm.DebugPrint(string, 0);
            gsm.DebugPrint(phone_num, 1);
          #endif
       }
        else {
          // there is not valid phone number on the SIM pos.#1
          #ifdef DEBUG_PRINT
            gsm.DebugPrint("DEBUG there is no phone number", 1);
          #endif
         }
     }

    response=gsm.IsSMSPresent(SMS_UNREAD);
    Serial.print("Response UNREAD ");
    Serial.println(response);
    if (response)
    {
      gsm.GetSMS(response, phone_num, string, 160);
      #ifdef DEBUG_PRINT
        gsm.DebugPrint("Numero ",0);
        gsm.DebugPrint(phone_num ,0);
        gsm.DebugPrint("\r\n  Testo ",0);
        gsm.DebugPrint(string ,0);
      #endif
    }
    delay (1000);

    response=gsm.IsSMSPresent(SMS_READ);
    Serial.print("Response READ ");
    Serial.println(response);
        if (response)
    {
      gsm.GetSMS(response, phone_num, string, 160);
      #ifdef DEBUG_PRINT
        gsm.DebugPrint("Numero ",0);
        gsm.DebugPrint(phone_num ,0);
        gsm.DebugPrint("\r\n  Testo ",0);
        gsm.DebugPrint(string ,0);
      #endif
    }
    delay (1000);

    response=gsm.IsSMSPresent(SMS_ALL);
    Serial.print("Response ALL ");
    Serial.println(response);
        if (response)
    {
      response=gsm.GetAuthorizedSMS(2, phone_num, string, 160,1,9);
      #ifdef DEBUG_PRINT
        gsm.DebugPrint("Numero ",0);
        gsm.DebugPrint(phone_num ,0);
        gsm.DebugPrint("\r\n  Testo ",0);
        gsm.DebugPrint(string ,0);
        gsm.DebugPrint("\r\n  Auth ",0);
        gsm.DebugPrint(response,0);
      #endif
    }
    delay (1000);
    //gsm.HangUp();

  } 

    response=gsm.CallStatus();
    Serial.print("Response ");
    Serial.println(response);
    delay (2000);

}

 

TDGINO TEMP

This firmware allows you to test the temperature sensor DS18B20. For communication with the sensor must have the library available from:

http://www.milesburton.com/Dallas_Temperature_Control_Library

Once loaded in the sketch TiDiGino, pressing the button will send an SMS containing the temperature at the specified number. Moreover, during a remote call, the sistem answer and pressing the keypad of your phone you can test the DTMF section.

/* TDGino example

Sketch to send a SMS with temperature and to check the DTMF section

 created 2011
 by Boris Landoni

 This example code is in the public domain.

http://www.open-electronics.org


http://www.futurashop.it

 */

#include <GSM.h>
#include <OneWire.h>
#include <DallasTemperature.h>
//for enable disable debug rem or not the string       #define DEBUG_PRINT
// definition of instance of GSM class
GSM gsm;

// Set pin numbers:
const int powergsm =  77;
const int ctsgsm   =  39;
const int rtsgsm   =  29;
const int dcdgsm   =  27;
const int dtrgsm   =  28;
const int reset    =  35;
const int ring     =  34;
const int ld1      =  25;
const int ld2      =  26;
const int stato    =  76;
const int rele1    =  36;
const int rele2    =  37;
const int sda      =  20;
const int scl      =  21;
const int in1      =  84;
const int in2      =  83;
const int stddtmf  =  14;
const int q1dtmf   =  72;
const int q2dtmf   =  73;
const int q3dtmf   =  74;
const int q4dtmf   =  75;
const int puls     =  62;
const int sonda    =  63;

// Data wire is plugged into port 2 on the Arduino
#define ONE_WIRE_BUS sonda
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
// arrays to hold device address
DeviceAddress insideThermometer;

float tempC=0;

void setup() {
  // set the digital pin as output:
  pinMode(powergsm, OUTPUT);
  pinMode(rtsgsm, OUTPUT);
  pinMode(dtrgsm, OUTPUT);
  pinMode(reset, OUTPUT);
  pinMode(ld1, OUTPUT);
  pinMode(ld2, OUTPUT);
  pinMode(rele1, OUTPUT);
  pinMode(rele2, OUTPUT);
  pinMode(sda, OUTPUT);
  pinMode(scl, OUTPUT); 

  // set the digital pin as input:
  pinMode(ctsgsm, INPUT);
  pinMode(dcdgsm, INPUT);
  pinMode(ring, INPUT);
  pinMode(stato, INPUT);
  pinMode(in1, INPUT);
  pinMode(in2, INPUT);
  pinMode(stddtmf, INPUT);
  pinMode(q1dtmf, INPUT);
  pinMode(q2dtmf, INPUT);
  pinMode(q3dtmf, INPUT);
  pinMode(q4dtmf, INPUT);
  pinMode(puls, INPUT);
  pinMode(sonda, INPUT); 

  // start serial port at 9600 bps:
  Serial.begin(9600);
  //Serial1.begin(115200);
  Serial.println("system startup");
  //gsm.InitSerLine();   //initialize serial 1
  gsm.TurnOn(115200);              //module power on
  gsm.InitParam(PARAM_SET_1);//configure the module
  gsm.Echo(1);               //enable AT echo 

        Serial.print("Locating DS18B20 devices...");
        sensors.begin();
        Serial.print("Found ");
        Serial.print(sensors.getDeviceCount(), DEC);
        Serial.println(" devices.");

        // report parasite power requirements
        Serial.print("Parasite power is: ");
        if (sensors.isParasitePowerMode()) Serial.println("ON");
        else Serial.println("OFF");

        if (!sensors.getAddress(insideThermometer, 0)) Serial.println("Unable to find address for Device 0");
        // set the resolution to 9 bit (Each Dallas/Maxim device is capable of several different resolutions)
        sensors.setResolution(insideThermometer, 9);

        Serial.print("Device 0 Resolution: ");
        Serial.print(sensors.getResolution(insideThermometer), DEC);
        Serial.println();
}

void loop()
{
  int response=0;
  char phone_num[20]; // array for the phone number string
  char string[160];
  int tono=0;
  // if we get a valid byte, read analog ins:

    if (digitalRead(puls)==0)
    {
      int tempCdec=tempC;
      int tempCuni=(tempC*100)-(tempCdec*100);
      sprintf(string,"Temperatura rilevata %d.%d gradi",tempCdec,tempCuni);
      Serial.println(string);
      response=gsm.SendSMS("+39123456789",string);  //insert your telephone number
      Serial.print("response ");
      Serial.println(response);
    }

    switch (gsm.CallStatus())
    {
      case CALL_NONE:
        delay (1000);
        sensors.requestTemperatures(); // Send the command to get temperatures
        tempC = sensors.getTempC(insideThermometer);
        Serial.print("Temp C    : ");
        Serial.println(tempC);
        break;

      case CALL_INCOM_VOICE:
        Serial.println("Chiamata in arrivo");
        delay (2000);
        gsm.PickUp();
        Serial.println("Risposto");
        break;

      case CALL_ACTIVE_VOICE:
        Serial.println("Chiamata attiva");
        for (int i=0;i<100;i++)
        {
          if (digitalRead(stddtmf)==1)
          {
            sprintf(string,"DTMF %d - %d - %d - %d",digitalRead(q1dtmf),digitalRead(q2dtmf),digitalRead(q3dtmf),digitalRead(q4dtmf));
            Serial.println(string);
            tono=0;
            bitWrite(tono, 0, digitalRead(q1dtmf));
            bitWrite(tono, 1, digitalRead(q2dtmf));
            bitWrite(tono, 2, digitalRead(q3dtmf));
            bitWrite(tono, 3, digitalRead(q4dtmf));
            Serial.print("tono = ");
            Serial.println(tono);
            while(digitalRead(stddtmf)==1)
            {
              delay (10);
            }
            i=0;
          }

          delay (10);
        }
        break;
     }   

}

 

TDGINODTMF

Sketch allows you to check the status of the call (incoming call, active call, etc.) and check the function of the section DTMF. It also returns the button pressed on the telephone keypad.

/* TDGino example
Sketch to test the DTMF section

 created 2011
 by Boris Landoni

 This example code is in the public domain.

http://www.open-electronics.org


http://www.futurashop.it

 */

#include <GSM.h>
//for enable disable debug rem or not the string       #define DEBUG_PRINT
// definition of instance of GSM class
GSM gsm;

// Set pin numbers:
const int powergsm =  77;
const int ctsgsm   =  39;
const int rtsgsm   =  29;
const int dcdgsm   =  27;
const int dtrgsm   =  28;
const int reset    =  35;
const int ring     =  34;
const int ld1      =  25;
const int ld2      =  26;
const int stato    =  76;
const int rele1    =  36;
const int rele2    =  37;
const int sda      =  20;
const int scl      =  21;
const int in1      =  84;
const int in2      =  83;
const int stddtmf  =  14;
const int q1dtmf   =  72;
const int q2dtmf   =  73;
const int q3dtmf   =  74;
const int q4dtmf   =  75;
const int puls     =  62;
const int sonda    =  63;

void setup() {
  // set the digital pin as output:
  pinMode(powergsm, OUTPUT);
  pinMode(rtsgsm, OUTPUT);
  pinMode(dtrgsm, OUTPUT);
  pinMode(reset, OUTPUT);
  pinMode(ld1, OUTPUT);
  pinMode(ld2, OUTPUT);
  pinMode(rele1, OUTPUT);
  pinMode(rele2, OUTPUT);
  pinMode(sda, OUTPUT);
  pinMode(scl, OUTPUT); 

  // set the digital pin as input:
  pinMode(ctsgsm, INPUT);
  pinMode(dcdgsm, INPUT);
  pinMode(ring, INPUT);
  pinMode(stato, INPUT);
  pinMode(in1, INPUT);
  pinMode(in2, INPUT);
  pinMode(stddtmf, INPUT);
  pinMode(q1dtmf, INPUT);
  pinMode(q2dtmf, INPUT);
  pinMode(q3dtmf, INPUT);
  pinMode(q4dtmf, INPUT);
  pinMode(puls, INPUT);
  pinMode(sonda, INPUT); 

  // start serial port at 9600 bps:
  Serial.begin(9600);
  //Serial1.begin(115200);
  Serial.println("system startup");
  //gsm.InitSerLine(115200);   //initialize serial 1
  gsm.TurnOn(115200);              //module power on
  gsm.InitParam(PARAM_SET_1);//configure the module
  gsm.Echo(1);               //enable AT echo
}

void loop()
{
  int response=0;
  char phone_num[20]; // array for the phone number string
  char string[160];
  int tono=0;
  // if we get a valid byte, read analog ins:

    switch (gsm.CallStatus())
    {
      case CALL_NONE:
        delay (1000);
        break;

      case CALL_INCOM_VOICE:
        Serial.println("Chiamata in arrivo");
        delay (2000);
        gsm.PickUp();
        Serial.println("Risposto");
        break;

      case CALL_ACTIVE_VOICE:
        Serial.println("Chiamata attiva");
        for (int i=0;i<100;i++)
        {
          if (digitalRead(stddtmf)==1)
          {
            sprintf(string,"DTMF %d - %d - %d - %d",digitalRead(q1dtmf),digitalRead(q2dtmf),digitalRead(q3dtmf),digitalRead(q4dtmf));
            Serial.println(string);
            tono=0;
            bitWrite(tono, 0, digitalRead(q1dtmf));
            bitWrite(tono, 1, digitalRead(q2dtmf));
            bitWrite(tono, 2, digitalRead(q3dtmf));
            bitWrite(tono, 3, digitalRead(q4dtmf));
            Serial.print("tono = ");
            Serial.println(tono);
            while(digitalRead(stddtmf)==1)
            {
              delay (10);
            }
            i=0;
          }

          delay (10);
        }
        break;
     }   

}

 

TDGINO FT919

The TDGINO has the ability to host many of the planned shield for Arduino.  For example is possible mount a SD card shield that stores all incoming calls and SMS. Or you can expand the inputs and outputs if necessary. With this sketch  you can check the status of digital or analog inputs of the I/O shield and manage the outputs via simple serial commands. Of course you could simply turn on the various relay calling TiDiGino and using DTMF commands.

/* TDGino example
Use with I/O shield FT919

 created 2011
 by Boris Landoni

 This example code is in the public domain.

http://www.open-electronics.org


http://www.futurashop.it

 */

#include <GSM.h>
//for enable disable debug rem or not the string       #define DEBUG_PRINT
// definition of instance of GSM class
GSM gsm;

// Variables will change:
int in=0;
int out=0;
int an=0;
int inByte=0;

// the follow variables is a long because the time, measured in miliseconds,
// will quickly become a bigger number than can be stored in an int.
long interval = 1000;           // interval at which to blink (milliseconds)

// Set pin numbers:
const int powergsm =  77;
const int ctsgsm   =  39;
const int rtsgsm   =  29;
const int dcdgsm   =  27;
const int dtrgsm   =  28;
const int reset    =  35;
const int ring     =  34;
const int ld1      =  25;
const int ld2      =  26;
const int stato    =  76;
const int rele1    =  36;
const int rele2    =  37;
const int sda      =  20;
const int scl      =  21;
const int in1      =  84;
const int in2      =  83;
const int stddtmf  =  14;
const int q1dtmf   =  72;
const int q2dtmf   =  73;
const int q3dtmf   =  74;
const int q4dtmf   =  75;
const int puls     =  62;
const int sonda    =  63;

void setup() {

    // start serial port at 9600 bps:
  Serial.begin(9600);

  // set the digital pin as output:
  for (int out=8; out<=13; out++){
    pinMode(out, OUTPUT);
  }
}

void loop()
{
  // here is where you'd put code that needs to be running all the time.

  // check to see if it's time to blink the LED; that is, if the
  // difference between the current time and last time you blinked
  // the LED is bigger than the interval at which you want to
  // blink the LED.

  if (Serial.available() > 0) {
    protocollo();
  }

}

void protocollo()
{
  inByte = Serial.read();
    switch (inByte)
    {
        case 79: //O  out

          Serial.println("Out number? (1 to 6)");   // send an initial string
            while (Serial.available() <= 0)
            {
              delay(300);
            }

            out = Serial.read()-48;
            Serial.println("ricevuto ");
            Serial.print(out);
            if (out>=1&&out<=6)
            {
              out=out+7;
              if (!digitalRead(out))
                digitalWrite(out, HIGH);
              else
                digitalWrite(out, LOW);

              Serial.print("Out ");
              Serial.print(out-7);
              Serial.print(" = ");
              Serial.println(digitalRead(out));
            }

          break;

        case 73: //I
          //input

          Serial.println("In number? (1 to 6)");   // send an initial string

            while (Serial.available() <= 0)
            {
              delay(300);
            }

            in = Serial.read()-48;
            if (in>=1&&in<=6){
            in=in+1;

            Serial.print("In ");
            Serial.print(in-1);
            Serial.print(" = ");
            Serial.println(digitalRead(in));
            }
          break;

          case 65: //A
          //analog

          Serial.println("Analog number? (1 to 6)");   // send an initial string

            while (Serial.available() <= 0)
            {
              delay(300);
            }

            an = Serial.read()-48;
            if (an>=1&&an<=6){
            an=an-1;     

            Serial.print("Analog ");
            Serial.print(an+1);
            Serial.print(" = ");
            Serial.println(analogRead(an));
            }
          break;

        //default:
          // if nothing else matches, do the default
          // default is optional

    } 

}

 

These are just some examples created with the sole purpose of testing the hardware features.

Images

 
   
   

Files 

Download ZIP File  TiDiGino Libary
Decompressing the zip in the folder of the Arduino libraries (eg C: \Program Files \ arduino-0022 \ libraries) the library is immediately usable.
 Download ZIP File Replace the file pins_arduino.c located under the  IDE installation folder (eg C: \ Program Files \ arduino-0022 \ hardware \ arduino \ cores \ arduino) with the file content in this folder.
 Download ZIP File  The TiDiGino gerber file.

 

SEND NOW YOUR REQUEST FOR PARTICIPATION

About Boris Landoni

Boris Landoni is the technical manager of Open-Electronics.org. Skilled in the GSM field, embraces the Open Source philosophy and its projects are available to the community.