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! > Electronics > General Electronics Discussion


General Electronics Discussion Discuss basic electronics, power supplies and anything else electronic related here.


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 01-04-2004, 07:09 PM
Swede's Avatar  
Join Date: Dec 2003
Location: United States
Posts: 383
Swede is on a distinguished road
Solid-State limit switch experiment

For everyone interested: I did a quick experiment today using a hall-effect device to replace the mechanical microswitch currently in use in my bench mill. The test objectives were to see first if a simple circuit would actually work, and second, to see how repeatable the action of the device would be. This latter is important, as a consistent home function on your mill will help with batch operations and fixturing.

My mill uses 1000-line servos, Flashcut control, ground ballscrews (2mm pitch C3 grade), THK rails. For the test, I increased the resolution of the system to its best, which was 0.00005". The Flashcut system uses digital servo drivers (Logosol) so I am able to jog and move about by "step" which equates to a single line on the encoder wheel.

When homing in Flashcut, the software is designed to report any deviation from the previous home operation. This allowed me to run a few dozen home ops in succession and check the results.

The quick/dirty circuit: The system uses a hall sensor (several were tried) which acts as an open drain to a cheap logic-level N-MOSFET like a BS170. The entire test setup uses an external 5V supply, and behaves like a NORMALLY CLOSED microswitch.

On the left is the hall chip, with built-in digital logic and hysteresis. It behaves like a simple NPN transistor. When the South pole of a magnet is in range, the transistor is "on", which dumps the charge on the MOSFET gate to ground, shutting off the MOSFET. This opens the line from the controller, and the controller senses an open circuit ("switch is tripped"). With no magnet, the MOSFET gate is pulled high with the 10K pullup resistor; the MOSFET conducts, and the controller "sees" a closed switch.

Inside probably 95% of modern digital CNC controllers is a setup like that shown. Everything to the right of the vertical dashed line is part of the controller. One of the paired switch lines has a small potential... it is likely pulled high internally, and that line is tied to a uProcessor chip. The other switch wire is simply ground. When the two wires are continuous, like an NC microswitch, the wire to the uProcessor is near ground potential, and the uProcessor determines that the circuit is in its normal closed state.

With this circuit, the CNC controller switch line that is pulled high is wired to the MOSFET drain, and the grounded line to the MOSFET source. The 470 ohm resistance is a safeguard against excess current if a component fails.

On the Hall chip, pin 1 is Vcc, pin 2 is ground, and pin 3 is the "output" (open drain). Current through the hall cannot exceed typically 25 to 50 mA; this setup will draw ~ 1 mA.
Attached Thumbnails
Click image for larger version

Name:	hallsw.jpg‎
Views:	1019
Size:	31.6 KB
ID:	1199  
Reply With Quote

  #2   Ban this user!
Old 01-04-2004, 07:24 PM
Swede's Avatar  
Join Date: Dec 2003
Location: United States
Posts: 383
Swede is on a distinguished road

Part II:

The circuit works very well! In the pic below, you can see the breadboard riding on my X-axis. A wafer neodymium magnet is mounted in a TDI mount.

Experiments were run with three different sensors, a Micronas HAL506UA, a DN6852A, and a neat Motorola 2ss52M magnetoresistive sensor, very sensitive. Of the three, the 6852 was least sensitive, the HAL506 in the middle. All three showed excellent repeatability, with the 2SS52M the best, consistently re-homing to 0.0005" or better, MUCH better than a microswitch. A combination including a more sensitive hall device (2SS52M) and a weaker magnet showed the best accuracy and repeatability. The air gap when the hall triggered ranged from 0.2" to 1" or more. Further improvement came when I turned a steel round into a point (like a pencil), stuck the magnet on the fat end, and lined up the point with the device.

The benefits of this circuit are many. I wouldn't use a mill with other than Normally Closed (NC) switches, either mechanical or like this, solid state. Any failure of a component will typically open the loop, causing the system to stop. No moving parts = better reliability. It is also more accurate than a microswitch. With a good setup, it should be VERY easy to adjust by simply moving some tiny magnets on a slim steel bracket.

