PDA

View Full Version : Help requested - installing end stop sensors onto my chinese 3018 Pro



favouritesky
12-07-2020, 10:04 PM
Hi all,

I've recently bought myself a chinese 3018 cnc from ebay and having played around with it for a couple of weeks have gotten a hang of most of the basics. I've been insipred by the likes of Cosmo Channel and Minh's Man Cave on youtube to add a few small upgrades onto it.
I'm not a total CNC newbie - I did a Mechanical Engineering degree way back when, so the physical side is fairly logical to me but I'm much less confident and competent on the electrical and programming side.
I managed to find a guide to GRBL settings and 'un-reverse' the Z travel direction (as the machine arrived with it reversed $=4 for some reason).

I'm now trying to install my limit switches, which is giving me a few more grey hairs...
I bought a set of these switches (based on the recommendation of Cosmo Channel); https://www.banggood.com/10Pcs-Geekcreit-RAMPS-1_4-Endstop-Switch-For-RepRap-Mendel-3D-Printer-With-70cm-Cable-p-1054554.html?rmmds=myorder&cur_warehouse=UK

The physical install and basic wiring has been ok, I've repurposed some leftover IKEA brackets as I dpn't have a 3D printer to make anything perfectly tailored yet.
I've managed to wire each pair of switches in parallel, carried out a little test by moving the bed and spindle into each switch and they seem to stop the machine OK.

* Question 1: I've connected the switches with the green wire to the + and the black to the - on the controller board - does that seem right?
The switch document says that;
"Red line connecting VCC (ramps of +)
Connect the black wire GND (ramps of -)
Green line connection Signal (ramps of s)" - which I can't say that I understand.

