This note will explain how to use the Write Wakeup (WWU) mode to display the Monza X tag chip EPC on an LCD screen using an Arduino Pro. The screen will start with no information displayed. Once the EPC is written to Monza X using RAIN RFID, the value will be displayed in HEX on the screen. The WWU mode will allow the tag chip and microcontroller (MCU) to be in a sleep state until data is written to Monza X. At this point, the MCU will wake from sleep mode, read the new EPC, display it to the screen, and enter sleep mode again.
Figure 1. Application Flowchart
- Monza X-8K or Monza X-2K development board
- Arduino Pro 3.3V (in this example, the board of an Arduino B-Square was used, but an Arduino Pro Mini 328 3.3V/8MHz1 would also work)
- SparkFun FTDI Basic Breakout - 3.3V
- 100 mil jumper wires
- Speedway Revolution and Mini-Guardrail Antenna2
- Host PC
1If using the Arduino Pro Mini, soldering on 100 mil headers will be required.
2Any RAIN RFID reader capable of writing an EPC may be used.
3The sample code will work without the LCD. WWU mode causes the EPC to be printed to the serial port, even if no LCD is connected.
- Arduino environment software and drivers for Windows, Mac or Linux
- Monza X library:
- ItemTest for Windows
For this document, we will be using an Arduino Pro 3.3V/8MHz board with headers already assembled. Note that a 3.3V Arduino should be used, not a 5V board such as the Arduino Uno unless a level shifter is used with Monza X for the SCL and SDA lines (the VCC/DCI input on the development kit is regulated down to 3.3V). The FTDI Basic board is connected to the pins RST, TX-0, RX-1, 5/3.3V, GND and GND to allow communication with a host computer. Connect the development kit, Arduino Pro and FTDI Basic and Serial LCD using the diagram below. The Arduino Pro connects to a host PC for programming but the PC is not needed to use the application as long as the Arduino Pro is powered.
Figure 2. Connection Diagram for Monza X Development Kit and Arduino Pro
Figure 3. Pinout for Monza X Development Kit I2C header
The battery jumper on the Monza X development kit should not be set (see the image below). This allows the board to receive DCI voltage from an external source allowing the Arduino to toggle power.
Figure 4. Hardware Setup
With the hardware configured as shown above, next the Arduino environment must be installed. The following guide outlines how to set up the environment on the operating system of choice: http://arduino.cc/en/Guide/HomePage. Additional drivers may need to be installed when the Arduino Pro is first connected to the PC - install drivers as necessary using the previous guide.
Next, we need to add the Monza X library files. Open Arduino on the PC. Go to "Sketch -> Import Library... -> Add Library...". Select the file "MonzaX.zip" and select "Open". This should add the library to the Arduino environment - it should now be visible as a contributed library. For information on installing libraries, see: http://arduino.cc/en/Guide/Libraries.
Figure 5. MonzaX library in Arduino
Now connect the Ardiuno Pro to the PC. Select the board in the Arduino application: "Tools -> Board -> Arduino Pro or Pro Mini". For older versions of the software, you may need to select "Arduino Pro or Pro Mini (3.3V, 8MHz) w/ ATmega328". Select the processor: "Tools -> Processor -> ATmega328 (3.3V, 8MHz)". Select the COM port the board is connect on (the manufacturer will enumerate as FTDI in the device manager). To find the COM port in Windows, go to Start, right-click Computer, select "Manage" and select "Device Manager" on the left. Under the section "Ports (COM & LPT)" there should be a USB COM port. Right click the COM port. The manufacturer should be FTDI. This should be the COM port for the Arduino. In this case, the device is detected on COM33, so COM33 was selected from "Tools -> Serial Port".
Figure 6. Arduino board selection
Figure 7. Arduino processor selection
Write Wakeup Mode Overview
In order to use WWU mode with Monza X, the DCI pin must be allowed to toggle and the SCL and SDA lines must be pulled high. The ATmega328 has these lines pulled high internally, so additional pull-up resistors are not used although a final design should include external pull-up resistors. When the WWU bit is set to one (as occurs in the sample code), WWU mode is enabled. When DCI is high, Monza X may be accessed via I2C or RFID. When DCI is low, Monza X may be accessed passively via RFID. When the tag chip is written to with DCI low, the SCL line is pulled low. This will trigger an interrupt on SCL_INT of the Arduino to wake the system up and display the EPC on the LCD before falling back asleep.
Running Sample Code
Extract MonzaX_WWU_DisplayEPC.zip into the Arduino documents folder (ie "C:\Users\USERNAME\Documents\Arduino"). Open "MonzaX_WWU_DisplayEPC.ino" using Arduino. Click "Upload" to compile and upload the sketch onto the Arduino Pro. If unable to upload the sketch, verify the correct board and processor are selected as outlined in the Software Setup section.
Once the sketch is done uploading, open the Serial Monitor ("Tools -> Serial Monitor") and set the baud rate to 115200. Notice in the serial monitor that the Monza X chip should have been detected, the application started, and the Ardunio should enter lower power sleep mode.
Now, use ItemTest or another platform to write an EPC to the tag. This will wake the Ardunio up which will read the EPC, print the EPC over the serial port and display it on the LCD before again going to sleep. Note that the DCI is high when the program starts and the chip is detected, low when in sleep mode, and set to high when the MCU wakes up from the WWU interrupt on the SCL_INT pin to read Monza X memory. After reading memory, the Arduino goes to sleep again and DCI iss again low.
The default state for this system is for the MCU and Monza X chip to operate in passive or low power mode except for the short period after Monza X has been written to.
Figure 8. New EPC written to screen.
Figure 9. Serial Monitor results