Building the ResiBee Box: a 3D-printed Enclosure for AI-powered Resistor Recognition

by loarri in Circuits > Microcontrollers

256 Views, 0 Favorites, 0 Comments

Building the ResiBee Box: a 3D-printed Enclosure for AI-powered Resistor Recognition

ResiBee_main.jpg
CNN.png

ResiBee is a project that uses a small convolutional neural network (CNN), running on an STM32 Nucleo-H723ZG board, to automatically recognize a resistor's value from a photo. If you want to know more about the software side of the project — the CNN architecture, the dataset, the code — you can check out the full write-up here: ResiBee full article. In this Instructable I'll focus specifically on how I built the physical enclosure that houses the camera, the lighting and the resistor holder.

Supplies

20260731_214831(1).jpg
20260731_214833(1).jpg
20260804_134848(1).jpg
20260807_150733(1).jpg
20260807_150738.jpg
20260807_150747.jpg
20260807_150821(1).jpg
20260826_134510.jpg
20260828_120814.jpg
20260828_120829.jpg
20260828_120903.jpg
h723zg.png

What you'll need

  1. An electrical junction box, 90 x 240 x 190 mm (example here) — this became the main enclosure
  2. A slide switch, to enable photo capture
  3. An STM32 NUCLEO H723ZG board
  4. An Arducam 2MP Mini SPI camera (OV2640 sensor)
  5. Two white LEDs, driven directly by the STM32
  6. A small plano-convex lens (the kind used in VR headset lenses) — flat on one side, spherical on the other, used to optically magnify the image
  7. Baking/parchment paper, used as a light diffuser
  8. 3D printed parts (STL files available here): camera holder, box structure, project logo, a V-shaped resistor holder, and a spacer to move the camera away from the lid

The Enclosure

I started from a simple electrical junction box as the base enclosure — it's sturdy, easy to drill, and already sized to comfortably fit the electronics and the optical assembly inside.

The 3D Printed Parts

I designed and 3D printed several parts specifically for this project:

  1. a camera holder, to keep the Arducam module fixed and aligned inside the box;
  2. the box structure itself, to adapt the internal layout to the electronics;
  3. the project logo, just for a nice finishing touch;
  4. a V-shaped groove piece, where the resistor is placed for the photo — the V shape keeps it centered and at a consistent height every time;
  5. a small spacer, mounted on the lid, used to move the camera further away from the resistor and get the right focus distance.

All the STL files are available on Thingiverse: thingiverse.com/thing:7406619.

The Optics

WhatsApp Image 2026-09-10 at 08.22.01 (1).jpeg

Inside the lid, right in front of the camera, I placed a small plano-convex lens — the same type used in VR headsets — flat side facing one way and spherical side facing the other. This lens optically magnifies the image of the resistor, helping the camera capture more detail on such a small object.

Lighting

WhatsApp Image 2026-09-10 at 08.22.01 (2).jpeg

Two white LEDs, driven directly by the STM32, are mounted at roughly 45° on either side of the resistor, like two small angled torches. They serve a double purpose: they light up briefly to indicate that everything is ready to take the photo, and at the same time they illuminate the scene for the shot itself.

Underneath the LEDs I added a layer of baking paper to diffuse the light. Without it, the LEDs created sharp, punctual reflections on the resistor's surface — small hotspots that, as it turned out, caused some real headaches later on when training and fine-tuning the CNN. Diffusing the light fixed this and made the images much more consistent.

The Capture Switch

interruttore.png
WhatsApp Image 2026-09-10 at 08.22.01 (3).jpeg

A simple slide switch, wired to the STM32, is used to enable photo capture on demand — flip it, and the board takes care of lighting the scene, grabbing the frame from the camera and running it through the pipeline.

The Code

WhatsApp Image 2026-09-09 at 23.27.59.jpeg

Here you can find the code I used for STM32duino platform and the Python graphical interface, developed specifically to make the project work :-)

Final Result and Current Limitations

R_dataset.png
CNN.png
CNN_test.png
loss_accuracy.png

Putting all these pieces together — enclosure, 3D printed parts, optics, diffused lighting and the capture switch — gave me a small, self-contained box where I can place a resistor, take a photo, and get the CNN's prediction back.

The model isn't perfect yet: there's still work to do to optimize the code, and it often gets the multiplier digit wrong. Still, I think this project can be considered a good starting point and a working example of how to physically implement a CNN model directly on a microcontroller, from image capture all the way to inference.