Skip to the content
2 layers29 × 30.8 mmARSensors, the printed circuit board in 3D

If you stumble across this project feel free to use it for educational purposes. If you find errors or have questions about the circuit design or code feel free to reach out.

Size
29 × 30.8 mm
Copper layers
2
Thickness
1.6 mm
Parts
12
Nets
11
Pads
66
Tracks, vias
120, 21
Pours
1
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
4 Dec 2025
Updated
6 May 2026

Overview

ARSensors is an open-source printed circuit board by mcbearfish, from the mcbearfish/Mini-3D-Window-Viewer repository on GitHub. It is a 2-layer board of 29 × 30.8 mm with 12 parts on 11 nets, routed with 120 tracks and 21 vias.

Its parts include 5 capacitors, 2 resistors, 2 ICs and 1 connector.

README

README.md

3D Window Project

About

This is a developmental project intended to refresh my skills on designing and programming an STM32 microcontroller board. I chose a project scope that I believed would provide difficult circuit and programming challenges. I will document the development process in this README.

If you stumble across this project feel free to use it for educational purposes. If you find errors or have questions about the circuit design or code feel free to reach out. Please cite this repository as a source if you plan to use it.

Table of Contents

Project Description

This project is the 3D Window Viewer.

When placed on a flat surface, the device on startup will create a window into a 3D scene of a hammer (Boiler Up and Hail Purdue!). After startup, tilting and rotating the device updates the view of a 3D hammer while the virtual position remains anchored.

This project uses I2C accelerometer, gyroscope, and magnetometer sensors to estimate device orientation in C. The original goal was IMU-only position tracking, but drift made that impractical, so I redesigned the demo around constrained motion.

I designed my own custom STM32 development board and sensor board using KiCad Schematic and PCB Design Software.

Demo Video

Everything Is AWESOME

Hardware / Software Used

  • STM32 microcontroller
  • Custom STM32 main PCB
  • Custom sensor PCB
  • Accelerometer, gyroscope, and magnetometer over I2C
  • LCD display
  • KiCad for schematic and PCB design
  • CLion IDE
  • C firmware

Circuit Design

STM32 Circuit

image
This STM32 chip was chosen for its large number of GPIO pins and processing capabilities.

Button

image
Simple button circuit to test user inputs.

LEDs

image
Used for initial testing and debugging.

Crystal Oscillator

image
Provides a highly stable, accurate, and precise frequency reference.

USB-C Connector

image
Provides power to the board.

Boot Switch

image
Reset switch.

Mounting Holes

image
Grounded pads to use for mounting and probe testing.

Pin Connectors

image

Buck Converter

image
Chosen to smooth 5V to 3.3V for STM32 chip and sensors.

Accelerometer and Gyroscope

image
Chosen to estimate device orientation and motion. IMU-only position tracking was tested, but drift made it impractical for this version.

Magnetometer

image
Chosen to improve heading estimation and help correct gyro drift over time.

Pin Connector

image

Mounting Holes

image

Notes

I found Google's Gemini AI tool to be extremely helpful during this design process. Especially with mapping the pinout of the display to STM32. I used a cheap knockoff with no documentation and poor pinout labels. In the future may need to remap pins if display fails to work. See ARSensors project for second Board meant to connect sensors to this main board.

Manufacturing files can be found for each board in this repository.

Main PCB

image

image

image

image

Sensors PCB

image

image

image

image

Design Process

Designing my first board in almost 4 years was a great experience. In the workspace I have been living in a more software heavy environment. I found this project to be a great refresher of my skills.

I found the initial research phase to be quite enjoyable and straightforward. I easily identified the types of sensors, display, and STM32 chip I thought would be capable for the performance I wanted. Now that I identified the key components it was time to begin creating the schematic.

I quickly realized this was a larger challenge than my senior design project. Although I took a significant part in the circuit design, I realized how beneficial it was having a team of 4 people in multiple disciplines. The components I selected for this project were much more sophisticated than what was chosen for the senior design project. I was honestly a little overwhelmed at the start. I had to take my time and started to break components down. I started with the most important part, the STM32 chip.

