Remove a USB data-log stick safely: add an eject button

5 min read · Published November 11, 2026

Swapping a USB stick between writes works until the one write you pull through. Give the panel an eject pushbutton, a ready lamp and a write-status lamp, and let operators pull the stick only after the ready indication reads disabled. The tag names, build steps and swap procedure are below.

Pull the stick through the panel's eject control, never through a gap between two writes. Your panel logs every 30 seconds and the activity light can lag the write, so a swap timed by eye will sooner or later land inside a write and can destroy the stick with the whole log on it. The fix is three objects on one screen: a pushbutton on the eject system tag, a lamp for the USB-ready state and a lamp for the write status. The operator presses the button, waits for the ready lamp to go dark, swaps the stick, then watches both lamps come back. The tag names, the build steps and the checkout are below.

Why the light is the wrong cue

A 30-second logging interval puts 960 writes on the stick in an 8-hour shift: 8 h × 3600 s/h = 28,800 s, and 28,800 s ÷ 30 s = 960. Every one of those writes is a window in which pulling the stick can destroy it, and the log file goes with it. A flashing light tells you a write is running. A dark light tells you less than it seems, because the visible indication can lag a write that is still open in the panel. A swap that worked for weeks was running at those same odds the whole time.

What the USB system tags give you

The panel's system tag list includes a small USB set. Put the first three on the operator screen; the last three are optional capacity readouts.

System tag Object What the operator reads
SYS USB EJECT pushbutton one press flushes the buffer and opens the removal window
SYS USB READYTOUSE indicator lamp USB enabled or disabled; disabled is the pull cue
SYS USB WRITESTATUS indicator lamp idle or logging
SYS USB USEDMEMORY numeric display used capacity
SYS USB FREEMEMORY numeric display free capacity
SYS USB TOTALMEMORY numeric display total capacity

Turning SYS USB EJECT on writes the buffered records to the stick and allows time to remove the memory before the next scheduled write. SYS USB READYTOUSE then reads disabled, and that state is what an operator waits for.

Build the button and the two lamps

You need the project software on a PC, the panel with USB logging already running, the panel's system tag list, and a replacement stick for the checkout.

  1. Add a pushbutton and assign it to SYS USB EJECT. Give it an action that sets the tag on and holds it there; a momentary pulse is the wrong mode for a USB operation, and the same button-mode trap quietly stops an HMI USB log copy after one day.
  2. Add an indicator lamp on SYS USB READYTOUSE and label its two states as USB enabled and USB disabled.
  3. Add an indicator lamp on SYS USB WRITESTATUS and label its states as idle and logging.
  4. Optionally add numeric displays on SYS USB USEDMEMORY and SYS USB FREEMEMORY so a nearly full stick shows before it fills mid-shift.
  5. Load the project into the panel and place all three objects where an operator reaches them during a run.

The operator swap procedure

  1. Press the eject button. The panel writes its buffer to the stick.
  2. Wait for the ready lamp to read USB disabled. This is the pull cue.
  3. Swap sticks.
  4. Watch the ready lamp return to USB enabled.
  5. Watch the write-status lamp return to logging.

Print those five steps at the machine. The disabled state between steps 2 and 3 is the window the panel opens for the swap, and it holds until the next write would have been due.

Recommendation: put the button and both lamps on every panel that logs to USB, and write wait-for-USB-disabled into the operator instructions as the only permitted pull cue. If your panel's tag list carries no eject tag, change the workflow: log to a card or internal memory and copy the files out with a transfer operation, and stop timing pulls against the activity light.

Example: one swap on a 30-second log

Shift runs 06:00 to 14:00, logging every 30 s, with a write due at 13:59:30.

  • Writes scheduled in the shift: 8 h × 3600 s/h ÷ 30 s = 960.
  • The operator presses eject at 13:59:40, 10 s after the last write. The panel flushes the buffer and the ready lamp reads disabled.
  • Stick out, replacement in, 20 s. The ready lamp reads enabled again.
  • The 14:00:00 write lands 20 s after insertion, and the write-status lamp shows logging.
  • The removed stick carries every record through 13:59:30, with the file closed by the flush.

Change the interval to one write per minute and the shift carries 28,800 s ÷ 60 s = 480 writes, with at most 60 s from insertion to the logging indication. The interval changes how much data you gather; the eject button stays the removal control at either setting.

How to check it worked

Watch three transitions on the panel, once, with a test stick before the procedure goes to operators:

  • enabled to disabled right after the eject press;
  • disabled to enabled after the replacement goes in;
  • idle to logging when collection resumes.

Then open the retrieved file on a PC and confirm the rows run through the last sample. If the trend file needs header rows, add column headers to an HMI trend log file on USB covers the layout once the stick leaves the machine.

When the state will not settle

If the ready lamp stays enabled after the eject press, leave the stick in, check the button's tag assignment and action mode, and press once more. If logging never resumes after insertion, keep the stick installed, keep what is on it, and read the panel's diagnostics before anything else. A stick pulled while its state is unknown risks exactly the log you are retrieving.

The card-and-transfer alternative

One workflow separates collecting from retrieving: the panel logs to a memory card that stays installed, and a transfer operation copies the finished files to the USB stick on request. The stick then mounts only for the copy. If that fits your panel, enable HMI data logging to a CF card and pick the safe slot sets up the destination, and a safe CompactFlash card replacement covers the media swap. Give the copy its own completion indication before the stick comes out.

When the point of the numbers is to show them on the floor instead of filing them, that is a screen decision, and factory status display or operator HMI sorts which one does the job.

Questions

Can I keep swapping the stick between writes if I am quick about it?

Speed is not the variable. A 30-second interval schedules 120 writes every hour, and the activity indication can lag a write that is still open while the light reads dark. Press the eject button and wait for the disabled ready indication; that is the whole procedure.

What are the USB memory tags for?

SYS USB USEDMEMORY, SYS USB FREEMEMORY and SYS USB TOTALMEMORY report used, free and total capacity. Put them on the screen as numeric displays and have the operator check free space at the start of a shift so a stick never fills mid-shift. They answer how full the stick is; the ready and write-status tags answer when it can come out.

The ready indication stays enabled after I press eject. What should I do?

Leave the stick installed. Check that the button is assigned to the eject system tag and that its action sets the tag on and holds it there, then press once more. If the ready indication still reads enabled, stop the swap, keep the stick in place, and take the data off with the panel's file copy or transfer function instead.

Does pressing eject lose the samples taken since the last scheduled write?

No. Turning the eject tag on writes the buffered data to the stick first, then opens the removal window ahead of the next write, so the file on the removed stick ends at the last sample with the record complete. The wait that matters is the one after the press: pull only once the ready indication reads disabled.

Planning information, not legal or engineering advice. Rules differ by place: check codes and permits with your local authority and your licensed trades.

Keep reading

Build your signAsk for a quote