Arduino DRO Linear Scale Interface

Поделиться
HTML-код
  • Опубликовано: 15 сен 2024
  • #DRO #Arduino #LinearScale
    For a future project I need to identify and decode the signals from a DRO Linear Scale. In this video I explain the construction and demonstrate the signals output by the linear scale. I then use an Arduino to decode the positional data and display it on an LED 7 segment display.
    The Arduino source code for those who want to take a peek..
    github.com/m0x...
    www.ti.com/lit...
    en.wikipedia.o...
    en.wikipedia.o...

Комментарии • 74

  • @Gigator
    @Gigator 3 года назад +5

    Excellent video, got my linear glas scales up and running as a total arduino newbie in 15 minutes. Now I know they do "something" and I just have to figure out what setup I will end up using.

    • @m0xya
      @m0xya  3 года назад

      Awesome.. Glad it helped.

  • @ryangross6886
    @ryangross6886 6 месяцев назад

    Bought an oscilloscope recently, this was such a fun project to learn the ropes with it. Used your code in my project, thanks for such a great video!

  • @mannycalavera121
    @mannycalavera121 9 месяцев назад

    Thanks for the video, i recently bought a DRO scale for a Bridgeport but don;t need a full DRO readout, only for reference, the one i NEED isn't in stock so with this video i'll be able to reverse engineer the DRO myself. Thanks again.

  • @KW-ei3pi
    @KW-ei3pi 11 месяцев назад

    This is AWESOME! Thank you so much! I have made an Arduino controlled Stepper Motor power feed for my Bridgeport milling machine, that uses a Rotary Encoder for fine jogging. This opens up a world of possibilities! I will be checking your channel for more. Best regards.

  • @numptie01
    @numptie01 3 года назад +5

    This is excellent. Fantastic insight from hardware to software. The bloopers are well worth leaving in ; ]

    • @m0xya
      @m0xya  3 года назад

      Many thanks..

  • @mtraven23
    @mtraven23 2 года назад +2

    great video, exactly the project I'm getting into.
    If I could offer a suggestion on the code end: doing so much inside the interrupt function -could- result in interrupts hitting inside interrupts which (in my experience) makes arduino go a little wonky. but almost none of that needs to happen at the time of the interrupt. all you really have to do is log, in say a queue, that the event happened. then the processor can work on processing the position in the main loop, when its not busy getting interrupts. Admittedly, you'd have to move really fast to run into that problem with just 1 axis, but with more axis, it might cause problems. Also noteworthy: the method I described would likely be a touch more laggy, but be less likely to miss measurements. Just my 2 cents

    • @m0xya
      @m0xya  2 года назад

      many thanks.. yeah the code was thrown together as a proof of concept.. totally agree on order of opperation..

    • @mtraven23
      @mtraven23 2 года назад

      @@m0xya ok I get that. Curious if you considered a dedicated quadrature counter? something like the LS7366R? I'm just in the early stages of designing my dro, trying to workout the best way to go about this.
      were you able to get the whole system working to varry speed in accordance with cutting diameter? That's a feature I have long wanted (but no VFD :( )...i really love hearing cncs ramp up the rpm as they approach the center.

    • @JayarBass
      @JayarBass Год назад

      it was exactly what i was lookin for as well! great info brov, thanks fer lettin me steal yer homework! :D

    • @darren7650
      @darren7650 10 месяцев назад

      @@m0xya do you have updated code that would work in this manner?

  • @chiparooo
    @chiparooo 21 день назад

    Very cool! Thanks for sharing!

  • @wizrom3046
    @wizrom3046 2 года назад +3

    Thanks for documenting this! 👍
    It would have been great to include a diagram of the D connector pinout too, that's very useful.

    • @m0xya
      @m0xya  2 года назад +2

      Thanks for the message. Great idea re. the diagram. I shall put one together and add a link. Keep an eye out for a follow up video showing an advanced way of reading the data at a higher resolution. It is a project I'm currently looking at..

    • @wizrom3046
      @wizrom3046 2 года назад +2

      @@m0xya thank you, looking forward to it. Subbed. 👍🛎

    • @airman2468
      @airman2468 2 года назад +1

      @@m0xya Just subscribed! Looking forward to the follow-up. It is hard to find complete projects on this subject. Thanks for making this.

    • @m0xya
      @m0xya  2 года назад

      @@airman2468 many thanks.. let me see what i can do..

  • @OhHeyTrevorFlowers
    @OhHeyTrevorFlowers Год назад

    Exactly what I was looking for. Thank you for sharing.

  • @christopherrumford
    @christopherrumford 3 года назад +1

    Nice video,thank you for taking the time to make and share.

    • @m0xya
      @m0xya  3 года назад +1

      Many thanks..

  • @darren7650
    @darren7650 10 месяцев назад +1

    How do those numbers translate into centimeters? For example, if you move it a total value of 5,729 as shown in your video when you move it, how many then make a centimeter? Is it possible to figure that out?

  • @TechTomVideo
    @TechTomVideo 2 года назад +2

    Hi,
    first i like to thank you for this enlighting video.
    my question is: why does the lookup table is how it is?
    THEORY:
    as far as i understand the code, you modify the variable "phase" as follows:
    - bitshift left
    - enter value A
    - bitshift left
    - enter value B
    - limit variable "phase" to 4 bits
    so we have 2 bits of the old value of AB (ab) and 2 bits of the new Value (AB).
    "phase" is always build like abAB
    (small letters "ab" means old, captial "AB" means new )
    Possible Values of AB are: 00 10 11 01 00 10 11 01 00 10 11 01 ..... (encoder pulses)
    phaseLookup[] = {0,-1,1,-1,1,0,-1,-1,-1,1,0,1,1,1,-1,0};
    so the variable "phase" only can have the following values:
    [phase = decimal = lookuptable equivalent]
    0010 = 02 = +1
    1011 = 11 = +1
    1101 = 13 = +1
    0100 = 04 = +1
    0001 = 01 = -1
    0111 = 07 = -1
    1110 = 14 = -1
    1000 = 08 = -1
    so the possible values in decimal are: 01, 02, 04, 07, 08, 11, 13, 14
    so the lookup table could look as follows: 0,-1,1,0,1,0,0,-1,-1,0,0,1,0,1,1,0
    QUESTION:
    why has your lookuptable values on position 3, 6, 9, 12
    3 is b0011 which means one step of the encoder was missed and you can't decide in which direction it went, but your table says "-1"
    but it should be + or - 2 which is not clear
    6 is b0110 /// 9 is b1001 /// 12 is b1100 /// same thing
    why did you decide to enter values here?
    did i miss something?
    Thank you for your time
    kindest regards
    Tom

    • @m0xya
      @m0xya  2 года назад +1

      Hi many thanks for the comment. Please give me a short while for a more detailed reply. I will try to find my original notes on the creation of the truth and lookup tables.
      Will get back to you soon,
      Phil

    • @TechTomVideo
      @TechTomVideo 2 года назад

      @@m0xya did you gather some informations?
      i used your bitshift-code successfully for a handwheel digital encoder

  • @tpsintra
    @tpsintra Год назад +1

    Excelente vídeo
    Muito bom conteúdo
    Obrigado

    • @m0xya
      @m0xya  Год назад +1

      Many thanks, Phil

  • @piotr5455
    @piotr5455 Год назад +2

    Nice video. Do you know exactly what happens when the slider changes direction? Normal directions are given by eg ABabABab and BAbaBAba etc, but when the direction changes you get Aa or aA or Bb or bB. What I don't understand is how to count these changes. Does Aa count as eg 1up or 1up & 1down? I'm using my scale to motorise the head movement on a Warco WM18 mill, and each event is 5 microns and important. I can't get the totals to add up right on a change of direction.

    • @m0xya
      @m0xya  Год назад

      Hi, sorry for the delay in replying, busy with work. Someone else asked a similar question a while back. I will try to do a video explaining how the encoding works and how it is translated etc. Keep an eye out for an update.. Thanks..

    • @MarcoS-hv8gt
      @MarcoS-hv8gt Год назад

      I´m currently working on installing a DRO for a college project, I wish we could discuss more about the logic of the encoder, if you´re willing to :D

  • @CHIPLOAD
    @CHIPLOAD 2 года назад +2

    hey, great video i was looking around for some sources and stumbled across this, subbed as well. did you figure out the limits in terms of speed of movement in respect to the capability of the arduino in sampling the signal? i am really wondering if this will be fast enough or if i have to go with a dedicated chip for that part. all the best, cheers!

    • @m0xya
      @m0xya  2 года назад +3

      hi, thanks for the comment. glad you found it interesting. as far as speed of movement, i haven't tested it for max speed. for my use an arduino will probably be fine, as i would not be moving faster than 10cm per second. there are 2000 pulses for each 1cm movement. and the arduino is running at ~18mhz. so if you moved at 10cm per second it would be 20000 pulses per second. the processing done by the arduino is quite simple (hence the reason why i removed the if else loops). what i would do is use one arduino to capture/count the pulses and another to handle any complex calculations, that way you would always have a source of truth which would feed its value to the other one when needed.
      however, i have an updated version in the pipeline which will also dramatically increase the resolution to 0.1um. i am still playing with the design, but keep an eye out for an update.
      many thanks,
      phil

    • @CHIPLOAD
      @CHIPLOAD 2 года назад

      @@m0xya thanks for the reply! yeah i was thinking the same using a dedicated arduino for sampling per linear scale and then feed this into another one for processing/displaying/etc. i was just not sure if that would make the most sense since getting some dedicated IC wouldn't be too hard or even some sort of FPGA would work too. cheers, daniel

  • @mtraven23
    @mtraven23 8 месяцев назад

    so I used your video a year ago for the first time, now I gotta do it again & forgot how! lol. thanks again!
    I'm curious, was your scale advertised to have a home position?
    Both of mine were said to have a Z channel to home to, and the wire is there for it in the tether, but I spent days trying to clock a signal on that line before giving up. All the IC's you showed, are potted on version. I can take the lid off, but its just a block of black and I'm not gonna dig into a working scale. If my electronics are like yours, as I suspect they are, its quite clear that 3rd channel doesn't exist.
    one other question, is there anything in those electronics that would suggest running at 3.3v would be a problem? I've test it on mine, it seems to work fine...but I might not notice a small error, the sort that being under powered might produced. I'm trying to run the whole thing on a 3.7v battery with a 3.3v MC, its a whole lot simpler if I dont need to send 5v to the scale.

  • @Hossein_Ash
    @Hossein_Ash 2 года назад +1

    Excellent Thank you sir.

    • @Hossein_Ash
      @Hossein_Ash 2 года назад +1

      Is the digital readout showing actual distance or does it still need to be converted to read actual distance moved? Thanks

    • @m0xya
      @m0xya  2 года назад +1

      Hi, so on the example code it is just counting the number of markers on the glass strip, so in theory this is in microns. So the numbers shown are microns travelled, however, to make it more usable you would need to convert it to mm or inches. Hope this helps..

  • @David_11111
    @David_11111 Год назад +1

    yay very cool project, would love to chat more..

    • @m0xya
      @m0xya  Год назад

      hi, many thanks.. email at your will

  • @ohsnapfit2096
    @ohsnapfit2096 7 месяцев назад

    Whats the pin out for the DB9 connector?

  • @Stefan_Van_pellicom
    @Stefan_Van_pellicom 8 месяцев назад

    Would it be possible to use an Arduino to sum 2 linear scales and transmit the combined signal to the DRO ?

  • @nathandalemccann
    @nathandalemccann Год назад

    I'm just in the beginning stages of researching something like this but need to zero in at different positions and trip a solenoid at a certain position or if two encoders are out of sync. Application is left and right sides of a press brake to control tilt and stop limit. Is it possible? I have zero Arduino experience but some CNC, electronics, and BASIC programming. I understand I would be learning C. I would like to do this in addition to a CNC backgauge (2 axis) with a CNC shield, maybe control a couple other simple things.

  • @Likeaudio
    @Likeaudio 3 года назад +1

    This is a very good video. Are the pulses spaced by microns ? Each change is 5 microns?

    • @m0xya
      @m0xya  3 года назад +1

      Many thanks.. It is slightly more complicated than that, but fundamentally, yes each pulse (or change in phase) represents a movement of 5 microns. The pulses also provide direction information. If you were just counting each pulse you would not know if you were moving up or down (left or right). By having the two channels A/B it is possible to detect the direction of travel.

  • @jasenolan7357
    @jasenolan7357 Год назад +1

    Would any adjustments to the code need to be made for this to work on a 750mm linear scale?

    • @m0xya
      @m0xya  Год назад

      hi, the overall length of the scale should not make any difference. just so long as the reader head is the same and generates the same output. let me know how you get on. phil

  • @safetybeacons8124
    @safetybeacons8124 Год назад +1

    const int pinA = 2;
    const int pinB = 3;
    const int phaseLookup[] = {0,-1,1,-1,1,0,-1,-1,-1,1,0,1,1,1,-1,0};
    volatile bool A = false , B = false,updated=false;
    volatile int counter = 0, phase =0;
    void setup()
    {
    Serial.begin(115200);
    pinMode(pinA, INPUT);
    pinMode(pinB, INPUT);

    attachInterrupt(digitalPinToInterrupt(pinA), trig, CHANGE);
    attachInterrupt(digitalPinToInterrupt(pinB), trig, CHANGE);
    }
    void loop()
    {
    if (updated)
    {
    Serial.println(String(counter));
    updated=false;
    }
    }
    void trig()
    {
    A = digitalRead(pinA);
    B = digitalRead(pinB);
    phase

  • @ChrisS-oo6fl
    @ChrisS-oo6fl Год назад +1

    I’ve been looking for this. I’d like to use an ESP32 and send the data to phone via BLE or via a WiFi AP. I need to display the information in circumference.

    • @m0xya
      @m0xya  Год назад

      Hi, yeah there is no reason why the code couldn't be converted to run on an ESP32.. It just relies on the interrupt and line status values. Thanks,
      Phil

  • @winandd8649
    @winandd8649 10 месяцев назад

    Awesome, thank you! 😎

    • @m0xya
      @m0xya  9 месяцев назад

      Thanks

  • @alvarogonzalezperez3333
    @alvarogonzalezperez3333 9 месяцев назад

    Buenas noches.
    Sabrias de algun dro para reglas de optimun con señal 1vpp (señales 90, 180, 270) o si se pueden modificar las reglas para lecturas ttl.
    Gracias

  • @zouz6
    @zouz6 2 года назад +1

    the code works perfectly for one input from a DRO, how do i introduce another reading from a different direction into this code ?

    • @m0xya
      @m0xya  2 года назад

      Hi, glad you got it working. Are you looking to add another axis (ie. another DRO reader)? If so you would need to duplicate the logic needed to listen for events and use another I/O port which is capable of enabling interupts. I can put together some example code if you like. It is also worth remembering that different Arduinos have different numbers of configurable interupts, so it may not work with the device you're using. Give me a short while and I'll put something together.

  • @leizhao1387
    @leizhao1387 2 месяца назад

    coooooooooool

  • @Hossein_Ash
    @Hossein_Ash 3 года назад +1

    Excellent Thank you

    • @m0xya
      @m0xya  3 года назад

      Many thanks..

    • @Hossein_Ash
      @Hossein_Ash 2 года назад

      Hello and thanks for the replies. I have a question for you if you don’t mind: do you think it is possible to use the glass scale signals as feedback from say the x-axis on a mill which might some run out to overcome the problem of the run out!? Thank you

  • @mikemorris3033
    @mikemorris3033 2 года назад +1

    Hi- did you complete the project to installation. I would like to have a private discussion about this.

    • @m0xya
      @m0xya  2 года назад

      Hi, it is still an ongoing project. Slow and steady..

  • @FNickerson-tj1hh
    @FNickerson-tj1hh Год назад

    Excellent coding examples! Thank you.
    Are your examples downloadable anywhere?

  • @DreamerMos
    @DreamerMos Год назад +1

    Hi! Really good work! Could you please show the pinout of DRO.

    • @m0xya
      @m0xya  Год назад

      I'm working on a few updates to this project. Keep an eye out for them..

  • @ferocious_r
    @ferocious_r 2 года назад +1

    Does the Z line produce any pulse on your scale?

    • @m0xya
      @m0xya  2 года назад

      Hi, sorry for the delay in replying. In answer to your question, no it doesn't have anything on the z line. The only output from these linear scales is channel A/B logic signalling. Take a look at my recent video which looks at the generated signals.. ruclips.net/video/FdOkUCCBc8Q/видео.html

  • @honey-kb5wo
    @honey-kb5wo Год назад

    Can you fix also Heidenhain linear encoder

  • @darkobul1
    @darkobul1 2 года назад

    Do those linear scales have an index pulse?

    • @m0xya
      @m0xya  2 года назад +1

      Hi, thanks for messaging. The scales in the video do not have index pulses. They only have the A/B channels, so there is no way to tell where along the scale the read head is. Some (more expensive) scales do have the index signals.

  • @joecox9958
    @joecox9958 5 месяцев назад

    I thought you would at least give the DRO link so people can follow?

  • @franciscoanconia2334
    @franciscoanconia2334 Год назад +2

    I really hate the pejorative term "chinesium". Let's see what you can build within that price envelope.
    There are plenty of EXCELLENT instruments coming from China at half teh value of european brands. But y'all want high quality within an 10% envelope.

    • @m0xya
      @m0xya  Год назад +1

      Hi, thanks for the comment. I think most people know and appreciate the range of quality available from Chinese manufacturers. The term "chinesium" is used to describe products which are cheaper and as a result are "usually" of an inferior quality. I'm not for one moment suggesting there is anything wrong with this, however, you should be aware of the differences. I buy plenty of items like these due to my budget and requirements. My expectations of the devices are, I would say, accurate to the price being paid and the quality I expect of them.
      A perfect example of chinesium would be the recent video by BigCliveDotCom: ruclips.net/video/axow7KnBtaM/видео.html

  • @handdancin
    @handdancin Год назад +1

    i think you could lose the "outtakes"

    • @m0xya
      @m0xya  Год назад

      thanks for the comment. it is odd, as i have had others comment on how they liked the outtakes.. all comes down to personal taste..

    • @nickp4793
      @nickp4793 Год назад

      @@m0xya Nice job on the technical content of the video. I agree with keeping the out takes out, I almost turned it off. The root issue is the outtakes are repeating information. There are some youtube "creator training" videos that talk about how repeating yourself is one of the worst things to do in a video.