For the STM32 I first connected any power related pins and decoupling capacitors. Then I used the STM32CubeMX tool to assign pinouts. I knew between the display and other peripherals I needed a lot of pins, so I started by making sure the chip was capable of supporting them all. Once I verified the chip was capable I began connecting components. The most critical was the USB-C connector, which flashes code onto the chip. The USB-C will also provide power to the whole system. I spent quite a bit of time researching possible power designs. The USB-C provides 5V and I need 3.3V for the STM32 and sensors. I eventually decided on a synchronous buck converter because it would provide an efficient and stable step down from 5V to 3.3V. The display needs 5V, so I decided on a simple low-pass filter because it would provide a clean signal and I have experience with designing those on circuit boards in the past.

Next I added the sensors. I found the datasheets to be extremely helpful. The design process was made much easier by following the typical application circuits that they detailed. Then I added the display, button, and some LEDs. The extra LEDs and button will be useful at the start of programming to make sure the board can properly run code and debug. Lastly I added a connector for debug pins.

Now that I had a schematic to follow I moved onto the PCB layout. This portion was much more difficult than expected. It was at this point I had to take into account physical and cost restrictions. JLCPCB was my choice of board manufacturer. To minimize costs I decided on a 2 layer board, which gave me a lot of physical trace constraints. Also, since the sensors are a bit costly, I decided to move them to a second circuit board to save on future costs. With these new challenges I had to go back to my schematic and STM32CubeMX. Unfortunately I was not able to place my STM32 pinouts more conveniently to minimize trace crossovers. At this point I decided to go with a more generic pin layout that I can wire with some 2.54mm connectors to minimize my trace lengths and crossovers. In the future I will look at more layered boards or other STM32 chips as potential solutions.

To minimize costs on JLCPCB I tried to identify basic parts in the JLCPCB library. Not all parts selected were in that and drove up the cost (~$3 per part not in the basic library). In the future I will place more emphasis on this to lower my costs.

Major credit to Phil's Lab PCB Design video: https://www.youtube.com/watch?v=aVUqaB0IMh4. This was a great refresher on circuit board design and I highly recommend his channel.

Soldering and Assembly

When ordering the board I decided that to save on costs to I would hand solder some of the components. This involved things the STM32 chip, USB-C connector, asynchronous buck converter, buttons, and pins. I felt this was a great skill refresher. I took it slow and steady. I started with easier items like the pins and buttons to get back into the flow of things. The picture below is from right before I went to solder the STM chip.
image

I bought a cheap soldering station and found it pretty useful when adding the smaller components. In the picture below you can see a cheaper soldering iron. I found this ok for the larger components but, I decided it was safer to spend the money and get a proper iron for the delicate items like the USB-C and STM32 chip.
image

Box Design

I bought a simple project box and placed the main board inside the box. I left the sensor board on top along with the display to keep them on the same level. image

Code Design

Initial Project Scope

The initial goal of the project was to use the IMU sensors to track the 3D coordinates of the device so that it could act as a camera. The camera would then be able to view a 3D object fixed in space from all angles and get closer or farther away.

Limitations of IMU Sensors

While prototyping I found that it was not feasible to use the IMU sensors alone for positional tracking. The significant position drift was too much to overcome, even with adjusting bias in the Kalman filter parameters. I also tested the individual sensors to check for noise and bias. Surprisingly, these cheaper sensors performed quite well. The accelerometer did display the most noise. I believe this was due to environmental sensitivities. Testing was performed on my desk and away from any electronics, this however does not guarantee a perfectly still environment.

Since position is calculated by integrating acceleration twice, even with tiny errors, the positional data errors grew massive. The estimated position drifted so quickly that the 3D object would only remain visible for a split second. I determined this was unusable and decided to change scope.

Redesign

I decided to pivot the project and try to get the most out of the current setup. I decided to simulate the camera view of the 3D object where moving and tilting the box changes camera view direction realistically, but position is anchored.

Code Flow

The main program initializes the board, sensors, sensor fusion, and 3D engine before entering the main loop. In the loop, new sensor data is read and passed into the sensor fusion algorithm. This project uses an Extended Kalman Filter, which fuses gyroscope, accelerometer, and magnetometer data into a stable orientation estimate. That orientation estimate is then used to update the rendered 3D object and draw the pose overlay.

text
main()
|
+-- HAL_Init()
+-- SystemClock_Config()
+-- MX_GPIO_Init()
+-- MX_FMC_Init()
+-- I2C_Bus_Reset()
+-- MX_I2C1_Init()
|
+-- Engine3D_Init()
|   \-- GPU_Init()
|
+-- Sensors_Init()
+-- Sensors_ShowStartupCountdown()
+-- Sensors_Calibrate()
+-- Sensors_ShowInstructionScreen()
+-- Sensors_GetReferenceFrame()
+-- EKF_Init()
+-- EKF_SetReference()
|
\-- while (1)
    +-- Sensors_Read()
    +-- EKF_Predict()
    +-- EKF_Update()

