Final Video link:

link

Inspiration

Fed up of forgetful, confusing shopping lists and waiting endlessly in long queues just to pay? So are we, so we want to create Pay2Go - join us in revolutionizing the ease of shopping!

What it does

Can be easily linked to an app on phones, in which users can create shopping lists and set up payment options ahead of time. Pay2Go basket tracks items placed in it using RFID aiding customers to not forget any items. When customers leave the store, automatically charges customers for the items in the basket (the purchase). Customers must return the shopping basket within a certain timeframe to the merchant (time necessary to store purchased items), otherwise, they will be charged a fee.

How We Built It & Technical Challenges

Technical Implementation Use RFID to scan items placed in basket and transmit this information to user via bluetooth. A force sensor is used to ensure that all items in the basket have been scanned, i.e. the weight measured does not exceed the expected weight for the set of scanned items.

Software Arrays of different datatypes store the relevant information for the items, with each index of the arrays storing information for the same item, i.e. the arrays combine as rows to form a matrix, where each column refers to one item. We used the MFRC522 library and BTSerial library, to make interfacing with the RFID chip and Bluetooth Slave module easier. We wrote two functions, getID(), which returns a boolean stating whether or not it was able to set the global variable tagID to the ID of a nearby RFID tag which it concatenated byte by byte, and getWeight(), which performs calculations to convert the measured analog Voltage to a resistance, which it then converts to a conductance which can be converted finally to the force, which it returns. These functions allow us to light up the Green LED when a tag is read sucessfully and the red LED when the force is too high for the set of scanned items.

HardWare Most of our design iterations were on the hardware side, with the software side developed quickly on the side. We began with a large board upon which we could nicely space out all our components, and added component by component starting with the RFID chip. We looked up documentation online and worked with libraries, until we would get a working function that could return the ID. We then added the force sensor along with the LED checklights, which were much easier to set up (the force sensor is simply a variable resistor that we placed in a voltage divider circuit). Finally we added the bluetooth slave module, to complete the electrical circuitry ( we chose to place the slave module with the sensors, since the user would be controlling the sensors and storage, etc. as the master). Upon completion of the electrical circuit we repackaged our circuit onto the much smaller protoboard inside a mechanical box, for which we lasercut new sides and top, with holes for our extruding components. The result is a nicely packaged item checker, that can be placed into any basket.

Code

#include #include #include #define forcePin A0 #define RST_PIN 9 // Configurable, see typical pin layout above #define SS_PIN 10 // Configurable, see typical pin layout above #define confirmRead 7 #define weightAlert 6 #define buzzerPin 4 #define NOTE 1000

MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance SoftwareSerial BTSerial(2, 3); //TX RX byte readCard[4]; char* myTags[100] = {}; int numOfItems = 2; int stored[3] = {0, 0, 0}; int weight[3] = {2, 3, 1}; String database[3] = {"DDFFA014", "BDAFD813", "1D769E14"}; String itembase[3] = {"Powerbank", "Pen", "Chocolate"}; int storedCount = 0; int tagsCount = 0; String tagID = ""; boolean successRead = false;

int fsrPin = 0; // the FSR and 10K pulldown are connected to a0 int fsrReading; // the analog reading from the FSR resistor divider int fsrVoltage; // the analog reading converted to voltage unsigned long fsrResistance; // The voltage converted to resistance, can be very big so make "long" unsigned long fsrConductance; long fsrForce;

