PDA

View Full Version : Help with CNC 3018 from Banggood



JeanB
13-03-2020, 06:39 PM
Good afternoon,

I need help in trying to run my 3018 CNC purchase on Banggood.

I installed 5 micro switches (2 X, 2 Y and 1 Z) to act as end stops and used for homing.

The homing cycle works fine. I home and zero my machine in the lower left corner of the table, however, when I want to carve, using Easel, it gives me a hard limit alarm as soon as I try to turn on the spindle.

After hours of reading, I changed all my limit switch wiring to shielded wires……..Nothing still same issues.

After homing,
• my machine positions are X = -284, Y = -2, Z = -2
• my work position is X = 0, Y = 0, Z= 0

If, after homing, I remove the limit switches using $21=0 and try to start a carve, my spindle will start but then, my table moves (Y axis) moves a few mm into the back frame (I have a 2 mm homing pull-off). It should move towards the front?????

Please help, thank you.

Jean

JAZZCNC
13-03-2020, 09:21 PM
Sounds like you have a noise issue if only happens when spindle starts. Does the control software have an option to apply De-bounce filtering to the inputs.?

JeanB
14-03-2020, 01:31 PM
Thank you for your reply.

Yes, there is a de-bounce setting and I have it at $26=250 which is the maximum..... it seems I can go. I tried various settings, as suggested by the pocket GRBL guide, but still nothing.

Do I need to change all the wiring to shielded cable? I already changed all the micro switch cable to shielded cable?

