CNCzone.com-The Largest Machinist Community on the net!



Home Page Mark Forums Read Today's Posts My Replies Classifieds Reviews Photo Gallery Web Links Share Files Advertise With Us Ad List
Go Back   CNCzone.com-The Largest Machinist Community on the net! > Machine Controllers Software and Solutions > LinuxCNC (formerly EMC2)


LinuxCNC (formerly EMC2) Discuss LinuxCNC (formerly EMC2) Controlers here!


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 11-26-2008, 08:11 PM
 
Join Date: Jun 2005
Location: Indianapolis, IN, USA
Age: 26
Posts: 86
supahonkey is on a distinguished road
EMC2 and a rotary encoder

I am building a CNC tube bender as a senior project for my BS in MET. I am using EMC2 on Ubuntu 8.04. I am using a breakout and relay board to control a 120V Vickers directional control valve. I have a 500 PPR rotary encoder. It is my wish to use the rotary encoder to track die position (0-100ish degrees). I hooked the required ports (A,B,Ground and +Vdc) to the breakout board. I would like to have a small DRO on the screen that tells me angular position in degrees. I have searched online but found nothing. I have sent EMC2 to look for pins 12 and 13 as spindle position A and spindle position B. Pins 1 and 14 are outputs that are set as Spindle CC and Spindle CCW. I have absolutely no clue what to do next. Please guide me as I am a new user to EMC2. Check out my build here if you are interested:

http://cnczone.com/forums/showthread...796#post531796
Reply With Quote

  #2   Ban this user!
Old 11-27-2008, 06:06 AM
 
Join Date: Nov 2006
Location: Germany
Posts: 2
juergen is on a distinguished road

Hi!
You may take a look at Parallel-port Two-axis PWM servo controller for Etch CNC
It uses two simple DC-Servo connected to a PWM bridge and encoders. All connected directly to the parallel port.
You did not write anything about home or reference switches (and limit switches...)? Hope your design has one (at least).
Without any real knowledge about tube benders (except they bend tubes...) i would mount a reference or home switch at a (slightly) negative angle (-5°) to leave some space when inserting the tubes...

EDIT: The config files are there, too. So you can have a look at them.

Jürgen

Last edited by juergen; 11-27-2008 at 05:38 PM.
Reply With Quote

  #3  
Old 11-27-2008, 09:34 AM
Al_The_Man's Avatar
Community Moderator
 
Join Date: Dec 2003
Location: Canada
Posts: 16,542
Al_The_Man is on a distinguished road
Buy me a Beer?

AFAIK EMC like Mach does not input an encoder into the parallel port, you might look at wether EMC does interface a Manul Pulse Hand Wheel, this is typically a 100p/turn encoder for manual motion and adapt this routine.
EMC also has the option of add-on cards for servo operation.
Otherwise you would have to use the A & B pulses and write an algorithm that detects one pulse as counts and the other for direction. You may run into a timing issue, depending on how fast the parallel port was read and the encoder speed.
You may not necessarily need home or limit switches as the hydraulics could simply bottom out on a stop.
For home registration, you could just bottom to a stop, and when motion was zero for so many seconds, make this zero reference.
Al.
__________________
CNC, Mechatronics Integration and Machine Design.
“Logic will get you from A to B. Imagination will take you everywhere.”
Albert E.
Reply With Quote

  #4   Ban this user!
Old 11-27-2008, 12:44 PM
 
Join Date: Sep 2004
Location: USA
Posts: 147
Dan Falck is on a distinguished road

These links might help, they are related to using encoders with parallel ports in emc2:

http://wiki.linuxcnc.org/cgi-bin/emc..._A_MPG_Pendant

http://emergent.unpythonic.net/projects/01142347802

http://wiki.linuxcnc.org/cgi-bin/emc..._With_Encoders

http://www.members.shaw.ca/swstuff/spindle-encoder.html

So I guess it can be done, in any number of ways. I haven't done it myself yet, but I want to try it too.


Thanks,
Dan
Reply With Quote

  #5   Ban this user!
Old 11-27-2008, 02:03 PM
 
Join Date: Jun 2005
Location: Indianapolis, IN, USA
Age: 26
Posts: 86
supahonkey is on a distinguished road

The first link with the MPG writeup seems like it will work well. I am going to try it when I get home. If I manage to get the rotary encoder hooked up, will EMC2 display a DRO displaying angular position in degrees?
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 11-27-2008, 02:05 PM
acondit's Avatar  
Join Date: Apr 2005
Location: USA
Posts: 1,774
acondit is on a distinguished road

I built a rotary encoder for the spindle of my lathe and I am using the parallel port to read its inputs. I am only using the index and 100 count features, I never got the B channel hooked up and working. I am attaching the portion of my ".hal" file that has to do with the spindle encoder.

Here is a link to my thread. The encoder starts at message 48 and continues (off and on) to message 85.

