# Baby Mobile Audio Board v2 — Design Document ## Overview Drop-in replacement for baby crib mobile electronics. Custom audio from SPI flash, DC motor control, 8 buttons, and long runtime on 2×AA batteries. No programmer needed — upload audio via USB drag-and-drop or Bluetooth. ## Architecture ``` 2×AA (1.8-3.2V) → SW9 → D1(BAT54S) → TPS61220 boost → 3.3V ──┐ ├── MDBT50Q USB-C VBUS (5V) → D3(BAT54S) → MCP1700 LDO → 3.3V ────────────┘ (nRF52840) │ ┌────────────── SPI ── IS25LP128F (16MB flash, 2.3-3.6V) │ │ ┌───────── PWM ── R+C LPF ── PAM8302A ── 8Ω speaker │ │ │ ┌───── GPIO ── AO3400A MOSFET ── DC motor │ │ │ │ ┌─── GPIO ── 8× buttons (internal pull-ups) │ │ │ │ │ ┌─ USB ── USB-C D+/D- (mass storage) │ │ │ │ │ │ BLE ── phone (wireless upload) │ └────┴───┴─┴─┴──────────────────────────────────────────────────┘ ``` ## Power Design — Diode OR-ing (Safe for ALL Battery Types) ``` BAT54S TPS61220 2×AA ──SW9──┤►├──────┐ ┌─ VIN VOUT ─── 3.3V rail ├── node ┤ USB VBUS ───┤►├── LDO ┘ └─ EN GND ─── GND BAT54S MCP1700 L ─── L1(4.7µH) ``` **Why this is safe:** The Schottky diodes only pass current in one direction. When USB provides 3.3V via the LDO, the boost converter stops switching and the battery diode is reverse-biased. Zero current flows into the batteries regardless of chemistry (alkaline, NiMH, lithium). **Diode drop:** BAT54S drops ~0.25V. TPS61220 accepts inputs down to 0.7V. Depleted 2×AA = 1.8V → boost sees 1.55V → still operational. ## Pin Mapping — MDBT50Q (nRF52840) | Module Pin | nRF52840 Port | Function | Connected To | |------------|---------------|--------------|-------------------------------| | 4 | P0.02/AIN0 | Button 1 | SW1 → GND (active LOW) | | 5 | P0.03/AIN1 | Button 2 | SW2 → GND | | 6 | P0.04/AIN2 | Button 3 | SW3 → GND | | 7 | P0.05/AIN3 | Button 4 | SW4 → GND | | 8 | P0.06 | Button 5 | SW5 → GND | | 9 | P0.07 | Button 6 | SW6 → GND | | 10 | P0.08 | Button 7 | SW7 → GND | | 11 | P0.09 | Button 8 | SW8 → GND | | 12 | P0.10 | Motor PWM | R4(100Ω) → Q1 gate | | 13 | P0.11 | Audio PWM | R2(4.7K) → C7(10nF) → C6 → U3| | 14 | P0.12 | Flash ~CS | U2 pin 1 | | 15 | P0.13 | SPI MOSI | U2 pin 5 | | 16 | P0.14 | SPI MISO | U2 pin 2 | | 17 | P0.15 | SPI SCK | U2 pin 6 | | 18 | P0.16 | LED output | R6(1K) → D2 → GND | | 19 | P0.17 | Amp ~SD | U3 pin 1, R3(100K) → GND | | 20 | P0.18/~RESET | Reset | (internal pull-up) | | 21 | P0.19 | TXD (serial) | J5 pin 2 | | 22 | P0.20 | RXD (serial) | J5 pin 3 | | 28 | D- | USB Data - | J6 D- | | 29 | D+ | USB Data + | J6 D+ | | 33 | SWDIO | Debug | J4 pin 2 (SWD header) | | 34 | SWDCLK | Debug | J4 pin 3 (SWD header) | | 32 | VCC | Power | 3V3 rail | | 1 | GND | Ground | GND rail | ## SPI Flash: U2 — IS25LP128F (SOIC-8) | Pin | Name | Connected To | |-----|-----------|-------------------| | 1 | ~CS | P0.12 (FLASH_CS) | | 2 | SO (MISO) | P0.14 (SPI_MISO) | | 3 | ~WP | 3V3 (tie high) | | 4 | GND | GND | | 5 | SI (MOSI) | P0.13 (SPI_MOSI) | | 6 | SCLK | P0.15 (SPI_SCK) | | 7 | ~HOLD | 3V3 (tie high) | | 8 | VCC | 3V3 | **Operating voltage: 2.3V–3.6V** — works across entire boost output range. ## Audio Signal Path ``` P0.11 (PWM) → R2(4.7K) → node → C6(1µF coupling) → PAM8302A A+ │ C7(10nF) → GND RC LPF cutoff: 1/(2π × 4700 × 10e-9) ≈ 3.4 kHz ``` ## USB-C Wiring ``` USB-C Pin → Board ──────────────────── VBUS (5V) → D3 anode → MCP1700 VIN GND → GND D+ → nRF52840 D+ (pin 29) D- → nRF52840 D- (pin 28) CC1 → R7(5.1K) → GND CC2 → R8(5.1K) → GND ``` ## Bill of Materials | Ref | Part | Package | Qty | ~Cost | |--------|----------------------|---------------|-----|--------| | U1 | MDBT50Q-P1MV2 | Module | 1 | $6.00 | | U2 | IS25LP128F-JBLE | SOIC-8 | 1 | $2.00 | | U3 | PAM8302AASCR | SOIC-8 | 1 | $0.80 | | U4 | TPS61220DCKR | SC-70-5 | 1 | $0.80 | | U5 | MCP1700-3302E/TT | SOT-23 | 1 | $0.20 | | Q1 | AO3400A | SOT-23 | 1 | $0.15 | | D1 | BAT54S | SOT-23 | 1 | $0.05 | | D3 | BAT54S | SOT-23 | 1 | $0.05 | | D4 | SS14 | SMA | 1 | $0.10 | | D2 | LED green | 0805 | 1 | $0.05 | | L1 | 4.7µH inductor | 0805 | 1 | $0.15 | | R2 | 4.7KΩ | 0805 | 1 | $0.01 | | R3 | 100KΩ | 0805 | 1 | $0.01 | | R4 | 100Ω | 0805 | 1 | $0.01 | | R5 | 100KΩ | 0805 | 1 | $0.01 | | R6 | 1KΩ | 0805 | 1 | $0.01 | | R7,R8 | 5.1KΩ | 0805 | 2 | $0.02 | | C1 | 100µF/10V | Radial 5mm | 1 | $0.15 | | C2 | 100nF | 0805 | 1 | $0.01 | | C3 | 10µF | 0805 | 1 | $0.05 | | C5 | 100nF | 0805 | 1 | $0.01 | | C6 | 1µF | 0805 | 1 | $0.02 | | C7 | 10nF | 0805 | 1 | $0.01 | | C8 | 10µF | 0805 | 1 | $0.05 | | C9,C10 | 10µF | 0805 | 2 | $0.10 | | C11,C12| 1µF | 0805 | 2 | $0.04 | | SW1-8 | Tactile switch | 6mm SMD | 8 | $0.80 | | SW9 | SPDT slide | THT | 1 | $0.20 | | J1 | JST-PH 2-pin | THT | 1 | $0.15 | | J2 | JST-PH 2-pin | THT | 1 | $0.15 | | J3 | JST-PH 2-pin | THT | 1 | $0.15 | | J4 | 1×4 pin header | 2.54mm | 1 | $0.10 | | J5 | 1×3 pin header | 2.54mm | 1 | $0.05 | | J6 | USB-C receptacle | SMD | 1 | $0.30 | | | **TOTAL** | | |**~$12**| ## Power Analysis | State | MCU | Flash | Amp | Motor | Boost η | Battery mA | |--------------------|--------|--------|--------|--------|---------|------------| | Audio + motor | 4 mA | 8 mA | 10 mA | 80 mA | 90% | ~113 mA | | Audio only | 4 mA | 8 mA | 10 mA | 0 | 90% | ~24 mA | | BLE idle | 0.5 mA | 0.001 | 0.001 | 0 | 85% | ~0.7 mA | | Deep sleep | 0.002 | 0.001 | 0.001 | 0 | — | ~0.01 mA | **Estimated runtimes on 2×AA alkaline (2500 mAh usable with boost):** | Mode | Runtime | |------------------|--------------| | Audio + Motor | ~22 hours | | Audio only | ~104 hours | | BLE standby | ~149 days | | Deep sleep | ~28 years | | 30 min/day use | **~44 days** | ## Module Options (Soldering Difficulty) The schematic is designed around the MDBT50Q module, but the firmware works on any nRF52840 board. Here are your options from easiest to hardest: | Module | ~Cost | USB-C | Bootloader | Soldering | |-----------------------------|-------|-------|------------|------------------| | **Seeed XIAO nRF52840** | $10 | Yes | UF2 preloaded | **Through-hole headers** — solder like any DIP. Has castellated pads too. | | **Adafruit Feather nRF52840** | $25 | Yes | UF2 preloaded | Through-hole headers | | **SparkFun Pro nRF52840** | $20 | Yes | UF2 preloaded | Through-hole headers | | **Ebyte E73-2G4M08S1C** | $3 | No | None | Castellated edge pads — hand-solderable with regular iron | | **MDBT50Q-P1MV2 (Raytac)** | $6 | No | None | SMD pads — needs reflow or hot air | **Recommended for beginners: Seeed XIAO nRF52840.** It plugs into standard 2.54mm headers like an Arduino Nano. USB-C and UF2 bootloader are built in, so you never need a programmer. Just drag-and-drop firmware and audio files. **If using a XIAO or Feather:** you can skip the TPS61220 boost converter, MCP1700 LDO, USB-C connector, and CC resistors from the BOM. The dev board handles all of that. Feed the boost converter's 3.3V output to the board's 3V3 pin. Total BOM drops to ~$15 including the XIAO. **If using MDBT50Q or E73:** you need the full schematic as designed. The E73 is the budget option — castellated pads are solderable with flux, a fine tip, and patience. Pre-tin both the pads and the board footprint, then tack one corner and reflow the rest. ## User Experience ### Upload Audio (USB) 1. Plug USB-C cable into board 2. Board appears as USB mass storage drive 3. Drag .wav or .mp3 files onto drive 4. Eject and unplug — music ready to play ### Upload Audio (Bluetooth) 1. Open Web Bluetooth page on phone (no app install) 2. Connect to "BabyMobile" device 3. Select audio files → transfer 4. ~15 min for 30 minutes of audio at BLE speeds ### Update Firmware 1. Double-tap reset button (or hold BTN1+BTN2 on power-on) 2. Board appears as UF2 drive 3. Drag .uf2 firmware file onto drive 4. Board reboots with new firmware ### No-Programmer Setup The MDBT50Q ships with the nRF52840 bootloader ROM. Flash the Adafruit nRF52 UF2 bootloader once via SWD (J4 header) using any $3 CMSIS-DAP probe, J-Link, or even a Raspberry Pi. After that, all future updates are drag-and-drop over USB. The SWD header is only needed once.