← BACK TO THE SIMPLE VERSION
PROPER INSTRUCTIONS

Make a USB temperature logger: proper instructions

This logger sends temperature readings from a DS18B20 probe over Arduino USB serial to a computer, which timestamps and saves them as CSV. It is useful for a workshop, greenhouse or equipment cupboard while the computer is running. It is not standalone: sleeping, rebooting or disconnecting the computer stops the log.

Parts and wiring

  1. Connect red to 5 V, black to GND and data to D2.
  2. Connect 4.7 kΩ between data and 5 V, then inspect the setup before USB power.

Arduino and recorder software

Install OneWire and DallasTemperature. Set Serial.begin(9600); every 30 seconds request a conversion and print only the Celsius value with two decimal places. Check it in Serial Monitor, then close Serial Monitor before starting Python because one serial port is normally held by one program.

open the serial port at 9600; read a line; convert it to float; write current local ISO timestamp, Celsius, and Celsius * 9 / 5 + 32 to temperature.csv; flush after every row.

Install PySerial with python3 -m pip install pyserial. Identify the Arduino port in Arduino IDE: Windows often uses COM3, Linux may use /dev/ttyACM0, and macOS commonly uses /dev/cu.usb… . Configure that exact name in the recorder. Write a header of timestamp,celsius,fahrenheit only when creating a new file. Use the computer’s time zone deliberately: the Arduino has no clock in this design.

Test and fault finding

  1. Run for five minutes, inspect the CSV, and check that timestamps rise and about ten records appear.
  2. Warm the probe by hand or move it between indoor locations; values should change plausibly.
  3. For an overnight observation prevent sleep temporarily, use a ventilated powered computer, and route the cable safely.
  4. If the port cannot open, close Serial Monitor, confirm the cable transfers data, reconnect and recheck the port name.
  5. If rows are blank, match 9600 baud at both ends and inspect Arduino output first. If readings fail, recheck data, power and pull-up resistor.

Security and limits

Anyone with computer access can alter CSV and anyone can unplug or heat the probe. Use a password-protected account, lock the screen and copy important files, but do not call this tamper-evident evidence. One probe measures one point only. Do not use it for medicines, food compliance, fire detection, intrusion monitoring or automatic protection.

Build carefully

Disconnect USB before moving wires. Work on a dry, uncluttered bench and use only the low-voltage supply provided by USB while developing the circuit. Check each connection against the label on the actual module, because clone boards can put connectors in a different order. A breadboard is useful for experiments but its contacts can work loose; do not leave an unattended project in a place where a lead can be pulled, crushed or exposed to water.

Record what you changed between tests. Change one setting, upload one revision, then repeat the same test. This is faster and safer than changing wiring, code and sensor position at once. Once the circuit works, add strain relief and an enclosure, but keep access for inspection and do not hide untested connections.

Before relying on any result

Repeat the test after changing the final location and after a power cycle. Label leads and keep notes of settings, dates and observed behaviour. Do not extend sensor leads indefinitely or substitute a power supply without checking voltage and current requirements. If behaviour changes without an explained reason, return to the last known-good wiring rather than bypassing a protective component or increasing supply voltage.

Review the result

Hobby electronics is most reliable when its assumptions are visible. Identify what creates an input, what the board decides, and what physical output follows. Consider loss of power, disconnected cable, loose breadboard contact, wrong software port, restart, accidental adjustment and environmental change. A successful five-minute demonstration proves only that it worked for five minutes under those conditions. Repeat tests after adjustments, and keep the project clearly labelled as a low-voltage experiment where others might otherwise assume it provides protection or control.

Practical checklist

Before each use, inspect the USB lead, board, insulation and sensor cable for damage. Confirm the board is powered from the intended low-voltage source and that its indicator behaviour agrees with the latest test. Keep the instructions, component part numbers and the current program with the project so that a future repair does not depend on memory. Do not leave a breadboard assembly where children, pets, moisture, metal objects or moving furniture can reach it. Disconnect power before repositioning conductors.

When diagnosing a problem, begin with the simplest observation: power indication, physical connector orientation, measured input state and program output. Use a known-good cable and a short test setup before adding extensions, enclosures or optional modules. Do not “fix” an uncertain fault by removing resistors, joining supply rails, increasing voltage or bypassing a switch. If a component becomes hot, smells unusual, repeatedly resets the board, or has damaged insulation, disconnect power and replace or investigate it before continuing.

Document both expected and unexpected results. Note the ambient conditions, sensor placement, delay settings and test duration. That evidence makes false triggers, questionable temperature readings and intermittent connections easier to distinguish from software mistakes. The finished device remains a hobby experiment: use independent, purpose-designed equipment wherever a missed event, incorrect measurement or failure to operate could cause loss, injury, regulatory breach or an emergency response.