void setup() { pinMode(buzzerPin, OUTPUT); BTSerial.begin(9600); Serial.begin(9600); // Initialize serial communications with the PC while (!Serial); // Do nothing if no serial port is opened (added for Arduinos based on ATMEGA32U4) SPI.begin(); // Init SPI bus mfrc522.PCD_Init(); // Init MFRC522 mfrc522.PCD_DumpVersionToSerial(); // Show details of PCD - MFRC522 Card Reader details Serial.println(F("Scan PICC to see UID, SAK, type, and data blocks...")); pinMode(confirmRead, OUTPUT); pinMode(weightAlert, OUTPUT); }

uint8_t getID() { // Getting ready for Reading PICCs if ( ! mfrc522.PICC_IsNewCardPresent()) { //If a new PICC placed to RFID reader continue return 0; } if ( ! mfrc522.PICC_ReadCardSerial()) { //Since a PICC placed get Serial and continue return 0; } tagID = ""; for ( uint8_t i = 0; i < 4; i++) { // The MIFARE PICCs that we use have 4 byte UID readCard[i] = mfrc522.uid.uidByte[i]; tagID.concat(String(mfrc522.uid.uidByte[i], HEX)); // Adds the 4 bytes in a single String variable } tagID.toUpperCase(); mfrc522.PICC_HaltA(); // Stop reading return 1; }

int getWeight() { fsrReading = analogRead(forcePin);
//Serial.print("Analog reading = "); //Serial.println(fsrReading);

// analog voltage reading ranges from about 0 to 1023 which maps to 0V to 5V (= 5000mV) fsrVoltage = map(fsrReading, 0, 1023, 0, 5000); //Serial.print("Voltage reading in mV = "); //Serial.println(fsrVoltage);

if (fsrVoltage == 0) { //Serial.println("No pressure");
} else { // The voltage = Vcc * R / (R + FSR) where R = 10K and Vcc = 5V // so FSR = ((Vcc - V) * R) / V yay math! fsrResistance = 5000 - fsrVoltage; // fsrVoltage is in millivolts so 5V = 5000mV fsrResistance *= 10000; // 10K resistor fsrResistance /= fsrVoltage; // Serial.print("FSR resistance in ohms = "); // Serial.println(fsrResistance);

fsrConductance = 1000000;           // we measure in micromhos so 
fsrConductance /= fsrResistance;

// Serial.print("Conductance in microMhos: "); // Serial.println(fsrConductance);

// Use the two FSR guide graphs to approximate the force
if (fsrConductance <= 1000) {
  fsrForce = fsrConductance / 80;     
} else {
  fsrForce = fsrConductance - 1000;
  fsrForce /= 30;         
}

}

if(fsrForce > 1) { Serial.print("Force in Newtons: "); Serial.println(fsrForce);
} return fsrForce; //delay(1000); }

void loop() {

successRead = getID();
if( successRead == true) {

digitalWrite(confirmRead, HIGH);
for(int i = 0; i < 2; i++) {

  if(tagID == database[i]) {
    stored[i]++;
  }
}

    Serial.print("Bag Contains: ");
    for(int i = 0; i < numOfItems; i++) {
      if(stored[i] != 0) {
        Serial.print(stored[i]);
        Serial.print("x " + itembase[i] + ", ");
      }
    }
    Serial.println();
    if (tagID.equals("BDAFD813")) {
        char inChar = 'A';
        Serial.println(inChar);
        BTSerial.print(inChar);
      } else if (tagID.equals("1D769E14")) {
          char inChar = 'B';
          Serial.println(inChar);
          BTSerial.print(inChar);
        } else if (tagID.equals("DDFFA014")) {
          char inChar = 'C';
          Serial.println(inChar);
          BTSerial.print(inChar);
          }
    //delay(100);
} else {

digitalWrite(confirmRead, LOW);
}

successRead = false;

int expWeight = 0;
for(int i = 0; i < numOfItems; i++) {

  expWeight += weight[i] * stored[i];
}

if(getWeight() > expWeight) {
  digitalWrite(weightAlert, HIGH);
  tone(buzzerPin, NOTE);
} else {
  noTone(buzzerPin);
  digitalWrite(weightAlert, LOW);
}

}

What's next for Pay2Go

We would liked to have worked on integrated payment solutions, which would be the next step for Pay2Go, either in the form of a magnetic card reader or through fintech solutions on an app. We also started development of an android app for smartphone users, which I think would be our next primary focus.

Built With

Share this project:
×

Updates