No video

Arduino DRO Linear Scale Interface

  Рет қаралды 24,566

m0xya

m0xya

Күн бұрын

#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
@chiparooo
@chiparooo 2 күн бұрын
Very cool! Thanks for sharing!
@Gigator
@Gigator 3 жыл бұрын
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.
@numptie01
@numptie01 3 жыл бұрын
This is excellent. Fantastic insight from hardware to software. The bloopers are well worth leaving in ; ]
@m0xya
@m0xya 3 жыл бұрын
Many thanks..
@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.
@OhHeyTrevorFlowers
@OhHeyTrevorFlowers Жыл бұрын
Exactly what I was looking for. Thank you for sharing.
@wizrom3046
@wizrom3046 2 жыл бұрын
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 жыл бұрын
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 жыл бұрын
@@m0xya thank you, looking forward to it. Subbed. 👍🛎
@airman2468
@airman2468 2 жыл бұрын
@@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..
@mtraven23
@mtraven23 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?
@David_11111
@David_11111 Жыл бұрын
yay very cool project, would love to chat more..
@m0xya
@m0xya Жыл бұрын
hi, many thanks.. email at your will
@hosseinashkboos5188
@hosseinashkboos5188 2 жыл бұрын
Excellent Thank you sir.
@hosseinashkboos5188
@hosseinashkboos5188 2 жыл бұрын
Is the digital readout showing actual distance or does it still need to be converted to read actual distance moved? Thanks
@m0xya
@m0xya 2 жыл бұрын
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..
@tpsintra
@tpsintra Жыл бұрын
Excelente vídeo Muito bom conteúdo Obrigado
@m0xya
@m0xya Жыл бұрын
Many thanks, Phil
@TechTomVideo
@TechTomVideo 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 жыл бұрын
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
@winandd8649
@winandd8649 9 ай бұрын
Awesome, thank you! 😎
@m0xya
@m0xya 9 ай бұрын
Thanks
@darren7650
@darren7650 10 ай бұрын
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?
@hosseinashkboos5188
@hosseinashkboos5188 3 жыл бұрын
Excellent Thank you
@m0xya
@m0xya 3 жыл бұрын
Many thanks..
@hosseinashkboos5188
@hosseinashkboos5188 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
@safetybeacons8124
@safetybeacons8124 Жыл бұрын
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
@CHIPLOAD
@CHIPLOAD 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 жыл бұрын
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
@Stefan_Van_pellicom
@Stefan_Van_pellicom 7 ай бұрын
Would it be possible to use an Arduino to sum 2 linear scales and transmit the combined signal to the DRO ?
@DreamerMos
@DreamerMos Жыл бұрын
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..
@Likeaudio
@Likeaudio 3 жыл бұрын
This is a very good video. Are the pulses spaced by microns ? Each change is 5 microns?
@m0xya
@m0xya 3 жыл бұрын
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.
@piotr5455
@piotr5455 Жыл бұрын
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 11 ай бұрын
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
@ohsnapfit2096
@ohsnapfit2096 6 ай бұрын
Whats the pin out for the DB9 connector?
@mtraven23
@mtraven23 7 ай бұрын
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.
@jasenolan7357
@jasenolan7357 Жыл бұрын
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
@leizhao1387
@leizhao1387 Ай бұрын
coooooooooool
@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.
@ChrisS-oo6fl
@ChrisS-oo6fl Жыл бұрын
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
@FNickerson-tj1hh
@FNickerson-tj1hh Жыл бұрын
Excellent coding examples! Thank you. Are your examples downloadable anywhere?
@zouz6
@zouz6 2 жыл бұрын
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.
@alvarogonzalezperez3333
@alvarogonzalezperez3333 8 ай бұрын
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
@mikemorris3033
@mikemorris3033 2 жыл бұрын
Hi- did you complete the project to installation. I would like to have a private discussion about this.
@m0xya
@m0xya Жыл бұрын
Hi, it is still an ongoing project. Slow and steady..
@joecox9958
@joecox9958 4 ай бұрын
I thought you would at least give the DRO link so people can follow?
@honey-kb5wo
@honey-kb5wo Жыл бұрын
Can you fix also Heidenhain linear encoder
@ferocious_r
@ferocious_r 2 жыл бұрын
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.. kzbin.info/www/bejne/fJWynIh5eKeWbrM
@darkobul1
@darkobul1 2 жыл бұрын
Do those linear scales have an index pulse?
@m0xya
@m0xya 2 жыл бұрын
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.
@franciscoanconia2334
@franciscoanconia2334 Жыл бұрын
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 Жыл бұрын
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: kzbin.info/www/bejne/l6nSqGqBo6enl68
@handdancin
@handdancin Жыл бұрын
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 11 ай бұрын
@@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.
@christopherrumford
@christopherrumford 3 жыл бұрын
Nice video,thank you for taking the time to make and share.
@m0xya
@m0xya 3 жыл бұрын
Many thanks..
@vevor.official  glass scales @TouchDRO
22:48
Shadon HKW
Рет қаралды 11 М.
How to use encoders (Optical, Hall Effect, Quadrature)
20:44
Will Donaldson
Рет қаралды 105 М.
Unveiling my winning secret to defeating Maxim!😎| Free Fire Official
00:14
Garena Free Fire Global
Рет қаралды 9 МЛН
Magic trick 🪄😁
00:13
Andrey Grechka
Рет қаралды 54 МЛН
What will he say ? 😱 #smarthome #cleaning #homecleaning #gadgets
01:00
Whoa
01:00
Justin Flom
Рет қаралды 33 МЛН
How to find connector pinouts of linear scale (linear encoder)? Ep.1
6:09
Mr. Green's Workshop
Рет қаралды 7 М.
Cutting DRO glass scales is easier than you think.
11:25
Mike's Workshop Adventures
Рет қаралды 4,6 М.
HACKED!: Using an HDD Motor as a Rotary Encoder?!
8:21
GreatScott!
Рет қаралды 1,5 МЛН
How to control a DC motor with an encoder
9:30
Curio Res
Рет қаралды 434 М.
PicoDRO, DIY digital readout with the Raspberry Pi Pico. Ep.2
12:01
Mr. Green's Workshop
Рет қаралды 8 М.
DRO digital readout -linear scale- repair for $0,1
4:19
TinC33
Рет қаралды 28 М.
Forget WiFi! This Wireless Method is WAY Better?
12:14
GreatScott!
Рет қаралды 560 М.
Unveiling my winning secret to defeating Maxim!😎| Free Fire Official
00:14
Garena Free Fire Global
Рет қаралды 9 МЛН