BACK
Home Page

Phone Spam - Project

The entire project is Documented and open (except for the server-side part, for security reasons).
Feel free to use this schematics.
Phase 1 - caller ID
Read caller ID from Tip and Ring with the HT9032D decoder chip.
Phase 2 - caller ID
Arduino code to get the caller ID.
Phase 3 - WiFi chip
A small and cheap WiFi Transmitter.
Phase 4 - Access Point
How to connect to an access point.
Phase 5 - Post Request
Sending phone number to a server.
Phase 6 - LCD display
A LCD display for the caller name.

Phase 5 - Post Request

Shortly

We send the phonenumber to the web in the header. This will speed up the request and we don't need to write too much in the body.
This is what I want from this module, to test it. Once it works, I have to create a checksum with the secret key to identify the user.
But this is another chapiter.

Arduino usage

Memory usage for FSK:
50% - Flash (max 32kb)

25% - SRAM (max 2048 bytes)

12% - EEPROM (max 1024 bytes)

FSK and ESP8266 with all message strings are using 50% of the entire flash. Variables something like 500 bytes on the SRAM and userdata and SSID data 128 bytes on EEPROM.

The POST message

It was really tricky!!! If you miss the length of 1 byte or you forget something, the post message will not work! Remember it! No errors are allowed here!

void esp8266_postRequest(byte phonenumber[], byte phonelen)
{
  if(esp8266_send(F("AT+CIPSTART=\"TCP\",\"phonespam.petrucci.ch\",80"), true))
  {
    byte i;
    byte buff[64];
    byte bufflen = 0;
    byte temp;

    bufflen = 0;
    buff[bufflen++]  = 'u';
    buff[bufflen++]  = '=';
    settings_getAccountUsername(&buff[2]);
    for(;bufflen<16+2;bufflen++)
    {
      if(buff[bufflen] == 0x00) break;
    }
    buff[bufflen++]  = '&';
    buff[bufflen++]  = 'p';
    buff[bufflen++]  = '=';
    for(i=0;i<phonelen;i++)
    {
      tPhoneInfo.number[i] = phonenumber[i];
      buff[bufflen++] = phonenumber[i];
    }
    tPhoneInfo.number[phonelen] = 0;
    buff[bufflen++]  = '&';
    buff[bufflen++]  = 'k';
    buff[bufflen++]  = '=';
    for(i=0;i<16;i++)
    {
      buff[bufflen++] = random('0', '9');
    }

    Serial.println(F("Sending POST:"));
    for(i=0;i<bufflen;i++)
    {
      Serial.print(char(buff[i]));
    }
    Serial.println();
    
    esp8266_Serial.print(F("AT+CIPSEND="));
    if(bufflen < 100)
      esp8266_Serial.println(24 + 29 + 27 + 48 + 16 + 6 + bufflen + 2);
    else
      esp8266_Serial.println(24 + 29 + 27 + 48 + 16 + 7 + bufflen + 2);
    
    for(i=0;i<100;i++)
    { 
      if(esp8266_Serial.available())
      {
        temp = esp8266_Serial.read();
        Serial.print(char(temp));
        if(temp == '>') break;
      }
      delay(1);
    }
    delay(1);
    
    esp8266_Serial.println(F("POST /get.php HTTP/1.1"));        // 24 bytes
    esp8266_Serial.println(F("Host: phonespam.petrucci.ch"));   // 29 bytes
    esp8266_Serial.println(F("User-Agent: Phonespam/1.0"));     // 27 bytes
    esp8266_Serial.println(F("Content-Type: application/x-www-form-urlencoded")); // 48 bytes
    esp8266_Serial.print(F("Content-Length: ")); // 16 bytes
    esp8266_Serial.println((int)bufflen);                       //  6/7 bytes
    esp8266_Serial.println();
    for(i=0;i<bufflen;i++)
    {
      esp8266_Serial.write(buff[i]);                            // bufflen
    }
    esp8266_Serial.println();

    //empty buffer
    for(i=0;i<50;i++)
    { 
      while(esp8266_Serial.available()) esp8266_Serial.read();
        //Serial.print(char(esp8266_Serial.read()));
      delay(1);
    }

    while(esp8266_Serial.available() == 0);

    esp8266_getName();
    
    for(int j=0;j<10;j++)
    {
      for(i=0;i<200;i++)
      { 
        while(esp8266_Serial.available())
          Serial.print(char(esp8266_Serial.read()));
        delay(1);
      }
    }
    Serial.println();
    
    esp8266_send(F("AT+CIPCLOSE"), true);
  }
  else
  {
    Serial.print(F("FAILED"));

    esp8266_send(F("AT+CIPCLOSE"), true);
  }
}


Comments:

© Phonespam - 2015Adriano Petrucci Progetto personale per cercare di rendere la vita difficile a questi bas*ardi.