Show Posts
Pages: 1 2 [3] 4 5 ... 36
31  Using Arduino / Programming Questions / Multiple definitions error with TIMER0_OVF_vect on: May 28, 2014, 01:52:55 pm
I'm using a program (written by someone else), that uses ISR(TIMER0_OVF_vect).  When I try to compile in Arduino IDE (v1.05)  I get a multiple definition error because Arduino's wiring.c also uses TIMER0_OVF_vect.  Wiring.c isn't used by this program, but I guess Arduino checks it anyway.   The author doesn't compile using the Arduino IDE, so he doesn't have to worry about this.
I don't know much about interrupts and don't know anything about which one TIMER0_OVF_vect represents.  How do I get rid of this error?  I have a feeling it's more complex then just renaming something.

The program can be found here: https://github.com/grbl/grbl/tree/dev
The specific file is  stepper.c, line 419
32  Using Arduino / General Electronics / Re: opto-coupler: transistor vs logic on: May 18, 2014, 10:00:29 pm
So you're saying that if you write a simple sketch that starts a stepper to spinning and monitors those input pins that then those inputs (D9,10,11) will report back Highs when there should be Lows and/or Lows when there should be Highs?
I'm not familiar enough with steppers and the gshield to write a sketch to that.  Maybe it's easy, I'm not sure. 

When I first installed the limit switches, I had the shields from the limit switch wires and the shields from the stepper motor wires all connected to the Arduino ground.  When I turned everything on, it immediately went into alarm mode because it thought a limit switch had been tripped.   If I reset the alarm, it would just go right back into alarm mode for a limit switch. 
The next thing I did was disconnect the motor shield from ground and just let it float.  This helped a lot, the machine didn't go into alarm mode as before. 
I put my scope on the input as shown in a previous photo and I looked at the signal under both scenarios above.  With the motor shield connected to ground I had big oscillations, ringing or something.  It was a couple volts p-p.  When I had the shield floating, it was much better. A number of people who have the same CNC router (a ShapeOko) report that they have problems with noise and the limit switches.  What I'm trying to do now is just decrease the noise as much as possible to minimize the chance of false limit switch triggers.   

33  Using Arduino / General Electronics / Limit switch Schematic on: May 18, 2014, 07:15:53 pm
Here's a schematic of my wiring (not including wires going to the stepper motors).
The gshield schematics can be found here:
https://github.com/synthetos/grblShield/tree/master/hardware/gshield_v5_schematic
34  Using Arduino / General Electronics / Noise on CNC limit switch wires on: May 18, 2014, 06:26:30 pm
Here's a picture of where my scope probes are connected and a few screenshots of what I'm seeing on the scope.  The ground wire for the scope is coming out of one of the unused terminal block pins.

35  Using Arduino / General Electronics / Noise on CNC limit switch wires on: May 18, 2014, 06:25:46 pm
Here are some pictures of my setup.  Inside the yellow electrical enclosure I have an Uno.  Plugged into the Uno is a gshield motor controller.  In the upper left is a proto board with some screw terminal blocks.  Into the top set of screw terminal blocks plug two push-button switches which then go to A0 and A1 on the Uno.  The 3 limit switch cables go into the screw terminal blocks on the right side of the proto board.  For the limit switches, I have the ground wire and shield connected together in the same opening in the terminal block.  On the X-axis limit switch you can see I have a 0.1uF cap, nothing on the other two.  On the bottom of the Uno (which you can't see) I have three 330 ohm  pull-up resistors for the limit switch lines, which are inputs D9,10,11 and the 5V pin.  The limit switches wires actually connect to the gshield, but it's a direct connection down to the Uno via the stacking header.  The ground on the proto board (and thus all the limit switches and push-buttons) comes from the ground pin next to D13.
The gsheild is powered by a 24 VDC power supply.  The Uno does not get power from the ghsield, instead it's powered by the USB cable from my laptop.
The three stepper motors are connected on the right side of the gshield.  The shields are not connected to ground, but they are connected to each other.  I initially had the stepper motor shields connected to ground, but this caused the Uno to think the limit switch was activated.  

I'm working on a schematic I'll upload shortly.

Edit: The limit switch wires have ferrite chokes right outside the yellow enclosure.
36  Using Arduino / General Electronics / Re: opto-coupler: transistor vs logic on: May 18, 2014, 03:53:10 pm
Quote
I'm showing the circuit using the normally-closed terminal.
@Runaway Pancake
Been telling him that for ages but he keeps on ignoring it.
I wasn't ignoring it, I appreciate all the feedback.  I did do some testing with normally closed switch - actually I just closed the limit switch to see if that made any difference with the noise I saw on the scope.  Unfortunately,  I didn't see any difference.  I thought I posted that on the forum, but apparently I didn't.
37  Using Arduino / General Electronics / Re: opto-coupler: transistor vs logic on: May 18, 2014, 01:54:34 pm
Quote
Can you explain why this would make it worse?
Because when the switch has been triggered it is only being pulled down with 1K5 which is not as hard as a direct pull to ground therefore making it more prone to interference.

What happened when you tried the fail safe option of having the switch normally connect to ground?

The way I see it you have a grounding problem.

Good point.  Do you have any suggestions for how I should filter out the noise?
38  Using Arduino / General Electronics / Re: opto-coupler: transistor vs logic on: May 18, 2014, 09:02:39 am
What ever made you think that would work?
I would imagine that is worse than ever.
Not worse, but not better either.  I wanted a low-pass filter to get rid of the noise on the limit switch line.  Can you explain why this would make it worse?
39  Using Arduino / General Electronics / Re: opto-coupler: transistor vs logic on: May 17, 2014, 10:09:16 pm
I tried the RC low-pass filter on one of the limit switch wires, it didn't seem to do much looking at my scope.  Attached is the circuit I used.  I used a 1.5k resistor.  Tomorrow I'll try 100k.
40  Using Arduino / General Electronics / Re: opto-coupler: transistor vs logic on: May 17, 2014, 07:34:00 pm
connect D9  between C1 and R2
R2 can have much higher resistans, 100 kohms.
0.1 uF and 100 kohms make an timeconstant (RC) of 10 ms
Pelle
Thanks. I'll give it a try.
41  Using Arduino / General Electronics / Re: opto-coupler: transistor vs logic on: May 17, 2014, 03:26:28 pm
Is this the right way to add the RC Low-pass filter (R2 & C1)?   See attached schematic.
42  Using Arduino / General Electronics / Re: opto-coupler: transistor vs logic on: May 16, 2014, 09:54:53 pm
FYI, a floating shield is useless.
Things definitely got better with floating shields on the stepper motor cables (limit switch sheilds were still grounded).  I noticed the difference on my scope.  And more importantly, with the behavior of the CNC router.  When I had the motor cable shields grounded, the CNC went into limit switch alarm mode right away.  With floating shields, this didn't happen anymore.  I'm not saying the way I have it now is the right way; it just works better then having all the shields tied together to ground.  I do have all the motor shields connected to each other. 

Quote
1) You get 4V of noise, how are your scope probes setup?  Are they set to 1x or 10x?  (It looks like you have the same scope as one I use at work, and I know they can be either).  If they are set to 10x, try setting them to 1x and see if the problem is still 4V.  (Looking at the problem can make it worse since the probe is high impedance)
They are set to 1X.  I have Rogol DS1102E

