Smart Meter Visualizer - Battery Powered

Portable Wiring Schematic with 3.7V Li-ion Battery

Battery Powered Wiring Schematic

100%
Battery (3.7V)
Boosted (5V)
Ground (GND)
Data (GPIO)
USB Connection
3.7V 5V GND Li-ion 3.7V 9900mAh + - Protection Charging TP4056 Module USB Boost Converter 3.7V to 5V IN+ IN- OUT+ OUT- Raspberry Pi Zero 2 W GPIO Header USB GND 5V GPIO18 GND RTL-SDR V4 Dongle USB Antenna 900 MHz Antenna Level Shifter 74AHCT125 VCC GND A1 OE Y1 GND LED Strip WS2812B Addressable 5V DIN GND 1000µF 6.3V + 470Ω USB GPIO18 Data Data

Hardware Requirements

  • Power System:
    • 3.7V 9900mAh Li-ion Battery
    • TP4056 Li-ion Battery Charging Module
    • 3.7V to 5V DC-DC Boost Converter (2A+ output)
  • Processing:
    • Raspberry Pi Zero 2 W
    • RTL-SDR V4 Dongle
    • 900 MHz Antenna
  • Output:
    • WS2812B Addressable LED Strip
    • 74AHCT125 Level Shifter
    • 470Ω Resistor
    • 1000µF 6.3V Capacitor

Wiring Instructions

  1. Battery System Setup:
    • Connect Li-ion battery to TP4056 charging module
    • Connect charging module output to boost converter input
    • Connect boost converter output to 5V power bus
    • Connect all grounds to common ground bus
  2. Power Connections:
    • Connect 5V bus to Pi 5V pin (Pin 2)
    • Connect 5V bus to level shifter VCC (Pin 14)
    • Connect 5V bus to LED strip through capacitor
    • Connect all grounds to common ground bus
  3. Signal Connections:
    • Connect RTL-SDR to Pi USB port
    • Connect antenna to RTL-SDR
    • Connect Pi GPIO18 (Pin 12) to level shifter A1 (Pin 2)
    • Connect level shifter Y1 (Pin 3) to 470Ω resistor
    • Connect resistor to LED strip DIN
    • Connect level shifter OE (Pin 1) to ground (always enabled)

Software Setup

Install Dependencies

sudo apt update
sudo apt install rtl-sdr git
sudo pip install pyrtlsdr
sudo pip install rpi_ws281x adafruit-circuitpython-neopixel
sudo pip install numpy scipy

Battery Monitoring Script

import time
import board
import neopixel
from rtlsdr import RtlSdr
import numpy as np

# LED Configuration
LED_COUNT = 60
LED_PIN = board.D18
LED_BRIGHTNESS = 0.3

pixels = neopixel.NeoPixel(LED_PIN, LED_COUNT,
brightness=LED_BRIGHTNESS,
auto_write=False)

# SDR Configuration
sdr = RtlSdr()
sdr.sample_rate = 2.048e6 # 2.048 MHz
sdr.center_freq = 915e6 # 915 MHz (US)
sdr.gain = 40 # Adjust as needed

# Battery monitoring function
def get_battery_level():
  # This would need to be implemented based on your specific
  # battery monitoring hardware (ADC, voltage divider, etc.)
  # For now, return a simulated value
  return 0.7 # 70% charged

def process_samples(samples):
  # FFT to find signal strength
  fft = np.fft.fft(samples)
  power = np.abs(fft)**2
  return np.mean(power)

def update_leds(signal_strength, battery_level):
  # Map signal strength to LED colors
  intensity = min(1.0, signal_strength / 1000)
  
  # Add battery indicator to first 5 LEDs
  battery_leds = int(battery_level * 5)
  
  for i in range(LED_COUNT):
    if i < battery_leds:
      # Green for battery level
      pixels[i] = (0, 255, 0)
    else:
      # Create pulsing effect for signal strength
      pulse = (np.sin(time.time() * 2 + i * 0.1) + 1) / 2
      r = int(255 * intensity * pulse)
      g = int(100 * intensity * (1-pulse))
      b = int(50 * intensity)
      pixels[i] = (r, g, b)
  pixels.show()

try:
  while True:
    samples = sdr.read_samples(256*1024)
    strength = process_samples(samples)
    battery = get_battery_level()
    update_leds(strength, battery)
finally:
  sdr.close()

Important Considerations

⚠️ Battery Safety: Li-ion batteries can be dangerous if mishandled. Always use a protection circuit and never leave charging unattended.
⚠️ Power Efficiency: Monitor battery life carefully. The Pi Zero 2 W and LED strip can drain the battery quickly.
💡 Battery Life: With a 9900mAh battery, expect approximately 4-6 hours of runtime depending on LED usage.
  • Boost Converter: Use a high-efficiency (90%+) boost converter to maximize battery life
  • Power Management: Consider implementing sleep modes or reducing LED brightness to extend battery life
  • Battery Monitoring: Add a voltage divider and ADC to monitor battery level in software
  • Charging: The TP4056 module provides safe charging with overcharge protection
  • Heat Management: The boost converter and Pi may generate heat; ensure adequate ventilation
  • Frequency: Smart meters use different frequencies by region (915MHz US, 868MHz EU)
  • Antenna: Use a properly tuned 900MHz antenna for best reception
  • Legal: Check local regulations for radio reception
Glow