FatCat’s’DIY’Wheel’Encoders’ - Micromouse Online...IniHal’Thoughts’Z’Results’ •...
Transcript of FatCat’s’DIY’Wheel’Encoders’ - Micromouse Online...IniHal’Thoughts’Z’Results’ •...
![Page 1: FatCat’s’DIY’Wheel’Encoders’ - Micromouse Online...IniHal’Thoughts’Z’Results’ • PCB’using’toner’transfer’worked’OK’ • Laser’printed’encoder’discs’worked’OK’](https://reader036.fdocuments.in/reader036/viewer/2022071219/6055cc14f7945b2d71210a95/html5/thumbnails/1.jpg)
FatCat’s DIY Wheel Encoders
by Tim Foden, MINOS 2012
![Page 2: FatCat’s’DIY’Wheel’Encoders’ - Micromouse Online...IniHal’Thoughts’Z’Results’ • PCB’using’toner’transfer’worked’OK’ • Laser’printed’encoder’discs’worked’OK’](https://reader036.fdocuments.in/reader036/viewer/2022071219/6055cc14f7945b2d71210a95/html5/thumbnails/2.jpg)
Overview
• Aims • Versions
– Not suitable – Final
• Conclusions • QuesHons
![Page 3: FatCat’s’DIY’Wheel’Encoders’ - Micromouse Online...IniHal’Thoughts’Z’Results’ • PCB’using’toner’transfer’worked’OK’ • Laser’printed’encoder’discs’worked’OK’](https://reader036.fdocuments.in/reader036/viewer/2022071219/6055cc14f7945b2d71210a95/html5/thumbnails/3.jpg)
Aims
• Would like a resoluHon of < 1mm • Would like quadrature output • Be cheap to make • Small and light • Be buildable in my garage • Easy to mount on the robot • Get iniHal pracHce at making DIY PCBs
[Disclaimer: I don’t really know what I’m talking about]
![Page 4: FatCat’s’DIY’Wheel’Encoders’ - Micromouse Online...IniHal’Thoughts’Z’Results’ • PCB’using’toner’transfer’worked’OK’ • Laser’printed’encoder’discs’worked’OK’](https://reader036.fdocuments.in/reader036/viewer/2022071219/6055cc14f7945b2d71210a95/html5/thumbnails/4.jpg)
IniHal Thoughts
• Use a laser printed encoder paVern disc • Have two sensors, posiHoned 90° apart
– If the encoder paVern has an odd number of cycles then 90° out of phase waveforms are guaranteed
• Use a comparator to convert sine waves to square waves
• Use a POT to set the mid-‐voltage level
![Page 5: FatCat’s’DIY’Wheel’Encoders’ - Micromouse Online...IniHal’Thoughts’Z’Results’ • PCB’using’toner’transfer’worked’OK’ • Laser’printed’encoder’discs’worked’OK’](https://reader036.fdocuments.in/reader036/viewer/2022071219/6055cc14f7945b2d71210a95/html5/thumbnails/5.jpg)
IniHal Thoughts -‐ Board
![Page 6: FatCat’s’DIY’Wheel’Encoders’ - Micromouse Online...IniHal’Thoughts’Z’Results’ • PCB’using’toner’transfer’worked’OK’ • Laser’printed’encoder’discs’worked’OK’](https://reader036.fdocuments.in/reader036/viewer/2022071219/6055cc14f7945b2d71210a95/html5/thumbnails/6.jpg)
IniHal Thoughts – Early Encoder Discs
![Page 7: FatCat’s’DIY’Wheel’Encoders’ - Micromouse Online...IniHal’Thoughts’Z’Results’ • PCB’using’toner’transfer’worked’OK’ • Laser’printed’encoder’discs’worked’OK’](https://reader036.fdocuments.in/reader036/viewer/2022071219/6055cc14f7945b2d71210a95/html5/thumbnails/7.jpg)
IniHal Thoughts -‐ Results
• PCB using toner transfer worked OK • Laser printed encoder discs worked OK • Quadrature separaHon difficult to achieve
– Compounded by other ‘noisy’ signal effects
![Page 8: FatCat’s’DIY’Wheel’Encoders’ - Micromouse Online...IniHal’Thoughts’Z’Results’ • PCB’using’toner’transfer’worked’OK’ • Laser’printed’encoder’discs’worked’OK’](https://reader036.fdocuments.in/reader036/viewer/2022071219/6055cc14f7945b2d71210a95/html5/thumbnails/8.jpg)
IniHal Thoughts -‐ Signals
• This is the kind of signal I expected to see:
![Page 9: FatCat’s’DIY’Wheel’Encoders’ - Micromouse Online...IniHal’Thoughts’Z’Results’ • PCB’using’toner’transfer’worked’OK’ • Laser’printed’encoder’discs’worked’OK’](https://reader036.fdocuments.in/reader036/viewer/2022071219/6055cc14f7945b2d71210a95/html5/thumbnails/9.jpg)
IniHal Thoughts -‐ Signals
• This is the kind of signal I got:
– Amplitude too small – VerHcal ‘wave’ – Horizontally oscillaHng period
![Page 10: FatCat’s’DIY’Wheel’Encoders’ - Micromouse Online...IniHal’Thoughts’Z’Results’ • PCB’using’toner’transfer’worked’OK’ • Laser’printed’encoder’discs’worked’OK’](https://reader036.fdocuments.in/reader036/viewer/2022071219/6055cc14f7945b2d71210a95/html5/thumbnails/10.jpg)
IniHal Thoughts -‐ Signals
• Useless for converHng to a square wave:
![Page 11: FatCat’s’DIY’Wheel’Encoders’ - Micromouse Online...IniHal’Thoughts’Z’Results’ • PCB’using’toner’transfer’worked’OK’ • Laser’printed’encoder’discs’worked’OK’](https://reader036.fdocuments.in/reader036/viewer/2022071219/6055cc14f7945b2d71210a95/html5/thumbnails/11.jpg)
IniHal Thoughts -‐ Signals
• Use a lower resoluHon encoder paVern to get a larger amplitude signal:
![Page 12: FatCat’s’DIY’Wheel’Encoders’ - Micromouse Online...IniHal’Thoughts’Z’Results’ • PCB’using’toner’transfer’worked’OK’ • Laser’printed’encoder’discs’worked’OK’](https://reader036.fdocuments.in/reader036/viewer/2022071219/6055cc14f7945b2d71210a95/html5/thumbnails/12.jpg)
IniHal Thoughts -‐ Signals
• This sHll produces a signal that isn’t really good enough for reliable quadrature:
![Page 13: FatCat’s’DIY’Wheel’Encoders’ - Micromouse Online...IniHal’Thoughts’Z’Results’ • PCB’using’toner’transfer’worked’OK’ • Laser’printed’encoder’discs’worked’OK’](https://reader036.fdocuments.in/reader036/viewer/2022071219/6055cc14f7945b2d71210a95/html5/thumbnails/13.jpg)
IniHal Thoughts -‐ Results
• PCB using toner transfer worked OK • Laser printed encoder discs worked OK • Quadrature separaHon difficult to achieve
– Compounded by other ‘noisy’ signal effects
• Single pot for mid-‐range voltage not good enough
• Used op-‐amp (MCP6002) instead of comparator – Why?
– I think this eventually failed
![Page 14: FatCat’s’DIY’Wheel’Encoders’ - Micromouse Online...IniHal’Thoughts’Z’Results’ • PCB’using’toner’transfer’worked’OK’ • Laser’printed’encoder’discs’worked’OK’](https://reader036.fdocuments.in/reader036/viewer/2022071219/6055cc14f7945b2d71210a95/html5/thumbnails/14.jpg)
2nd Version
• Really use a comparator this Hme • Allow slightly more flexibility in posiHoning to tweak quadrature separaHon
• Use 2 POTs for seing mid voltage
• Use SMT components throughout
![Page 15: FatCat’s’DIY’Wheel’Encoders’ - Micromouse Online...IniHal’Thoughts’Z’Results’ • PCB’using’toner’transfer’worked’OK’ • Laser’printed’encoder’discs’worked’OK’](https://reader036.fdocuments.in/reader036/viewer/2022071219/6055cc14f7945b2d71210a95/html5/thumbnails/15.jpg)
2nd Version -‐ Board
![Page 16: FatCat’s’DIY’Wheel’Encoders’ - Micromouse Online...IniHal’Thoughts’Z’Results’ • PCB’using’toner’transfer’worked’OK’ • Laser’printed’encoder’discs’worked’OK’](https://reader036.fdocuments.in/reader036/viewer/2022071219/6055cc14f7945b2d71210a95/html5/thumbnails/16.jpg)
2nd Version -‐ Results
• SHll too difficult to align to get good quadrature separaHon
• Even if I could align the sensors to get the quadrature Hming correct... – The signal ‘wobbles’ up and down – The signal sHll has horizontal ‘compression’ – Difficult to get the resoluHon required
![Page 17: FatCat’s’DIY’Wheel’Encoders’ - Micromouse Online...IniHal’Thoughts’Z’Results’ • PCB’using’toner’transfer’worked’OK’ • Laser’printed’encoder’discs’worked’OK’](https://reader036.fdocuments.in/reader036/viewer/2022071219/6055cc14f7945b2d71210a95/html5/thumbnails/17.jpg)
3rd Version
• Back to the drawing board • Looked around once again for another way to achieve aims – Found a monolithic chip that appeared just the job
• Avago Technologies • AEDR-‐8300-‐1P2 • 2 Channel, 150 LPI
![Page 18: FatCat’s’DIY’Wheel’Encoders’ - Micromouse Online...IniHal’Thoughts’Z’Results’ • PCB’using’toner’transfer’worked’OK’ • Laser’printed’encoder’discs’worked’OK’](https://reader036.fdocuments.in/reader036/viewer/2022071219/6055cc14f7945b2d71210a95/html5/thumbnails/18.jpg)
3rd Version -‐ Board
![Page 19: FatCat’s’DIY’Wheel’Encoders’ - Micromouse Online...IniHal’Thoughts’Z’Results’ • PCB’using’toner’transfer’worked’OK’ • Laser’printed’encoder’discs’worked’OK’](https://reader036.fdocuments.in/reader036/viewer/2022071219/6055cc14f7945b2d71210a95/html5/thumbnails/19.jpg)
3rd Version -‐ Results
• I failed to get this encoder to work – Needs to have a reflecHve disc
• Laser printed encoder disk not suitable • Failed to make a suitable reflecHve encoder disc
– Chip possibly requires the encoder paVern to be the correct resoluHon • And this is too high a resoluHon to be able to manufacture in my garage
![Page 20: FatCat’s’DIY’Wheel’Encoders’ - Micromouse Online...IniHal’Thoughts’Z’Results’ • PCB’using’toner’transfer’worked’OK’ • Laser’printed’encoder’discs’worked’OK’](https://reader036.fdocuments.in/reader036/viewer/2022071219/6055cc14f7945b2d71210a95/html5/thumbnails/20.jpg)
3rd Version -‐ Results
![Page 21: FatCat’s’DIY’Wheel’Encoders’ - Micromouse Online...IniHal’Thoughts’Z’Results’ • PCB’using’toner’transfer’worked’OK’ • Laser’printed’encoder’discs’worked’OK’](https://reader036.fdocuments.in/reader036/viewer/2022071219/6055cc14f7945b2d71210a95/html5/thumbnails/21.jpg)
4th Version
• The single chip encoders gave me an idea – It’s possible to mount the detectors close together
• No need for 90° separaHon of detectors • If distance between detectors matched with encoder paVern, quadrature separaHon should be guaranteed.
![Page 22: FatCat’s’DIY’Wheel’Encoders’ - Micromouse Online...IniHal’Thoughts’Z’Results’ • PCB’using’toner’transfer’worked’OK’ • Laser’printed’encoder’discs’worked’OK’](https://reader036.fdocuments.in/reader036/viewer/2022071219/6055cc14f7945b2d71210a95/html5/thumbnails/22.jpg)
4th Version -‐ Board
P.TRANS IR-‐LED P.TRANS
![Page 23: FatCat’s’DIY’Wheel’Encoders’ - Micromouse Online...IniHal’Thoughts’Z’Results’ • PCB’using’toner’transfer’worked’OK’ • Laser’printed’encoder’discs’worked’OK’](https://reader036.fdocuments.in/reader036/viewer/2022071219/6055cc14f7945b2d71210a95/html5/thumbnails/23.jpg)
4th Version – EmiVer/Detector arrangement
• 90° signal separaHon can be achieved if the distance between the centres of the phototransistors is matched to the width of the stripes on the encoder disc – To get 90° separaHon need 1½ stripes... so the stripe width should be 2/3 of the distance between the phototransistors
4mm 3.3mm
![Page 24: FatCat’s’DIY’Wheel’Encoders’ - Micromouse Online...IniHal’Thoughts’Z’Results’ • PCB’using’toner’transfer’worked’OK’ • Laser’printed’encoder’discs’worked’OK’](https://reader036.fdocuments.in/reader036/viewer/2022071219/6055cc14f7945b2d71210a95/html5/thumbnails/24.jpg)
4th Version -‐ Results
• Easier to get quadrature alignment • SHll have various noisy elements
• SHll not able to give fine enough resoluHon
![Page 25: FatCat’s’DIY’Wheel’Encoders’ - Micromouse Online...IniHal’Thoughts’Z’Results’ • PCB’using’toner’transfer’worked’OK’ • Laser’printed’encoder’discs’worked’OK’](https://reader036.fdocuments.in/reader036/viewer/2022071219/6055cc14f7945b2d71210a95/html5/thumbnails/25.jpg)
5th (and Final) Version
• Back to drawing board (again!) – Looking at magneHc encoders that output quadrature give me a new idea – Use a PIC instead of a comparator
• Hopefully this will solve a number of problems: – Can use large encoder paVern to get large signal to noise raHo – reduces the effect of the ‘wobble’
– Can use trigonometry to work out actual angle between repeHHons of the paVern, and thus sHll get a high resoluHon
– Can auto-‐calibrate to reduce problems due to differing signal amplitudes and not quite accurate phase separaHon
![Page 26: FatCat’s’DIY’Wheel’Encoders’ - Micromouse Online...IniHal’Thoughts’Z’Results’ • PCB’using’toner’transfer’worked’OK’ • Laser’printed’encoder’discs’worked’OK’](https://reader036.fdocuments.in/reader036/viewer/2022071219/6055cc14f7945b2d71210a95/html5/thumbnails/26.jpg)
5th Version -‐ Board
![Page 27: FatCat’s’DIY’Wheel’Encoders’ - Micromouse Online...IniHal’Thoughts’Z’Results’ • PCB’using’toner’transfer’worked’OK’ • Laser’printed’encoder’discs’worked’OK’](https://reader036.fdocuments.in/reader036/viewer/2022071219/6055cc14f7945b2d71210a95/html5/thumbnails/27.jpg)
5th Version – Encoder PaVern
![Page 28: FatCat’s’DIY’Wheel’Encoders’ - Micromouse Online...IniHal’Thoughts’Z’Results’ • PCB’using’toner’transfer’worked’OK’ • Laser’printed’encoder’discs’worked’OK’](https://reader036.fdocuments.in/reader036/viewer/2022071219/6055cc14f7945b2d71210a95/html5/thumbnails/28.jpg)
5th Version – Sine Wave Signal
![Page 29: FatCat’s’DIY’Wheel’Encoders’ - Micromouse Online...IniHal’Thoughts’Z’Results’ • PCB’using’toner’transfer’worked’OK’ • Laser’printed’encoder’discs’worked’OK’](https://reader036.fdocuments.in/reader036/viewer/2022071219/6055cc14f7945b2d71210a95/html5/thumbnails/29.jpg)
5th Version -‐ CalibraHon
• It is possible to idenHfy 8 equidistant points in Hme and angle along a plot of sine waves in quadrature.
• These points are where the waves cross the 0 line, and where the absolute values cross each other.
• By running the wheels at a constant speed it is possible to get pairs of Hmes and angles, and use these to linearise the output.
![Page 30: FatCat’s’DIY’Wheel’Encoders’ - Micromouse Online...IniHal’Thoughts’Z’Results’ • PCB’using’toner’transfer’worked’OK’ • Laser’printed’encoder’discs’worked’OK’](https://reader036.fdocuments.in/reader036/viewer/2022071219/6055cc14f7945b2d71210a95/html5/thumbnails/30.jpg)
5th Version – Sensor Psuedo-‐code complexQuadrature {
setupA2dForFreeRunning performCalibration loop-forever { waitForA2dCycleToComplete x, y = readA2dValues adjustMinAndMaxValues midX, midY = calculateMidPoints dx, dy = x – midX, y – midY angle = atan2(dy, dx) angle = perform-linearisation(angle) updateAccumulatedAngle performHysteresis sendAccumulatedAngle }
}
![Page 31: FatCat’s’DIY’Wheel’Encoders’ - Micromouse Online...IniHal’Thoughts’Z’Results’ • PCB’using’toner’transfer’worked’OK’ • Laser’printed’encoder’discs’worked’OK’](https://reader036.fdocuments.in/reader036/viewer/2022071219/6055cc14f7945b2d71210a95/html5/thumbnails/31.jpg)
5th Version – Results / Conclusion
• Worked saHsfactorily – Hurrah! – ResoluHon < 1mm (actually about 1/3 mm) – Can output quadrature – Is relaHvely cheap to make – Small and light – I can build it in my garage – Easy to mount on FatCat – Lots of pracHce at making PCBs – more than I expected!
![Page 32: FatCat’s’DIY’Wheel’Encoders’ - Micromouse Online...IniHal’Thoughts’Z’Results’ • PCB’using’toner’transfer’worked’OK’ • Laser’printed’encoder’discs’worked’OK’](https://reader036.fdocuments.in/reader036/viewer/2022071219/6055cc14f7945b2d71210a95/html5/thumbnails/32.jpg)
QuesHons