This shows you the differences between two versions of the page.
pm:prj2023:apredescu:nfc_system [2023/05/06 16:02] bogdan.stefanescu02 Added list of parts |
pm:prj2023:apredescu:nfc_system [2023/05/30 15:37] (current) bogdan.stefanescu02 final |
||
---|---|---|---|
Line 2: | Line 2: | ||
===== Introducere ===== | ===== Introducere ===== | ||
- | <note tip> | + | Using an Arduino microcontroller and an NFC module, a Near Field Communication (NFC) Payment System is a system that enables contactless payments. The system initiates and completes a payment transaction by exchanging data between the NFC module and a compatible device, such as a smartphone or contactless card. |
- | Prezentarea pe scurt a proiectului vostru: | + | |
- | * ce face | + | When a user initiates a payment, the Arduino microcontroller processes the transaction and transmits a signal to the NFC module in order to establish communication with the user's device. The user then affirms the transaction via their device, after which the system verifies the transaction and completes it. |
- | * care este scopul lui | + | |
- | * care a fost ideea de la care aţi pornit | + | Overall, an Arduino-based NFC Payment System provides a basic and efficient method for making contactless payments that can be implemented in a variety of applications, from vending machines to transportation systems. |
- | * de ce credeţi că este util pentru alţii şi pentru voi | + | |
- | </note> | + | |
===== Descriere generală ===== | ===== Descriere generală ===== | ||
- | <note tip> | + | **Block Schema**: |
- | O schemă bloc cu toate modulele proiectului vostru, atât software cât şi hardware însoţită de o descriere a acestora precum şi a modului în care interacţionează. | + | |
- | Exemplu de schemă bloc: http://www.robs-projects.com/mp3proj/newplayer.html | + | {{ :pm:prj2023:apredescu:125085-block-schema.png?direct&500 |}} |
- | </note> | + | |
===== Hardware Design ===== | ===== Hardware Design ===== | ||
Line 26: | Line 22: | ||
{{ :pm:prj2023:apredescu:pn532.jpg?direct&300 |}} | {{ :pm:prj2023:apredescu:pn532.jpg?direct&300 |}} | ||
- | **ESP-01**: The ESP-01 is a popular Wi-Fi module that is based on the ESP8266 chip. It has a compact form factor and is simple to integrate into a variety of electronic projects. It supports Wi-Fi protocols 802.11 b/g/n and may be programmed using AT commands or the NodeMCU firmware. It's popular in Internet of Things (IoT) applications like home automation, smart sensors, and remote control systems. | + | **ESP-01**: The ESP-01 is a popular Wi-Fi module based on the ESP8266 chip. It has a small form factor and can be easily integrated into various electronic projects. It supports 802.11 b/g/n Wi-Fi standards and can be programmed using AT commands or with the NodeMCU firmware. It is commonly used in Internet of Things (IoT) applications such as home automation, smart sensors, and remote control systems. |
{{ :pm:prj2023:apredescu:esp01.jpg?direct&300 |}} | {{ :pm:prj2023:apredescu:esp01.jpg?direct&300 |}} | ||
+ | |||
+ | ** Logic Level Shifter**: A logic level shifter is a versatile circuit that plays a crucial role in bridging the gap between different voltage levels in digital signals. It acts as a compatibility translator, facilitating seamless communication and integration between devices operating at varying logic levels. This enables smooth interaction and ensures efficient data exchange in electronic projects, including those in the realm of Internet of Things (IoT) applications like home automation, smart sensors, and remote control systems. | ||
+ | |||
+ | {{ :pm:prj2023:apredescu:125085_logic_shifter.jpg?direct&300 |}} | ||
**Arduino UNO** - a microcontroller board based on the ATmega328P processor. It is one of the most popular Arduino boards and is intended to be a simple foundation for constructing a variety of electronic projects. | **Arduino UNO** - a microcontroller board based on the ATmega328P processor. It is one of the most popular Arduino boards and is intended to be a simple foundation for constructing a variety of electronic projects. | ||
{{ :pm:prj2023:apredescu:atmega328p.jpeg?direct&300 |}} | {{ :pm:prj2023:apredescu:atmega328p.jpeg?direct&300 |}} | ||
+ | |||
+ | ===Electrical Schema=== | ||
+ | |||
+ | {{:pm:prj2023:apredescu:125085-electric-schema.png|}} | ||
+ | |||
+ | |||
+ | |||
===== Software Design ===== | ===== Software Design ===== | ||
- | <note tip> | + | This app was written using Arduino IDE and Visual Studio Code. |
- | Descrierea codului aplicaţiei (firmware): | + | The software is divided in 3 parts: |
- | * mediu de dezvoltare (if any) (e.g. AVR Studio, CodeVisionAVR) | + | - Arduino Code |
- | * librării şi surse 3rd-party (e.g. Procyon AVRlib) | + | - ESP (Wifi) Code |
- | * algoritmi şi structuri pe care plănuiţi să le implementaţi | + | - Web Server |
- | * (etapa 3) surse şi funcţii implementate | + | |
- | </note> | + | === Arduino === |
+ | 1. First, we include all the libraries we need to use for the project. | ||
+ | <code> | ||
+ | #include <Wire.h> | ||
+ | #include <PN532_I2C.h> | ||
+ | #include <PN532.h> | ||
+ | #include <NfcAdapter.h> | ||
+ | #include <LiquidCrystal.h> | ||
+ | #include <SoftwareSerial.h> | ||
+ | #include <SerialESP8266wifi.h> | ||
+ | </code> | ||
+ | |||
+ | 2. Next, we define the pins of the LCD, NFC, buzzer and ESP01 modules, as noted in the electrical schema. | ||
+ | |||
+ | 3. In the setup() function, we initialize the serial communication between Arduino and computer, and between Arduino and ESP01 module, with the baud rate of 115200. | ||
+ | |||
+ | 4. We call the initLCD() function, which initialises the LCD screen, the initNFC() function , which turns the NFC module on, and the initWifi() function. which initialises the module. We also send a packet to the server, so that it knows that the Arduino is online. | ||
+ | |||
+ | 5. We display on the LCD "Awaiting Transaction". During this time, we wait for a NFC reading request from the ESP. | ||
+ | {{ pm:prj2023:apredescu:125085-working.jpeg?direct&300 |}} | ||
+ | |||
+ | 6. When a packet is received (a transaction initiated from the web interface), the value of the transaction is displayed on the LCD, along with the indication to tap a payment card to the NFC reader, which is activated. | ||
+ | |||
+ | 7. If a card is presented, its information is sent to the server for the processing of the transaction and balance updates. | ||
+ | |||
+ | === ESP (WiFi) Code === | ||
+ | 1. First we initialise the Serial connection with the Arduino. | ||
+ | |||
+ | 2. We connect to the WiFi network, and send a confirmation packet through the Serial. | ||
+ | |||
+ | 3. We create an HTTP server, with the endpoint /pay, which listens for payment requests from the web interface. | ||
+ | |||
+ | 4. When a request is received, a reading from the NFC sensor is requested from the Arduino. | ||
+ | |||
+ | 5. The reading is send back to the web as a response to the request. | ||
+ | |||
+ | === Web Server === | ||
+ | The web server is written using PHP, and uses an MySQL database for data storage. | ||
+ | |||
+ | The server contains the following pages: | ||
+ | |||
+ | 1. Main page | ||
+ | It contains the list of products, a login/logout button, a link to the admin interface | ||
+ | |||
+ | 2. Purchase pages (/buy, /pay) | ||
+ | Get the list of POS Terminals from the DB, send to the chosen one a NFC reading request, use the acquired data to process the transaction | ||
+ | |||
+ | 3. Account pages (/login, /logout, /register, /account, /card) | ||
+ | Get and store user data such as accounts, cards, balances | ||
+ | |||
+ | 4. Managment page (/products) | ||
+ | List and update the products. | ||
===== Rezultate Obţinute ===== | ===== Rezultate Obţinute ===== | ||
- | <note tip> | + | <html> |
- | Care au fost rezultatele obţinute în urma realizării proiectului vostru. | + | <iframe frameborder="0" scrolling="no" marginheight="0" marginwidth="0"width="788.54" height="443" type="text/html" src="https://www.youtube.com/embed/J1LEsm5ILNM?autoplay=0&fs=0&iv_load_policy=3&showinfo=0&rel=0&cc_load_policy=0&start=0&end=0&origin=https://youtubeembedcode.com"></iframe> |
- | </note> | + | </html> |
===== Concluzii ===== | ===== Concluzii ===== | ||
+ | |||
+ | In conclusion, the NFC Payment System project utilizing an Arduino microcontroller, NFC module, and ESP-01 Wi-Fi module successfully demonstrates the implementation of a contactless payment system. The project provides a user-friendly interface through an LCD display and enables communication between the Arduino and a compatible device for initiating and verifying payment transactions. | ||
+ | |||
+ | By leveraging the capabilities of the PN532 NFC controller chip and the logic level shifter, the system ensures reliable communication and compatibility between devices operating at different voltage levels. The integration of the ESP-01 Wi-Fi module enables seamless connectivity and enables the system to interact with web-based interfaces for transaction processing and user management. | ||
+ | |||
+ | Overall, the NFC Payment System project offers a practical and accessible solution for implementing contactless payment functionality in various applications, such as vending machines, transportation systems, and more. | ||
===== Download ===== | ===== Download ===== | ||
+ | {{:pm:prj2023:apredescu:125085_WEB-server.zip|}} | ||
- | <note warning> | + | {{:pm:prj2023:apredescu:125085_Arduino.zip|}} |
- | O arhivă (sau mai multe dacă este cazul) cu fişierele obţinute în urma realizării proiectului: surse, scheme, etc. Un fişier README, un ChangeLog, un script de compilare şi copiere automată pe uC crează întotdeauna o impresie bună ;-). | + | |
- | Fişierele se încarcă pe wiki folosind facilitatea **Add Images or other files**. Namespace-ul în care se încarcă fişierele este de tipul **:pm:prj20??:c?** sau **:pm:prj20??:c?:nume_student** (dacă este cazul). **Exemplu:** Dumitru Alin, 331CC -> **:pm:prj2009:cc:dumitru_alin**. | + | {{:pm:prj2023:apredescu:125085_ESP01.zip|}} |
- | </note> | + | |
- | ===== Jurnal ===== | ||
- | <note tip> | ||
- | Puteți avea și o secțiune de jurnal în care să poată urmări asistentul de proiect progresul proiectului. | ||
- | </note> | ||
===== Bibliografie/Resurse ===== | ===== Bibliografie/Resurse ===== | ||
- | <note> | + | **LCD 1602A** - http://wiki.sunfounder.cc/index.php?title=LCD1602_Module |
- | Listă cu documente, datasheet-uri, resurse Internet folosite, eventual grupate pe **Resurse Software** şi **Resurse Hardware**. | + | |
- | </note> | + | **SerialESP8266wifi** - https://github.com/ekstrand/ESP8266wifi |
+ | |||
+ | **PN532** - https://github.com/Seeed-Studio/PN532 | ||
+ | |||
+ | **NDEF** - https://github.com/don/NDEF (NFC communication protocol) | ||
<html><a class="media mediafile mf_pdf" href="?do=export_pdf">Export to PDF</a></html> | <html><a class="media mediafile mf_pdf" href="?do=export_pdf">Export to PDF</a></html> | ||