FiberGrid is a sensor framework for robotics

Similar projects worth following
FiberGrid is an inexpensive 3D printed optical sensor framework for robotics. If you don't want to spend years learning about electronics, how to interface sensors to microcontrollers and DSP but you are ready to jump into action building robots, this project is for you! Forget Raspberry PI, arduino, PICs and other MCUs. There is an easier and much cheaper way to add sensors to your projects. Add hundreds of 3D printed mechanical sensors to your robots for the price of cheap plastic optic fiber. The goal of this project is to take electronics out of the picture and allow ten year olds and adults around the world to build sophisticated devices.

How it works

Fibergrid hardware consists of two parts: a lightsource and a camera with an enclosure.  They are connected to 3D printed sensors by inexpensive plastic fibers.  The light source shines light on a grid with exposed fiber ends.  Fibers transmit light to your light blocking sensors.  What light remains is picked up by another fiber that transmits it to the camera enclosure. Camera software running on your PC, laptop, tablet, phone, Raspberry PI or anything that has or can interface with a camera converts each incoming fiber's light to a number.

You design the sensors based on the principle of blocking light.  Alternatively LEDs can be placed within individual sensors.  In either case, FiberGrid is able to sense how much light a mechanical sensor blocks and give you a value in software.

How the software works

There are two parts to FiberGrid software.  FiberCal is a calibration program that finds centers and bounds of the fibers in the camera's visual field and saves this information in a file.  Second is the FiberGrid "driver".  It uses the config file and provides a simple API for reading your sensors.  

The location of the fibers should never change if you have made the hardware device properly.  This allows me to separate the driver and calibration software for two reasons.  Detecting fibers can be done more accurately with human interaction.   The second reason is portability.  The driver could probably be written in 50 lines of python or java or C# code or re-written in C++ without using OpenCV.  Meanwhile the calibration utility does not need to change.

Here fibergrid calibration utility (fc) is detecting 3 fibers in the grid.  Image on the left is a closeup of one of the fibers.  You have an ability to change the fiber detection threshold, fiber visual size and add or remove fibers manually by clicking.  You should configure fibergrid to collect light from abount 100 pixels for each fiber (indicated by a green square). Fiber size is the square side in pixels.  Save the config file by pressing "S"!  Software is available here:

How the sensors work

All FiberGrid sensors block or capture light.  For example, an optical encoder is one type of sensors that block the light.  I am currently working on a rotary optical encoder for FiberGrid. (see project logs)  Fibers can also be used as a compound eye to capture ambient light.

Try placing one fiber from the light module and another fiber from the camera into each side of a thin drinking straw or fiber cladding.  While watching the cam on the screen, push the fibers in and out or bend the straw.  Notice how the brightness of one dot on the screen changes.  You've just made your first sensor.

fibergrid_sensor1 in the 3D model pack uses a piece of flat polarized plastic (film) from disposable 3D movie theater glasses to make rotation sensors.  It has two small pieces that spin relative to each other.  When polarization of the pieces is at 90 degrees they will block a lot of light coming from the emitter fiber. (see build instructions)

As you can see, It is easy to make linear/rotary position sensors.  Measuring force is harder.  It requires as little displacement as possible and stability over a wide temperature range.  Making  intrinsic fiber optic strain sensors is difficult!  In addition, currently FiberGrid does not perform spectral analysis of the light.  It measures the total amount of light received.  Here are the alternatives for creating force sensors that come to mind:

* Very stiff position sensors.
* Stiff compliant semi-transparent material / 3D printer filament.
* Stiff reflective material that changes...

Read more »

Zip Archive - 67.51 kB - 09/06/2019 at 01:38


JPEG Image - 2.70 MB - 09/06/2019 at 01:01


Zip Archive - 148.77 kB - 08/27/2019 at 20:08


JPEG Image - 2.62 MB - 08/27/2019 at 19:55


JPEG Image - 2.30 MB - 08/27/2019 at 19:55


View all 27 files

  • 1 × Plastic fiberoptic cable Cheap plastic insulated end glow optical fiber. I bought 100ft of 1 mm black jacket star ceiling optic lighting fiber for about $22USD from It consists of a very loose-fitting jacket over a plastic core.
  • 1 × USB camera Depending on your needs it can be a $5 usb cam or a Raspberry PI cam or in my case a $65 Kayeton Technology 330fps at 640x360 with a 4mm manual focus lens usb camera from aliexpress. Camera framerate is important but resolution is not! High FPS allows FiberGrid to read sensor values at a higher rate. Camera needs to be able to focus on objects close to the lens (1 to 3 inches). Manual focus lense is the best.
  • 1 × USB LED lamp USB LED lamp or a small flashlight. Do not use lasers as they can burn out the sensors in your camera!
  • 1 × 3D printer and BLACK PLA filament A 3D printer and BLACK PLA for printing all components. Black PLA is used to block ambient light.

  • Optical encoders

    rand328909/06/2019 at 01:13 0 comments

    Optical encoders are the easiest sensors to use with FiberGrid!  Here I am testing an encoder with two fibers attached to it

    In the future, I will make an encoder wheel with pegs out of alignment in order to place tracks close together. It will also have slits narrowing towards one end to block more light and increase precision.  For now I've taken an existing encoder wheel I've found on thingieverse and created a bracket that fits fibergrid plugs.  Bracket can be downloaded here.

  • Fibergrid enclosure for board cameras

    rand328908/27/2019 at 20:10 0 comments

    I am working on a one-piece (grid attached to shroud) version for a board camera.  For now it has one plug hole.  It prints under an hour in vase mode. It can also be printed as a multi-layer shell.

  • Request for information

    rand328908/25/2019 at 01:46 0 comments

    Computer mice have optical sensors in them that have hundreds of pixels and internal framerates of thousands of frames per second.  Many of them allow raw image readout.  Reading them at high FPS is another story.  I've heard about read speeds of only 10fps over serial.  At that speed mouse sensors could only be used to add FiberGrid support to low end MCUs without USB.  If you succeed at reading any mouse image sensors at 30 fps or higher using any bus or find inexpensive high fps cameras or CCD/CMOS image sensors, please let me know!  Would TOF cameras be any good for this?

    Another possibility are CMOS linear image sensors. (Toshiba or Espos)  The problem is focusing hundreds of fibers on a short (8 to 30mm) narrow window.  You need an MCU to control them.  With linear sensors you no longer need FiberGrid software.

  • Please share your sensors!

    rand328908/25/2019 at 01:45 0 comments

    Please share your sensor designs!  Send me a link to your creations or pictures and suggestions to toandrey(at)yahoo(dot)com

