Skip to the content
2 layers48.3 × 60 mmSswingg bat, the printed circuit board in 3D

Bat sensor for SwingLab (CricPro): ESP32-C3 Super Mini, BMI160, LiPo and TP4056. Circuit diagrams, staged Arduino sketches and a build guide.

Size
48.3 × 60 mm
Copper layers
2
Thickness
1.6 mm
Parts
13
Nets
23
Pads
50
Tracks, vias
36, 0
Routed
Yes
KiCad
KiCad 10.0 (file 20260206)
Created
11 Oct 2026
Updated
22 Oct 2026

Overview

Sswingg bat is an open-source printed circuit board by gaurav3611, from the gaurav3611/Cric-Pro-Hardware repository on GitHub. It is a 2-layer board of 48.3 × 60 mm with 13 parts on 23 nets, routed with 36 tracks and 0 vias.

Its parts include 3 ICs, 2 capacitors, 2 resistors, 1 diode and 1 connector. It belongs with the sensors and measurement boards and the ESP32 and RISC-V boards of this library.

README

README.md

SSwinGG bat sensor: hardware and firmware, step by step

A small sensor that sits on a cricket bat and sends every movement of the bat to the SSwinGG dashboard over Bluetooth. This folder holds the circuit, the firmware, and a guide that builds it one stage at a time, so that each stage is tested before the next part is added.

It is written for someone who has not done this before. Each stage says what to wire, what to upload, what you should see, and what is going on between the parts.

From a swing to a number on the screen

What has been checked, and what has not

  • Checked: every sketch compiles for the ESP32-C3 Super Mini, with no warnings. Stages 1 to 8 have also been run on a computer against a pretend sensor, battery and dashboard, and what they print, send and do with the light was checked there. The 14-byte Bluetooth packet was read back with the web app's own code.
  • Not checked: nothing here has run on real hardware yet. The pin orders in the drawings come from published pinouts, not from your boards, the battery circuit has not been built, and the printed circuit board has not been made.

So follow the stages in order, and trust the labels printed on your own boards over any drawing.

Versions

0.2.0, 2026-10-21. C2, a 220 µF capacitor that steadies the 5V line, added to both zero PCB layouts and the full circuit. A proposed impact sensor: a piezo disc wired without diodes, not yet read by the firmware. The continuity tester also runs on an ESP32 DevKit. The phone app moved to mobile_app_swing.

0.1.0, 2026-10-17. First version: the circuit, nine stages, the guides as PDF, the one-file firmware and the layout without the diode.

Parts

PartNotes
ESP32-C3 Super MiniThe small board with a USB-C socket and eight pins on each side.
GY-BMI160The motion sensor board: acceleration and rotation on three axes each.
LiPo cell, 3.7 V, 1500 mAhOne cell with two leads. Buy one with a built-in protection board, which is the usual kind.
TP4056 charger module with protectionThe version with six pads: IN+ IN- B+ B- OUT+ OUT-. See the question about the charger.
Slide switchThree pins in a row, 2.54 mm apart, for example the SS12D00.
Diode 1N5817A Schottky diode. A 1N5819 also works and loses a little more voltage.
Zero PCBAt least 20 by 16 holes. The common 5 by 7 cm board is big enough.
Female header stripsTwo with 8 pins, one with 7. With them the two boards can be unplugged.
Insulated hook-up wireThin single-strand wire.
USB-C cable that carries dataCharge-only cables give no serial port.
Phone charger, 5 V and 1 A or moreTo charge the cell through the TP4056.
Only for stage 7Two 100 kilohm resistors and one 100 nanofarad ceramic capacitor.

Tools: a soldering iron and solder, a multimeter, wire cutters, insulating tape or heat-shrink tube, and double-sided foam tape for mounting.

docs/parts-to-buy.pdf is the shopping list: the exact name to search for, how many, and what to check before paying.

Before you touch the battery

A LiPo cell stores a lot of energy and can catch fire when it is mistreated.

  • Never let the red and the black lead touch. Cut and solder them one at a time, never both together.
  • Check which lead is plus with a multimeter before soldering. Red is normally plus, but plugs are wired both ways.
  • Charge it only through the TP4056, on a surface that cannot burn, and not unattended.
  • Do not use a cell that is swollen, dented or punctured.
  • Protect it on the bat. Mount it away from where the ball hits, with foam under it.

The stages

Do them in order. Each folder under stages/ holds one sketch and a page, README.pdf, with the steps. The links in the table open those pages.

StageWhat you addWhat you learnIt works when
1. BlinkThe ESP32 board and a USB cableUploading, the Serial Monitor, outputs and inputsThe light blinks and lines appear
2. I2C scanThe sensor, on five wiresWhat I2C is, and addressesIt prints RESULT: PASS
3. Read the sensorNothingRegisters, bytes, counts and unitsFour checks pass and z reads 1 g
4. Swing speedNothingCalibration, and the speed formulaA swing prints a speed
5. BluetoothNothingAdvertising, connecting, notifications, the packetThe test page shows 50 readings a second
6. BatteryCell, charger, switch, diodeWhere the power flows, charging, brownoutsIt runs with no cable and counts no brownouts
7. Battery levelOptional: two resistors, one capacitorMeasuring a voltageThe printed voltage matches a multimeter
8. The bat firmwareNothingHow it all fits togetherThe dashboard records a shot
9. WiFiOptional: nothingWiFi, HTTP and JSONThe API lists the bat as online

