Project tutorial
On the phone monitor

On the phone monitor © LGPL

Working in a cubicle where colleagues couldn't see when I was on the phone, I needed a device that lights up every time I'm on the phone.

  • 189 views
  • 0 comments
  • 0 respects

Components and supplies

Apps and online services

About this project

I volunteer in an office where I'm often calling people on my personal cell phone, but others in the office can't see when I am, so sometimes try to talk with me over the partition or walk over to chat only to find I'm on a call.

I needed something to alert them, so I made a simple device that lights up when I'm making or taking a phone call.

1) Wire the Arduino and Bluetooth module.

2) Upload the sketch to listen for Bluetooth notifications.

3) Upload the phone app to MIT AppInventor 2.

4) Pair your phone with the Bluetooth module, usually named HC-05. (Don't skip this part.) Note the Bluetooth device number. You may want to add it to your phone app (top right block).

5) Load it into your phone (using the MIT AI2 Companion or download the app and send it to the phone to install).

6) Launch the phone app & test. The phone code contains a hidden pair of buttons for testing. Tap on the red phone icon and they appear (as seen in the video in the beginning).

This app has code (top right) that automatically selects the Bluetooth module when it turns on. You can change the number so it automatically connects to yours, or you can delete that set of blocks entirely and just do a scan each time. The device number can usually be seen when you pair the phone with the module for the first time, or when you scan for the module within the app.

7) I printed a case for the device using my 3D printer, but any little project box will work, or it can be left open.

When it's all done, power up the Arduino, start the phone app, scan for the HC-05 Bluetooth module (if you didn't put the device number in the code), and then any time you're taking or making a call, the led lights up.

Demonstration

A future addition to the code would be something that re-establishes the link if I walk out of range. I've read that it can be added by error trapping, so if the app tries to send a Bluetooth signal and can't, it goes to an error block that reconnects.


Code

Arduino CodeArduino
This listens for the phone's Bluetooth signal, and turns on if there's an active phone call.
int LED1=8;  // red to change

int tx=1;
int rx=0;
char inSerial[15];


void setup(){
  Serial.begin(9600);  
  pinMode(LED1, OUTPUT);
  
  pinMode(tx, OUTPUT);
  pinMode(rx, INPUT);
  delay(2000);
  digitalWrite(LED1, HIGH);  // blink 3x to show it's on
  delay(500);
  digitalWrite(LED1, LOW);
  delay(500);
  digitalWrite(LED1, HIGH);
  delay(500);
  digitalWrite(LED1, LOW);
  delay(500);
  digitalWrite(LED1, HIGH);
  delay(500);
  digitalWrite(LED1, LOW);
}

void loop(){
  int i=0;
  delay(500);
  if (Serial.available() > 0) {
  while (Serial.available() > 0) {
  inSerial[i]=Serial.read();
  i++;
  }
  inSerial[i]='\0';
  Check_Protocol(inSerial);
  }
}

void Check_Protocol(char inStr[]){
  int i=0;
  int m=0;
  Serial.println(inStr);
  if (!strcmp(inStr,"Off")){    //Led1 Off  
    digitalWrite(LED1, LOW);
    Serial.println("Off");  // only used for debugging
    for(m=0;m<11;m++){      // clears out buffered data so it doesn't keep seeing it and repeat
      inStr[m]=0;}
    }
  if (!strcmp(inStr,"On")){     //Led 1 on
    digitalWrite(LED1, HIGH);
    Serial.println("On"); // only used for debugging
    for(m=0;m<11;m++){    // clears out buffered data so it doesn't keep seeing it and repeat
      inStr[m]=0;}
    }
  else{
    for(m=0;m<11;m++){  // clears out buffered data so it doesn't keep seeing it and repeat
      inStr[m]=0;}
  i=0;
  }
}
MIT App Inventor 2 SketchScheme
The app that watches the phone and sends a signal when there's a call (incoming or outgoing).
No preview (download only).

Custom parts and enclosures

3D printed box
OPTIONAL box to enclose the device.

Schematics

MIT App Inventor 2 Sketch
The app that watches to phone to send signal when there's a call (incoming or outgoing).
on_a_call_L7MYjFg83H.aia
Wiring diagram
Wiring bb mgbk9p5atu

Comments

Similar projects you might like

Temp and Humidity Monitor with Graphs and Battery Monitor

Project tutorial by paulsb

  • 3,305 views
  • 0 comments
  • 17 respects

Android Phone Control of NeoPixel Display

Project tutorial by Bryce K and Lucas W

  • 5,532 views
  • 2 comments
  • 9 respects

LOL Surprise Doll Hotel Elevator controled by mobile phone

Project in progress by Dkovacic74

  • 2,482 views
  • 0 comments
  • 11 respects

Sleeping Phases Determination

Project tutorial by Diana Khalipina

  • 8,156 views
  • 3 comments
  • 32 respects

Home Automation with Arduino Uno and SmartEdge Agile

Project tutorial by AYUSHMAN SAHA

  • 3,222 views
  • 0 comments
  • 4 respects

View Serial Monitor Over Bluetooth

by millerman4487

  • 40,470 views
  • 13 comments
  • 40 respects
Add projectSign up / Login