Share this

Application of USB interface sensors and memory in data recording

2026-04-06 07:41:04 · · #1
Currently, there are many data acquisition devices on the market that can record data on a PC, such as National Instruments' LabVIEW. However, the sensors in these devices are increasingly adopting USB interfaces instead of RS232 or other traditional interfaces. Previously, using USB devices in embedded systems required relatively high-performance hardware, including a USB Host controller interface, an RTOS, and USB software drivers. As a result, due to the implementation cost of USB Host functionality, design engineers were reluctant to add USB devices to small 8-bit or 16-bit MCU systems. However, with the introduction of the latest generation of intelligent USB Host controller ICs, when used in conjunction with an MCU, not only can USB data acquisition devices be used in PC applications, but data can also be stored on low-cost, high-capacity flash drives. Data Logging Application The first application example shows an MCU controller and an FTDIVNC1LUSBHost controller with two ports: one for reading information from a data sensor, and the other for storing information on a flash drive. The MCU and USBHost controller communicate via a UART (or SPI) command monitoring interface, allowing the application to control the USB device using a simple command set. The application block diagram is shown in Figure 1. The MCU chosen here is the PIC18F1320 from the Microchip PICDEM4 demonstration board, although it should be directly connected to other members of the PIC family and other MCU families. A 4-wire connection (plus power and ground) is used between the MCU and VNC1L, connecting to the PIC's EUSART (Tx and Rx) and two I/O ports for RTS/CTS data flow control. Alternatively, the 4-wire SPI port can also be implemented via direct bit-splitting of the I/O ports. C source code for both methods is provided below. This application requires reading data from a DLPDesign DLP-TILT2 axis tilt sensor and then storing the received data in CSV format on a USB flash drive. When the DLP-TILT module receives an OUT data packet containing the letter "z" from the USB bus, it samples the sensor current reading, while the tilt sensor reading is read by an IN data packet. The OUT data packet can be sent along with a DSD (Device Send Data) command via the VNC1L monitor, followed by the number of bytes and the data to be sent. The IN data packet is received along with a DRD (Device Read Data) command, and the VNC1L will return the number of bytes and all data read from the device. Because USB requires data to be transmitted in data packets, there is typically a delay of a few milliseconds, although this can be mitigated by providing a larger buffer for the sensor data. Of course, some designs may not require USB sensors and may simply store data on a flash drive; this is common in data acquisition applications where the MCU samples analog data or records data from an external source. Since there is no need to probe the USB device, a higher data acquisition rate can be achieved this way. Data Acquisition Application [img=450,227]http://embed.chinaitlab.com/UploadFiles_4615/200809/20080917104213883.jpg[/img] Figure 2 shows an analog input application. In this example, we still use the PIC18F1320 on the Microchip PICDEM4 demo board as the MCU. The accelerometer module is STMicroelectronics' STEVAL-MKI010V1, which is connected to the PIC's analog input. The PIC periodically samples this input, and the results are sent to a FIFO buffer, executed in software, and then written to the storage device by the VNC1L. The VNC1L monitor provides commands to read and write files on the USB flash drive. It also has commands to manage the file system, allowing for the creation, renaming, and deletion of files and directories. With commands for communicating with the USB device, the file system commands are very easy to use. The order in which data is written to a file is as follows: use the OPW (Open to Write) command, followed by the filename, then WRF (Write to File), followed by the number of bytes to write, then CLF (Close to File), again followed by the filename. The standard sector size for a USB flash drive is 512 bytes, so for best results, a 512-byte buffer should be provided before writing data to the USB flash drive. USB flash drives typically use FAT12, FAT16, or FAT32 file systems. In these systems, clusters are allocated on demand, which can cause minor delays when clusters are not in order; however, this is usually only common on drives that are nearly full. Almost any USB flash drive with a sector capacity of 512 bytes and using the FAT file system can be used as the storage device for the VNC1L. The VNC1L's firmware can be upgraded in the field, either via a special upgrade file on the USB flash drive or via ROM upgrade through its UART interface. Other advantages of the VNC1L-based design include its ability to pause the USB flash drive when not in use to save power, and to automatically wake it during file operations. The VNC1L itself can also enter a low-power sleep mode and be woken up by the microcontroller application. Placing the USB device protocol and file management system on a single IC offers numerous benefits for embedded data logging or acquisition system designs, enabling low-power 8-bit and 16-bit MCUs to access USB devices and flash drives. FTDI's VNC1L implements this functionality in a cost-effective manner.
Read next

CATDOLL 136CM Vivian

Height: 136cm Weight: 23.3kg Shoulder Width: 31cm Bust/Waist/Hip: 60/54/68cm Oral Depth: 3-5cm Vaginal Depth: 3-15cm An...

Articles 2026-02-22