Drawbacks are that the setup must be powered, but most controllers have 5V available for external digital logic. This circuit is very crude at this point, and I'll need to brainstorm failure modes a bit to ensure that the circuit does, in fact, open with ANY component failure.

Anyway, this was fun to mess with today. Maybe someone wants to do a bit more with it. I'm going to make an axis with this when the circuit is refined and quadruple checked. These components are very cheap. There's no reason why one couldn't have dual switches in seriesat either end of an axis, virtually guaranteeing a correct stop of an axis when a limit has been breached.

Swede
Attached Thumbnails
Click image for larger version

Name:	hall01.jpg‎
Views:	738
Size:	50.6 KB
ID:	1200  
Reply With Quote

  #3  
Old 01-04-2004, 08:43 PM
Gold Member
 
Join Date: Apr 2003
Location: Ohio, USA
Posts: 1,739
Ken_Shea is on a distinguished road
Don't quit now!

Very interesting Swede, keep up the post as you progress.

When you first posted I suspected that accuracy would be very tight as similar switches are used on ABS brakes, ignition switches ets.

Your good, real good

Ken
Reply With Quote

  #4   Ban this user!
Old 01-05-2004, 08:51 AM
Swede's Avatar  
Join Date: Dec 2003
Location: United States
Posts: 383
Swede is on a distinguished road

Thank you Ken. I was thinking about the project today, and maybe I'll write a little PIC uProcessor code to manage limit switch functionality. An 8 pin PIC12C would do 2 axes, while a 14 or 118 pin larger flash memory PIC could do all three or more axes. A PIC processor would replace the MOSFET, you'd still need the hall chips and magnets, and would have an advantage in response and flexibility of function.

One final option would be to have a super-minimal setup consisting ONLY of a hall chip. The magnet would be fixed right next to the hall, and the axis would interpose a sheet steel vane between the magnet and PIC. It would transition from NC to NO when the vane is blocking the flux.
Reply With Quote

  #5  
Old 01-05-2004, 09:34 AM
Bloy2004's Avatar
Fumbling Machinist
 
Join Date: Oct 2003
Location: Sturgeon Bay, WI
Posts: 892
Bloy2004 is on a distinguished road

Hi Swede,
I am in the very early stages of installing limit switches(I have none) and your super minimal setup option interests me....
Does this mean the only moving part is the steel intercepter plate attached to the moving axis? If so, what exact hall chip is needed using gecko g320's and Mach2, and how would the circuit look?
Since I have servos, and want to prevent runaway should communication be lost with the computer, I am also interested in "safety switches" where the switch is separate from the controller and wired directly through the power to the servo motors so any axis movement beyond a point will cut power and save a crash. This seems very important especially if the axis is moving toward a spinning lathe chuck. Are these setups you speak of related?
Thanks so much for your output!
John(bloy2004)

Last edited by Bloy2004; 01-05-2004 at 09:44 AM.
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 01-05-2004, 12:14 PM
Swede's Avatar  
Join Date: Dec 2003
Location: United States
Posts: 383
Swede is on a distinguished road

Hi John!

Each controller will be different. I am assuming your setup is a normally closed loop. Also remember I know just enough electronics to do some stupid things like this, but happily most of them work. Maybe someone smarter than me has more to say.

The first thing I'd do is put a digital ammeter (Radio Shack) in line with the two limit switch wires on your controller and measure the current that your system generates. Mine has a current of 7.4mA.

If the current is, say, 20mA or less (it should be) you are in luck, as any hall effect or cheap transistor can "sink" that much current, and can be used as a switch.

Look at the minimal circuit. It has done away with the MOSFET; the hall chip is responsible for switching the current from your limit wires. Again this will only work for 20 mA or less.

