This shows you the differences between two versions of the page.
pm:prj2023:apredescu:nfc_system [2023/05/28 23:52] bogdan.stefanescu02 picture |
pm:prj2023:apredescu:nfc_system [2023/05/30 15:37] (current) bogdan.stefanescu02 final |
||
---|---|---|---|
Line 25: | Line 25: | ||
{{ :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. | ||
Line 32: | Line 36: | ||
===Electrical Schema=== | ===Electrical Schema=== | ||
- | {{ :pm:prj2023:apredescu:125085-electric-schema.png?direct&300 |}} | + | {{:pm:prj2023:apredescu:125085-electric-schema.png|}} |
+ | |||
Line 39: | Line 45: | ||
This app was written using Arduino IDE and Visual Studio Code. | This app was written using Arduino IDE and Visual Studio Code. | ||
- | The workflow of the application is as follows: | + | The software is divided in 3 parts: |
+ | - Arduino Code | ||
+ | - ESP (Wifi) Code | ||
+ | - Web Server | ||
- | 1. First, we include all the libraries we need to use for this project. | + | === Arduino === |
+ | 1. First, we include all the libraries we need to use for the project. | ||
<code> | <code> | ||
#include <Wire.h> | #include <Wire.h> | ||
Line 56: | Line 66: | ||
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. | 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 starts and connects the WiFi module to the internet. We also send a packet to the server, so that it knows that the Arduino is online. | + | 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, a server is open which awaits packets from the orders server. | + | 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 |}} | {{ pm:prj2023:apredescu:125085-working.jpeg?direct&300 |}} | ||
Line 64: | Line 74: | ||
7. If a card is presented, its information is sent to the server for the processing of the transaction and balance updates. | 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> | ||