building a absolute position encoder from scratch

Поділитися
Вставка
  • Опубліковано 7 лип 2024
  • This is a video about an absolute position encoder. And it’s made only from 3D-printed parts and printed circuit boards. I’m on a mission to make this work up to 5000 rpm. I think it’s possible but there has definitely been some challenges.
    If you are keen on finding out my solution before the next video is released or have your own suggestions on how to fix the challenges, feel free to engage in the comments.

КОМЕНТАРІ • 67

  • @365robots
    @365robots  8 місяців тому

    Go and check out the update implementing Gray code and copper-patch-based patterns in this video:
    ua-cam.com/video/O8CtjtqY2iI/v-deo.htmlsi=OhyIqiVN8XmEPFhG

  • @Clark-Mills
    @Clark-Mills 11 місяців тому +52

    For the encoder disc use grey-code rather than binary. Maybe get the encoder disc cut from metal stock similar to how the solder paste mask sheets are made. Very good work, thanks! Keep it up.

    • @flo47able
      @flo47able 11 місяців тому +3

      A pcb with full copper player should do it. Probably cheaper if you order pcbs anyway.

    • @AndersJackson
      @AndersJackson 11 місяців тому +7

      ​@@flo47ableI eould, as you say, go for PCB encoding plate. BUT seriously, Grey coding is the way to go. You really can not even theoretically construct detectors that manage all binary readings of for example 1111 - 0000 and also all other readings, like 0000 - 1111 where more then two bits change att the same time.
      Grey code is the proper engineering solution.
      But except for that, I don't see any obviously errors in the design.

    • @peepopalaber
      @peepopalaber 11 місяців тому +2

      Thin Metal-Sheets would deform with higher rpm, PCB's would delaminate. Industrial absolute rotary encoders are thick magnetised rings with precise hall-sensors or thick encoding wheels that are one sided etched and/or printed, that a black/white pattern result.

    • @qwerty3663
      @qwerty3663 11 місяців тому +3

      Go with a Single Track Gray Code instead.

    • @Clark-Mills
      @Clark-Mills 11 місяців тому +1

      @@qwerty3663 Thank you, just looked it up and it's rather good! Excellent pointer, Cheers! :)

  • @JonnyDeRico
    @JonnyDeRico 11 місяців тому +21

    to increase signal to noise ratio, I would not have placed the leds in one line to each other - this is prone to interference on the receiving side. You could modulate the amplitude of the leds signals and only read the inputs on high amplitute. Doing this with phase offset for each led driving signal. If there are allways on - build some kind of mask / tunnel before the photo transistors to narrow their field of view. use a schmidt trigger on the receiving side. build a calibration routine... their are plenty of improvements :) But you will get there. Fill free to ask me :)

    • @365robots
      @365robots  11 місяців тому +4

      A lot of great suggestions! I will keep them in mind whilst debugging.

    • @AndersJackson
      @AndersJackson 11 місяців тому +2

      That is a great suggestion to solve the interfearence problem, and using Grey encoding of position.
      Nothing that is hard to do.

    • @Sekir80
      @Sekir80 11 місяців тому +5

      @@365robots Gray code, Gray code, Gray code!

  • @idahobob
    @idahobob 11 місяців тому +8

    I've had problems with blocking IR LED's with opaque maaterials. Paint your encoder wheel black and see if the dark signal is stronger.
    On your next encoder, leave the copper on it to block all light, as well as use Grey Code which will double your resolution, as well as eliminate many other problems.

  • @Spacefish007
    @Spacefish007 11 місяців тому +5

    why not just use a photodiode with a TIA? It works quite well. reverse bias the photodiode to use the diode in photoconductive mode, this increases response time.
    One way to increase the signal amplitude is to use a very high resistor for the feedback loop in the Op-Amp and apply an controllable offset-voltage at the positive terminal (potentiometer between GND and VCC). That way you can substract a fixed offset (ambient light) but still get the high gain / signal amplitude.
    Regarding the gray-code slot disk: Why not order it made from PCB-Stencil? It has way sharper edges/resolution in the slots and is thinner / does not as easily colide with other things. Just make a 95% circular slot arround the outline and leave 4 small bridges to cut it out of the stencil manually.

    • @365robots
      @365robots  11 місяців тому +1

      Offsetting the Ambient is a great suggestion. I was even thinking about including an additional diode to measure the ambient light and automatically adjust the offset voltage using a DAC.

  • @SojournerDidimus
    @SojournerDidimus 4 місяці тому +2

    Using flip chips for the LEDs might allow for a completely flat surface on the LED and photodiode PCBs.

  • @DisorderedArray
    @DisorderedArray 11 місяців тому +2

    You could 3d print a thin disc that has fitting slots for the smd components on the pcb boards. It only has to be as thick as the largest z dimension of the smds, and could be glued to the pcb. It would stop the encoder disc rubbing on the pcb components, and if its printed in black filament, then it would help stop stray light.
    I use such thin 3d printed shields on my pcbs, as light guides or just for aesthetic reasons.

  • @GorgotMM
    @GorgotMM 11 місяців тому +2

    You should stagger the LEDs coverng the whole circumference to limit interference. It would also make construction easier.
    And as others have noted, use gray code.

  • @artrock8175
    @artrock8175 11 місяців тому +1

    Awesome project! Thanks for sharing! 🙏

  • @Corbot130
    @Corbot130 11 місяців тому +1

    Super cool stuff!

  • @sleepib
    @sleepib 11 місяців тому +1

    Can get rid of a whole PCB by using reflecting vs absorbing segments and putting the LEDs on the same board as the phototransistors. Can just use a regular 2d printer to make those.
    If you don't want to use gray code, add another copy of the finest encoder ring, but offset it. You can use this signal to time the absolute reads so you don't get messed up by imperfect transitions, or you can just use those two finest channels as a quadrature encoder.
    Before going to an opamp, I'd try a BJT to amplify the signal.

  • @SarahKchannel
    @SarahKchannel 11 місяців тому +1

    I built something similar, not an absolute position encoder - just an encoder. I ran into the same issue with the LED/Transistors. Your encoder disc should not be translucent, have not reflective edges etc.. so there is not spill of IR.
    Further I had to add a Schmitt-Trigger circuit to get the signal clean and digitized for the MCU to read.

  • @Vandy_fpv
    @Vandy_fpv 11 місяців тому +1

    Keep it up big dawg! Awesome stuff

  • @user-dk9je2mb4x
    @user-dk9je2mb4x 11 місяців тому +2

    I made this technology but for Linear type encoder in my room. But I compensated for the interference by changing the brightness of the LEDs. IR light passes well through plastics. Use a different type of disk partition.

    • @365robots
      @365robots  11 місяців тому +1

      Thanks for your contribution! Noted the easy passage trough the FR4 as well. Will probably use copper traces to block the light on the next revision.

  • @jr0th
    @jr0th 11 місяців тому

    Beside many good ideas from other comments, here's are my two cents:
    - as FR4 PCB is partially transparent to IR, you may design your disc without any cutouts, but using top and bottom copper layers to block the light, this will also help to not instantly rip the components off the board,
    - on your phototransistor, you most likely need a pulldown as the phototransistor is not totally cut-off, so the more your input impedance, the less the voltage difference, (probably adding some pulldown around 30k to 60k will quite surely make your current design usable),
    - you may need to reduce your emitter power: at the usual power, the IR will bounce off everything, making the detection harder than needed, or better, you may command each emitter individually to eliminate interference.

  • @Kilohercas
    @Kilohercas 11 місяців тому +1

    Use higher power LED, as well as with lens on top to focus light more (narrow beam LED, it will give 10x more light). Also IR will be transmitter over FR4, you need to make it opaque for IR. Use black paint or stencil on your optical scale.

  • @duncanmarks1590
    @duncanmarks1590 8 місяців тому

    Hi, very good start and impressive assembly but as others have already said an optically solid disk may solve most of the signal to noise issues. also Grey code is designed specifically for this application. bye

  • @adam207321
    @adam207321 11 місяців тому +2

    avoid photo transistors they are slow to respond to light changes. Even if your cransconductance amplifier will work for detecting the small changes your finest most dense holes will be muffled together and the phototransistor just wont be able to keep up after a few kHz (assuming the number of holes the resolution, the speed of switching of the finest holes will be above a 100kHz. This requires SERIOUS processing power to say the least.
    Use photo diodes instead, with a transconductance amplifier with schmidt triggering. This will get you closest to what you need on a cheap scale. I can help you with the schematic and building the thing if you wish. I have myself considered a high speed photo measuring device for calibrating camera shutters where you measure the exposure time, essentially how long is the photodiode recieving light. My device would work up to 1/10000 of a second ( 10kHz) but that will not be fast enough for your encoder at 5k rpm. I would also consider a different solution for the photo interupting wheel. How about printing it on thin translucent foil with an ink jet? This would get you a thin and smooth surface against which rubbing is not such a huge problen (except maybe wear). Also at 5krpm the expansion might be too large so accound for that. Such thin PCB stuff does not appreciate such high forces and I am willing to bet this will become a high speed shrapnell hazard at 3k rpm. But there is a solution! Ever heard of SMT stencils? Yes those. You could have them made by JLCpcb and such. This would offer you a easy cheap way to make a precise and thin encoder wheel. Good luck man.

    • @365robots
      @365robots  11 місяців тому +1

      Thanks for the detailed response! Moving towards photodiodes is probably unavoidable at this point. Ideally I would still like to keep the PCB encoder wheel, just to keep the price down.

    • @adam207321
      @adam207321 11 місяців тому +1

      @@365robots fair. Also you should have the wheel painted black and separate light paths for each photodiode to avoid crosstalk problems.

  • @polkiipo
    @polkiipo 11 місяців тому +3

    Very interresting, I had a lot of surprise using phototransistor in the past. I'm curious about how you will handle this :)

  • @UmbraAtrox_
    @UmbraAtrox_ 11 місяців тому +1

    good channel. subscribed

  • @neilbarnett3046
    @neilbarnett3046 11 місяців тому

    I'd put everything except the LEDs on the other side of the PCB, maybe even put them in holes, really reduce the depth of the extraneous components on the disk.

  • @Ambassador_Kobi
    @Ambassador_Kobi 11 місяців тому +4

    Why didn't you use gray code for the encoding wheel?

    • @365robots
      @365robots  11 місяців тому +1

      Wanted to keep everything easily understandable. But that’s for sure one of the first upgrades happening.

    • @AndersJackson
      @AndersJackson 11 місяців тому +1

      ​@@365robotsgray coding isn't hard to understand, and covering it back to binary encoding in software is really just a lookup in a array of constants.
      Not hard to understand at all. And reduces hardware detection of false positions.

    • @adam207321
      @adam207321 11 місяців тому +1

      @@AndersJackson however we dont really know what kind of processing power he has at hand. While it would be easy to do so, an arduino will definitely not be able to keep up real time positioning at 5k rpm (there would be tooo mich data for the arduino to crunch trough including driving the motor into the precise spot)

    • @godfreypoon5148
      @godfreypoon5148 11 місяців тому +1

      @@AndersJackson or a few logic gates

    • @AndersJackson
      @AndersJackson 11 місяців тому +1

      @@adam207321 fetching data from an array isn't a hard problem to solve. And if that IS a problem, then he really should consider another CPU. Yes, it isn't a problem in a Arduino.

  • @conorstewart2214
    @conorstewart2214 11 місяців тому +1

    How do you plan to use this? If you just attach it to the motor output shaft it won’t be much use as an absolute encoder as the motor will rotate it many times when moving from one end to the other, so there will be many points with the same encoder output, so it probably won’t be much more useful than just an off the shelf magnetic absolute encoder used like that or just a quadrature encoder. Even if that wasn’t an issue it looks like you only have an 8 bit encoder which means a maximum resolution of 1.4 degrees, which isn’t really small enough to deal with the 1.8 degree step angle of most stepper motors and definitely not if microstepping is used.
    If you plan on gearing the encoder off of the motor shaft so the encoder gives its linear position along the axis then your resolution will be pretty bad, a maximum of around 2 mm on a 500 mm axis.
    If you just used an off the shelf absolute magnetic encoder then your resolution would be better, even cheap ones are 12 bit and they have the advantage of not adding much inertia to the shaft. A PCB disc, that rubs, mounted on bearings might not hold up at high speeds, but a tiny magnet added to the end of a shaft with no need for bearings may be better.

    • @365robots
      @365robots  11 місяців тому +1

      I have plans to integrate it into a custom robotics actuator. The absolute encoding will enable FOC for the motor.

    • @conorstewart2214
      @conorstewart2214 11 місяців тому +1

      @@365robots wouldn't using a magnetic encoder be better and easier? That seems to be what odrive and other projects use.

  • @GeekDetour
    @GeekDetour 11 місяців тому +2

    Hi there! You made an 8-bit encoder right? I was about to suggest the AS5600 - it's a 12bit magnetic encoder - but the RPM will be FAR less than what you want to achieve... Wow... 5000 RPM!? Good luck! Excellent video.

    • @Nicolas_dG
      @Nicolas_dG 11 місяців тому +2

      MA702 should be a great replacement, works up to 12000rpm for sure, dont remember of the precision but should be 12bit

  • @ibrahimkocaalioglu
    @ibrahimkocaalioglu 11 місяців тому +1

    Have you considered magnetic encoder ?

  • @tommays56
    @tommays56 11 місяців тому

    Ya by the time the kick stepper current is high enough to develop full torque the motion get very cog ⚙️

  • @gxurma
    @gxurma 8 місяців тому

    Hey, ever heard of Grey coded or brujin encoder disks? Muuuch easier to handle, and the alignment of the sensors is also much easier.

  • @Leonelfreak
    @Leonelfreak 7 місяців тому

    do you know how someone is able to make an encoder code disk the size of a penny? im trying to build something for a video game controller and the disc holes need to be around .40mm and the disc it self has to be around 10mm

  • @schorschoppenheim1825
    @schorschoppenheim1825 8 місяців тому

    just cannot reach very high resolution, not properly for motor control itself. for some limited application, for example, after the reduced gearbox, if the motor already equipped with a high resolution encoder.

  • @heartminer5487
    @heartminer5487 11 місяців тому

    rather than using milled pcb I would recommend laser printed vinyl sheet

  • @hugoelec
    @hugoelec 11 місяців тому +1

    You should use steel sheet plate instead of pcb board. Or at least paint that pcb black to increase signal

    • @365robots
      @365robots  11 місяців тому +3

      Thanks for the suggestion! Tried to avoid this initially but might have to go there at some point.

    • @AndersJackson
      @AndersJackson 11 місяців тому +2

      Or just use a solid copper layer on the encoding plate.

  • @Noconstitutionfordemocrats1
    @Noconstitutionfordemocrats1 11 місяців тому

    Does anybody know if this video was made by AI?

  • @godfreypoon5148
    @godfreypoon5148 11 місяців тому

    Buddy, you urgently need to learn what "Gray Code" is.

  • @DaisyWang-ss7pl
    @DaisyWang-ss7pl 11 місяців тому +1

    Nice video! Don't know if any PCB or 3D printing services are needed for your upcoming content, if so, would love to sponsor and achieve any cooperation together! (PCBWay Daisy)