Notes on AI Assistance

Portions of the firmware were developed with assistance from AI tools, including OpenAI Codex and Google's Gemini. I used these tools to help generate code structure, debug embedded issues and tune parts of the sensor-fusion pipeline. All AI-assisted code was reviewed, tested, and modified by me before being included in the final project.

I found Codex especially useful for working through embedded C issues and code organization. Gemini was useful during early design exploration, especially for brainstorming and pin-mapping support, but I had to review its output carefully because it sometimes suggested larger code changes than intended.

Final Result

The final device renders a wireframe 3D hammer on the LCD. After startup calibration, tilting or rotating the physical box updates the rendered view in real time. The device uses IMU sensor fusion for orientation estimation while keeping virtual position constrained to avoid IMU drift.

This project was great for refreshing my bare-metal embedded skills. Making a device and writing code that brings it to life is always a joy. The next project should hopefully move faster now that I have regained familiarity with the whole process.

Parts

12
QtyValueFootprintReferences
4100nCapacitor_SMD:C_0402_1005MetricC1, C2, C3, C5
23k3Resistor_SMD:R_0603_1608MetricR1, R2
2MountingHole_PadMountingHole:MountingHole_4.3mm_M4_Pad_ViaH1, H2
11uCapacitor_SMD:C_0402_1005MetricC4
1Conn_01x08Connector_PinHeader_2.54mm:PinHeader_1x08_P2.54mm_VerticalJ1
1LIS3MDLTRfootprints1:LGA-12_2X2X1_STMU2
1LSM6DSRTRfootprints:LGA-14L_2P5X3X0P83_STMU3

More from mcbearfish/Mini-3D-Window-Viewer

1
  • 2 layers61.5 × 57 mmARviewer, the printed circuit board in 3D

    ARviewer

    mcbearfish/Mini-3D-Window-Viewer

    If you stumble across this project feel free to use it for educational purposes. If you find errors or have questions about the circuit design or code feel free to reach out.

    61 parts

Similar boards

  • 2 layersNrf bga, the printed circuit board in 3D

    Nrf bga

    github-linguist/linguist

    Language Savant. If your repository's language is being reported incorrectly, send us a pull request!

    12 parts14kMIT
  • 2 layers66.9 × 74.5 mmDeskHop, the printed circuit board in 3D

    DeskHop

    hrvach/deskhop

    Fast Desktop Switching Device

    12 parts7.9kGPL-3.0
  • 2 layers40 × 15 mmSensors, the printed circuit board in 3D

    Sensors

    google/mozc-devices

    Circuit diagrams and firmware source code for Gboard DIY keyboards

    12 parts3kApache-2.0
  • 2 layers42.7 × 56.5 mmTle6240 driver, the printed circuit board in 3D

    Tle6240 driver

    rusefi/rusefi

    rusefi - GPL internal combustion engine control unit

    12 parts1.2k
  • 2 layers49 × 25 mm5v boost regulator, the printed circuit board in 3D

    5v boost regulator

    hackclub/OnBoard

    💡 Join 1,000 teenagers and make your first PCB with a $100 grant!

    12 parts915
  • 2 layers28.3 × 10.3 mmTap Photosensor PCB, the printed circuit board in 3D

    Tap Photosensor PCB

    VoronDesign/Voron-Tap

    Tap is a nozzle-based z-probe for the V2 and Trident printer designs. The entire toolhead moves to trigger an optical switch. Tap offers many advantages:

    12 parts716GPL-3.0
  • 2 layers25.4 × 70.4 mmTpmsniffer, the printed circuit board in 3D

    Tpmsniffer

    stacksmashing/pico-tpmsniffer

    A simple, very experimental TPM sniffer for LPC bus

    12 parts696

Questions

How big is the ARSensors PCB?

It measures 29 × 30.8 mm and has 2 copper layers, 1.6 mm thick.

What parts does the ARSensors use?

12 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 ARSensors KiCad files?

From the mcbearfish/Mini-3D-Window-Viewer repository on GitHub, at the commit this page was made from: the board is ARSensors/ARSensors.kicad_pcb and its schematic ARSensors/ARSensors.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the ARSensors design in my own project?

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