Arduino Sensor Code for Food-Safety Temperature Alarms

For US and UK restaurant, café and food-truck owners with an Arduino Uno and a 10k NTC probe. The same reading can pass in one country and fail in another.

Probe prints ADC 708 · 10 kΩ series · R25 10 kΩ · Beta 3950
7.8°C / 46.1°F
US FDA Food Code 2022 · cold holding 41°F (5°C)FAIL
England 2013 Regulations · chill holding 8°CPASS

Paste into ColdHoldAlarm for your probe and rule:


Full version — $44 once · get the 6 sketches
This page checks one reading while you look at it. The sketches check every second while nobody is in the kitchen: a breach at 2 a.m. is still flashing at 7 a.m. One payment, not a subscription. Rival yardstick: a Temp Stick WiFi sensor was $169.00 for one sensor on tempstick.com on 26 Sep 2026.

Check your own probe

No ADC number yet? Upload the built-in example File ▸ Examples ▸ 03.Analog ▸ AnalogInOutSerial or any sketch that prints analogRead(A0). Menu names differ between IDE versions and UI languages.

Wiring (all 6 sketches, Arduino Uno)

PinConnectUsed by
5V → 10 kΩ → A0Fixed series resistor from 5V to A0all probe sketches
A0 → probe → GND10k NTC thermistor probe between A0 and GNDColdHold, Freezer, HotHold, CoolingLog, IceCalibration
D13Alarm / FAIL LED (on-board LED works)all
D12Green PASS LED + 220 Ω to GNDCoolingLogTimer
D8Active 5V buzzer + (− to GND)ColdHold, Freezer, HotHold, CoolingLog, DoorAjar
D2Push button to GND (reset / START), internal pull-upColdHold, Freezer, HotHold, CoolingLog, DoorAjar
D3Door reed switch to GND, magnet on the doorDoorAjarAlarm

What the 6 sketches do that a tutorial does not

SketchRuleDevice a tutorial omits
ColdHoldAlarmFDA 41°F (5°C) or England 8°C10-min door grace · 0.5°C hysteresis · latched alarm · probe-fault alarm · CSV log
FreezerAlarmEU -18°C, 3°C fluctuationTells a 45-min defrost from a failure · instant alarm above -15°C
HotHoldAlarmFDA 135°F (57°C) or England 63°C5-min lid grace · 1°C hysteresis · latch
CoolingLogTimerFDA 135°F→70°F in 2 h, →41°F in 6 h totalClock starts only when hot food falls through 57°C · prints the failed stage
ProbeIceCalibrationFDA ±1°C thermometer accuracyWaits for 60 s stable reading · prints the offset line to paste
DoorAjarAlarm—Debounced reed switch · 3-min latch · hourly open count

Install: unzip as is (each .ino sits in a folder with the same name) ▸ open it in Arduino IDE ▸ pick board Arduino Uno and your port ▸ Upload. Libraries: none, built-in Arduino core only. Every sketch was compiled with arduino-cli for arduino:avr:uno. Hardware is not included.

Get the complete version $44

This page is the working piece. The full pack has everything below.

The same 46°F walk-in fails the FDA 41°F limit and passes England's 8°C. 6 compiled Uno sketches that latch the alarm until someone resets it.

Temp Stick WiFi temperature sensor: $169.00 for one sensor on tempstick.com, checked 26 September 2026.

Buy the full version — $44
ENDEJAESPT

Find a tool

· ReadyStack

Worked example

Real numbers from this tool, line by line.

Arduino Sensor Code for Food-Safety Temperature Alarms (FDA 41°F / UK 8°C)

A walk-in fridge that reads 46°F is illegal in a US kitchen and legal in an English one. The US FDA Food Code 2022 (3-501.16) says cold holding at 41°F (5°C) or less. The Food Safety and Hygiene (England) Regulations 2013 (Schedule 4) say chill holding at 8°C or below, which is 46.4°F. Same probe, same number, two different answers.

That is why a generic Arduino thermistor tutorial is not enough for a kitchen. It prints a temperature. It does not know your rule.

We wired a 10k NTC thermistor to an Arduino Uno the standard way: 5V to a 10 kOhm resistor to A0, and the probe from A0 to GND. With a Beta of 3950, an ADC reading of 708 converts to 7.8°C, or 46.1°F. Under the FDA rule that is a FAIL, over the limit by 2.8°C (5.1°F). Under the England rule it is a PASS, inside the limit by 0.2°C. The free check on this page does that conversion for your own probe values and prints the const lines to paste.

