Mini‐Lab - dbsandis/MyUTProject GitHub Wiki

Your mini-lab setup using the NUCLEO-H753ZI is well-structured for development, with a strong focus on high-speed ADC sampling, ultrasonic pulse generation, and real-time logging. Given your component list, here’s how you can structure your workbench and initial setup:


1. Physical Layout on the Workbench

Recommended Placement:

  1. Center: NUCLEO-H753ZI development board (main processing unit).
  2. Left Side: Power supply and T/R switch circuit.
  3. Right Side: Raspberry Pi 5 CM5 carrier board (for logging and analysis).
  4. Top: TFT Display for real-time monitoring.
  5. Front: Breadboard for easy prototyping and signal routing.

2. Connections & Initial Wiring

(A) Power & Management

  • NUCLEO-H753ZI
    • Powered via USB or bench power supply (5V, 3.3V).
  • T/R Switch & Pulser Circuit
    • Requires separate power supply (5V or 12V, depending on circuit).
  • Raspberry Pi 5 CM5 Carrier
    • 5V supply from a regulated source (shared with NUCLEO if safe).

(B) Ultrasonic Signal Processing Flow

1. Pulser Trigger (NUCLEO → T/R Switch)

  • PC10 (Trigger Input) → Connected to T/R switch pulser input.
  • Generates precise pulses for the ultrasonic transducer.

2. Transducer to ADC Signal Flow

  • Echo signals captured by the transducer are routed:
    • Through the T/R switch (protecting the receiver circuit).
    • Into the LTC2387-16 ADC for high-speed sampling.
  • NUCLEO SPI1 (PA5, PA6, PA7, PA4) connects to ADC for SPI data transfer.
  • PA0 (ADC1_IN0) can be used as an optional reference voltage input.

3. Data Transfer (NUCLEO → Raspberry Pi 5 CM5)

  • UART3 (PB10 - TX, PB11 - RX) → Logs real-time data to Pi for storage & processing.
  • Baud rate: 115200 recommended for stable communication.

4. Displaying Data on TFT Screen

  • SPI2 (PB13 - SCK, PB14 - MISO, PB15 - MOSI, PB12 - CS) → Interfaces with the 3.5”-5” TFT display.
  • Displays live ultrasonic waveforms or processed results.

5. Timestamping with RTC

  • I2C1 (PB8 - SCL, PB9 - SDA) → Connected to the DS3231 RTC.
  • Used for accurate timestamping of measurements.

6. Power Management

  • PB2 (Power Control) → Enables low-power modes during idle periods.

3. Step-by-Step Lab Setup

Step 1: Prepare the NUCLEO Development Board

  1. Install STM32CubeIDE and STM32CubeMX for firmware development.
  2. Enable:
    • SPI1 (ADC Communication)
    • UART3 (Pi Communication)
    • GPIO Interrupts (Trigger)
    • PWM (Pulser Control)
    • I2C (RTC)
  3. Configure DMA for SPI ADC transfers for efficiency.

Step 2: Set Up Ultrasonic Circuit

  1. Wire the T/R switch to the transducer.
  2. Connect the pulser output to PC10 (Trigger Input on NUCLEO).
  3. Route echo signals from T/R switch to the LTC2387-16 ADC.

Step 3: Implement Data Logging

  1. NUCLEO → Pi UART communication setup (115200 baud).
  2. Python script on Raspberry Pi 5 CM5:
    • Reads ultrasonic data via UART.
    • Logs measurements with RTC timestamps.
    • Stores data in CSV, SQLite, or NoSQL (MongoDB).
    • Performs optional AI-based filtering or classification.

Step 4: Display Live Results

  1. SPI-based TFT interface on the NUCLEO.
  2. Displays:
    • Raw ultrasonic signals.
    • Processed distance or material thickness.
    • Timestamped logs.

4. Testing & Debugging

Basic Tests

Oscilloscope Check

  • Validate PWM pulses (PA8) → Pulser circuit.
  • Check SPI signals (PA5-PA7) → ADC input.
  • Observe echo waveforms.

NUCLEO Debug

  • Send sample data over UART to Raspberry Pi.
  • Ensure proper ADC readouts with DMA transfers.

Pi Data Logging

  • Confirm UART data reception.
  • Test RTC timestamp accuracy.

TFT Display Output

  • Display real-time waveforms & measurements.

5. Expanding the Lab

  • Multiple transducers? Add GPIO-controlled multiplexing.
  • AI Signal Processing? Train an AI model on the Pi.
  • Battery-powered? Optimize low-power modes on PB2.

Conclusion

This mini-lab setup lets you prototype real-time ultrasonic logging, signal processing, and AI-enhanced analysis using the NUCLEO-H753ZI and Raspberry Pi 5 CM5. You can now refine firmware, optimize data handling, and scale the system for field use! 🚀 You're designing a power management circuit for your Ultrasonic Data Logger in KiCad, incorporating a Li-Ion 3.7V (2500mAh) battery with a boost converter and LDO for efficient power distribution.

Steps to Add the Battery Symbol in KiCad

  1. Open KiCad's Schematic Editor.
  2. Press "A" to add a symbol and search for:
    • Battery: Device:Battery_Cell
    • Choose a single-cell Li-Ion symbol.
  3. Place it and rename it BAT_3.7V.

