Send a counter value from an HMI panel by email twice a day

6 min read · Published November 13, 2026

Set two run-time presets in the PLC, 3 h and 5 h, and let an HMI event fire on each timer Done bit: it copies the counter tag into an email to the two or three people who need the number. When a whole department has to read every count, send the same samples by FTP to a shared folder instead.

The easiest way to send a counter value twice a day is to let the PLC pick the moment and the HMI panel do the mailing. Put a run timer in the PLC with one preset at 3 h of production and a second at 5 h, then create an Event Manager entry in the panel project for each timer Done bit. The event copies the counter tag into an email and sends it to the two or three people who need the number. Email is the right delivery for a small audience. When a whole department, quality or maintenance has to read every count, send the same two samples by FTP to a shared server folder instead. This article sets up the email path step by step, shows where the FTP route differs, and works the two sample times through with real numbers.

Email or FTP: pick the destination first

The destination decides everything downstream, so choose it before you touch the PLC. The panel's event manager can send email with tag values embedded in the message, transfer files, save data to a CF card or USB stick, and capture the screen, all triggered from a bit in the PLC. The same two trigger bits feed any path in the table.

Delivery path Fits when What it needs
Email Two or three people read the count Mail server settings and the recipient addresses
FTP to a shared folder A department reads the reports in one place A server, an account and a folder with write permission
Copy tag & save to file The network is down, or you collect readings by hand A CF card or USB stick in the panel
Screen capture Recipients need visible context or several values at once The capture action in the event, and larger messages

Recommendation: with two or three recipients, run the email path: one Event Manager entry per sample, triggered by a PLC timer Done bit, with the counter tag embedded in the message body. Switch to FTP to a shared folder when more than three people need every sample, and keep a copy tag & save to file event on a card as the fallback for both routes.

What you need

  • The counter register in the PLC and its data type, so the panel tag reads the value in the right format
  • The bit that starts a production run, so the timing resets with every run
  • Two timers in the PLC, one Done bit per sample time
  • The mail server address, port and panel login, from your mail administrator
  • The recipient addresses, two or three for the email path
  • For the FTP route: the server address, an account and a folder the panel can write to
  • A CF card or USB stick for the fallback file

The setup, step by step

  1. Make the panel read the counter. Map a tag to the counter's register and put it on a scratch screen. Watch it track the PLC counter while the machine counts. If the panel value stalls, fix the link first; the same display work is covered in putting a PLC counter value where operators can see it.

  2. Build the two production-time triggers in the PLC. Reset both timers on the run-start bit, give each timer its own preset and its own Done bit, and enter the presets in the timer's time base. The worked example below uses seconds. Watch both Done bits in the PLC monitor during a run before any delivery is switched on.

  3. Create one event per sample. Add an Event Manager entry whose trigger is the first timer Done bit, and a second entry for the second Done bit. The action is the email send with the counter tag embedded in the message. No copy instruction in the PLC is needed for this: the panel already reads the counter as a tag, and the event copies that tag at the moment of the send. On the FTP route, the same two Done bits drive file-transfer events instead.

  4. Enter the mail settings. The panel needs a real SMTP server, its address, port and the login, and a webmail address alone won't do; the reason is in why an HMI email needs an SMTP server. Send one test message to yourself before wiring the triggers.

  5. Bench-test with short presets. With the machine stopped or in a safe state, set the first preset to 60 s, step the count up, and confirm the Done bit fires and the email arrives with the right number. Change presets and force bits only with the line stopped; this test belongs in a changeover window, not on a program that is running production.

  6. Restore the real presets. Put the production sample times back in and confirm both events are still enabled.

Worked example: case counts at the two sample times of a production run

The inputs: a line that counts cases since the run started; sample 1 at 3 h of production and sample 2 at 5 h; both timers with their time base set to seconds; the run-start bit resets both timers to zero; recipients are the shift supervisor and quality, two addresses; the bench-test preset is 60 s.

The rule: preset in seconds = sample time in hours × 3600 s per hour. Each timer turns its own Done bit on once per run at its preset, and the panel event fires on that bit and mails the counter value as it stands at that moment.

The arithmetic: preset 1 = 3 h × 3600 s/h = 10,800 s. Preset 2 = 5 h × 3600 s/h = 18,000 s.

The result: the first Done bit turns on at its preset, 3 h into the run, and the first email carries the case count at that instant; the second Done bit turns on at 18,000 s and the second email carries the count then. Two messages per run, and on a one-run day that is the twice-a-day send. The reset at run start rearms both timers for the next run. A run that ends before the second preset sends one sample; if you also want a count at run end, drive a third event from the run-stop bit.

The decision: two recipients, so email wins. With more than three readers of every sample, the same two Done bits drive FTP events that drop the file in the shared folder instead.

How to check it worked

  • Both samples in one run: the first Done bit fires at 10,800 s, the second at 18,000 s, and the first send leaves the second event armed.
  • The value matches: at each trigger, the number in the message equals the counter in the PLC monitor at that instant.
  • Delivery: each recipient gets both messages; on the FTP route, the file lands in the folder and opens. A fired Done bit with no arriving file is a folder-permission problem first. The server side of that route is the same as any controller-to-folder transfer, and this guide to FTP file transfers to a PC shared folder covers the account and folder checks.
  • Send errors: if the panel reports a send failure, check DNS before the mail settings; the DNS-first checklist for HMI email errors walks it in order.
  • Sample labels: recipients can tell sample 1 from sample 2 by the marker or the recorded time in the message.

The decision for each case

  • Two or three people need the count: timers at the two production sample times, one Event Manager entry per Done bit, email with the counter tag embedded.
  • A department reads every sample: the same two Done bits, FTP to the shared folder.
  • The network is down at sample time: the card file from the save-to-file event, collected by hand until delivery is fixed.

Questions

Can the PLC email the counter value when there is no panel on the machine?

Some controllers can send an email from a boolean event on their own, with no panel involved. The trigger logic is the same: a run timer's Done bit at each sample time starts the send, and the message body carries the counter value. Check the controller's instruction set for event email before building it; if the instruction is not there, the panel route in this article is the way to get the count out.

How do recipients tell the first reading from the second?

Give each send its own marker. Record the timer's elapsed value or a sample number next to the counter value in the message, so the readings separate into sample 1 and sample 2. The email arrival time helps too, but it shifts when a run starts late, so the recorded marker is the one to rely on.

What is the fallback when the network is down and production keeps running?

Keep the save-to-file event on a CF card or USB stick as a second path. The panel writes the counter value to the card at each trigger, and you read the card from a laptop when the mail or FTP link returns. Treat the card as temporary collection and repair the delivery path so both samples arrive on their own again.

Why not just email a screen capture of the counter display?

A screen capture carries everything visible on that screen, which suits a report where context matters, like a batch summary with several values and a graph. For one counter value it hides the number inside an image. The counter tag pasted into the message body is easier to read, search and file, and the message stays small.

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