When I do depress the switch, I think the wires are starting to heat up until it is released and it disconnects the machine from my laptop.It also dims the 'P' LED, which illuminates when I have either power or USB connected, so it seems to be drawing current (forgive me for such a basic statement, electricity isn't my strong point!).
I haven't yet tried to deliberately crash into the limits whilst working to see what happens yet.

A lot of the guides online that I've found seen specific to Arduino or Woodpecker based hardware and I'm fairly sure mine is different, it's made by Shenzhen Moski Technology Co.

2856728568
Here's a couple of photos of the controller board, not sure what else would be helpful to provide.

* Question 2: What behaviour should I expect when the switches are triggered? Is there a setting within GRBL so that instead of acting like an emergency stop, the spindle will retract back to a previous position? My assumption is yes, as that would seem likely to me for how a homing setup would work. So far I've just been moving the spindle manually from my G-code sender (UGS) - maybe it behaves differently during a proper cut?

Thanks in advance for anyone that read this far, and even more if you're able to offer any assistance!

Doddy
13-07-2020, 07:39 AM
I can't open the link to Banggood - site down at this time (at least for me) at this time. However, I've found other RAMPS 1.4 limit switches with green/black/red wiring.

STOP!, recheck your wiring.

Green to +, black to -?, no, you provide the correct instruction - red to +, black to -, and green to 'S' (guess, "Switch" or "Sense"). What you have described with Green to + is that when you actuate the switch you're shorting the PSU to the RAMPS drivers. Chances are that's crowbarring the supply to the microcontroller and that's why the machine is losing comms with your PC.

The limit switches on the control card should have 3 pins - get us a photo of that, or just review what you've done with the above in mind. I wouldn't power the machine until you've done that.

favouritesky
13-07-2020, 07:18 PM
Hi, thanks for the really quick response Doddy, appreciate your help.

I've attached photos showing the relevant part of the controller board.

28569

"Green to +, black to -" - yes, this is how I had it previously (and red to S). So it perhaps seems like a simple case of having put the plug on upside down onto the controller board?

28570
This is the actual switch I have (though just to add to the confusion, it's shown there with yellow in place of green, black and red are shown correctly).

Doddy
13-07-2020, 10:13 PM
Hi, thanks for the really quick response Doddy, appreciate your help.

I've attached photos showing the relevant part of the controller board.

28569

"Green to +, black to -" - yes, this is how I had it previously (and red to S). So it perhaps seems like a simple case of having put the plug on upside down onto the controller board?

28570
This is the actual switch I have (though just to add to the confusion, it's shown there with yellow in place of green, black and red are shown correctly).

Yeah, those connectors provided with the switches aren't polarised - Orientate them with red=+, black=-, green=S. Ironically the connectors on the controller are polarised (different connector) so blame the accountants for penny pinching.

You shouldn't have damaged anything... much (perhaps lifed a microswitch or two), provided the PCB has survived.

Doddy
13-07-2020, 10:22 PM
If, however, I've missed the point - if the connectors ONLY plug in one way around onto the controller card then we need a plan B. Let me know.

dazp1976
14-07-2020, 12:48 AM
If, however, I've missed the point - if the connectors ONLY plug in one way around onto the controller card then we need a plan B. Let me know.

They are the same as lipo battery balance connectors.
If you're gentle you can push on the tabs of the metal connectors with a stanley knife and slide them out of the connector block.
Then swap them over, slide back in.
Jump to 2 mins 10 secs in on the video below.
https://www.youtube.com/watch?v=dYkTjXpTJaQ

Doddy
14-07-2020, 06:54 AM
Dazp - the reason I posted what I did is because of this image from both Banggood and Aliexpress, there's a similar but less well defined image on Amazon. These taken from a search on RAMPS 1.4 End Stop from the URL OP provided that just didn't work for me.

28571

Which shows a Dupont connector (non-polarised) at one end which allows for incorrect insertion into the controller card.

If, of course, the cable is different with the OP's switches and the appropriate mating connector has been used, but the pin order is incorrect - then I'd agree - depress the retention clip on each socket and remove, reorder and re-insert.

favouritesky
15-07-2020, 08:58 PM
Thank you - the connectors to the board can be plugged in either way, so it was a simple enough job to turn them around. It now seems to be working as I think I expected - when I'm connected (using UGS) and I manually drive it into any switch, I now have an error returned;

An unexpected error was detected: ALARM: Hard limit
[Reset to continue]

Really appreciate your help with this one!

Doddy
15-07-2020, 09:03 PM
Thanks for feeding back, it can help others later down the line.

I don't know UGS but suggest you investigate if you can use the switches for homing, and whether you can set soft-limits

favouritesky
15-07-2020, 09:18 PM
That's exactly what I'm trying to get my head around now! Haven't quite cracked it as the machine returns an error when it first hits the upper Z switch as the first step of the homing cycle. I'll post back here if/when I manage to implement it - wish me luck!

Kitwn
17-07-2020, 01:47 AM
I've never used UGS seriously (though I have tried loading it on my laptop) but there will be something somewhere that specifically instructs the software to use the same switches for homing and limits. All you have to do is find it!

Good luck

Kit

JBaz
05-12-2020, 05:16 PM
Favouritesky

I'm installing limit switches on my recently purchased Banggood 3018 router and your control board looks very similar to mine, other than the fact that the limit switch connectors are at 90degrees to mine 29220

My main issue is that I have installed 5 limit switches and there are only 3 connectors on the board.

How did you resolve that?

ZASto
05-12-2020, 08:48 PM
If you are using NC (Normally Closed) switches, connect the axis switches in series and to the relevant connector.
If, on contrary, you use NO (Normally Open) switches, the axis switches in parallel.
29221
29222

JBaz
06-12-2020, 10:52 AM
ZASto

Thanks for responding.

I am OK with connecting them in series or parallel depending on the switch.

The switches I have can be both NC or NO (3 wires connected but I assume only 2 are in use at any one time) and at the moment I don't know whether the 3 I have connected (1 each to the available connectors ) are working as NC or NO, but they are working.

My issue is that the labels on the board mark the limit switch connector pins as X+ve, common and X-ve.
29224

This suggests to me that one pin is for the limit switch at the positive end of travel and the other for the negative end.

Against that I have now got one switch connected for each axis and they all work fine.

Before I start cutting wires and experimenting (and possibly frying the board!) I was asking if anybody had solved the issues.

JAZZCNC
06-12-2020, 11:09 AM
Because you have a Gnd then (+) / (-) I would be confident it's (+) limit and (-) limit. But it's easy to check, just connect Gnd and either + or - wire to one switch and flick the switch and it should show on the screen (-) Limit triggered or (+) Limit.

What control software is are you using.?

What switch type is it.?

JBaz
06-12-2020, 11:56 AM
Thanks for the response.

I'm using gbrlControl and the switches are unbranded Banggood jobs that have the same 3 wire connectors as the control board.
29225

I'll try your suggestion and post how it goes.

Doddy
06-12-2020, 12:07 PM
JBaz, all the advice offered above is sound in general terms. However, that image that you show worries me slightly (there's an indication of an LED in there, and I wouldn't expect to need 3-wire just to a simple micro-switch. There appears to be a general adaptation of limit-switches in the generic Chinese engraver market that do present both a +5V, GND and sense on the connector (either 3-pin, or 4-pin), and generally shorting pins might be a "bad idea". If you can get a good photo of the limit switch - taken from both sides of the board (ideally showing the traces and the components on the board), we might be able to offer specific advice.

Edit:

https://uk.banggood.com/15-Set-Mechanical-Endstop-Limit-Switch-Module-with-1m-Cable-for-Reprap-Ramps-1_4-3D-Printer-Part-p-1432967.html?rmmds=buy&cur_warehouse=CN

As an example - has +5/0V supply with a sense line. The controller card that you have is, I think, marked poorly to help understand the wiring required. Did you not receive a PDF for wiring up the board?

JBaz
06-12-2020, 01:19 PM
Doddy

Here are some pics of the switches I have plus I found the actual switch component from Hiaihua online.
29227
29228
29226
The switch complete does have an LED which lights up when the switch activates.

I have plugged in 3 switches - one for each axis - with the 3 wire connectors/cables supplied with switches and they work fine. I just don't know how to connect the remaining 2 switches at the other end of the axes.

Doddy
06-12-2020, 02:04 PM
The Banggood images confuse the hell out of me - they've mirrored one side of the board. Never mind.

JBaz, have you access to a multimeter, and if asked to measure resistance across the pins of the limit switch board do you know what to do?

(What I'd ask is to measure the resistance from white-to-red, and white-to-black, for the switch in the not-pressed state, and in the pressed state... 4 readings in all).

(My confusion is with the BG images apparently showing the NC contact to sense, and the NO to ground - that's... peculiar... at least with a Sunday brain). Ultimately what others have said is correct, and all we're looking to do is wire switches either in parallel or series, but I'm being (too?) cautious trying to make sure there's no risk of shorting anything out with different switch positions.

Also, I have to ask - have you access to basic electrical tools (soldering irons, etc)?

JBaz
06-12-2020, 04:25 PM
JazzCNC - I'm not ready to cut any wires yet, so please bear with me.

Doddy - using the multi-meter, when the switch is in the not-pressed state the white to red reading is zero and the white to black is 4.75v. With the switch connected and in the alarm position (led on) both readings are 2.25v.

HOWEVER (!) triggering the switch is no longer causing the status in gbrlControl to go to Alarm, although the console is still showing ALARM: Hard limit etc and I have to go through the reset process.

A quick question. Once the alarm has been triggered the only way I can get the stepper motor to turn and release the switch is to set $21=0, jog the motor, press unlock and then reset $21=1. Is that what I should be doing?

I do have a soldering iron etc, but I have also installed a connector block on the chassis, if I have to start rewiring connections.

Doddy
06-12-2020, 05:05 PM
Okay, I wasn't clear - I was really talking about resistance, not voltage, with the machine powered off and across the limit switch, disconnected from the controller.

But, perhaps this is a good time to stand back and ask what you're trying to do? That isn't intended as anything other than perhaps an opportunity to provide perhaps a better solution to where you're heading.

Limit switches are useful to stop a large machine destroying itself, however, please understand that by the time you've hit a hard limit you're pretty much failed in planning your work. Most people will use "soft limits" - where the control software can recognise that it's going to hit an axis limit. A quick google suggests that grblcontrol recognises soft limits.

What soft limits does require, is resolving a known machine coordinate - and this is where your existing 3 axis inputs work as "home" switches, not "limit" switches. That would allow you to power the machine, select "home" for each/all axis, after which the machine will move each axis until each switch is active - at that point the machine knows where the spindle is, and you then configure the X/Y/Z constraints from that as "soft" limits (i.e. software-based offsets from the machine home position). You don't then need the additional switches, and you have more control over managing the machine (as the controller knows exactly where the spindle is at all times).

Suggest you read up on soft limits, homing switches, machine and work coordinate systems. I do believe that if well supported, that a homing/soft-limit set-up will give you a better experience than just hard limit switches. Going down that road will require that you disable machine limits (from what I've briefly seen of grbl, $21), and enable Homing, and that should resolve your latter question.

Note, although there are a few owners on here with GRBL-based controllers most of us are using somewhat different motion controllers/software - you might find better support for GRBL queries within a GRBL user group.

JBaz
06-12-2020, 05:40 PM
Doddy

Thanks for the input.

Up to now I have been using offsets to position the spindle home adjacent to where I want to start cutting. I then unplug and reconnect the USB cable to reset the machine co-ordinates to that position. That way I can clamp the stock where I like. For the few jobs I have done so far this has worked, but it includes a lot of jogging with the corresponding risk of running out of space. Hence my desire for limit switches to stop hitting the buffers when jogging.

I have read about setting up a fixed "home" position and including line of Gcode in a standard "footer" to make the spindle to return to that home position at the end of every job, so it becomes the machine coordinate origin every time the machine is reconnected, but felt that at this stage of my learning to speak CNC there was enough to be getting on with.

I kind of get the concepts behind setting up a home at one end of the axes and using soft limits for the other ends, so I will spend some more time as you suggest and see if I can use just 3 switches - which I have enough connectors on the board to accommodate.

Thanks again for your help.

JAZZCNC
06-12-2020, 05:49 PM
JazzCNC - I'm not ready to cut any wires yet, so please bear with me.

I'm bowing out of this one as too many cooks spoil the broth and Doddy as got you covered, he's much more experience than me on the electronics front and in particular these cheap Chinese electronics, you are in safe hands.:encouragement:

JBaz
06-12-2020, 06:08 PM
Thanks JazzCNC

I think I've got some more reading to do!

Good luck.