Power Management Circuit Design

Your power design needs:

  1. Battery Charging: TP4056 or MCP73831 (Li-Ion charge controller).
  2. Boost Converter (for 5V or higher rails):
    • MT3608 (5V, 1.2A)
    • XL6009 (Up to 12V)
    • MP1584 (Adjustable 2A)
  3. LDO Regulators (for stable voltages like 3.3V for STM32):
    • AMS1117-3.3V (Simple but 1A max)
    • MIC5219-3.3V (Better efficiency, low dropout)

Power Circuit Connections

  • Battery (3.7V) → TP4056 → Boost Converter (5V/12V) → LDO (3.3V) → STM32 + Peripherals
  • Boost converter output (5V) → Raspberry Pi 5 CM
  • LDO (3.3V) → STM32H743ZI

Schematic Setup in KiCad

  1. Battery (BAT_3.7V)

    • Positive Terminal → TP4056 IN+
    • Negative Terminal → GND
  2. TP4056 (Charge Controller)

    • IN+ → USB 5V / Solar Panel
    • OUT+ → Boost Converter Input
    • OUT- → GND
  3. Boost Converter (MT3608 or MP1584)

    • VIN → TP4056 OUT+
    • VOUT → 5V Rail (for Raspberry Pi & Peripherals)
    • GND → Common Ground
  4. LDO Regulator (AMS1117-3.3V)

    • VIN → 5V Boost Output
    • VOUT → 3.3V STM32H743ZI
    • GND → Common Ground

Next Steps

  1. Create KiCad schematic components: If a part isn’t available, create custom symbols for TP4056, Boost Converter, and LDO.
  2. PCB Layout: Place power components near each other, ensuring proper ground planes.
  3. Simulate Power Consumption: Validate battery life for 2500mAh.

Would you like me to generate the KiCad symbol library file for these components? Or do you need help with specific PCB layout guidelines? 🚀

How to Integrate Separate Power Modules in Your Circuit

Since you are using pre-built modules like the TP4056 (Li-Ion Charger), Mini360 (Buck Converter), and AMS1117-3.3V (LDO Regulator), you have two main approaches:


Option 1: Using a Custom PCB to Mount and Connect Modules

Pros:

  • Faster development; no need to source and solder individual SMD components.
  • You can swap out or upgrade modules if needed.
  • Less risk of mistakes since modules are pre-tested.

🚫 Cons:

  • Bulkier than a fully integrated PCB.
  • Not as optimized in terms of power efficiency, size, and routing.

Steps to Integrate Modules with a PCB

  1. Design a Carrier PCB (Breakout Board)

    • Use KiCad or EasyEDA to create a PCB layout with mounting slots for the modules.
    • Provide pin headers and solder pads to connect modules together.
    • Include mounting holes for securing modules.
  2. Wiring Connections

    • TP4056 Module
      • BAT+Battery Positive
      • BAT-Battery Negative (GND)
      • OUT+Mini360 Input (VIN)
      • OUT-GND
    • Mini360 (Buck Converter)
      • VINTP4056 OUT+ (Battery 3.7V)
      • VOUTAMS1117-3.3V (LDO Input)
      • GNDCommon Ground
    • AMS1117-3.3V (LDO Regulator)
      • VINMini360 5V Output
      • VOUTSTM32 (3.3V Power Line)
      • GNDCommon Ground
  3. Connect the PCB to Your Main Circuit

    • Route 3.3V and 5V power rails from the PCB to the STM32, Raspberry Pi CM5, and display.
    • Ensure proper grounding.

Option 2: Designing a Fully Integrated PCB

Pros:

  • More compact and professional design.
  • Optimized power routing → Lower resistance and voltage drop.
  • Less overall heat → Better thermal management.

🚫 Cons:

  • Requires sourcing and soldering individual components.
  • If a mistake is made, redesigning and re-manufacturing the PCB is necessary.

Steps to Design a Custom PCB with Components

  1. Design Schematic in KiCad

    • Replace the TP4056 module with a TP4056 IC circuit.
    • Replace Mini360 with a Buck Converter IC (like MP1584).
    • Replace AMS1117 module with the AMS1117-3.3V regulator IC.
  2. PCB Layout

    • Keep power traces wide to handle current.
    • Place decoupling capacitors near voltage regulators.
    • Ensure proper heat dissipation (thermal vias, copper pours).
  3. Manufacture & Solder

    • Order from PCB manufacturers like JLCPCB, PCBWay.
    • Use SMD soldering or reflow oven for precision.

Which Approach is Best for Your Project?

🛠 Best for Fast Prototyping (Beginner to Intermediate Level)

👉 Use a PCB Carrier Board with Prebuilt Modules

  • Good for quick testing and modular design.
  • Easier to troubleshoot and replace parts.

⚡ Best for Production & Compact Design (Advanced Level)

👉 Design a Fully Integrated PCB

  • Optimized for size and power efficiency.
  • Better if you're planning mass production.

Final Recommendation for Your Ultrasonic Data Logger

🔹 Start with a PCB Carrier for TP4056, Mini360, AMS1117 for rapid prototyping.
🔹 Once you verify functionality, consider integrating all components into a custom PCB for a final, optimized design.

Would you like help designing the KiCad schematic & PCB layout for either approach? 🚀