Sending a message or notification from Arduino to Android via Bluetooth module hc-05

I am working on a project in which i am hoping to create a app in not app inventor, when my Trash box is full then sends a message or pop up notification on my app via Bluetooth .

I have a bluetooth module hc-05 and an Arduino Nano. I am just starting and I don't have a clue how to begin, please help!

Your post was MOVED to it's current location as it is more suitable.

Could you also take a few moments to Learn How To Use The Forum.

Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.

How can I start ? Please guide me.

Where is the "Trash box" located and how will you know that it is full ?

The trash box will be in the boat and the waste will go into the trash box through the conveyor belt.

int Limit = 27; //height limit of your garbage bin in cm


const int trigPin = 3;
const int echoPin = 2;
long duration, percentage, range;

void setup()
{
  Serial.begin(9600);
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
}

void loop()
{
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);  
  digitalWrite(trigPin, HIGH);  
  delayMicroseconds(10);  
  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH);
  percentage = (duration / 2) / 29.1 / Limit * 100;
  range = 100 - percentage;

if ((range >= 0) && (range <= 100))
  {
    if (range > 70)
      {
        Serial.print("F ");
      }
    if ((range >= 30) && (range <= 70))
      {
        Serial.print("M ");
      }
    if (range <= 30)
      {
        Serial.print("E ");
      }
    
     Serial.print(range);
     Serial.println();
     delay(500);
  }
  
else
 {
  Serial.print("F 100");
  Serial.println();
  delay(500);
 }

}

This is the code that will tell you how much dustbin is full?

Can I send a message via Bluetooth module to android app using Arduino nano?

Yes

The Bluetooth module will appear as a serial connection to which you print whatever message you want to transmit.. It would be a good idea to use a SoftwareSerial port for the Bluetooth module so that you can use Serial for debugging using the Serial monitor

Ok, can you giving me example ?

How can i Start for message sending code? I don't have idea for about so, please help me...!

#include <SoftwareSerial.h>

SoftwareSerial BTSerial(10, 11); // RX, TX

void setup()
{
  Serial.begin(115200);
  while (!Serial);
  BTSerial.begin(9600);
}

void loop()
{
  BTSerial.write("message from Arduino");
  delay(1000);
}

So can I get the output by combining the above two codes?

Get a simple example like mine working first then consider combining them

Ok thank you sir it's very useful for my final year project.

Good luck with your project. Come back to this topic if you need more help

1 Like