Alan
Attached Files
File Type: txt spindle.hal.txt‎ (1.1 KB, 107 views)
__________________
http://www.alansmachineworks.com
Reply With Quote

  #7   Ban this user!
Old 11-27-2008, 08:05 PM
 
Join Date: Jun 2005
Location: Indianapolis, IN, USA
Age: 26
Posts: 86
supahonkey is on a distinguished road

Wow, thanks for your help Alan. I probably don't need the B channel either. My rotary encoder will never rotate more than 100 degrees because my tube bender can't move past 102ish degrees. My encoder is 500PPR, so it will only ever send out 130 pulses over 15 seconds, leading to 9 pulses per second (very minimal). Your file opens in Notepad as a paragraph; everything is smashed together. Hopefully Linux will open it differently.
Reply With Quote

  #8   Ban this user!
Old 11-27-2008, 09:20 PM
acondit's Avatar  
Join Date: Apr 2005
Location: USA
Posts: 1,774
acondit is on a distinguished road

Linux uses LF (linefeeds) to denote the end of a line but windows/dos expects a CR/LF pair.

Alan
__________________
http://www.alansmachineworks.com
Reply With Quote

  #9  
Old 11-27-2008, 10:20 PM
Al_The_Man's Avatar
Community Moderator
 
Join Date: Dec 2003
Location: Canada
Posts: 16,542
Al_The_Man is on a distinguished road
Buy me a Beer?

Originally Posted by supahonkey View Post
Wow, thanks for your help Alan. I probably don't need the B channel either. My rotary encoder will never rotate more than 100 degrees because my tube bender can't move past 102ish degrees.
How will you indicate a bi-directional count with one channel, or do you intend to set it up un-directional count?
Al.
__________________
CNC, Mechatronics Integration and Machine Design.
“Logic will get you from A to B. Imagination will take you everywhere.”
Albert E.
Reply With Quote

  #10   Ban this user!
Old 11-28-2008, 10:14 AM
acondit's Avatar  
Join Date: Apr 2005
Location: USA
Posts: 1,774
acondit is on a distinguished road

Originally Posted by Al_The_Man View Post
How will you indicate a bi-directional count with one channel, or do you intend to set it up un-directional count?
Al.
Al,

If he never rotates more than 100° he should be able to just use a direction signal and count. He might even be able to use the index to set up home.

Alan
__________________
http://www.alansmachineworks.com
Reply With Quote

Sponsored Links
  #11  
Old 11-28-2008, 10:23 AM
Al_The_Man's Avatar
Community Moderator
 
Join Date: Dec 2003
Location: Canada
Posts: 16,542
Al_The_Man is on a distinguished road
Buy me a Beer?

Originally Posted by acondit View Post
Al,

If he never rotates more than 100° he should be able to just use a direction signal and count. He might even be able to use the index to set up home.

Alan
I have not used EMC, but am not sure I see how he would get a count and a direction from just the A channel?
The general premise for an encoder is one channel is the count and the other the direction pulse, no?
Al.
__________________
CNC, Mechatronics Integration and Machine Design.
“Logic will get you from A to B. Imagination will take you everywhere.”
Albert E.
Reply With Quote

  #12   Ban this user!
Old 11-28-2008, 10:25 AM
acondit's Avatar  
Join Date: Apr 2005
Location: USA
Posts: 1,774
acondit is on a distinguished road

Originally Posted by supahonkey View Post
Wow, thanks for your help Alan. I probably don't need the B channel either. My rotary encoder will never rotate more than 100 degrees because my tube bender can't move past 102ish degrees. My encoder is 500PPR, so it will only ever send out 130 pulses over 15 seconds, leading to 9 pulses per second (very minimal). Your file opens in Notepad as a paragraph; everything is smashed together. Hopefully Linux will open it differently.
The only reason I never hooked up the B channel was because I couldn't seem to get the third optical switch positioned correctly. In the hal file I posted you should only need to change a couple things to hook up your B channel which would then give you (2000 cpr / (100/360))=555.56 counts for 100° or 555 counts for 99.9°.

Alan
__________________
http://www.alansmachineworks.com
Reply With Quote

Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
rotary encoder help anslee Linear and Rotary Motion 0 11-17-2008 07:24 PM
EMC2, Xylotex and Sherline Rotary Table kiwols LinuxCNC (formerly EMC2) 2 12-18-2007 12:58 PM
Qt20hp Turret Rotary Encoder intermax Mazak, Mitsubishi, Mazatrol 3 12-11-2007 02:10 AM
Emc2 with encoder feedback R.thayer LinuxCNC (formerly EMC2) 5 01-27-2007 09:26 AM
How to tell if my motor is Pulse encoder or quadrature encoder? Darc Servo Motors and Drives 0 07-22-2005 03:51 AM




All times are GMT -5. The time now is 05:28 PM.





Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO
Template-Modifications by TMS

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361