Stages 1 to 5 run from the USB cable. The battery comes in at stage 6, when everything else is known to work.

The whole circuit

The whole circuit

FromToWhat it carriesAdded in
3V3VIN of the sensorPower for the sensor, 3.3 voltsStage 2
GNDGND of the sensorGroundStage 2
GPIO4SCLI2C clockStage 2
GPIO3SDAI2C dataStage 2
SAO of the sensorGNDFixes the sensor's address at 0x68Stage 2
Cell, red leadB+ of the chargerBattery plusStage 6
Cell, black leadB- of the chargerBattery minusStage 6
OUT+ of the chargerSwitch, an end pinBattery plus, protectedStage 6
Switch, middle pinDiode, plain endBattery plus, switchedStage 6
Diode, striped end5VPower into the ESP32 boardStage 6
OUT- of the chargerGNDGroundStage 6
Switch, middle pinR1Battery plus, switchedStage 7
GPIO0middle of R1 and R2Half the battery voltage. C1 goes from here to ground.Stage 7
R2, other endGNDGroundStage 7

Leave the sensor's 3V3, CS, INT1, INT2 and OCS pins unconnected.

More drawings:

The printed circuit board, drawn by KiCad

Is the TP4056 the right charger?

Yes. The chip is called TP4056. There is no common charger called TP4050, so that is almost certainly the module you have.

  • What it does. It charges one LiPo cell from 5 volts. It holds the current steady until the cell reaches 4.2 volts, then holds 4.2 volts until the current has dropped to a tenth, and then stops.
  • Get the version with protection. It has six pads instead of four, and two extra small chips. They disconnect the cell when it is drained below about 2.4 volts, charged above about 4.3 volts, or shorted.
  • The charging current is 1 amp as sold. That suits a 1500 mAh cell: cells are normally charged at up to their capacity per hour, which here is 1.5 amps. A full charge takes about two hours. To charge more gently, see docs/make-changes.pdf.
  • The ESP32-C3 Super Mini has no charger of its own, which is why this module is needed.
  • It is not a switch and not a regulator. The slide switch turns the bat off. The regulator on the ESP32 board makes the 3.3 volts.

Set up the Arduino IDE

  1. Install the Arduino IDE, version 2, from arduino.cc.
  2. Add the ESP32 boards: Tools > Board > Boards Manager, search for esp32, and install "esp32 by Espressif Systems". This kit was compiled with version 3.3.11.
  3. Choose the board: Tools > Board > esp32 > Nologo ESP32C3 Super Mini.
  4. Choose the port: Tools > Port, the one that appears when the board is plugged in. On a Mac its name starts with /dev/cu.usbmodem.
  5. Open a sketch with File > Open and pick the .ino file inside a stage folder.
  6. Upload, then open Tools > Serial Monitor and set it to 115200 baud.

No library has to be installed. Everything the sketches need is in their own folders.

If an upload cannot connect: hold the BOOT button, press and release RESET, release BOOT, and upload again. Press RESET once afterwards to start the sketch.

How it works, and how to change it

What is in this folder

