![]() | |
| Home Page | Mark Forums Read | Today's Posts | My Replies | Classifieds | Reviews | Photo Gallery | Web Links | Share Files | Advertise With Us | Ad List |
| |||||||
| General Electronics Discussion Discuss basic electronics, power supplies and anything else electronic related here. |
| This forum is sponsored by: |
![]() |
| | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
| ||||
| ||||
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. |
|
#2
| ||||
| ||||
| 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 |
|
#3
| |||
| |||
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 |
|
#4
| ||||
| ||||
| 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. |
|
#5
| ||||
| ||||
| 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. |
| Sponsored Links |
|
#6
| ||||
| ||||
| 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 |
|
#7
| ||||
| ||||
| 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 |
|
#8
| ||||
| ||||
| 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 |
|
#10
| |||
| |||
one would probably also use standard debounce strategy in the pic code - multiple samples to confirm validity etc Dave
__________________ maybe... |
| Sponsored Links |
|
#11
| ||||
| ||||
| 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 |
|
#12
| ||||
| ||||
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 |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
| |
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 |