Skip to content

Wiring steps (photos)

This page provides step-by-step wiring photos and guidance so you can assemble the project safely. If you have real photos you'd like to include, replace the SVG placeholders in docs/images/ with your own images (e.g., wiring-step-1.jpg).

GPIO Pinout

GPIO Pinout

Wiring diagram

Below is an illustrative wiring diagram showing the Raspberry Pi, ADS1115 and ZMPT101B connections. This diagram is illustrative only and does not replace proper safety practices.

Wiring diagram

Quick wiring summary

  • ADS1115 VCC → Pi 3.3 V (Pin 1)
  • ADS1115 GND → Pi GND (Pin 6)
  • ADS1115 SDA → Pi SDA (Pin 3)
  • ADS1115 SCL → Pi SCL (Pin 5)
  • ADS1115 A0 → ZMPT101B Vout
  • ZMPT101B VCC → 5 V (use board 5 V or external supply, per sensor recommendation)
  • ZMPT101B GND → Pi GND

Step 1 — Connect ADS1115

Step 1 — Connect ADS1115

  • Connect ADS1115 VCC → Pi 3.3 V (Pin 1)
  • Connect ADS1115 GND → Pi GND (Pin 6)
  • Connect ADS1115 SDA → Pi SDA (Pin 3)
  • Connect ADS1115 SCL → Pi SCL (Pin 5)

Step 2 — Connect ZMPT101B output to A0

Step 2 — Connect ZMPT101B

  • Connect ZMPT101B Vout → ADS1115 A0
  • Connect ZMPT101B GND → Pi GND
  • Connect ZMPT101B VCC → 5 V (if the board requires it)

Note: ZMPT101B boards often include a bias circuit — read the board notes and do not apply mains directly without correct isolation and a fuse.

Step 3 — Connect 2" LCD Display (Optional)

The 2" Waveshare SPI LCD (ST7789) provides real-time monitoring with QR code display, voltage readings, and anomaly status.

LCD SPI Connections:

  • LCD VCC → Pi 3.3 V (Pin 1)
  • LCD GND → Pi GND (Pin 6)
  • LCD DIN (MOSI) → Pi GPIO 10 (SPI MOSI, Pin 19)
  • LCD CLK (SCK) → Pi GPIO 11 (SPI SCLK, Pin 23)
  • LCD CS → Pi GPIO 8 (SPI CE0, Pin 24)
  • LCD DC → Pi GPIO 25 (Pin 22)
  • LCD RST → Pi GPIO 27 (Pin 13)
  • LCD BL → Pi GPIO 24 (Backlight, Pin 18)

SPI Configuration Required:

  1. Enable SPI interface: sudo raspi-config → Interfacing Options → SPI → Enable
  2. Verify SPI devices: ls /dev/spi* should show /dev/spidev0.0 and /dev/spidev0.1
  3. Test display: Run python -m pika.display_qr --auto-ip to verify LCD functionality

Note: The display is optional. The system will fall back to saving PNG images (lcd_latest.png) if no LCD is connected or if running on non-Linux systems.

Step 4 — Verify and test

  • Power the Pi and run a low-rate read script to confirm values on A0.
  • Use the demo page (/demo) to confirm the UI and highlight detection before applying mains voltages.
  • For initial testing prefer a safe, low-voltage source or an isolation transformer.
  • Test LCD display: python -m pika.display_qr --auto-ip should show QR code on screen.

Measure & adjust sensor output (multimeter)

Before connecting the ADS1115 to the Raspberry Pi, validate that the ZMPT101B output stays within the ADC input range (0–3.3 V) to avoid damaging the Pi. The steps below assume the sensor board is powered and common ground is connected; do NOT connect mains directly for these checks — use an isolation transformer or a low-voltage test source if possible.

Steps

  1. Power up the ZMPT101B (and the Pi/ADS1115) but leave the sensor input unconnected or use a safe low-voltage source.
  2. Set your multimeter to DC volts and measure the DC level at the sensor output (Vout measured to GND). With a 3.3 V supply, the midpoint bias should be roughly 1.5 V. If it is far from this value, adjust the board trim pot slowly until the DC reading is near 1.5 V.
  3. With a small, isolated AC test signal (or the real sensor input if you have an isolation transformer), measure the AC RMS voltage at Vout using the multimeter AC mode. Many bench multimeters show VRMS; if you only have RMS, estimate peak amplitude as: Vpk ≈ Vrms × √2.
  4. Verify the peak values will not exceed ADC rails: ensure (Voffset + Vpk) < 3.3 V and (Voffset − Vpk) > 0.1 V (leave a small safety margin, e.g. 0.1–0.2 V).
  5. Example: Voffset ≈ 1.5 V and Vrms ≈ 0.7 V → Vpk ≈ 0.99 V, so 1.5 ± 0.99 → stays within 0.51 … 2.49 V (safe).
  6. If the peak would exceed the allowable range, reduce the sensor gain using the trim pot (turn slowly while watching the multimeter) or add attenuation between the sensor and ADS1115. Repeat the measurement after every change.
  7. If you have an oscilloscope, inspect the waveform for clipping or DC offset changes while the sensor is under expected load — an oscilloscope gives a definitive peak-to-peak reading.
  8. Once the output is within safe limits, connect the ADS1115 to the Pi, start the logger at a low sample rate, and verify readings in the /demo or the live UI. Watch for saturated (flat) readings which indicate clipping.

Safety notes

  • If you do not have an isolation transformer or a low-voltage source, do not attempt to adjust the trim pot while connected to mains. Contact a qualified technician if you are unsure.
  • Small adjustments can produce large changes — always adjust slowly and re-check after each small turn.
  • Use protective equipment and follow local regulations when measuring mains voltages.

If you have real photos you'd like added, upload them to docs/images/ and update the markdown to reference the new filenames; I can also add a small gallery plugin to MkDocs if you'd like.