Show Posts
Pages: [1] 2
1  Using Arduino / Networking, Protocols, and Devices / Re: Serial rx problem. Serial.available() always return 0. on: September 10, 2013, 06:34:57 am
Yep, you centered the point! i tested it with an oscilloscope, the rx line was at 2 v.
Thanks for the tip!

2  Using Arduino / Networking, Protocols, and Devices / Serial rx problem. Serial.available() always return 0. on: September 09, 2013, 08:40:08 am
Hi, i'm trying to send command to a bluetooth module using UART.
I'm having a strange problem though. When i use the arduino USB Serial Light Adapter (http://arduino.cc/en/Main/USBSerial ) i can send command and read answers from the module using serial monitor.

If i load this sketch on arduino micro i can correctly send command to the bt module but i can't read the answer, Serial.available() never return a number greater than 0.

Code:
   

#define POWER 11

void setup(){
   
  //Turn on bt module
  pinMode(POWER, OUTPUT);
  digitalWrite(POWER, LOW);

  //Serial init
  Serial.begin(9600);
  while(!Serial) ;
  Serial1.begin(9600);
   
}

void loop(){
 
  // read from port 0, send to port 1:
  if (Serial.available()) {
    int inByte = Serial.read();
    Serial1.write(inByte);

  }
 
  // read from port 1, send to port 0:
  if (Serial1.available()) {
    int inByte = Serial1.read();
    Serial.write(inByte);
  }
 
}




I can't figure out what's happening. Someone has any clue?

Tx.
Gabriele
3  Development / Other Software Development / Re: Arduino on Xcode Project — Official Thread on: May 11, 2013, 06:53:53 am
Hi, I'm trying to get the project configuration working but I have an error on line 16 of easyTransfer.cpp:

_serial->print(0x06, BYTE);

It says: "BYTE was not declared in this scope"
What do you think it could be?

Tx
Gabriele
4  Using Arduino / Networking, Protocols, and Devices / Re: Bluetooth Clarification Needed on: December 07, 2011, 05:12:19 am
Thank you!

Quote
Keep in mind that this is a 3.3V board. If you are connecting it to a 5V Arduino, you may want to have a look at the last link on the sparkfun site on how to connect it safely.
Not a prob, i disabled atmega internal pullup editing the twi.c file, i will use external pull up to 3.3v

5  Using Arduino / Interfacing w/ Software on the Computer / Re: midi message on: December 07, 2011, 05:09:03 am
Sorry for the delay, well what i can suggest you is to try isolating the problem.
Is it arduino side or computer side? if it is computer side is it a protocol problem, a live problem?

You can send the midi to a real midi instrument (an hardware one) and see what happen so that you can test arduino side.

I suppose you are sending midi over arduino integrated usb, try to use an adapter (they are really cheap), connect arduino to a midi to usb adapter wiring the midi socket to arduino this way:

http://arduino.cc/en/Tutorial/Midi

then read midi from the midi/usb interface.

Therefore there is a library that includes midi function you can find it here:

http://arduinomidilib.sourceforge.net/a00001.html#a3a80e9bd2cfdb619be91d80e8f3b7825

