Show Posts
Pages: 1 2 [3] 4 5 ... 35
31  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. 
32  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?
33  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()
34  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?
35  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.
36  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.
37  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?
38  Development / Other Software Development / Re: Arduino on Xcode Project — Official Thread on: March 26, 2014, 10:09:46 pm
I'd like to see the Iteaduino Lite board supported by EmbedXcode
See: http://imall.iteadstudio.com/iteaduino-lite.html

I got a bunch of these recently and they seem pretty nice.  You can operate at 3.3v or 5v and they have lots of pads so you can solder leads right to the board.  They only cost $8. 
39  Development / Other Software Development / Re: Arduino on Xcode Project — Official Thread on: March 13, 2014, 02:32:44 pm
Hence the solution of modifying the main makefile, which is preserved from being updated.

Modifying the makefile seems like the best approach.  It would be really nice if EmbedXcode supported multiple BOARD_PORT definitions.  Embedxcode would try the first, if that failed, it would try the next, and so on.
40  Development / Other Software Development / Re: Arduino on Xcode Project — Official Thread on: March 13, 2014, 01:52:43 pm
The way to handle this is to change the default BOARD_PORT on the board configuration file as you did or to uncomment and specify a port after BOARD_PORT on the main makefile.

Thanks.
Are the board config files over-written when you upgrade an existing project to the latest version of EmbedXcode?


41  Development / Other Software Development / Re: Arduino on Xcode Project — Official Thread on: March 13, 2014, 07:36:21 am
I was using EmbedXCode (v1.39) with my Arduino Pro-Mini 3.3v and it was having trouble finding the serial port.  Uploading would fail right away.  So I ran "ls /dev/tty.usb*' in terminal and in the mini 3volt xcconfig file I changed

Code:
BOARD_PORT = /dev/tty.usbmodem*
to
Code:
BOARD_PORT = /dev/tty.usbserial-AH01PAW8

This solved the problem.  Is there a way to make EmbedXcode work better with usbmodem*?  I gather the whole serial port thing is a bit tricky.

Also, I noticed that a few times I uploaded the sketch and Xcode said it was successful but the changes I made didn't take, so the program really didn't upload - strange.   I did see the Tx and Rx LEDs blink rapidly.  This happened when the Target was "Upload", but sometimes it worked properly on Upload.  I changed the target to "Fast" and the program was actually uploaded, but it may have been a coincidence that it worked with the Fast target. 

I'm running on iMac with Mavericks and using Adafruit FTDI Friend.   This morning I installed EmbedXcode v1.41 and had the same issue with the serial port. 
42  Development / Other Software Development / Re: Arduino on Xcode Project — Official Thread on: March 11, 2014, 09:09:08 am
The problem with the Leonardo board is the way Serial ports are managed through USB. The latency you describe is caused by the operating system that needs to re-enumerate the USB devices. What version of Mac OS X do you have?

I've got Mavericks running on a new iMac I got a month ago.
43  Development / Other Software Development / Re: Arduino on Xcode Project — Official Thread on: March 11, 2014, 07:33:48 am
Serial ports in the Leonardo are tricky.
See Guide to the Arduino Leonardo and Micro for more details.

Even with the Arduino IDE, I've seen the Leonardo over serial port behave a bit finicky.  The only real advice in the link above was to hold down the reset button then upload - which works pretty well.  This is close to what I'm doing with Xcode, but it seems that Xcode will fail right away if it doesn't see a serial port while the Arduino IDE keeps looking for a bit.  So with the Arduino IDE you can start the upload, then release the reset button.  With Xcode you have to release the reset button then upload.  Unfortunately, this doesn't seem to help with the Serial Monitor in the Terminal window issue when using Xcode.  Do you have any tips for getting this to work?  Is there anything you can change in EmbedXcode that would help?
44  Development / Other Software Development / Re: Arduino on Xcode Project — Official Thread on: March 10, 2014, 08:26:58 pm
I'm trying to upload to a Leonardo, but xcode doesn't see it. 

I got xcode working with the Leonardo.  I press and release the reset button on the Leonardo.  As soon as I release the button I upload the sketch from Xcode.   My next problem is I can't get the serial monitor working in Terminal with the Leonardo.  I'll choose the Fast scheme and it opens the terminal windows, but not output from the Leonardo appears.
45  Development / Other Software Development / Re: Arduino on Xcode Project — Official Thread on: March 09, 2014, 09:57:47 pm
I'm trying to upload to a Leonardo, but xcode doesn't see it.  I get this error:
Code:
---- Size ----
Binary sketch size:  21028 bytes (of a 28672 byte maximum)
Estimated SRAM used: 1385 bytes (of a 2560 byte maximum)
Elapsed time: 0.8 s

---- Reset ----
screen -X kill
No screen session found.

make: [reset] Error 1 (ignored)
sleep 1
9.2-RESET:  <  leonardo ./ ./
stty -f /dev/tty.usbmodem14644111 1200
sleep 2

---- Upload ----
9.3-UPLOAD:  <  leonardo ./
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude -D -patmega32u4 -C/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf -cavr109 -b57600 -P/dev/tty.usbmodem14644111 -Uflash:w:Builds/embeddedcomputing.hex:i

Connecting to programmer: .avrdude: butterfly_recv(): programmer is not responding
make: *** [raw_upload] Error 1
Command /Applications/Xcode.app/Contents/Developer/usr/bin/make failed with exi

I don't have any other Arduinos plugged into the serial ports.  I'm using EmbedXcode+ 137.  I have not problem uploading to the Leonardo with the Arduino IDE (v1.05)
Pages: 1 2 [3] 4 5 ... 35