Doddy
14-03-2020, 03:07 PM
Complete guesswork here (without seeing your controller board - but you're suggesting some local controller, likely a microcontroller GRBL - complete guess, like I say), IF (guesswork again) the limit switches are couple to the ucontroller discrete inputs then you might be suffering with the intrinsic high-z inputs from the uC device with internal pull-up or pull-downs.

Are the microswitches wired to 0V/Ground? If so, is the switched input (the non-ground wire) floating at around 5V?, if so then you could try reducing the internal pull-up resistance by wiring a 1k resistor from the microswitch input to a local 5V pin. The point here to provide a low impedance path for noise introduced from the spindle to clamp onto the supply lines - by default the high-impedance input to the microcontroller is highly sensitive to signal voltage (and therefore induced noise)... If that makes sense?

If there's any joy with this a more practical solution would be to introduce opto-couplers on the input to the controller - they'd provide good noise immunity.

EDIT:

Can you provide any details of the controller card?, even a picture?

JAZZCNC
14-03-2020, 03:54 PM
Thank you for your reply.

Yes, there is a de-bounce setting and I have it at $26=250 which is the maximum..... it seems I can go. I tried various settings, as suggested by the pocket GRBL guide, but still nothing.

Do I need to change all the wiring to shielded cable? I already changed all the micro switch cable to shielded cable?

Ok well if De-bounce allowed it to work then you are obviously suffering from noise issues so now you need to lower the de-bounce back to Zero, the reason for this is because it slows the switch response time so can be unsafe, and go with a solution like Doddy mentions where you pull the input high or low to stop it floating.

If after this you still get noise issues then there are other methods, like Opto's and Capacitors, etc but won't get into that now because I'm 99% sure fixing the floating input will work.

JeanB
14-03-2020, 04:13 PM
Good Morning Doddy,

Thank you for your reply. Just to inform you I am not very proficient in electronics, so it may be difficult for me to answer your questions.

My CNC works with GRBL and I use the free version of Easel at this time in order to practice……..not much practice has been done at this time.  

My switches are wired as NO and when I check the voltage across the + and - pins, I get ~2 volts and if press the micro switch, I get 0 volts. From all the information I gathered, the bottom row of pins are all to ground???? Before changing my switch wiring to shielded wires, I tried, as suggested on the internet, to add a .47µF capacitor across the micro switch………nothing.

Please find attached a picture of my board. It says: Developower V2.0

Thanks27575

JeanB
14-03-2020, 04:23 PM
Good morning JazzCNC,

I just tried the debouched at 0, as soon as I try to carve and start the spindle, I get an alarm. As I said to Doddy, I already tried the capacitors and that did not work.

Doddy
14-03-2020, 05:07 PM
JeanB - okay, that's fine. I'm just about to head out for a last night of drunken debauchery before our government clamps down on that - I'll get some detail to you tomorrow morning.

Doddy
15-03-2020, 09:15 AM
EDIT: I've reread my post and realise that I've thrown a number of names into the equation: The "MEGA" or "AT-MEGA" or "ATMEGA328" is the micro-controller chip that sits on the "Nano" or "Arduino" - which is the small board about the size of two postage stamps. That board is the daughter board that sits on the larger "Developower" controller card. [END OF EDIT]

Cheers for the photo - that's confirmed pretty much what I've found on Banggood. I've tried to find a schematic of the board - there's a few people working on this but from what I've seen - if to be believed - it's pretty much confirmed my suspicion. I've yet to find a manual for the board but from what I can tell the 6x2 header for the limit switches presents the X/Y/Z axis inputs on two pins (total 6 for 3 axis) - presumably for up to two switches - one on each end of travel, and the other parallel pin header provides the ground "return" signal. The X/Y/Z input pairs are each commoned (shorted-together) for three separate signals that are passed to the micro controller - a generic Arduino Nano board.

The best I can work out is that the limit switches are wired something like this...

27581

Now from what I can see physically on the board image, and from other people's attempt at schematics, I see no pull-up resistors on the board. The Arduino (the ATMEGA 328 microcontroller chip) can be configured to provide a weak-pullup that is required to set a logic "1" on the input - and then the limit switches, if active, pull that to ground (a logic "0"). That's the principle of operation. And, in a low-noise environment that works.

As soon as you get any induced electrical noise on the limit input, if the input resistance is very high (as it is with the internal pull-up resistors on the ATMEGA) then the signal will be superimposed on the silly-low current signal on the input with the result that a voltage of only a few volts will swamp the behaviour of the internal pull-up and present a false reading to the ATMEGA. Signals above and below the supply voltage of the MEGA would be clamped through internal protection diodes to the supply lines - so these are unlikely to damage the device, but you are still able to get spurious readings.

You've said that there are recommendations to add a 0.47uF capacitor from ground to the input pin. This is a bit daft - the idea with this solution is to attenuate a fast-changing signal - lets say a voltage spike lasting no more than a few hundreds of microseconds. But a capacitor used in this way is acting on rate-of-change of input voltage, not a static input voltage, and the effect quickly dimities over time as the capacitor charges (or in this case, discharges). Then the silly-high-resistance of the internal pull-up resistance will make the RC time constant stupidly long and the behaviour of the input presents a poorly defined and slow acting switch.

Best to get rid of the capacitors.

So, my recommendation - and this is a bit of an experiment but it makes sense to me at least - is to reduce the pull-up resistance, which has the impact of, in the case of induced noise, providing a much lower resistance to the power-supply, which is a convenient low-resistance path to ground (at least for the AC-analysis). This means in practical terms you can dissipate a lot of the induced noise into the PSU and not into the input pin of the MEGA.

But, we cannot change the internal pull-up resistor - that's internal to the MEGA, but we can add a resistor in parallel - and the effect is the same. So, what I suggest is adding three resistors, one to each of the axis inputs, pulled up to the MEGA's 5V supply line. Something like this...

27582

The only problem is sourcing a 5V supply from the controller board - this is not present on the axis-limit switch inputs to the board, but is available elsewhere. Looking at another image of a (different) board...

27583

There's a clear silkscreen label of "5V" on a header pin next to the axis-limit switch inputs. Use that to export a 5V line to the choc-block that you have all your limit switches wired to.

From there, buy 3 resistors - I've said 1k but the actual value isn't particularly important. The lower the value (e.g. 470 Ohm, or 220 Ohm.... common values) would give better noise immunity, but at the expense of higher current draw. At 1k, the current through each resistor will be 5mA and power dissipated would be 25mW (this means you can order 1/8W, 1/4W, 1/2W etc, resistors without fear - to be honest, that 25mW is not going to overload any resistor that you'll be able to buy). A 220 Ohm would be drawing 25mA per resistor and I'd be worrying about the thermal impact this has on the local 5V regulators on the Arduino board). So, for now, I'd stick with 1k values.

Wire a resistor from the 5V line that you've just added, into the X axis input. Repeat for Y and Z. So, you'll have three resistors.

Test.

If you still have problems, try the software debounce as before. If you still have problems then try wiring two resistors in parallel for each of the 3 axis (so, a total of 6 resistors). This would have the result of lowering the 1k value to 500 Ohms, and improving the clamping on the induced noise, but hold a finger over the regulators (the big black rectangular things on the controller board) to make sure these don't get too hot.

If you still have problems, then I'm an idiot and I've wasted your time, and about $1 of resistors.

Let us know how you get on.

Mike

Kitwn
15-03-2020, 09:19 AM
My switches are wired as NO and when I check the voltage across the + and - pins, I get ~2 volts and if press the micro switch, I get 0 volts.
Thanks

2v strongly suggests a lack of pull-up resistors which leaves the inputs floating as Doddy has suggested. The inputs are hovering in an indeterminate state and susceptible to every light switch and cosmic particle in the vicinity. No input to any electronics should be left like this and many devices include the pull-up resistors internally, typically 10 Kohms. Some microcontrollers allow inputs to be selected as floating or pulled-up from software.

Doddy
15-03-2020, 09:19 AM
One thing!

I can't work out from the silk-screen labelling on that board which of the axis-inputs are ground and which are connected to the inputs to the micro controller.

If you have a multimeter (and you really need one for this - even a cheap one from Amazon) - you need to check which 6 pins in line on the axis-limits inputs are all connected together - these are the ground returns. For the remaining 6 pins, I expect each pair, for X/Y/Z to be shorted together - these are what you connect the resistors to.

Doddy
15-03-2020, 09:20 AM
<deleted>

Doddy
15-03-2020, 09:21 AM
2v strongly suggests a lack of pull-up resistors which leaves the inputs floating as Doddy has suggested. The inputs are hovering in an indeterminate state and susceptible to every light switch and cosmic particle in the vicinity. No input to any electronics should be left like this and many devices include the pull-up resistors internally, typically 10 Kohms. Some microcontrollers allow inputs to be selected as floating or pulled-up from software.

ATMEGA328 has an option for an internal 100k-ish pull-up.

Doddy
15-03-2020, 09:26 AM
My switches are wired as NO and when I check the voltage across the + and - pins, I get ~2 volts and if press the micro switch, I get 0 volts. From all the information I gathered, the bottom row of pins are all to ground???? Before changing my switch wiring to shielded wires, I tried, as suggested on the internet, to add a .47µF capacitor across the micro switch………nothing.
27575


Aha, thanks to Kitwn for making me realise that you're already well aware of the pin layout on the board - I'd missed that bit of your reply in my haste to reply. Hopefully you should be able to understand my earlier ramblings and ignore the bit about identifying the ground-returns on the board.

Kitwn
15-03-2020, 09:28 AM
I've just had a closer look at the picture and the blue board at the bottom is an Arduino Nano microcontroller board (or clone thereof). If the inputs from the switches are connected directly to the Nano without any other external circuitry then the inputs will be high impedance, floating unless they are specified as ' PULL-UP' in the software configuration.

Doddy
15-03-2020, 09:36 AM
I've just had a closer look at the picture and the blue board at the bottom is an Arduino Nano microcontroller board (or clone thereof). If the inputs from the switches are connected directly to the Nano without any other external circuitry then the inputs will be high impedance, floating unless they are specified as ' PULL-UP' in the software configuration.

Completely agreed.

My gut feeling is the the inputs will be (for god sakes!) configured with internal pull-up. But that is insufficient in this type of environment (it's barely good enough for bench-level development). The problem is not the ATMEGA328 chip, nor the Nano, but the implementation of the Nano onto the Developower board where the use-case should have been well understood by the designer. That board should have had pull-ups/downs on each input to the Nano. It's a poor design, destined to fail and cause frustration wherever it is used.

Kitwn
15-03-2020, 09:47 AM
Doddy,
We're obviously both talking at once!

Re the use of capacitors, the time constant for a .47uF cap and a typical 10K pull-up resistor is 0.47 mS, so a delay of about 1mS will result when the switch opens. Less if the smaller values of resistor are used. The delay when the switch closes depends on the resistance of the switch and the wiring to ground but will only be microseconds. I use 1uF capacitors on the inputs to my traditional cheap Chinese parallel break-out board without any obvious issues with delays and no noise-related false triggering.

Edit: Just seen your latest post (16) and agree completely. External resistors and noise filtering are a must.

JeanB
15-03-2020, 04:14 PM
Good Morning Doddy,

Thank you for all the info, however, as I am not very good in electronics, would it be easier to install an 8 channel Optocoupler as per Amazon Canada: “Elegoo CA-EL-SM-005”. This would only cost $12.86 and make for a nicer setup?

(https://www.amazon.ca/ELEGOO-Channel-Optocoupler-Arduino-Raspberry/dp/B06XCN5JNH/ref=sxbs_sxwds-stvp?cv_ct_cx=optocoupler&keywords=optocoupler&pd_rd_i=B06XCN5JNH&pd_rd_r=e9f5a088-75a0-4af5-9f9b-97fdb826c345&pd_rd_w=s0q8k&pd_rd_wg=IjraF&pf_rd_p=25609a94-16af-4bd7-9107-c9f01f8c9bd0&pf_rd_r=B2MPMET4QMT0GCZ5N9F4&psc=1&qid=1584278226&refinements=p_72%3A11192170011&rnid=11192166011).

From my understanding of the pictures, I would plug the micro switches to screw terminals and the Dupont connectors from the Developower board to the pins on the Optocoupler.

Could I have my micro switches as NC connected to the NC of the Optocoupler since it is a preferred position for security reasons?

Thanks,

JeanB
15-03-2020, 04:15 PM
Thank you for your help.

See my answer to Doddy

Doddy
15-03-2020, 06:26 PM
JeanB - Yes, to some extent. I don't like it, but it can be made to work:-

The relay board is low-side switched, so the existing 0V through the micro-switches to the 3 inputs (X/Y/Z) would work. You have to provide a 5V supply to the relay board as well, likely rated around 250mA for 3 relays.

The relays are change-over contacts, so connect +5V to the NO contact, and 0V to the NC contact and use the pole contact(s) as the drive into the controller card. That way the contact is either connected to +5V or to 0V, without any floating or high-z input resistance at play. The optoisolator input requires a good few milliamps and I think it unlikely to be as susceptible to noise.

The problem this does introduce is switching time (but not really important) and contact bounce (when the relay switches for a couple of milliseconds). Again, I don't think this is going to be important.

The bit I said about about NO/NC contacts being +5/0V - can't be arsed working out which way around - try and see. But if you want to change the microswitches from NO to NC then just swap the NO/NC contacts on the relays to match.

JeanB
16-03-2020, 03:10 PM
Good morning Doddy,

Thank you for all your help.

As I can see you are not much in favour of Optocoupler so I was reading on noiseless end stops and came across the following which appear to have little noise, do you think these would be better.

1. Optical end stops as per Alexpress : https://www.aliexpress.com/item/32656670473.html

Thanks

Doddy
16-03-2020, 05:22 PM
I don't know. Buy one and report back.

Personally I'd be buying 3 resistors but that's just me and my crazy ways.

Kitwn
18-03-2020, 11:55 AM
I don't know. Buy one and report back.

Personally I'd be buying 3 resistors but that's just me and my crazy ways.

Agree. It seems that the lack of pull-ups is the problem and, if it's outputs are open-collector, the opto-coupler will need the pull-ups anyway!

JeanB
18-03-2020, 01:08 PM
Good Morning Kitwn,

Thanks for your help.

I was going to install the resistors (cheapest solution) and separate 5v power supply, since I have one lying around. However, it will be a while before I can do anything as we are restricted to our homes due to the Corona virus. So I will let you if and when I get those resistors.

Thanks again.

AndyUK
18-03-2020, 02:03 PM
After hours of reading, I changed all my limit switch wiring to shielded wires……..Nothing still same issues.


Hi Jean,

Agree with Doddy and Kitwin that pull up resistors are indicated and should be fitted - but haven't seen any mention about shielding of the spindle wiring? You mention limit switch wiring shielding, but not spindle?

If its not already, I'd recommend making that shielded too in order to reduce the noise output. Also be sure to ground your shields at one (and only one) end.

JeanB
18-03-2020, 02:15 PM
Thank you, Andy,

I will shield the spindle and ground all the shields. I, at least, can do this for the time being.

MikeG
23-11-2020, 12:25 AM
Hi Jean,

I am a complete novice as far CNC machines go and I have got myself a new cnc 3018 pro machine. I just assembled it and have been playing around with the GBRL and calibration stuff and thought I should enable the homing feature which would need endstop switches.

I was looking at the Optical Endstop (https://www.aliexpress.com/item/32656670473.html) that you have mentioned in earlier posts and thought it would be a nice clean method as opposed to using the micro-switch option.

Did you get round to solving the issues you were having? Will be grateful if you could upload a pic or two of what your switches look like and how you have attached them to the XY and Z axis.

Thanks,
Mike

Muzzer
23-11-2020, 05:57 PM
Rather than bugger about with resistors, caps and optos, these can be very effective and require no electrical changes
https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20201123085056&SearchText=ferrite+clamp
You can fit them over the mains cables, the motor wiring (make certain all 3 wires go through together though!) and any signal bundles you have in your cabinet.

Note that VFDs are really supposed to be fitted with an EMC filter on the INPUT wiring (L, N & E). Many / most people omit to fit them and wonder why they are finding noise issues. There's no standard size but as long as you ensure it's rated for the max current, you can't go too far wrong. For reference, officially recommended EMC filter on my Yaskawa VFD is the same footprint as the VFD itself.
https://www.aliexpress.com/item/32739934406.html?spm=a2g0o.detail.0.0.61773360IkUV Aq&gps-id=pcDetailBottomMoreThisSeller&scm=1007.13339.169870.0&scm_id=1007.13339.169870.0&scm-url=1007.13339.169870.0&pvid=24edf08d-5be6-4874-9189-b0970651b2e1&_t=gps-id:pcDetailBottomMoreThisSeller,scm-url:1007.13339.169870.0,pvid:24edf08d-5be6-4874-9189-b0970651b2e1,tpp_buckets:668%230%23131923%230_668% 23808%233772%23971_668%23888%233325%236_668%232846 %238112%23583_668%232717%237563%23539_668%23100002 2185%231000066058%230_668%233468%2315608%23170

I have no experience with any of these suppliers but the products shown are in the right region, technically speaking.

MikeG
23-11-2020, 07:15 PM
Thanks Muzzer for your insight on EMF interference. Yes, I agree with what you mentioned. As I am an Electronics engineer from the 1980's, I do have a good understanding of these issues.

I thought about the need for resistors, caps and opto to reduce the stray currents - it would be over kill for a small hobby cnc machine like what I have got. In my case I am powering the controlled using a 24vDC power adaptor as opposed to maybe others who might be using the high wattage Mains PSU's to power their CNC machines and my be succeptible to such noise.

The spindle motor I am using is a basic 2 wire 24vDC 8000 rpm type so it is unlikely to interfere too much. I might solder a capacitor across the terminals to reduce and startup spikes.

Cheers

Doddy
23-11-2020, 10:19 PM
I thought about the need for resistors, caps and opto to reduce the stray currents - it would be over kill for a small hobby cnc machine like what I have got.

Knock yourself out with whatever works for you.

But here's some real-life experience:

I got one of our software apprentices to knock up an interface module using a Uno - idea being to support a variety of input devices (typically switches), output these encoded via serial to a Pi driving a TFT display and sending the input switch states over ethernet to a control system. The generic nature of this meant that, depending on switch configurations, one or more inputs could be disconnected / open-circuit. Unused, unconnected inputs could be driven either high or low through the physically adjacent pins that were connected. Solution to this was to use the internal pull-ups but a floating input was highly susceptible to parasitic drives - whether from capacitive coupling, or possibly through contaminants(grease, sweat?) on the board.

Another one, recently, despite my views on opto-isolators, another user on here was experiencing sporadic limit switch triggers on a 6040 machine, which we resolved by using a commercially available opto-isolator board on the inputs to the BoB. Prior to that, without the spindle operating, but under axis drive (so just stepper motors) that user was experiencing sporadic limit switch trips within around 8 seconds of motion... had to use mach3's debounce setting values of more than 1000 (40mS for a 25kHz kernel) to get anything remotely steady operation before we got the opto-isolated inputs stable.

Of course, your results may vary.

80's?, damn, you pre-date me by a couple of years.

Muzzer
23-11-2020, 11:05 PM
Me too - started out designing switched mode power supplies in the early 80s, now developing 800V 200kW EV drives. That involves switching tens or hundreds of amps and hundreds of volts within fractions of a microsecond within centimetres of "quiet" circuits. Making analogue and digital control circuits work reliably in the middle of a maelstrom of switching noise requires good understanding and design practice. Similarly, getting the emitted / conducted noise levels down to required levels can be very tricky. Optos are one way out but expensive and messy. They are generally only used where safety isolation is required.

Trying to filter noise out using software is a real bodge. Better to stop the noise getting to the micro to start with. Software filters never work the way you might imagine, as noise isn't a sine wave. Tackle it at or near source, rather than deal with the effects where they aren't wanted. Rather like tackling a barking dog, better to muzzle or strangle it than wrap the kennel and your head in blankets

JAZZCNC
23-11-2020, 11:51 PM
Rather like tackling a barking dog, better to muzzle

Is that "Muzzle It" or "Muzzer it"...:yahoo: I find a swift kick in the Bo!!@K$ works well. It's shite for a CNC machine but stops noise from dogs well enough.:miserable:

MikeG
24-11-2020, 05:57 AM
Hi Doddy,
Thanks for sharing your experience - yes I take on board everything you have mentioned. I have yet to venture into installing the endstops on my cheap little hobbycraft :) machine..

Retrofitting endstops on these cnc3018 machines requires the fabrication of yet more cheap plastic parts to hold the micro-switches in place. This requires even more complexity in the form of getting hold of a 3DP and my thinking was to avoid it all together for my machine.

I moved into computers as all the manufacturing moved to the East, so never really got the opportunity of applying may of the principals I learnt. Back in those days, I was using a CNC machine to run batch drilling of printed circuit boards and now that I gotten out of borring computers and software systems. I thought why not get myself a small hobby cnc and keep my brain ticking.. I am actually a Brit who mirated to Western Canada a few years ago.

Muzzer
24-11-2020, 10:14 AM
Is that "Muzzle It" or "Muzzer it"...:yahoo: I find a swift kick in the Bo!!@K$ works well. It's shite for a CNC machine but stops noise from dogs well enough.:miserable:

I'm afraid we had those uninstalled some time back. He keeps looking for them mind!

Muzzer
24-11-2020, 10:21 AM
I am actually a Brit who mirated to Western Canada a few years ago.

I moved out to BC with my family back in 2010 (North Van, Grouse Mtn, top of Capillano) and we stayed for 5 years. Loved all the snow sport, sea sport, camping, wildlife and accessible outdoors. I'm now huddling on the edge of the Irish Sea.

Miss the place like hell but we had mothers, sisters, cousins etc back here and the place was becoming too expensive for the young generation unless they lived out towards Chilliwack. Obviously I moved my entire workshop out there and back again, as its my life's work. I wish they'd hurry up with that time machine, as I'm impatient to go back to 2010 and do it all over again. I almost cry now when I see acquaintances posting stuff from there.

MikeG
04-12-2020, 05:40 AM
Yes, I am just hanging in Central Lonsdale and it has become a paradise for the wealthy retirees, folks who do not need to go to work :) I am too old for the skiing and outdoor activities. But the locals are being squeezed out to the outskirts to Surrey, Langley, Abbotsford, with Chilliwack being outside of the Metro area. I too have a mother and brother and I am in the process of returning back to be close to loved ones in their final years.