View previous topic :: View next topic |
Author |
Message |
RF_Developer
Joined: 07 Feb 2011 Posts: 839
|
|
Posted: Wed Feb 01, 2012 2:38 am |
|
|
The module you're using is a Sure Electronics XV-3500CB prototyping board:
http://www.sphere.ws/got/elcontests/200907_usbgyro/DC-SS010_Ver1.0_EN.pdf
The XV-3500CB itself is an IC from Epson Toyocom:
http://www.eea.epson.com/portal/pls/portal/docs/1/424992.PDF
The XV-3500CB doesn't have an I2C interface, just the voltage. The prototyping board has a Microchip MCP3421 18bit delta sigma I2C ADC with I2C interface with 2.048V Vref and this is what you are talking to when you connect with I2C to the prototyping board. That ADC should be good enough to get decent results from this sensor. There's a lot more to reading it than simply waiting for data to come along! You have to configure it to get it converting. The MCP3421 appears to be pretty straightforward as delta sigma convertors go, but you'll need to get to grips with how it works before you get anything useful out of it.
RF Developer |
|
|
rubenskc
Joined: 28 Sep 2011 Posts: 12
|
Hi Chaud... |
Posted: Wed Feb 22, 2012 5:48 am |
|
|
I'm starting a project here with a 16F877a and the XV-3500CB, also using CCS. How's your project going? I have the same issue with you, a bit of difficulty with the I2C, and would like to know how's your code now. Would you share it? _________________ Rubs |
|
|
Chaud
Joined: 11 Jan 2012 Posts: 39
|
Hi rubenskc |
Posted: Wed Feb 22, 2012 7:05 am |
|
|
Sure, so first of all you need to create i2c:
Code: |
#use i2c(master,sda= PIN_B0,scl=PIN_B1)
|
so for I2C i use this method:
Code: |
int32 readGyro(){
int32 gyro;
int value1;
int value2;
i2c_start();
i2c_write(209);
value1 = i2c_read(1);
value2 = i2c_read(0);
i2c_stop();
gyro = make16(value2,value1);
return gyro;
} |
i2c_start() -> starts the i2c
i2c_write(209) -> sends the instruction necessary to tell the slave that we want to read values (209 is the same thing than "11010001" as you can see in xv-3500 datasheet).
i2c_read(1) -> reads the first 8-bit number, "1" means that i want to receive another 8-bit
i2c_read(0) - > reads the last or MSB 8-bit number, "0" means that we have the 16-bit number already.
And gyro (returned value) is the conversion of 16-bit number to decimal.
Normally my offset is "16133" but it is different in all XV-3500CB's, your can be something arround 15000 or something arround 17000, that number is easy to get, just see the value that you get when the gyro is stable.
Anything, feel free to ask,
Chaud
EDIT: dont forget you need to have a resistor in SCL and SDA gyro pins,for pull-up's, otherwise i2C wont work (i use 2.2Kohm), and connect it to SCL and SDA pic16 pins, see on datasheet |
|
|
rubenskc
Joined: 28 Sep 2011 Posts: 12
|
Hm... |
Posted: Fri Feb 24, 2012 9:27 am |
|
|
Thanks, mate!!! Fantastic, I'll try this next week. I have a working accelerometer, but now I'm implementing a LCD and that is not working. As soon as the LCD is working fine, I'll try! Is the reading via serial really better (more accurate) than the reading via ADC? _________________ Rubs |
|
|
rubenskc
Joined: 28 Sep 2011 Posts: 12
|
Also... |
Posted: Fri Feb 24, 2012 9:37 am |
|
|
Also... how sensitive is the device? Did you get a good accuracy (1 degree or so) ?
We you able to integrate and get the angle from the reading info successfully? Would you share? _________________ Rubs |
|
|
rubenskc
Joined: 28 Sep 2011 Posts: 12
|
Any..... |
Posted: Thu Aug 09, 2012 8:05 am |
|
|
Any news, Chaud? I'm still getting trouble - the I2C interface works... but in trouble calculating the angle.... _________________ Rubs |
|
|
|