What will be the code for this?

Hi everyone.
My project topic is Roadside sign detection with notification on mobile.
For that I am using Arduino uno, MFRC522, Bluetooth HC-05, and some jumper wires.
The thing is i have created a connection module but I don't know how to connect them, i mean i need a code to sent a message to mobile by creating a MIT app.
I need a Arduino code that will connect mfrc522 scanner, Arduino uno and Bluetooth hc-05 together.
please help me with it.

Post what you've written so far and 'we' can got from there.

1 Like
#include <SPI.h>
#include <MFRC522.h>

#define SS_PIN 10
#define RST_PIN 9
MFRC522 mfrc522(SS_PIN, RST_PIN);  // Create MFRC522 instance.

int readsuccess;
byte readcard[4];
char str[32] = "";
String StrUID;

void setup() {
  Serial.begin(9600); // Initialize serial communications with the PC
  SPI.begin();      // Init SPI bus
  mfrc522.PCD_Init(); // Init MFRC522 card
}
// --------------------------------------------------------------------
void loop() {
  readsuccess = getid();
 
  if(readsuccess){
    Serial.println(StrUID);
    Serial.println("");   
    if (StrUID=="F3D8E9AB") {
      Serial.println("leftTurn ahead"); 
    }
     if (StrUID=="4E1FE9AB") {
      Serial.println("RightTurn ahead");
      }
    else if (StrUID=="5E5545D3") {
      Serial.println("RightTurn ahead"); 
    }
  }
}
// --------------------------------------------------------------------
int getid(){  
  if(!mfrc522.PICC_IsNewCardPresent()){
    return 0;
  }
  if(!mfrc522.PICC_ReadCardSerial()){
    return 0;
  }
 
  
  Serial.println("THE UID OF THE SCANNED CARD IS:");
  
  for(int i=0;i<4;i++){
    readcard[i]=mfrc522.uid.uidByte[i]; //storing the UID of the tag in readcard
    array_to_string(readcard, 4, str);
    StrUID = str;
  }
  mfrc522.PICC_HaltA();
  return 1;
}
// --------------------------------------------------------------------
void array_to_string(byte array[], unsigned int len, char buffer[])
{
    for (unsigned int i = 0; i < len; i++)
    {
        byte nib1 = (array[i] >> 4) & 0x0F;
        byte nib2 = (array[i] >> 0) & 0x0F;
        buffer[i*2+0] = nib1  < 0xA ? '0' + nib1  : 'A' + nib1  - 0xA;
        buffer[i*2+1] = nib2  < 0xA ? '0' + nib2  : 'A' + nib2  - 0xA;
    }
    buffer[len*2] = '\0';
}
this is the code which i am using to scan the uid and to change its name to sighs name which i need for my project.
But the thing is i want this messages like right turn ahed, left turn ahead should be get on mobile through bluetooth, on MIT app

this is the code which i am using to scan the uid and to change its name to sighs name which i need for my project.
But the thing is i want this messages like right turn ahed, left turn ahead should be get on mobile through bluetooth, on MIT app

have you done a tutorial with an HC-05 and MIT AI?
that will show you how to drive the Serial communication

1 Like

I did but i dont know how to use it to scanner. and on google no one have posted anything about it


This out put i want on mobile.

That would be an Android project, not an Arduino project.

1 Like

Are you allowed to put RFID tags on roadside signs?

The system works on the principle of sending and receiving data using serial communi- cation.

The RFID tags will be placed on the road such that they won’t get affected to weathering conditions

and handle the pressure of vehicles. Every RFID tag contains unique identification (UID). This UID

can be retrieved using RFID scanner. Arduino makes RFID scanner to read the information by

programming with Arduino language. The program code consists of an algorithm to scan the hex

value of UID and print it using Serial.print func- tion. This completes the scanning portion of the

system.The Bluetooth module transmits data using TX pin and receives data using serial

communication. The transmitted data is received by the android application.

I think we got what the homework was about :slight_smile:

where is your problem? did you try to integrate some code to drive the HC-05 as per the examples with MIT App Inventor (worry about making it nice with images later, just send a code)?

1 Like

I'm pretty sure this is a make-believe classroom assignment. :wink:

1 Like

I'm pretty sure this is a make-believe classroom assignment.

I hope so. I don't think an RFID tag will be detectable from a moving vehicle unless it's dangerously close and going rather slow.

The problem is i really dont know what to do, next i have nothing with me i need a Arduino code that will connect scanner arduino and bluetooth together to receive message on mobile using mit app

Its just a small project sir i am not actually going to put it in to a car its just a small dummy project for my final year, it carry marks so i am struggling.
:slightly_smiling_face:
i just have max to max 2 weeks for this.

The usual procedure is to learn the connection and programming and testing of one single device at a time and then in the future when you are familiar with the devices, you can develop a plan to integrate them all into your final product.
All the devices you have likely have sample programs available so you can begin with them.

You need to learn how to write that code, which is the point of your assignment.

2 Likes

yes using those now i know how to display uids on serial monitor, but the issue is i want to display those same messages using bluetooth hc-05 and arduino on moible.
and for that i want to creat a code of arduino which will help me to connect mobile bluetooth to arduino and will show those messages on mobile which i get on serial monitor

Get to work! You have two weeks, which should be plenty of time.