LCD Instrument Panel / Stage 3 of 3
Estimate voltage
Display a voltage estimate using an explicitly nominal 5 V reference.
Compiled 2026-10-19 (historical) · electrical review required
Download stage 3 PlatformIO projectRead code & run steps ↓
What changes now?
Display a voltage estimate using an explicitly nominal 5 V reference.
Expected after hardware review: The voltage estimate is labeled approximate; compare against a meter.
Builds on stage 2: Present relative position.
What you need
Check availability and exact module markings before starting.
Connections / current hardware gate
Before connecting power. Confirm the LCD backpack supply/pull-ups and the potentiometer connections before power. The nominal 5 V ADC reference is an estimate, not a measurement.
- Complete the LCD backpack checks from Hello World.
- Verify the potentiometer end rails and A0 wiper connection against the conditional wiring reference.
- Compare any voltage estimate with a meter; leave the electrical-review gate closed until the physical checks are complete.
Conditional connection table and full module facts
Electrical review is incomplete. Conditional references require confirmation; unresolved pins or rails are not wiring instructions. Power off before changing connections.
| From device / pin | To device / pin | Signal / voltage | Connection status and notes |
|---|---|---|---|
LCD1602 16×2 Character Display with I²C BackpackSDA | ELEGOO Mega 2560 R3 boardD20 / SDA | I2C SDA Voltage unresolved | Conditional reference Verify backpack IC, carrier supply and pull-up rail before enabling. |
LCD1602 16×2 Character Display with I²C BackpackSCL | ELEGOO Mega 2560 R3 boardD21 / SCL | I2C SCL Voltage unresolved | Conditional reference Mega mapping; not Uno A4/A5. |
10 kΩ potentiometerwiper | ELEGOO Mega 2560 R3 boardA0 | ADC 5 V | Conditional reference Identify terminals; outer ends to reviewed Mega reference supply and ground; nominal estimate is not calibration. |
display/peripheralGND | controllerGND | Signal reference 0 V | Conditional reference Unpowered wiring check; use correct common-ground topology and keep high-current panel returns out of thin signal paths. |
display/peripheralVCC | verified supplyPin unresolved | Peripheral power Voltage unresolved | Conditional reference Supply voltage/current unknown at carrier level until reviewed; no assumed 5 V or 3.3 V instruction. |
Access describes the source of a requirement. Check availability, the exact revision and the complete power/driver/harness system before starting. Inventory quantities are expected purchase/BOM quantities, not live stock.
product family verified · preflight required
Compatibility and unresolved details
- Display: 16 × 2 characters
- Interface: I²C backpack; exact expander revision not asserted
- ELEGOO Mega 2560 R3 boardClub-owned
product family verified · preflight required
- 10 kΩ potentiometerClub-owned
product family verified · preflight required
Compatibility and unresolved details
- Taper/wiper power: Unverified
Use this complete project
Target: megaatmega2560 · Environment: checkpoint3 · Stage branch: DISPLAY_STAGE=3
- Open the complete project. Download the stage ZIP, extract it and open the folder containing
platformio.iniandsrcin VS Code. Keep its supporting headers and libraries together. - Build stage 3. Select
checkpoint3in PlatformIO Project Tasks → General → Build, or use a PlatformIO terminal:
A successful Build compiles the program; it does not upload it or approve electrical connections.pio run -e checkpoint3 - Stop at the hardware gate. The supplied electrical-review flag remains false. Have a qualified reviewer complete the actual module, wiring and power checks before using an approved configuration for hardware operation.
As supplied, Serial at 115200 baud reports
STOP: complete wiring/power review in guide before enabling hardware.and initialization stops.
After electrical review: Upload and Monitor
Only with the actual setup reviewed and the configuration explicitly approved, choose this stage's Upload task. Close any monitor using the board first.
pio run -e checkpoint3 -t uploadOpen the matching Monitor at 115200 baud, then compare the expected result with what actually happens.
pio device monitor -b 115200Record Build, Upload and physical observations separately.
Complete source
The viewer starts at src/main.cpp. Use Source file for the board profile, PlatformIO configuration and supporting code. Keep the complete ZIP together.
workspaces/lcd-instrument-panel/src/main.cpp
#include <Arduino.h>
#include <Wire.h>
#include <hd44780.h>
#include <hd44780ioClass/hd44780_I2Cexp.h>
#include <DisplayCore.h>
#include "board_profile.h"
hd44780_I2Cexp lcd;
bool ready=false;
uint32_t lastUpdate=0;
void row(uint8_t r,const char* text){lcd.setCursor(0,r);char padded[17];uint8_t i=0;for(;i<16&&text[i];++i)padded[i]=text[i];for(;i<16;++i)padded[i]=' ';padded[16]='\0';lcd.print(padded);}
void setup(){Serial.begin(115200); if(!kElectricalReviewComplete){Serial.println("STOP: complete wiring/power review in guide before enabling hardware.");return;}Wire.begin();const int status=lcd.begin(16,2);if(status){Serial.print("LCD initialization error: ");Serial.println(status);return;}ready=true;}
void loop(){if(!ready)return;uint32_t now=millis();if(!displaylab::elapsed(now,lastUpdate,250))return;lastUpdate=now;
const int raw=analogRead(A0);Serial.println(raw);char line[17];
#if DISPLAY_STAGE == 1
row(0,"A0 raw ADC");snprintf(line,sizeof(line),"Count:%4d",raw);
#elif DISPLAY_STAGE == 2
row(0,"Pot position");snprintf(line,sizeof(line),"Scale:%3d %%",int((raw*100L+511)/1023));
#else
row(0,"A0 estimate");const unsigned millivolts=(uint32_t(raw)*5000U+511U)/1023U;snprintf(line,sizeof(line),"%u.%03u V",millivolts/1000,millivolts%1000);
#endif
row(1,line);}
Source integrity · SHA-256
2a1ac9dd3b7c4e434162492220927ed95d420883e685206b8e3e56600b6ec293Raw downloads and standalone ZIPs retain the canonical bytes and supporting files. Copy follows the selected Comments setting.
Check the result
The voltage estimate is labeled approximate; compare against a meter.
As supplied, the false electrical-review flag prevents this hardware result. After qualified review, record what actually happens; the text above is an expected result, not a bench transcript.
Original verification checklist
- Build the exact selected environment; distinguish dependency resolution from source compilation.
- Observe the stated output and record actual behavior; expected result is not an observed transcript.
- Test the named failure mode before proceeding.
Troubleshooting
Constant zero or full scale
Verify the wiper and outer terminals with resistance/continuity checks, then measure the wiper voltage without exceeding the ADC input rail.
Readout jitters
Compare the raw Serial counts first. Shorten connections and stabilize reference/ground before adding a filter that could hide the fault.
Estimate disagrees with meter
Measure the actual reference and compare endpoint behavior. Explain model assumptions before adjusting the display to look correct.
Technical explanation / original guide
Read the complete original stage guide
Original source/research wording is preserved. The stage's dated build evidence above supersedes earlier blanket compile-status wording; no physical results are implied.
Build it
Display a voltage estimate using an explicitly nominal 5 V reference.
Open workspaces/lcd-instrument-panel in VS Code/PlatformIO. Select checkpoint3 and run pio run -e checkpoint3. This is FIRMWARE_SOURCE_AUTHORED with embedded compilation unverified. Review the electrical flag and canonical conditional wiring before any upload.
Understand it
The raw count is captured once per update and reused for calculation, display and Serial evidence. Integer arithmetic promotes the product before multiplying by 5000, avoiding a narrow intermediate. The display samples at 250 ms, so it does not flicker or waste bus traffic. The LCD row helper keeps old digits from surviving when a new number is shorter. An instrument needs a raw observation path as well as a formatted presentation; otherwise formatting can conceal a sensor or wiring fault.
Source review precision: The screen heading is A0 estimate; the calculation uses a nominal 5000 mV reference. It does not print an approximation symbol on the numeric line. Compare the model with an actual meter reading before treating the result as measured volts.
Expected result and verification
The voltage estimate is labeled approximate; compare against a meter.
This is expected after a correct build and electrical review, not a captured bench transcript.
Check the selected source branch and named failure conditions. Record actual build or software output separately from future physical observations.
Likely failures
Constant zero or full scale: Verify the wiper and outer terminals with resistance/continuity checks, then measure the wiper voltage without exceeding the ADC input rail.
Readout jitters: Compare the raw Serial counts first. Shorten connections and stabilize reference/ground before adding a filter that could hide the fault.
Estimate disagrees with meter: Measure the actual reference and compare endpoint behavior. Explain model assumptions before adjusting the display to look correct.
Build evidence, target and remaining verification
Original status: unverified.
Successful checkpoint3 build recorded 2026-10-19 for megaatmega2560; 4 warnings recorded.
No compile was attempted in this pass under the user's testing limit. Upload and physical bench observation remain untested.
atmelavr@5.1.0 · arduino
Diagnostics before integration
- ACK/NACK bus scan Environment: checkpoint1