PathWhat it is
stages/01_blink to stages/09_wifi_to_apiOne Arduino sketch per stage, each with its own page, README.pdf.
stages/08_sswingg_bat/The firmware that stays on the bat. Its settings are in config.h.
app/The same recorder as a web page. recorder.js holds its logic, which tools/check.mjs tests.
sswingg_bat_one_file/The same firmware as one file, for opening or pasting into the Arduino IDE on its own. tools/make_one_file.mjs makes it from stage 8.
stages/*/bmi160.hThe sensor driver. The same file in three folders, because the Arduino IDE only compiles files inside a sketch's own folder.
stages/*/swing_packet.hBuilds the 14-byte packet. This is the agreement with the web app.
stages/*/battery.hBattery voltage to percent.
diagrams/Every drawing as SVG, and make_diagrams.py, which draws them.
docs/The seven guides listed above, as PDF.
pcb/The printed circuit board as a KiCad 10 project, sswingg-bat.kicad_pro, with its own library of the kit's parts. sswingg-bat-gerbers.zip is what you upload to a maker, bom.csv the parts list.
tools/make_pcb_files.mjsRuns KiCad's checks on the board and makes the Gerber zip, the parts list and the board drawings from the KiCad design. Needs KiCad.
diagrams/diagrams.pdfAll drawings in one file, one per page, for printing.
tools/ble_test.htmlA page that connects to the bat from a browser and shows what it sends.
tools/check.mjsChecks the whole kit without hardware.
tools/make_pdfs.mjsMakes the PDFs from their Markdown sources. Those sources are kept out of the repository. This README is the only Markdown document in it.
tools/sim/The simulator that check.mjs uses to run the sketches on a computer.

Check the kit without hardware

After changing a sketch, a pin or a drawing, run:

bash
node tools/check.mjs            # under a minute
node tools/check.mjs --board    # also compiles every sketch for the ESP32-C3, several minutes

It needs Node 22 or newer and a C++ compiler. It confirms that the copies of the shared files are identical, that every sketch, the drawings and this README use the same pins, that the packet is what the web app expects, and that every sketch behaves as its stage describes when run in the simulator. When KiCad is installed, it also runs KiCad's checks on the PCB and confirms that its schematic is the circuit of the drawings. It cannot check soldering, radio range or a real battery.

You can also run a single sketch in the simulator and watch what it prints:

bash
tools/sim/run.sh stages/04_swing_speed "swing@3000:400:900:1,end@6000"

The words of the scenario are listed at the top of tools/sim/sim_main.cpp.

The phone app

mobile_app_swing holds SSwinGG recorder, an Android app written in Flutter, in its own repository. It connects to the bat, records each shot between Start and Stop, guesses the type of shot, and saves every reading as a CSV file in a folder per type, named like pull_shot/pull_shot_001.csv. Its README says how to build and install it.

app/ is the same recorder as a web page for Chrome on Android, for phones where installing an app is not wanted. docs/phone-app.pdf explains it.

Using it with the dashboard

  1. Open the SSwinGG dashboard in Chrome or Edge and sign in. The web app is in the Cric-Pro-FE repository.
  2. Switch the bat on and wait for the slow blink.
  3. Press Connect Sensor and choose SwingLab-Bat.
  4. Press START SHOT, swing, then press STOP & SAVE SHOT. The dashboard reads the sensor only between those two presses.

Only one program can be connected to the bat at a time. Close the test page first.

Parts

13
QtyValueFootprintReferences
3M2MountingHole:MountingHole_2.2mm_M2H1, H2, H3
2100k 1%Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_HorizontalR1, R2
1100nFCapacitor_THT:C_Disc_D5.0mm_W2.5mm_P5.00mmC1
11N5817Diode_THT:D_DO-41_SOD81_P10.16mm_HorizontalD1
1220uF 10VCapacitor_THT:CP_Radial_D6.3mm_P2.50mmC2
1BatteryConnector_JST:JST_PH_B2B-PH-K_1x02_P2.00mm_VerticalJ1
1ESP32-C3 Super Minisswingg:ESP32-C3_SuperMini_SocketU1
1GY-BMI160sswingg:GY-BMI160_SocketU2
1SS12D00G3sswingg:SW_Slide_SS12D00G3SW1
1TP4056 modulesswingg:TP4056_Module_WiredU3

Similar boards

  • 2 layers40 × 20 mmUsb uart, the printed circuit board in 3D

    Usb uart

    earthtojake/text-to-cad

    Design physical products with AI

    13 parts26kMIT
  • 2 layers35 × 29 mmMagSpoofTC, the printed circuit board in 3D

    MagSpoofTC

    samyk/magspoof

    A portable device that can spoof/emulate any magnetic stripe, credit card or hotel card "wirelessly", even on standard magstripe (non-NFC/RFID) readers.

    13 parts4.2k
  • 2 layers20.6 × 23.6 mmAO-03 signal amplifier, the printed circuit board in 3D

    AO-03 signal amplifier

    fossasia/pslab-scripts

    Pocket Science Lab - Scripts for Sensor Experiments

    13 parts1.6kApache-2.0
  • 2 layers47 × 35.6 mmMX7-C-35PL C11, the printed circuit board in 3D

    MX7-C-35PL C11

    rusefi/rusefi

    rusefi - GPL internal combustion engine control unit

    13 parts1.2k
  • 2 layers95 × 95 mmCube batteryboard, the printed circuit board in 3D

    Cube batteryboard

    willem-pennings/balancing-cube

    A cube that balances itself in a corner or edge using reaction wheels

    13 parts1.1kGPL-3.0
  • 2 layers15.2 × 20.3 mmPt100stick, the printed circuit board in 3D

    Pt100stick

    VoronDesign/Voron-Hardware

    Cool Hardware designed by the Voron Design group

    13 parts1.1kGPL-3.0
  • 2 layers53.9 × 23.2 mmBuffer, the printed circuit board in 3D

    Buffer

    hoglet67/RGBtoHDMI

    Bare-metal Raspberry Pi project that provides pixel-perfect sampling of Retro Computer RGB/YUV video and conversion to HDMI

    13 parts1kGPL-3.0

Questions

How big is the Sswingg bat PCB?

It measures 48.3 × 60 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Sswingg bat use?

13 parts. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Sswingg bat KiCad files?

From the gaurav3611/Cric-Pro-Hardware repository on GitHub, at the commit this page was made from: the board is pcb/sswingg-bat.kicad_pcb and its schematic pcb/sswingg-bat.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Sswingg bat design in my own project?

Its repository states no licence, so its author keeps all rights: ask gaurav3611 before reusing the design.