Quote
2) Try the low-pass filter.  Since you aren't going for anything high speed, Use a big cap and small resistor.  Make sure to put it next to the Arduino.
I was going to use a 0.1uF cap with 1.5k resistor.   Do you think I should use a different combination?

Quote
3) Try adding some clip-on ferrite beads near your Arduino on the cables.  Just clip them around the whole cable.
Limit switch cables or stepper motor cables?

Quote
4) How are your grounds configured?  Do you have a loop in it, or is it in a proper star configuration?  Can you put the electronics in a box, separate from your motors?
There's a power supply that provides 24 volts to the motor controller (AKA gshield).  The gshield plugs into the Arduino Uno, but the gshield does not power the Uno.  Ground on the gshield and Uno are, of course, connected via the stacking headers, but the Uno is powered via USB from my laptop.  I tested the CNC's 24 VDC power supply with my ohm meter to see if the ground terminal was connected to mains ground - it was not, which is what I would expect.  But I figured I might as well check.
I have a ground wire coming off the Uno that goes to a little proto board with some small screw terminal blocks attached.  This is where the limit switches are wired into.  So all the grounds are pretty close together on the proto board. 
Here's a picture of the setup.  The three limit switch cables enter on the right, go into the terminal blocks, then down to the gshield, which is just bringing up pins D9,10,11 from the Uno underneath.  I have the shield drain wire going into the same terminal block opening as the ground wire.

When I took my measurements with the scope I put the probe right on the limit switch wire as it entered the terminal block.  The ground clip was connected to a wire I had coming out of another terminal block on the proto board.

330 ohm pull-up resistors are soldered to the bottom of the UNO.   I've got a 0.1uF cap on one of the 3 limit switch cables, it's inserted into the screw terminal block along with the wires (cap was installed after I took the above picture).

Moving the electronics would take a lot of rewiring; something I'm not ready to do yet.

Thanks for your help.  I'll give the low-pass filter a try tomorrow.



43  Using Arduino / General Electronics / Re: opto-coupler: transistor vs logic on: May 16, 2014, 05:09:41 pm
Quote
What do you mean by artifacts?
An artifact is something that shows in the data but is not real, it is a byproduct of the measuring or storage system.
For example you might see ringing on a line, this ringing can be real, that is it is actually in the circuit or it can be caused by the scope lead being applied to the signal pin. If when you use a better scope lead there is no ringing then you conclude that the first observation was an artifact, it was not real.
There are many other ways to get artifacts in your measurement like trouble with grounds. As I said I don't believe those measurements are real.

I'm taking an oscilloscope class next week, this will be a good topic to ask about.
44  Using Arduino / General Electronics / Re: opto-coupler: transistor vs logic on: May 16, 2014, 01:46:45 pm
I find it hard to believe that those are real signals, they look like artifacts especially with such a small pull up resistor.

What do you mean by artifacts?  I tried Googling "electrical noise artifact", but I got only medical stuff.

I'll see if using normally closed switch helps.
45  Using Arduino / General Electronics / Re: opto-coupler: transistor vs logic on: May 16, 2014, 10:42:24 am
That's way beyond "noise" (4V of radio noise in a wire?)

Looks more like power supply and/or grounding problems to me.
Do you have any suggestions for how to diagnose this further?
Pages: 1 2 [3] 4 5 ... 36