ardutronic
Published © CC BY-NC-SA

DIY Phone - CoolPhone!

I recently developed a prototype of my own Arduino based phone. Time to improve it.

IntermediateFull instructions provided5 hours1,529
DIY Phone - CoolPhone!

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
SIM800l
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Hot Air Station, Industrial
Hot Air Station, Industrial

Story

Read more

Custom parts and enclosures

cp_body_1L8bI4K0ZW.stl

cp_bottom_C6b96Nm7ho.stl

cp_keyp_kn9MEilp1m.stl

cp_top_atNLeQBzY4.stl

Schematics

Schematic

Board

Code

Code

Arduino
#include <SoftwareSerial.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 32 // OLED display height, in pixels
#define OLED_RESET     4 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);


char dane;
String Arsp, Grsp;
SoftwareSerial mySerial(A2, A3); // RX, TX

int butA = 5;
int butB = 6;
int butC = 7;
int butD = 8;
int butE = 9;
int butF = 10;
int butCALL = 2;
int butDISC = 3;

int  butAA;
int  butBB;
int  butCC;
int  butDD;
int  butEE;
int  butFF;
int disc;
int call;

int number;
unsigned long nr;
String toWrite;
int procent = 99;

char messageFromPC[32] = {0};
int integerFromPC = 0;
float floatFromPC = 0.0;
int integerFromBT = 1;

char receivedChars[] = "This is a test, 1234, 45.3" ;
char recvChar;
char endMarker = '>';
boolean newData = false;

void setup() {

  Serial.begin(9600);
  mySerial.begin(4800);
  if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3C for 128x32
    Serial.println(F("SSD1306 allocation failed"));
    for (;;); // Don't proceed, loop forever
  }
  Serial.println("Starting...");

  pinMode(butA, INPUT);
  pinMode(butB, INPUT);
  pinMode(butC, INPUT);
  pinMode(butD, INPUT);
  pinMode(butE, INPUT);
  pinMode(butF, INPUT);
  pinMode(butCALL, INPUT);
  pinMode(butDISC, INPUT);
  display.clearDisplay();

  Serial.println("Press a button");


}

void loop() {
  call = digitalRead(butCALL);
  disc = digitalRead(butDISC);
  butAA = digitalRead(butA);
  butBB = digitalRead(butB);
  butCC = digitalRead(butC);
  butDD = digitalRead(butD);
  butEE = digitalRead(butE);
  butFF = digitalRead(butF);


  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(SSD1306_WHITE);
  display.setCursor(0, 0);
  display.print(toWrite);
  display.setCursor(70, 24);
  display.print("CoolPhone");
  display.setCursor(100, 0);
  display.println(procent);
  display.setCursor(115, 0);
  display.print("%");

  pickTheNumber();
  display.display();




  if (mySerial.available())
  {
    Grsp = mySerial.readString();
    Serial.println(Grsp);
  }

  if (Serial.available())
  {
    Arsp = Serial.readString();
    mySerial.println(Arsp);
  }


  if (toWrite == "DISCONNECTED")
  {
    toWrite = "-";
  }

}

void pickTheNumber()
{
  if (butAA == HIGH)
  {
    delay(200);
    nr = xxxxxxxx;
    toWrite = "xxx";

  }

  if (butBB == HIGH)
  {
    delay(200);
    toWrite = "xxx";
    nr = xxxxxxxx;
  }

  if (butCC == HIGH)
  {
    delay(200);
    toWrite = "xxx";
    nr = xxxxxxxxx;
  }

  if (butDD == HIGH)
  {
    delay(200);
    toWrite = "xxx";
    nr = xxxxxxxxx;

  }

  if (butEE == HIGH)
  {
    delay(200);
    toWrite = "xxxx";
    nr = x3xxxxx4;
  }

  if (butFF == HIGH)
  {
    delay(200);
    toWrite = "nr 6th";
    nr = 123456789;
  }

  if (call == HIGH)
  {
    delay(200);
    String cmd;
    cmd = "ATD";
    cmd += ("+48");
    cmd += nr;
    cmd += ";";
    display.clearDisplay();
    display.setCursor(20, 15);
    display.setTextSize(2);
    display.print("CALLING");
    display.display();
    mySerial.println(cmd);
    delay(2000);
  }


  if (disc == HIGH)
  {
    delay(200);
    toWrite = "DISCONNECTED";
    mySerial.println("ATH");
  }
}

void parseData() {

    // split the data into its parts
    
  char * strtokIndx; // this is used by strtok() as an index
  
  
  strtokIndx = strtok(NULL, ","); // this continues where the previous call left off
  integerFromPC = atoi(strtokIndx);     // convert this part to an integer

   strtokIndx = strtok(NULL, ",,"); // this continues where the previous call left off
  integerFromBT = atoi(strtokIndx);     // convert this part to an integer

}


void showParsedData() {
 Serial.print("battery: ");
 Serial.println(integerFromBT);
}

Credits

ardutronic

ardutronic

39 projects • 37 followers
I'm 20 years old student of electronic technical college. I'm passionate about electronics as well as editing movies

Comments