How Does a Smart Vending Machine Authenticate Purchases Over Ethernet with WIZnet W5500?
Four AVR microcontrollers and a WIZnet W5500 Ethernet chip power this cashless vending machine; 10 units were deployed at Rajasthan IT Day 2017.
0
Components
Hardware components
WIZnet - W5500
Provides the machine's wired Ethernet link. Runs a WebSocket client over hardware TCP/IP (SPI) to authenticate purchase codes with the cloud server and receive dispatch commands.
Project description
๐ Overview
Rhitvik is an embedded systems engineer who, while developing a startup in India, designed and built a cashless vending machine from scratch using AVR microcontrollers and custom PCBs. The project reached production: 10 units were deployed at Rajasthan IT Day 2017 and shown at the Jaipur Literature Fest 2016, and the startup placed third at the Startup Inspire competition at the Indian Industrial Fair 2016, competing against 102 teams from across the country.
The machine lets a user pay through a mobile app, receive a one-time code, enter it on the machine's keypad, and collect the dispensed product. Every purchase code goes over the network for authentication: the WIZnet W5500 Ethernet chip opens a WebSocket connection to a cloud server, sends the code, receives the dispatch command in return (which shelf, which quantity), and signals the local controller to run the motor. That network path is the only link between the machine and the outside world, making the W5500 the single Ethernet gateway for the whole system.
The Smart Vending Machine Gen-2: a wall-mountable cashless vending unit that authenticates purchases over a WIZnet W5500 Ethernet link.
System Configuration
The machine uses four separate AVR microcontrollers, each with a dedicated job, coordinated over a shared 4-bit parallel bus. The W5500 handles the Ethernet link over SPI and runs the entire cloud communication independently of the other MCUs.
- ATmega328PU: master communication controller, connects to every other subsystem including the Ethernet controller, motor driver controller, sensor grid controller, and HMI.
- ATmega16: HMI controller, reads the PIN code entered on the keypad and drives the status display.
- ATmega32: motor and sensor controller, drives the motor that ejects the product and reads from the IR sensor grid to confirm a successful drop.
- ATmega8: IR sensor grid controller, monitors 16 IR sensors across the product slots and sends alerts on tampering.
- WIZnet W5500: hardwired TCP/IP Ethernet chip connected to the ATmega328PU over SPI; runs the WebSocket client that authenticates purchase codes with the cloud server.
- Libraries: Arduino Ethernet library for W5500 DHCP and socket, WebSocketClient by Pablo, AESLib for optional encryption, ArduinoJson.
System Architecture and Data Flow
Generated technical diagram: the W5500 is the sole Ethernet gateway between the local four-MCU cluster and the cloud server; each MCU handles one dedicated role.
The purchase flow runs through a state machine:
- User enters PIN on the keypad connected to the ATmega16 (HMI).
- ATmega16 transmits digits to the ATmega328PU over a clocked 4-bit parallel bus.
- ATmega328PU passes the OTP to the W5500 over SPI.
- W5500 sends the code to the server via WebSocket (TCP, port 4500, DHCP address).
- Server replies with a dispatch command:
O <orderId> <quantity> <shelf>. - ATmega328PU commands the ATmega32 (motor controller) with the shelf number, via the same 4-bit bus.
- ATmega32 runs the motor for the chosen slot until the IR sensor grid (ATmega8) confirms the product has dropped.
- ATmega328PU sends dispatch ACK to the server over the WebSocket connection.
If the PIN is wrong the server replies with an error event and the machine resets. If the Ethernet connection drops, the W5500 re-initiates DHCP and re-opens the WebSocket before the next request.
Inside the Machine
Inside the Smart Vending Machine: motor rack (bottom), IR sensor grid (product slots), and the control board assembly.
The physical design is compact and wall-mountable. Each product slot has a dedicated motor and a pair of IR sensors to confirm whether the product dropped successfully. The IR grid is driven by the ATmega8 and feeds status back to the ATmega32 motor controller, which closes the feedback loop without involving the cloud until confirmation is needed. Power comes from a modified PC power supply unit, providing 5V for the MCUs and 12V for the motors.
โ๏ธ Role of the WIZnet W5500
The W5500 is the only external network interface in the machine. No cellular or Wi-Fi is used; the machine assumes a wired Ethernet connection at the installation site, which is typical for fixed wall-mounted equipment in commercial or institutional settings.
The Arduino Ethernet library uses the W5500's hardware TCP/IP stack to handle DHCP, TCP connection management, and socket operations via SPI, so the ATmega328PU does not run a software network stack. The WebSocket handshake and message framing layer runs on top of the Arduino Ethernet client, leaving the W5500 to handle the IP-layer work in hardware. This matters for a low-power AVR: offloading TCP/IP to the W5500 leaves the ATmega328PU free to manage the 4-bit inter-MCU bus, parse server messages, and coordinate the dispatch lifecycle.
The state machine in the Ethernet controller code (SocketClient_Ethernet_StateMachine_polled.ino) reflects this cleanly: the W5500 handles connectivity, and the application layer above it handles only machine state (register, send OTP, wait for order, command machine, send ACK).
From Gen-1 to Gen-2, and Into the Field
The Smart Vending Machine Gen-1, the first version deployed in the field; the Gen-2 brought a more compact and refined mechanical design.
The project went through two hardware revisions. Gen-1 established the architecture and was the version shown at Jaipur Literature Fest 2016 and used for the Startup Inspire competition. Gen-2 refined the mechanical chassis and control board layout, and was the version deployed in quantity at Rajasthan IT Day 2017. Custom PCBs for the control board, the sensor RX board, and the sensor TX board were all fabricated, with Gerber files and pick-and-place data included in the repository.
The scale of the deployment is notable: 10 machines running simultaneously at a government technology event, distributing goodies and gifts to participants, is a meaningful real-world test for an embedded project that started as a startup idea.
Where It Fits and What It Does Not Cover
This project is a complete embedded reference for a cashless IoT vending machine: custom PCBs, firmware for four AVR MCUs, Ethernet socket client code, inter-MCU bus protocol, IR sensor grid, and motor control. It is well-suited as a starting point or reference for anyone building fixed-network embedded machines that need a simple cloud authentication or command loop.
The server-side code (the backend that receives OTPs, verifies them against purchases, and replies with dispatch commands) is not in the repository. The machine is also designed for a fixed Ethernet connection only; a site without wired Ethernet would need an additional gateway or a different network interface. The IR sensor feedback prevents false dispatch acknowledgments, but the code does not include a full inventory management layer.
Related WIZnet Maker Projects
Cashless and IoT-connected vending machines are a recurring theme on the Maker site. These three projects connect to the same problem space from different angles.
MDB Arduino Cashless connects a vending machine to a cashless payment system using the MDB (Multi-Drop Bus) protocol and a WIZnet Ethernet chip. Where this project builds the entire machine from AVR MCUs up, Hannah's project focuses on adding a cashless payment interface to an existing vending machine over MDB, which is the industry-standard protocol between vending machines and payment terminals. The two complement each other: one for building a machine, one for connecting an existing one to a payment network.
Easymeal IoT MDB Router is an IoT gateway that bridges a vending machine's MDB bus to the cloud using a WIZnet W5500. Where Rhitvik's machine is a standalone unit with its own controller, Easymeal connects existing vending machines to cloud services through their MDB ports. Both use the W5500 for the Ethernet link to the cloud, but the Easymeal project targets the retrofit case and uses the MDB protocol for machine communication.
Vending Machine / Cashless Device Implementation covers cashless payment implementation for vending machines, which is the same problem this project solves from the user-facing side. Comparing the two shows different approaches to the same cashless purchase loop, useful context for anyone designing a similar system.
โ FAQ
Q. What does the WIZnet W5500 do in this vending machine? The W5500 is the Ethernet gateway for the whole machine. It connects to the cloud server over TCP using a WebSocket client, sends the purchase PIN entered by the user for authentication, receives a dispatch command (shelf number and quantity) back from the server, and confirms successful delivery. No other part of the machine communicates with the outside world.
Q. Why does the machine use four separate AVR microcontrollers instead of one? Each MCU handles exactly one task: ATmega16 reads the keypad and drives the display, ATmega32 controls motors and reads the IR sensor grid, ATmega8 monitors 16 IR sensors, and ATmega328PU coordinates all of them and bridges to the W5500 over SPI. Splitting the workload like this keeps each MCU's firmware simple and makes it easier to debug and replace individual subsystems.
Q. How does the machine confirm that a product was successfully dispensed? The ATmega8 runs 16 IR sensors, one for each product slot. When a motor runs and a product falls, the IR beam is broken. The ATmega8 signals the ATmega32 motor controller, which stops the motor and reports success to the ATmega328PU master. Only after this confirmation does the machine send the dispatch acknowledgment to the server.
Q. Is there a mobile app for this machine? Yes. The purchase flow relies on a mobile app: the user browses inventory, selects a product, pays through the app, and receives a one-time code. The app itself is not in this repository, which contains only the firmware and hardware files for the machine.
Q. Can this machine be expanded to more product slots? The README notes that the system can be expanded to control up to 256 motors by modifying the sensor communication bus and adding more ATmega32 units. The 4-bit parallel bus and the W5500 Ethernet interface are not the bottleneck; the limit is the sensor bus addressing and the motor driver count.
ํ๊ตญ์ด (Korean)
๐ ๊ฐ์
Rhitvik์ ์ธ๋์์ ์คํํธ์ ์ ์ด์ํ๋ ์๋ฒ ๋๋ ์์คํ ์์ง๋์ด๋ก, AVR ๋ง์ดํฌ๋ก์ปจํธ๋กค๋ฌ์ ์ปค์คํ PCB๋ฅผ ์ด์ฉํด ํ๊ธ ์๋ ์ํ๊ธฐ๋ฅผ ์ง์ ์ค๊ณยท์ ์ํ์ต๋๋ค. ํ๋ก์ ํธ๋ ์ค์ ์์ฐ๊น์ง ์ด์ด์ก์ต๋๋ค. 2017๋ Rajasthan IT Day์ 10๋๊ฐ ๋ฐฐ์น๋๊ณ , 2016๋ Jaipur Literature Fest์์ ์ ์๋์ผ๋ฉฐ, ์คํํธ์ ํ์ 2016 ์ธ๋ ์ฐ์ ๋ฐ๋ํ 'Startup Inspire'์์ ์ ๊ตญ 102๊ฐ ํ ์ค 3์๋ฅผ ์ฐจ์งํ์ต๋๋ค.
๊ตฌ๋งค ํ๋ฆ์ ๋ชจ๋ฐ์ผ ์ฑ์์ ๊ฒฐ์ ํ ์ผํ์ฉ ์ฝ๋๋ฅผ ๋ฐ์ ๊ธฐ๊ธฐ ํคํจ๋์ ์ ๋ ฅํ๋ฉด ์ ํ์ด ๋ฐฐ์ถ๋๋ ๋ฐฉ์์ ๋๋ค. ์ธ์ฆ ๊ณผ์ ์ ์ ์ ์ผ๋ก ๋คํธ์ํฌ๋ฅผ ํตํด ์ด๋ฃจ์ด์ง๋๋ค. WIZnet W5500 ์ด๋๋ท ์นฉ์ด WebSocket ์ฐ๊ฒฐ๋ก ํด๋ผ์ฐ๋ ์๋ฒ์ ์ฝ๋๋ฅผ ์ ์กํ๊ณ , ๋ฐฐ์ถ ๋ช ๋ น(์ด๋ ์ ๋ฐ, ๋ช ๊ฐ)์ ๋ฐ์ ๋ก์ปฌ ์ปจํธ๋กค๋ฌ์ ์ ๋ฌํฉ๋๋ค. W5500์ ์ด ์์คํ ์ ์ ์ผํ ์ด๋๋ท ๊ฒ์ดํธ์จ์ด์ ๋๋ค.
์ค๋งํธ ์ํ๊ธฐ Gen-2: WIZnet W5500 ์ด๋๋ท ๋งํฌ๋ก ๊ตฌ๋งค๋ฅผ ์ธ์ฆํ๋ ๋ฒฝ๊ฑธ์ดํ ํ๊ธ ์๋ ์ํ๊ธฐ.
์์คํ ๊ตฌ์ฑ
์ด ์ํ๊ธฐ๋ ๊ฐ์ ์ ๋ด ์ญํ ์ ๋งก์ 4๊ฐ์ AVR ๋ง์ดํฌ๋ก์ปจํธ๋กค๋ฌ๊ฐ 4๋นํธ ๋ณ๋ ฌ ๋ฒ์ค๋ก ํ๋ ฅํฉ๋๋ค. W5500์ SPI๋ก ์ด๋๋ท ๋งํฌ๋ฅผ ๋ด๋นํ๋ฉฐ, ํด๋ผ์ฐ๋์์ ํต์ ์ ๋ ๋ฆฝ์ ์ผ๋ก ์ฒ๋ฆฌํฉ๋๋ค.
- ATmega328PU: ๋ง์คํฐ ํต์ ์ปจํธ๋กค๋ฌ. ์ด๋๋ทยท๋ชจํฐ ๋๋ผ์ด๋ฒยท์ผ์ ๊ทธ๋ฆฌ๋ยทHMI ์ปจํธ๋กค๋ฌ ๋ชจ๋์ ์ฐ๊ฒฐ.
- ATmega16: HMI ์ปจํธ๋กค๋ฌ. ํคํจ๋์์ PIN ์ฝ๋๋ฅผ ์ฝ๊ณ ์ํ ๋์คํ๋ ์ด๋ฅผ ๊ตฌ๋.
- ATmega32: ๋ชจํฐยท์ผ์ ์ปจํธ๋กค๋ฌ. ์ ํ์ ๋ฐฐ์ถํ๋ ๋ชจํฐ๋ฅผ ๊ตฌ๋ํ๊ณ IR ์ผ์ ๊ทธ๋ฆฌ๋๋ก ๋ฐฐ์ถ ์ฑ๊ณต ์ฌ๋ถ ํ์ธ.
- ATmega8: IR ์ผ์ ๊ทธ๋ฆฌ๋ ์ปจํธ๋กค๋ฌ. ์ ํ ์ฌ๋กฏ ์ ์ฒด 16๊ฐ IR ์ผ์ ๋ชจ๋ํฐ๋ง, ์ธ๋ถ ์กฐ์ ์ ๊ฒฝ๋ณด.
- WIZnet W5500: ํ๋์จ์ด TCP/IP ์ด๋๋ท ์นฉ. ATmega328PU์ SPI๋ก ์ฐ๊ฒฐ, ํด๋ผ์ฐ๋ ์๋ฒ์ WebSocket์ผ๋ก ๊ตฌ๋งค ์ฝ๋ ์ธ์ฆ.
- ๋ผ์ด๋ธ๋ฌ๋ฆฌ: Arduino Ethernet(W5500 DHCPยท์์ผ), WebSocketClient by Pablo, AESLib, ArduinoJson.
์์คํ ์ํคํ ์ฒ ๋ฐ ๋ฐ์ดํฐ ํ๋ฆ
์์ฑ๋ ๊ธฐ์ ๋ค์ด์ด๊ทธ๋จ: W5500์ด ๋ก์ปฌ 4-MCU ํด๋ฌ์คํฐ์ ํด๋ผ์ฐ๋ ์๋ฒ ์ฌ์ด์ ์ ์ผํ ์ด๋๋ท ๊ฒ์ดํธ์จ์ด์
๋๋ค.
๊ตฌ๋งค ํ๋ฆ์ ๋ค์ ์ํ ๋จธ์ ์ผ๋ก ๋์ํฉ๋๋ค:
- ์ฌ์ฉ์๊ฐ ํคํจ๋์ PIN ์ ๋ ฅ - ATmega16(HMI)์ด ์ฝ์.
- ATmega16์ด 4๋นํธ ๋ณ๋ ฌ ๋ฒ์ค๋ก ATmega328PU์ ์ ๋ฌ.
- ATmega328PU๊ฐ OTP๋ฅผ SPI๋ก W5500์ ์ ๋ฌ.
- W5500์ด WebSocket(TCP, ํฌํธ 4500)์ผ๋ก ์๋ฒ์ ์ฝ๋ ์ ์ก.
- ์๋ฒ๊ฐ ๋ฐฐ์ถ ๋ช
๋ น ์๋ต:
O <orderId> <์๋> <์ ๋ฐ>. - ATmega328PU๊ฐ ATmega32์ ์ ๋ฐ ๋ฒํธ ์ ๋ฌ.
- ATmega32๊ฐ ๋ชจํฐ๋ฅผ ๊ตฌ๋, ATmega8 IR ์ผ์๋ก ์ ํ ๋ํ ํ์ธ.
- ATmega328PU๊ฐ ์๋ฒ์ ๋ฐฐ์ถ ACK ์ ์ก.
๊ธฐ๊ธฐ ๋ด๋ถ
์ํ๊ธฐ ๋ด๋ถ: ๋ชจํฐ ๋(ํ๋จ), IR ์ผ์ ๊ทธ๋ฆฌ๋(์ ํ ์ฌ๋กฏ), ์ ์ด ๋ณด๋ ์กฐ๋ฆฝ์ฒด.
์ปดํฉํธํ ๋ฒฝ๊ฑธ์ดํ ๋์์ธ์ผ๋ก, ๊ฐ ์ฌ๋กฏ๋ง๋ค ์ ์ฉ ๋ชจํฐ์ IR ์ผ์ ์์ด ์์ด ๋ฐฐ์ถ ์ฑ๊ณต ์ฌ๋ถ๋ฅผ ํ์ธํฉ๋๋ค. ์ ์์ ๊ฐ์กฐ๋ PC ํ์์ํ๋ผ์ด๋ก MCU์ฉ 5V์ ๋ชจํฐ์ฉ 12V๋ฅผ ๊ณต๊ธํฉ๋๋ค.
โ๏ธ WIZnet W5500์ ์ญํ
W5500์ ์ํ๊ธฐ์ ์ ์ผํ ์ธ๋ถ ๋คํธ์ํฌ ์ธํฐํ์ด์ค์ ๋๋ค. ์ ๋ฃฐ๋ฌ๋ Wi-Fi๋ ์ฌ์ฉํ์ง ์์ต๋๋ค. Arduino Ethernet ๋ผ์ด๋ธ๋ฌ๋ฆฌ๊ฐ W5500์ ํ๋์จ์ด TCP/IP ์คํ์ ์ด์ฉํด DHCP, TCP ์ฐ๊ฒฐ, ์์ผ์ ์ฒ๋ฆฌํ๋ฏ๋ก ATmega328PU์ ์ํํธ์จ์ด ๋คํธ์ํฌ ์คํ์ด ํ์ ์์ต๋๋ค. ์ ์ ๋ ฅ AVR์์ TCP/IP๋ฅผ W5500์ ์คํ๋ก๋ํ๋ฉด MCU๋ MCU ๊ฐ 4๋นํธ ๋ฒ์ค ๊ด๋ฆฌ, ์๋ฒ ๋ฉ์์ง ํ์ฑ, ๋ฐฐ์ถ ์๋ช ์ฃผ๊ธฐ ์กฐ์จ์๋ง ์ง์คํ ์ ์์ต๋๋ค.
Gen-1์์ Gen-2, ๊ทธ๋ฆฌ๊ณ ํ์ฅ ๋ฐฐํฌ
Gen-1: 2016๋
Jaipur Lit Fest์ Startup Inspire ๊ฒฝ์ง๋ํ์์ ์ ๋ณด์ธ ์ด๊ธฐ ๋ฒ์ . Gen-2๋ ๊ธฐ๊ณ ์ค๊ณ์ ์ ์ด ๋ณด๋ ๋ ์ด์์์ ๊ฐ์ ํด 2017๋
์์ฐ ๋ฐฐํฌ๋์ต๋๋ค.
Gen-1์ด ์ํคํ ์ฒ๋ฅผ ํ๋ฆฝํ๊ณ Jaipur Literature Fest์ Startup Inspire(3์)์์ ์ ์๋์ผ๋ฉฐ, Gen-2๊ฐ ๊ธฐ๊ตฌ๋ถ์ ์ ์ด ๋ณด๋๋ฅผ ๊ฐ์ ํด Rajasthan IT Day 2017์ 10๋ ๋ฐฐํฌ๋์ต๋๋ค. ์ ์ฅ์์๋ ์ ์ด ๋ณด๋, ์ผ์ RX ๋ณด๋, ์ผ์ TX ๋ณด๋ ๋ชจ๋์ Gerber ํ์ผ๊ณผ pick-and-place ๋ฐ์ดํฐ๊ฐ ํฌํจ๋์ด ์์ต๋๋ค.
ํ์ฉ์ฒ์ ํ๊ณ
์ด ํ๋ก์ ํธ๋ ํ๊ธ ์๋ IoT ์ํ๊ธฐ๋ฅผ ์ํ ์๊ฒฐํ ์๋ฒ ๋๋ ๋ ํผ๋ฐ์ค์ ๋๋ค. ์ปค์คํ PCB, 4๊ฐ AVR MCU ํ์จ์ด, ์ด๋๋ท ์์ผ ํด๋ผ์ด์ธํธ ์ฝ๋, MCU ๊ฐ ๋ฒ์ค ํ๋กํ ์ฝ, IR ์ผ์ ๊ทธ๋ฆฌ๋, ๋ชจํฐ ์ ์ด๊ฐ ๋ชจ๋ ํฌํจ๋ฉ๋๋ค.
ํ๊ณ: ์๋ฒ ์ธก ์ฝ๋(OTP ๊ฒ์ฆ ๋ฐ ๋ฐฐ์ถ ๋ช ๋ น ๋ฐฑ์๋)๋ ์ ์ฅ์์ ์์ต๋๋ค. ์ ์ ์ด๋๋ท๋ง ์ง์ํ๋ฏ๋ก ๋ฐฐ์ ์ด ์๋ ํ์ฅ์๋ ๋ณ๋ ๊ฒ์ดํธ์จ์ด๊ฐ ํ์ํฉ๋๋ค.
๊ด๋ จ WIZnet ๋ฉ์ด์ปค ํ๋ก์ ํธ
MDB Arduino Cashless - MDB(Multi-Drop Bus) ํ๋กํ ์ฝ๊ณผ WIZnet ์ด๋๋ท์ผ๋ก ๊ธฐ์กด ์ํ๊ธฐ์ ํ๊ธ ์๋ ๊ฒฐ์ ๋ฅผ ์ถ๊ฐํ๋ ํ๋ก์ ํธ. Rhitvik์ ํ๋ก์ ํธ๊ฐ ์ํ๊ธฐ ์ ์ฒด๋ฅผ ์ง์ ๋ง๋ค์๋ค๋ฉด, ์ด ํ๋ก์ ํธ๋ ๊ธฐ์กด ์ํ๊ธฐ์ ๊ฒฐ์ ์ธํฐํ์ด์ค๋ฅผ ์ถ๊ฐํฉ๋๋ค. ๋์ ์๋ก ๋ณด์ํฉ๋๋ค.
Easymeal IoT MDB Router - WIZnet W5500์ผ๋ก ๊ธฐ์กด ์ํ๊ธฐ์ MDB ๋ฒ์ค๋ฅผ ํด๋ผ์ฐ๋์ ์ฐ๊ฒฐํ๋ IoT ๊ฒ์ดํธ์จ์ด. ๋ ํธ๋กํ ๋ฐฉ์์ผ๋ก W5500 ์ด๋๋ท ๋งํฌ๋ฅผ ํ์ฉํ๋ ์ ์ ๊ฐ์ง๋ง, ์์ฒด ์ ์ ๊ธฐ๊ธฐ๊ฐ ์๋ ๊ธฐ์กด ์ํ๊ธฐ ์ฐ๊ฒฐ์ ์ด์ ์ ๋ง์ถฅ๋๋ค.
Vending Machine / Cashless Device Implementation - ์ํ๊ธฐ ํ๊ธ ์๋ ๊ฒฐ์ ๊ตฌํ ํ๋ก์ ํธ. ์ฌ์ฉ์ ์ธก์์ ๊ฐ์ ํ๊ธ ์๋ ๊ตฌ๋งค ๋ฃจํ๋ฅผ ๋ค๋ฅธ ๋ฐฉ์์ผ๋ก ์ ๊ทผํ ์ฌ๋ก์ ๋๋ค.
โ ์์ฃผ ๋ฌป๋ ์ง๋ฌธ (FAQ)
Q. ์ด ์ํ๊ธฐ์์ WIZnet W5500์ ๋ฌด์์ ํ๋์? W5500์ ์ํ๊ธฐ ์ ์ฒด์ ์ด๋๋ท ๊ฒ์ดํธ์จ์ด์ ๋๋ค. WebSocket ํด๋ผ์ด์ธํธ๋ก ํด๋ผ์ฐ๋ ์๋ฒ์ ์ฐ๊ฒฐํด ์ฌ์ฉ์๊ฐ ์ ๋ ฅํ ๊ตฌ๋งค PIN์ ์ ์กํ๊ณ , ๋ฐฐ์ถ ๋ช ๋ น(์ ๋ฐ ๋ฒํธยท์๋)์ ๋ฐ์ ๋ก์ปฌ ์ปจํธ๋กค๋ฌ์ ์ ๋ฌํ๋ฉฐ, ์ฑ๊ณต ๋ฐฐ์ถ์ ACK๋ก ํ์ธํฉ๋๋ค. ๊ธฐ๊ธฐ์์ ์ธ๋ถ์ ํต์ ํ๋ ์ ์ผํ ์ปดํฌ๋ํธ์ ๋๋ค.
Q. ์ AVR MCU๋ฅผ 4๊ฐ๋ ๋ถ๋ฆฌํด์ ์ฌ์ฉํ๋์? ๊ฐ MCU๊ฐ ๋ฑ ํ๋์ ์ญํ ๋ง ๋ด๋นํฉ๋๋ค. ATmega16์ ํคํจ๋ยท๋์คํ๋ ์ด, ATmega32๋ ๋ชจํฐยทIR ์ผ์, ATmega8์ 16๊ฐ IR ์ผ์ ๋ชจ๋ํฐ๋ง, ATmega328PU๋ ์ ์ฒด ์กฐ์จ๊ณผ W5500 SPI ๋ธ๋ฆฌ์ง์ ๋๋ค. ์ด๋ ๊ฒ ๋ถ๋ฆฌํ๋ฉด ๊ฐ ํ์จ์ด๊ฐ ๋จ์ํด์ง๊ณ ์๋ธ์์คํ ๋ณ ๊ต์ฒดยท๋๋ฒ๊น ์ด ์ฌ์์ง๋๋ค.
Q. ์ ํ์ด ์ ๋ง ๋ฐฐ์ถ๋๋์ง ์ด๋ป๊ฒ ํ์ธํ๋์? ATmega8์ด ๊ฐ ์ฌ๋กฏ์ IR ๋น์ ๋ชจ๋ํฐ๋งํฉ๋๋ค. ๋ชจํฐ๊ฐ ๋์ ์ ํ์ด ๋จ์ด์ง๋ฉด IR ๋น์ด ์ฐจ๋จ๋ฉ๋๋ค. ATmega8์ด ATmega32์ ์๋ฆฌ๋ฉด ATmega32๊ฐ ๋ชจํฐ๋ฅผ ๋ฉ์ถ๊ณ ATmega328PU ๋ง์คํฐ์ ์ฑ๊ณต์ ๋ณด๊ณ ํฉ๋๋ค. ์ด ํ์ธ์ด ์๋ฃ๋ ํ์๋ง ์๋ฒ์ ๋ฐฐ์ถ ACK๊ฐ ์ ์ก๋ฉ๋๋ค.
Q. ์ด ์ํ๊ธฐ์ฉ ๋ชจ๋ฐ์ผ ์ฑ๋ ์๋์? ๋ค. ์ฌ์ฉ์๋ ์ฑ์์ ์ฌ๊ณ ๋ฅผ ํ์ธํ๊ณ ์ ํ์ ์ ํํด ๊ฒฐ์ ํ๋ฉด ์ผํ์ฉ ์ฝ๋๋ฅผ ๋ฐ์ต๋๋ค. ์ฑ ์ฝ๋๋ ์ด ์ ์ฅ์์ ํฌํจ๋์ง ์์ผ๋ฉฐ, ์ ์ฅ์๋ ์ํ๊ธฐ ํ์จ์ด์ ํ๋์จ์ด ํ์ผ๋ง ๋ด๊ณ ์์ต๋๋ค.
Q. ์ฌ๋กฏ์ ๋ ๋๋ฆด ์ ์๋์? README์ ๋ฐ๋ฅด๋ฉด ์ผ์ ํต์ ๋ฒ์ค๋ฅผ ์กฐ์ ํ๊ณ ATmega32๋ฅผ ์ถ๊ฐํ๋ฉด ์ต๋ 256๊ฐ ๋ชจํฐ๊น์ง ํ์ฅํ ์ ์์ต๋๋ค. W5500 ์ด๋๋ท ์ธํฐํ์ด์ค๋ 4๋นํธ ๋ฒ์ค๊ฐ ๋ณ๋ชฉ์ด ์๋๋ผ, ์ผ์ ๋ฒ์ค ์ฃผ์ ์ง์ ๊ณผ ๋ชจํฐ ๋๋ผ์ด๋ฒ ์๊ฐ ํ๊ณ์ ๋๋ค.
Documents
-
GitHub Repository (Smart Vending Machine)
Full source: firmware for all 4 AVR MCUs, Gerber files, schematics, pick-and-place files
-
Demo Video (YouTube)
Working demo of the Smart Vending Machine
-
WIZnet W5500
The hardwired TCP/IP Ethernet chip used as the cloud gateway
-
Arduino Ethernet Library
Library used for W5500 DHCP and TCP socket management