The real loss is not the number. It is the time nobody is looking. A compressor that fails after close is found when someone opens the door in the morning, and by then the fridge may have recovered. A simple sketch that lights an LED while it is too warm goes dark again, and nobody knows anything happened.

So every alarm in this pack does four things a tutorial leaves out:

  1. Grace time. ColdHoldAlarm counts a breach only after 10 minutes over the limit, so a delivery with the door open does not trip it.
  2. Hysteresis. It clears only 0.5°C below the limit, so it does not flicker on and off at the line.
  3. A latch. Once tripped, the LED and buzzer stay on until someone presses the reset button, even after the fridge cools down.
  4. A probe-fault alarm. An unplugged or shorted probe is an alarm, never a silent pass.

We checked this on the host with a simulated probe: 46°F for 5 minutes stayed quiet, 5.2°C for 19 minutes latched the alarm, the alarm stayed on through an hour back at 3°C, and a reset cleared it.

The other five sketches follow the same pattern. FreezerAlarm uses the EU -18°C quick-frozen limit from Directive 89/108/EEC and its 3°C fluctuation: a rise to -16°C for 40 minutes is treated as a defrost, 50 minutes latches the alarm, and anything above -15°C alarms at once. HotHoldAlarm uses 135°F (57°C) for the US or 63°C for England. CoolingLogTimer follows the FDA two-stage cooling rule (3-501.14): 57°C to 21°C within 2 hours and down to 5°C within 6 hours total. Its clock starts only when hot food falls through 57°C, so a probe left on the bench cannot start it early. ProbeIceCalibration prints the offset line for your probe, and DoorAjarAlarm latches after 3 minutes open.

What you change is four lines at the top of each file. SERIES_OHMS, NTC_R25_OHMS and NTC_BETA come from your resistor and your probe's datasheet. PROBE_OFFSET_C comes from ProbeIceCalibration: put the probe in stirred ice water, wait until the reading holds within 0.1°C for 60 seconds, and paste the line it prints. If the raw error is over 1°C, the FDA accuracy for Celsius thermometers (4-203.11), it tells you to check the parts first. Then one more line, RULE = 0 or RULE = 1, picks your country.

All 6 sketches use only the built-in Arduino core. Nothing to install from the Library Manager. Each one was compiled with arduino-cli for the Uno.

Start with the free check: type the ADC number your probe prints and pick your rule.

15 seconds — what it actually does

Questions people ask

What does this Arduino sensor code actually do?

Six Arduino Uno sketches turn one NTC thermistor probe into a food-safety alarm: fridge (FDA 41°F or England 8°C), freezer (-18°C), hot-hold (135°F or 63°C), a two-stage cooling timer, a door-ajar alarm and an ice-water calibration. Each alarm waits out door openings, stops flicker at the limit, latches until someone resets it and treats a broken probe as an alarm.

Who is this sketch pack for?

Restaurant, café, food-truck and commissary owners, or the maker who looks after their kitchen, who already own an Arduino Uno or Nano, a 10k NTC probe, a 10k resistor and a buzzer. You pick your rule with one line: RULE = 0 for the US FDA Food Code 2022, RULE = 1 for England's Food Safety and Hygiene Regulations 2013.

Why not use a free thermistor tutorial or ask a chatbot?

A tutorial prints a temperature. It does not know that 46°F fails the FDA 41°F limit but passes England's 8°C, it does not ignore a 2-minute door opening, and it forgets a 2 a.m. breach as soon as the fridge cools down again. These sketches latch that breach, alarm on an unplugged probe and are all compiled with arduino-cli for the Uno.

What can I do for free on this page?

Type the ADC number your probe prints, your series resistor, R25 and Beta, and pick US FDA, England or EU freezer. The page shows the temperature in °C and °F, the legal limit, pass or fail and the margin, and gives you the exact const lines for your probe. You also get the complete wiring table for all six sketches. You can check your own reading before you pay anything.

How does $44 compare with a ready-made monitor?

A Temp Stick WiFi sensor was listed at $169.00 on tempstick.com on 26 September 2026, for one sensor. This pack is $44, paid once, not a subscription, and runs on the Uno you already own, with six jobs: fridge, freezer, hot-hold, cooling log, door and calibration. It has no WiFi or phone alert; it alarms on site with a latched LED and buzzer.

Ask about this tool

One question, answered by the person who built it. Your email only if you want the answer sent.