Good Catch!
6  Using Arduino / Interfacing w/ Software on the Computer / Re: Using more than one software with arduino on: December 07, 2011, 04:49:35 am
Hi, i just discovered a way to send serial to multiple software, if you use bluetooth connection to send serial to your computer you can assign multiple serial port  to a single device, well, at least on mac osx.
7  Using Arduino / Networking, Protocols, and Devices / Bluetooth Clarification Needed on: December 06, 2011, 11:22:12 am
Hi, i made a sensor board and i want to make it wireless using the RN 41 (http://www.sparkfun.com/products/10559). From what i understood all i need to do is to attach the Rx and TX pin to arduino's TX and RX and all i will print with Serial.print(...) will be sent over the bluetooth, so that i can read it from bluetooth serial port using the internal bluetooth module of my macbook pro is that right?

Tx
Gabriele


8  Using Arduino / Interfacing w/ Software on the Computer / Re: midi message on: November 25, 2011, 04:28:05 pm
Well, you have to be a little bit more detailed... how do you send data to the computer?
9  Using Arduino / Interfacing w/ Software on the Computer / Re: Using more than one software with arduino on: November 25, 2011, 04:25:15 pm
Another option is to write a pseudo driver that read the serial from arduino, open a socket and mirror the serial data into it.
You can do it with few lines of python if you are not familiar with low level coding but with C you have more control.
10  Using Arduino / Networking, Protocols, and Devices / Re: I2C (SDA-SDL) Voltage problem on: November 25, 2011, 03:43:05 pm
Well, thanks to Fabio Varesano help i figured it out:

-Wire enable pull-ups by default so SDA-SCL lines are 5v

Reference:  http://www.varesano.net/blog/fabio/how-disable-internal-arduino-atmega-pullups-sda-and-scl-i2c-bus

-Internal pull-ups actually degrade the signal so i suggest you to disable them also with sensor that tolerate 5v voltage

Reference: http://www.dsscircuits.com/articles/effects-of-varying-i2c-pull-up-resistors.html


11  Using Arduino / Networking, Protocols, and Devices / Re: I2C 6 DOF IMU on: November 25, 2011, 03:35:48 pm
well, i guess you would have to better understand how these sensor work. I suggest you to read this:

http://www.starlino.com/imu_guide.html





12  Using Arduino / Networking, Protocols, and Devices / Re: I2C 6 DOF IMU on: November 18, 2011, 12:51:24 pm
Using this hardware is a bit more complicated than you think i use this sensors a lot, you can find a lot of well made tutorials, google fabio varesano or starlino for example.
Btw for the adxl345 you have to:



Code:

//Define byte to read:
#define ACC (0x53)           
#define A_TO_READ (6)   

// Init the sensor
writeTo(ACC, 0x2D, 0);     
writeTo(ACC, 0x2D, 16);
writeTo(ACC, 0x2D, 8);

//Use functions to get data out (following functions were made i think by fabio varesano) 

void getAccelerometerData(int * result) {
  int regAddress = 0x32;                                   //first axis-acceleration-data register on the ADXL345
  byte buff[A_TO_READ];
 
 

readFrom(ACC, regAddress, A_TO_READ, buff); //read the acceleration data from the ADXL345
 
  //each axis reading comes in 10 bit resolution, ie 2 bytes.  Least Significat Byte first!!
  //thus we are converting both bytes in to one int
  result[0] = (((int)buff[1]) << 8) | buff[0];   
  result[1] = (((int)buff[3])<< 8) | buff[2];
  result[2] = (((int)buff[5]) << 8) | buff[4];
}

//reads num bytes starting from address register on device in to buff array
void readFrom(int DEVICE, byte address, int num, byte buff[]) {
  Wire.beginTransmission(DEVICE); //start transmission to device
  Wire.send(address);        //sends address to read from
  Wire.endTransmission(); //end transmission
 
  Wire.beginTransmission(DEVICE); //start transmission to ACC
  Wire.requestFrom(DEVICE, num);    // request 6 bytes from ACC
 
  int i = 0;
  while(Wire.available())    //ACC may send less than requested (abnormal)
  {
    buff[i] = Wire.receive(); // receive a byte
    i++;
  }
  Wire.endTransmission(); //end transmission
}




//Writes val to address register on device
void writeTo(int DEVICE, byte address, byte val) {
   Wire.beginTransmission(DEVICE); //start transmission to device
   Wire.send(address);        // send register address
   Wire.send(val);        // send value to write
   Wire.endTransmission(); //end transmission
}




There are libraries for those sensors you can use if you want to simplify your work, remember the first rule of coding is not to reinvent the weel!
Cheers
13  Using Arduino / Networking, Protocols, and Devices / Re: I2C (SDA-SDL) Voltage problem on: November 18, 2011, 12:35:24 pm
Well i think i will first use a level converter on SDA-SCL and then i will do further investigation, if anyone is interested i'll post the results here

14  Using Arduino / Networking, Protocols, and Devices / Re: I2C (SDA-SDL) Voltage problem on: November 18, 2011, 10:07:53 am
Well, i already fried a mag 3110 and i'm going to try a hmc 5883l. I didn't understand already if the 5883l from spark fun can handle 5v SDA-SCL
15  Using Arduino / Networking, Protocols, and Devices / I2C (SDA-SDL) Voltage problem on: November 18, 2011, 07:44:45 am
Hi, i'm a little bit confused about the I2C and wiring library.
I need to use a sensor witch need 3.3v both on the Vcc and on the SDA-SCL.
From what i understood arduino has an internal pull-up resistor on SDA-SCL lines therefore their voltage is 5v, is this right?
If this is right all i need to do is to disable the internal pullups and use two external pull-ups resistor between SDA-SCL and the 3.3v to have SDA-SCL running at 3.3v right?

Tx.

Gabriele
Pages: [1] 2