The system is wired using any handy +5V source, although most hall chips work in a range of 3 to 28V or so. If your controller has a spare I/O +5V line (many do) you can wire it directly. With the magnet positioned next to the chip (air gap of ~ 1/2") the hall is ON and the circuit is complete. Only the south pole works, and the HIGH line from the controller must connect to pin3 of the hall. The controller thus sees "closed", and the servos operate.

A steel vane (anything which can block the mag flux path, say .75" wide, any thickness) is what moves, and when it is between the magnet and the hall chip, the hall is OFF, the circuit opens, and the controller says WHOA.

Suitable Hall chips www.digikey.com would be the DN6852A, cheap and effective.

Conditions which would cause the circuit to open: Loss of mag flux, or power failure to the hall chip. You could always mount a big panic switch in series, from points C to D, A to B, or both. The A to B line is the power supply to the hall chip itself. C to D is of course the limit switch line, and opening that will stop motion as well.

I'd toss in a couple of resistors for safety, say a 220 ohm between A and B, which will limit the current if the hall fails internally to ground, and it wouldn't hurt to add another between C and D, as long as its addition doesn't cause the circuit to not work. Whenever you work with circuits, you always need to assume that something will fail internally and cause a direct short to ground. the 220 ohm R with a 5V supply would keep the current to 23 mA. If your supply is 24V, use a 1K resistor. Make the R's 1/4 watt. Ohm's law I = E/R where I = current (amps), E = voltage, R = resistance in ohms.

The interesting phenomenon I saw with the hall setup is that normally when you seek home, the table moves until the switch is struck. It then moves opposite to clear the switch, then another, often software programmed distance further. With the hall switch, since there is an air gap, all you need to have your controller do is trip the switch, then back off until the switch closes again. Since these digital hall chips have hysteresis, you won't get nuisance trips in this case, and an additional movement away from the switch may not be needed.

I am going to try making a PIC processor chip which can handle all limit switch activities for a 3 axis machine. It will be able to do a number of "smart" monitoring services, maybe have a line for a second panic stop, possibly some other I/O functions as well. A "kit" would consist of a single chip, 5 or 6 hall chips, some neodymium magnets, maybe a mushroom panic switch. Would anyone be interested in such a device?

I hope this helps. Any electronic gurus PLEASE chime in. I don't want to steer anyone wrong with this stuff.


Swede
Attached Thumbnails
Click image for larger version

Name:	hall2.jpg‎
Views:	682
Size:	40.8 KB
ID:	1203  
Reply With Quote

  #7  
Old 01-05-2004, 12:38 PM
Bloy2004's Avatar
Fumbling Machinist
 
Join Date: Oct 2003
Location: Sturgeon Bay, WI
Posts: 892
Bloy2004 is on a distinguished road

Swede!

Thanks LOADS! I just turned on this wireless computer after moving it down to the basement near the machine and saw your response. What a nice way to verify its wireless internet capabilities.
Again! Your info is above and beyond what I was expecting..
Let the experiments commence!
John
Reply With Quote

  #8   Ban this user!
Old 01-05-2004, 06:49 PM
abasir's Avatar  
Join Date: Apr 2003
Location: Malaysia
Posts: 361
abasir is on a distinguished road

John,
The feature you wanted (emergency limit switch?) could be handled by the PIC easily by monitoring the enable signal from PC (if any) and the limit switches. Trigger on either one can be used to turn off a relay controlling the servo power (without needing PC intervention).

Swede,
I've done some work with PIC (but not a guru, yet) I think you may need some caps and pull-down/up resistor on the IO line to prevent induced spike/noise from falsely triggering the PIC.

Regards,
__________________
Stupid questions make me smarter...
See how smart I've become at www.9w2bsr.com ;-P
Reply With Quote

  #9   Ban this user!
Old 01-05-2004, 08:13 PM
balsaman's Avatar  
Join Date: Mar 2003
Location: Canada
Posts: 2,139
balsaman is on a distinguished road

What I need is a wirelsess parallel port. Then I can run my cnc from the living room...

Cool experiments. You must be retired..

Eric
__________________
I wish it wouldn't crash.
Reply With Quote

  #10   Ban this user!
Old 01-05-2004, 10:09 PM
 
Join Date: Jan 2004
Location: GTA CANADA
Posts: 122
davesaudio is on a distinguished road

I think you may need some caps and pull-down/up resistor on the IO line to prevent induced spike/noise from falsely triggering the PIC.
IMHO
one would probably also use standard debounce strategy in the pic code - multiple samples to confirm validity etc
Dave
__________________
maybe...
Reply With Quote

Sponsored Links
  #11   Ban this user!
Old 01-05-2004, 10:40 PM
Swede's Avatar  
Join Date: Dec 2003
Location: United States
Posts: 383
Swede is on a distinguished road

While my circuit engineering is not really strong, I feel pretty good with PIC code...I love working with PIC's, there is so much you can do. A single 16F876 (my favorite) can deliver PWM (DC spindle driver?), have multiple I/O lines, do ADC (analog/digital sampling and conversion), serial communication, tons of cool stuff. One chip can handle limit switches, drive multiple external AC devices using a SS relay, measure spindle temps, execute safety logic, basically limitless functionality.

The posted circuits are very raw for sure. Abasir you are correct, a ceramic cap would help, and the second schematic fails to show the I/O line being pulled up internally (inside the CNC controller) like the first schematic. Both of these circuits are predicated upon the limit switch lines being digital logic, if they are not, it probably wouldn't work.

Dave, your observation is very valid, but I suspect debounce logic it won't be needed, as the hall chips are in fact complex little suckers with their own internal logic, filtering and hysteresis. The schematics shown I simplified by making them look like a simple NPN drain for clarity. There shouldn't be any bounce at all, unlike a mechanical switch, but if there is a PIC can handle it.

Anyway I'll keep plugging on this concept. Lots to think about. I did a lot of work with hall chips both as electronic breakers for model IC engine distributors, and as a sensitive tach on a 160,000 RPM model turbine. A single magnet disk inside the compressor nut would trigger a static hall chip, and a count of the pulses over a short period of time would deliver the rotor RPM. The max frequency capability of the hall wasn't even approached even at over 2600 pulses/sec. They're amazing devices.

Swede
Reply With Quote

  #12   Ban this user!
Old 01-06-2004, 12:04 AM
anoel's Avatar  
Join Date: Apr 2003
Location: Central Illinois
Posts: 465
anoel is on a distinguished road

There shouldn't be any bounce at all, unlike a mechanical switch, but if there is a PIC can handle it.
Even simpler... If there was any debouncing needed a simple 555 circuit can clean it up for a a buck or two... But there'd be no need in this application. because the hall effect switch is either open or closed. There is no variance in a Hall Effect switch like there is in a Hall Effect Sensor.

When I built my coil winder I started out using a reed switch to trigger my counter. Nasty ugly pulses from the reed (Looking at it on a scope). I was able to clean it up to a fair degree with a 555 timer. But then I tried the Hall effect switch and the pluses coming straight out to the Hall were as clean on the scope as they were when I added the 555 to it at over 3,000 rpm. Even the puny kit built counter that I assembled could count very rapidly with hall device and it has no trigger debouncing like the Omron counter that I'm using now.
__________________
Nathan
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 Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
idea for limit switch, need opinions replicapro General Electronics Discussion 2 06-29-2007 06:59 AM
mach2 LIMIT SWITCH end of stroke reliese? mike10 Mach Software (ArtSoft software) 5 04-25-2005 10:48 AM
limit switch override swarfmacdaddy TurboCNC 5 12-12-2004 03:47 AM
Limit Switches Mr.Chips Xylotex 7 02-24-2004 09:13 PM
Solid state limit switches Swede General Electronics Discussion 0 01-03-2004 06:22 PM




All times are GMT -5. The time now is 09:10 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