Show Posts
Pages: 1 2 [3] 4 5 ... 35
31  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.
32  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.



33  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.
34  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.
35  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?
36  Using Arduino / General Electronics / Re: opto-coupler: transistor vs logic on: May 16, 2014, 08:20:25 am
Hmmm.  Then I'd probably be better off with a simple low pass filter.  What do you think?

Normally a stronger pullup would do the job, if you're saying it doesn't then it's impossible to say what to do without knowing:
a) The source + type of the noise
b) Why it would affect a switch on the end of a shielded cable.
c) What type of switch it is

I'm already using a 330 ohm pull-up resistor. 
The noise is coming from the pulses going to the stepper motors.  The wires to the stepper motor are shielded, but the shield is floating.  The wires to the limit switches are also shielded and the shield is connected to the ground on the Uno.
The limit switch is a McMaster Miniature snap action (see attached) (# 7779K22).

The problem is the Arduino thinks the limit switch was triggered when it wasn't.  Originally I had the stepper motor cable shields connected to the shields of the limit switches and all that was going to Arduino ground.  In this config the problem was bad.  The Arduino would immediately think the limit switch was tripped.  Then I disconnected the motor cable limit switch so it was floating and it was a lot better.  You can see some screenshots from my oscilloscope here:
http://www.shapeoko.com/forum/viewtopic.php?f=3&t=3423#p25805

37  Using Arduino / General Electronics / Re: opto-coupler: transistor vs logic on: May 16, 2014, 07:57:08 am
Quote
I don't have a 2nd power supply, I'm planning on just using the Arduino power. 
that defetes the whole pointed having an opto isolator making it a total waste of components, there will be no differance

Hmmm.  Then I'd probably be better off with a simple low pass filter.  What do you think?
38  Using Arduino / General Electronics / Re: opto-coupler: transistor vs logic on: May 15, 2014, 07:41:27 pm
Both need pullup resistor on the open collector output for the next stage to see valid high out.

The data sheet says the HCPL2631QT has an internal pull-up resistor
39  Using Arduino / General Electronics / Re: opto-coupler: transistor vs logic on: May 15, 2014, 07:17:45 pm
You do know that you will need a totally different and separate power supply for the switch side of the circuit.
Personally I don't see why you think you will have problems with noise on the line. Just use a strong pull up resistor.

I don't have a 2nd power supply, I'm planning on just using the Arduino power. 
My CNC router is a ShapeOko 2.  Noise problems on the limit switch cables are a pretty common problem, even with shielded cable.  The limit switches are an owner DIY upgrade, they are not part of the factory kit.
I was initially thinking of using R/C low-pass filter, but then I thought the opto-coupler would be better. 
40  Using Arduino / General Electronics / opto-coupler: transistor vs logic on: May 15, 2014, 12:22:54 pm
I'm using an Arduino Uno on my CNC router with some limit switches.  I want to optically isolate the limit switches so noise on the line doesn't cause problems (the wires are already shielded).  I noticed there a couple styles of opto-couplers: transistor and logic.  It seems like the logic would be a good choice since I'm only interested in on or off, but I don't know much about either type.  The opto-couplers I've been looking at are:
Logic: Digikey HCPL2631QT-ND (I picked this because it was used in a reprap isolation board schematic I found)
Transistor: Digikey 160-1362-5-ND

Which is the best choice for my application?
41  Using Arduino / Sensors / Re: BMA250 Accelerometer - how to sleep on: May 02, 2014, 12:10:05 pm
I figured out how to do this using the suspend feature.  I didn't realize I could wake the BMA250 from suspend sleep with an I2C command.  So this turned out to be pretty easy.  But I have a strange problem that has me stumped.  I have a test sketch that works.  It puts the accelerometer to sleep for 5 seconds, wakes it up for a reading then back to sleep.  I had a few Serial.println() statements in the code for debugging.  When I started to take the print statements out, it stopped working properly - it just stays in sleep mode and keeps returning the same value for x y z.  I tried putting a delay where the print statement was thinking maybe that was the cause, but that didn't help. 

Here is the working sketch with the Serial.println() statements still in place.

Code:
#include <Wire.h>
#define BMA250_I2CADDR      0x18
#define BMA250_RANGE        0x03   // 0x03 = 2g, 0x05 = 4g, 0x08 = 8g, 0x0C = 16g
#define BMA250_BW           0x08   // 7.81Hz (update time of 64ms) - slowest speed
#define BMA250_POWERMODE    0x11   // Power Mode register
#define BMA250_WAKEUP          0
#define BMA250_SLEEP           1

int AccelX;
int AccelY;
int AccelZ;


// Function Prototypes
void setup();
void loop();
void BMA250Init();
int BMA250ReadAccel();
uint8_t getPwrModeRegister();
bool setSleepMode(bool suspendMode);


void setup()
{
  Wire.begin();
  Serial.begin(9600);
  BMA250Init();
}


void loop()
{
  static uint32_t tmrSleep = millis();
 
 
  if ((long)(millis() - tmrSleep) > 0)
  {
    tmrSleep = millis() + 5000;
    setSleepMode(BMA250_WAKEUP);
    delay(2); // give accelerometer time to wake-up

    BMA250ReadAccel();
 
    // Print out the accelerometer data
    Serial.print("x: ");
    Serial.print(AccelX);
    Serial.print("\ty: ");
    Serial.print(AccelY);
    Serial.print("\tz:");
    Serial.print(AccelZ);
    Serial.println("");   
    Serial.println("Going to sleep now");
    setSleepMode(BMA250_SLEEP);
  }
}


void BMA250Init()
{
  // Setup the range measurement setting
  Wire.beginTransmission(BMA250_I2CADDR);
  Wire.write(0x0F);   // G-force range register
  Wire.write(BMA250_RANGE);
  Wire.endTransmission();
 
  // Setup the bandwidth
  Wire.beginTransmission(BMA250_I2CADDR);
  Wire.write(0x10);  // bandwidth register
  Wire.write(BMA250_BW);
  Wire.endTransmission();
} // BMA250Init


int BMA250ReadAccel()
{
  uint8_t ReadBuff[8];
 
  // Read the 6 data bytes from the BMA250
  Wire.beginTransmission(BMA250_I2CADDR);
  Wire.write(0x02);  // starting register for accel data
  Wire.endTransmission();
  Wire.requestFrom(BMA250_I2CADDR,6);
 
  for(int i = 0; i < 6;i++)
  { ReadBuff[i] = Wire.read(); }
 
  AccelX = ReadBuff[1] << 8;
  AccelX |= ReadBuff[0];
  AccelX >>= 6;
 
  AccelY = ReadBuff[3] << 8;
  AccelY |= ReadBuff[2];
  AccelY >>= 6;
 
  AccelZ = ReadBuff[5] << 8;
  AccelZ |= ReadBuff[4];
  AccelZ >>= 6; 
} // BMA250ReadAccel()



bool setSleepMode(bool suspendMode )
{
  uint8_t powerModeBuf;
 
  // Read current register value
  powerModeBuf = getPwrModeRegister();
  Serial.print("Read Register:  ");
  Serial.println(powerModeBuf, BIN);
 
  // Set the suspend bit
  if (suspendMode == BMA250_SLEEP)
  { powerModeBuf |= 1 << 7; }  // set bit 7
  else
  { powerModeBuf &= ~(1 << 7); }  // clear bit 7


  Serial.print("Write Register: ");
  Serial.println(powerModeBuf, BIN);

  // Write register back to accelerometer
  Wire.beginTransmission(BMA250_I2CADDR);
  Wire.write(BMA250_POWERMODE);  // Powermode register
  Wire.write(powerModeBuf);
  Wire.endTransmission();

  return suspendMode;

} // setSleepMode()



// Power Mode register 0x11
// bit 7 - suspend
uint8_t getPwrModeRegister()
{
  // Read the power mode register byte 0x11
  Wire.beginTransmission(BMA250_I2CADDR);
  Wire.write(BMA250_POWERMODE); // power mode register
  Wire.endTransmission();
  Wire.requestFrom(BMA250_I2CADDR,1);
  return Wire.read();

} // getPwrModeRegister()
42  Using Arduino / Sensors / BMA250 Accelerometer - how to sleep on: May 01, 2014, 10:39:55 pm
I have a Bosch BMA250 accelerometer that I'd like to connect to an TinyDuino.  Ideally, I want to have the TinyDuino and BMA250 both sleep for 8 seconds.  Then the TinyDuino would wake up and tell the BMA250 to wake up and transmit the accelerometer readings.  Then both would go back to sleep.  I looked at the BMA250 Data Sheet and I couldn't figure out how to do this - but there was a lot on the data sheet I didn't understand.  I also need to figure out how to put the TinyDuino to sleep, but one thing at a time.  Anyone know how to do this?
43  Development / Other Software Development / Re: Arduino on Xcode Project — Official Thread on: April 23, 2014, 09:26:17 pm
I just installed release 151.  I opened a project on release 148 or 149 and embedxcode+ upgraded my project.  But in the log it said it updated it to ver 150.
44  Development / Other Software Development / Re: Arduino on Xcode Project — Official Thread on: April 17, 2014, 09:48:32 pm
I just installed EmbedXcode+ ver 149, but when I opened a project, I was not prompted to upgrade.  I ran the Build scheme and looked at the log and it said embedxcode ver 141.
45  Community / Exhibition / Gallery / Re: reflow (toaster) oven now earning its keep on: April 05, 2014, 03:44:07 pm
here's the final circuit
(went through several iterations to get there - as you do!)
and here's the triac heater control

In your circuit, what's the purpose of R5?  Also, I see you have the mains hot connected to MT2 on the triac.  Does it matter which way the triac is wired?  Would it make a difference if MT1 went to mains hot and MT2 went to the oven?
Pages: 1 2 [3] 4 5 ... 35