Absolute encoder with esp32 cam ?

Thread Starter

JormaHeinolasta

Joined Dec 11, 2022
4
Hi everyone!

I have a small robotic project where I need absolute enocding. Due to lack of suitable (affordable) commercial products, I decided to make one of my own. I made a program that makes gray encoding stripes for linear slides, and now I have at least two options to manufacture reader for it.
One is to use optical transistors, one is to use cheap camera with sufficient framerate.

I have now tested ESP32 CAM AI-Thinker and it seems suitable at least from framerate point of view. 52 fps with 120x160px frames.

The camera will be fixed on relation to encoder strip and each black or white square can be read absolutely from the same point on the pic.
Any leads from where should I start searching information about how to do it, or have someone already done it?



IMG_20221211_115106_resized_20221211_115122841.jpg
 

DNA Robotics

Joined Jun 13, 2014
647
I like your encoding stripes. Is it just 8 bit? I think I would try the optical transistors first. It would be an easy to use direct read number. No AI or translating needed.
 

MrChips

Joined Oct 2, 2009
30,720
Hi everyone!

I have a small robotic project where I need absolute enocding. Due to lack of suitable (affordable) commercial products, I decided to make one of my own. I made a program that makes gray encoding stripes for linear slides, and now I have at least two options to manufacture reader for it.
One is to use optical transistors, one is to use cheap camera with sufficient framerate.

I have now tested ESP32 CAM AI-Thinker and it seems suitable at least from framerate point of view. 52 fps with 120x160px frames.

The camera will be fixed on relation to encoder strip and each black or white square can be read absolutely from the same point on the pic.
Any leads from where should I start searching information about how to do it, or have someone already done it?



View attachment 282778
Your encoder strip is a clever idea. It looks like straight 8-bit binary and not gray code.
You did not state your range and resolution required.

Another option would be to salvage an encoder strip from a discarded printer and use optical quadrature encoders plus a home sensor.
 

John P

Joined Oct 14, 2008
2,025
Or use a strip with wide and narrow bars/spaces forming a pseudo-random code. The pattern will tell you where you are over the length of the encoder, and you can use exact detection of the edges of the marks versus camera pixels to give you fine resolution.
 

Thread Starter

JormaHeinolasta

Joined Dec 11, 2022
4
Thanks for hints. One of my friends back home discovered this:
Polulu has sensor array and from github can be found a library for it.

https://en.wikipedia.org/wiki/Gray_code explains following:

The reflected binary code (RBC), also known as reflected binary (RB) or Gray code after Frank Gray, is an ordering of the binary numeral system such that two successive values differ in only one bit (binary digit). For example, the representation of the decimal value "1" in binary would normally be "001" and "2" would be "010". In Gray code, these values are represented as "001" and "011". That way, incrementing a value from 1 to 2 requires only one bit to change, instead of two.

When moving fast not all readouts need to succeed, we know we are still in sensible area when the readout stays in sane range, what ever that in this situation is. I know once I've tried.

The whole idea is to get rid of expensive loop-back steppers and servos.
 

ErnieM

Joined Apr 24, 2011
8,377
Using a Gray encoded strip is going to pay off well. Looking at your binary coded strip my worry was "what is the output when on an edge of two numbers?"

With Gray encode you still get a reasonable result.
 
Top