View all 4 project logs

  • 1

    Software is available here:

    Git clone. Change to the directory and type make.  Build the hardware and connect it to your computer.  Run fc (fiberCal) and generate fiberinit.h by pressing "s".  Play with fc sliders to get the best fiber detection (green squares around fibers).  Add fiberinit.h, fibergrid.h and fibergrid.cpp to your project or run ft (fibertest.cpp).  Use FiberGrid::read() or FiberGrid::readNormalized() to get sensor values!  Run your project to see the sensor values on a debug screen.  Comment out FIBERGRID_DEBUG to disable driver debug screen.  Currently both fiberCal and "the driver" programs rely on OpenCV library being installed to read the camera.

  • 2
    Making the hardware

    There are two versions of FiberGrid.  One for R&D and testing.  It features detachable fibers that can be disconnected from the grids.  Both fiber ends are glued into small 3D printed connectors.  The second is a "production version" where fibers are glued directly into the grids of the camera and light modules on one side and have a connector (plug) on the other.  This allows packing more fibers into the grid.  The diameter of the connector is greater than a plain fiber and takes up more grid space.  I am using a 1mm fiber.  If you need more than 200 - 300 sensors, try using 0.5mm fiber.  It should allow for a denser grid.  

    * Choose between the two designs. Current R&D version models allow for 16 or 86 connections to each module.  The "production" version has 100 and 216 hole plates.

    * Download FiberGrid 3D models and print the parts.  I used Creality Ender 3 to print my parts.  Cleanup the holes with a 1mm drill bit, a bit with diameter of your cladding and a ~4mm bit for large holes.

    * Assemble the light and camera modules as shown in the pictures below.

    * Cut the fiber into pieces of appropriate length depending on your project.  If you have chosen the R&D version, glue the connectors onto both fiber ends with superglue.  Otherwise glue one connector to one fiber end and glue the other end directly into the grid of the camera module.  Do the same for the light module fibers.  Plug unused holes with pegs (R&D version) or fill them with black silicone.

    * Print some sensors or design and print your own sensors with a 4mm diameter holes for fibers coming from the light module and going to the camera module.

    fibergrid bench is the largest component and takes several hours to print.  Try using 20% infill and a 0.3 mm layer height.

    The grid with 16 plug holes is attached to the fibergrid bench with two screws.

    In the picture above the camera is attached to the bench with a bolt.

    The shroud is pushed onto the grid and the camera slides into it. After that the camera bolt is tightened.

    Light module shown here is already assembled with two screws and a ziptie holding the flashlight to the base.  Flashlight front should not be touching the PLA parts since they can melt or deform.

    Closeup of the assembled fibergrid light module.

    Attaching the fibers to the light module and camera module.

    A sensor (fibergrid_sensor1.obj) is connected between the light and camera modules.

    Two more fibers are added to the camera module.

    This is my spool of 1mm fiberoptic cable.

    A length of the fiberoptic cable with two plugs glued to both ends.  The fiber and the jacket are inserted into the plug with a drop of glue in it.  After the glue sets, clip off the end of the fiber with scissors.

    Plugs, and a sensor in the background.

    Choices for the grid: 16 connectors, 100 holes, 216 holes.  In the two grids on the right the fibers have to be inserted and attached with glue directly.

  • 3
    Alternative construction techniques

    If you do not have a 3D printer, you can still play with this technology.  Bunch-O-Baloons water baloon straws are perfect for putting up to 37 fibers in a grid.  Fibers can be attached to individual straws with superglue.  Bunch-O-Baloons can screw onto a neck of a plastic water bottle making it easy to attach to any container with a light or a camera.  Glue the other end of the fibers directly into your sensors.  Paint everything black or wrap with black tape.

    As an alternative to Bunch-O-Baloons, drill holes with the diameter of your fiber through two sheets of black 3mm thick plastic.  Enlarge the holes in one sheet to the thickness of your fiber jacket.  Align the holes and glue the two sheets together.  Secure fibers into the holes with glue.  When the fiber is inserted it goes through both sheets of plastic, however the jacket will go in half way making a secure connection.

View all 6 instructions

Enjoy this project?



esot.eric wrote 08/26/2019 at 20:14 point

It's a weird-and-still-new to me era when image-processing is easier [and maybe even cheaper?] than using discrete photo-transistors. But it seems to be that way now, at least for some! Especially considering the ubiquity of devices and learning-tools with inbuilt cameras and limited GPIO.

This is an interesting and clever 'hack'/design/tool in that realm!

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates