Help with 3.3V SCA3000 accelerometer with 5V Duemilanove

Help! I am a newb to the Arduino and I do not have an electronics background. Nor do I have an oscilliscope. I’ve been trying to get the SPI communications working between a 5V Arduino Duemilanove and a 3.3V SCA3000 accelerometer on a breakout board from Sparkfun. But first, I think I first need help with the wiring.

My most “successful” attempt at trying to read information from the SCA3000 has been through the Sparkfun Logic Level converter, BOB-08745. Below is a diagram of how I connected it:

Arduino                      Logic Level Converter          SCA3000 Breakout
------------------           -------------------------      -----------------------
Pin 10 (SS or CS)            RXI --> RXO (chnl1)            CSB
Pin 11 (MOSI)                TXO --> TXI (chnl1)            MOSI
Pin 12 (MISO)                TXO --- TXI (chnl2)            MISO
Pin 13 (SPI clock)           RXI --> RXO (chnl2)            SCK
3.3V                         on Low Level side              VIN
5V                           on High Level side
Gnd                          both Gnds                      GND

no additional resistors were used

Voltages at CSB: 2.497V (High, or Disabled) & 0.111V (Low, or Enabled)
If connection from CSB to RXO is removed, CSB: 3.256V.  RXO: 2.370V & 0.001V.
Voltage at SCA3000 chip after Breakout board voltage regulator: 3.298V.  It does not matter whether connected to 5V or 3.3V from the Arduino.

The code I am using is at the bottom of this posting. The code is from another posting by Emdee. It is just trying to get information from the SCA3000.

Below are the results from the last attempt with this diagnostic program. This is using my 2nd SCA3000 Breakout board. (I believe I may have fried my first SCA3000 breakout board by connecting it directly to the Arduino):

Code:
SPCR: 1010011
Mode (address 14h) = 00010000
Status (address 2h) = 00000000
Int_status (i.e. buffer, etc., 16h) = 00000000
Ctrl_Sel (i.e. control register selector, 18h) = 00000000
Int_Mask (i.e. interput mask register, 21h) = 00000000
Temperature (addresses 13h &12h) = 0000000000000000
00000000 00000000  00000000 00000000  00000000 00000000      0    0    0
00000000 00000000  00000000 00000000  00000000 00000000      0    0    0
00000000 00000000  00000000 00000000  00000000 00000000      0    0    0

(mode = 0 just after uploading program.  Mode = 16, or Free-fall enabled after
repowering unit.)

I do get differing results after just uploading the program and opening a COM window as opposed to uploading the program, disconnecting the USB from the Arduino, reconnecting the USB, and then opening a COM window. The only difference is the value that is returned from the Mode register.

The most I’ve ever received from reading the X, Y, and Z accelerations is a single line of returned numbers. After that, it starts returning zeroes.

From another forum, I took the suggestion by RuggedCircuits to perform a Loopback test. I connected the MOSI to the MISO on the low voltage side of the Logic Level Converter (just to make sure the TX lines really were bi-directional). This is what I got. (This output does not have some of the reads of the other registers as I showed above – the program was altered slightly.)

SPCR: 1010011
mode = 00010100  (This value of 14h, or 20, is the address sent out on MOSI)
status = 2                 (This value of 2 is the address sent out on MOSI)
00000101 00000100  00000111 00000110  00001001 00001000   1284 1798  264
00000101 00000100  00000111 00000110  00001001 00001000   1284 1798  264
00000101 00000100  00000111 00000110  00001001 00001000   1284 1798  264

(The Binaries are addresses 5, 4 (for X), 7, 6 (for Y), and 9, 8 (for Z).)

The results were what I expected. Address In, Address Out. From the SPDR, you can see I’m trying the SPI communications at the slowest speed. That has not made a difference in communicating with the SCA3000.

I’ve tried other configurations, including some of the ones suggested in the Sparkfun Sensor Interfacing tutorial http://www.sparkfun.com/commerce/tutori … ials_id=65. I tried this connection and got some strange results:

Arduino                                                     SCA3000 Breakout
------------------           -------------------------      -----------------------
Pin 10 (SS or CS)            1kohm, 10kohm to 3.3V          CSB
Pin 11 (MOSI)                10kohm                         MOSI
Pin 12 (MISO)                directly wired                 MISO
Pin 13 (SPI clock)           10kohm                         SCK
3.3V                                                        VIN

With this voltage divider on CSB, V = 4.078 when high and 0.327V when low. The specs for the SCA3000 chip say V no higher than 3.6V.

SPCR: 1010011
mode = 00000010
status = 4
00010000 00000000  00000100 00000000  01000010 00001110      0 1024  526
00000000 01000000  00000100 00010000  01000000 00000010     64 1040    2
00000000 10000010  00000100 00000000  00000000 00001100    130 1024   12
01000000 00000000  00000000 00000000  01000100 00001100      0    0 1036
00000000 00000000  00000000 01000001  11000000 00000110      0   65    6
00000000 01100010  00000000 00000000  00000000 00010000     98    0   16
00100000 00000000  00000000 00000000  00000010 00001000      0    0  520
00000000 00000000  00000000 01000000  00000000 00000000      0   64    0


On a second attempt on running with this wiring configuration, I got:

SPCR: 1010011
mode = 00000000
status = 0
00000000 00000000  00000000 00000000  00000000 00000000      0    0    0
00000000 00000000  00000000 00000000  00000000 00000000      0    0    0
00000000 00000000  00000000 00000000  00000000 00000000      0    0    0

Instead of the voltage divider set up above, I used a diode in place of the 1k ohm resistor and got the voltages at CSB to 3.434V (High) and 0.212V (low). The COM window returned all zeroes for the modes, status, and accelerometer register reads.

Has anyone hooked up one of these SCA3000 chips to a 5V Arduino board successfully? How did you wire it? Could the 2.5V coming out of the Logic Level Converter be too low for this chip, even though the specs say 0.7 * VIN, or 2.31V min? Are there additional programming commands that are required with this chip to enable it over and above other chips with SPI communications?

Any help would be greatly appreciated!! I’ve been tearing my hair out on this over the last couple of weeks. This accelerometer is the one that is recommended for dead reckoning applications with digitial outputs.

/* Code is from Emdee, dated 2-18-09.  It is a test program only.
   This code does not include the bit shifting that will be eventually required.
   Slight mods from original code with more diagnostic println's. 
*/

#include <Spi.h>

#define UBLB(a,b)  ( ( (a) << 8) | (b) )
#define UBLB19(a,b) ( ( (a) << 16 ) | (b) )

byte b1,b2;
int Ax,Ay,Az;
unsigned int temp,n;


void setup()
{ Serial.begin(9600);
delay(20);
 Spi.mode(0);
delay(2);
SPCR = (1<<SPE)|(1<<MSTR)|(1<<SPR1)|(1<<SPR0); //Set SPI communications to slowest speed, or 250kHz
int n = SPCR;
 Serial.print("SPCR: ");
 binaryPrint(n);
 Serial.println();
 n = Spi.transfer(0x14);
 Serial.print("Mode (address 14h) = ");
 binaryPrint(n);
 Serial.println();
// n = Spi.transfer(0x00);
// Serial.print("RevID: ");
// binaryPrint(n);
// Serial.println();
 n = Spi.transfer(0x02);
 Serial.print("Status (address 2h) = ");
 binaryPrint(n);
 Serial.println();
 n = Spi.transfer(0x16);
 Serial.print("Int_status (i.e. buffer, etc., 16h) = ");
 binaryPrint(n);
 Serial.println();
 n = Spi.transfer(0x18);
 Serial.print("Ctrl_Sel (i.e. control register selector, 18h) = ");
 binaryPrint(n);
 Serial.println();
 n = Spi.transfer(0x21);
 Serial.print("Int_Mask (i.e. interput mask register, 21h) = ");
 binaryPrint(n);
 Serial.println();
 delay(1000);
 n = Spi.transfer(0x13);
 Serial.print("Temperature (addresses 13h &12h) = ");
 binaryPrint(n);
 n = Spi.transfer(0x12);
 binaryPrint(n);
 Serial.println();
/*
 n = Spi.transfer(0x14);
 Serial.print("mode = ");
 Serial.println(n);
 */
 delay(1000); 

}

char* fmtSpace(int i, char *buf)
{

 int j,k;
 for (j=0;j<7;j++) buf[j]=0;
 itoa(i,buf,10);
 j=0;
 if (i<10000) j=1; // less than 5 characters, 1 space
 if (i<1000)  j=2;
 if (i<100)   j=3;
 if (i<10)    j=4;
 for (k=5-1;k>=0 ;k--)
 {
   buf[k]= (k-j>=0)? buf[k-j] : ' ';
 }
 return buf;
}

void binaryPrint(byte in_b)
{ int i,j;
 byte b;
 for (i=7;i>=0;i--)
 {
   if (in_b & 1<<i)
     Serial.print('1');
   else
     Serial.print('0');
 }
}

char ibuf[10];
int c=0;
short s;
void loop()
{
//  if (!c) // my loop counter
//    Serial.println("Ax     Ay     Az ");

 b1 = Spi.transfer(0x05); //x axis msb
 b2 = Spi.transfer(0x04); //x axis lsb
 binaryPrint(b1);
 Serial.print(' ');
 binaryPrint(b2);
 b1 &= B00000111;         //just 11 bit so clear all but last 3 of msb
 Ax = UBLB(b1,b2);

 b1 = Spi.transfer(0x07); //y axis msb
 b2 = Spi.transfer(0x06); //y axis lsb
 Serial.print("  ");
 binaryPrint(b1);
 Serial.print(' ');
 binaryPrint(b2);
 b1 =  b1 & B00000111;         //just 11 bit so clear all but last 3 of msb
 Ay = UBLB(b1,b2);
 b1 = Spi.transfer(0x09); //z axis msb
 b2 = Spi.transfer(0x08); //z axis lsb
 Serial.print("  ");
 binaryPrint(b1);
 Serial.print(' ');
 binaryPrint(b2);
 b1 &= B00000111;         //just 11 bit so clear all but last 3 of msb
 Az = UBLB(b1,b2);
 fmtSpace(Ax,ibuf);
 Serial.print("  ");
 Serial.print(ibuf);
 fmtSpace(Ay,ibuf);
 Serial.print(ibuf);
 fmtSpace(Az,ibuf);
 Serial.println(ibuf);
 delay(10000);           
//  c++;
//  c = c % 20;
}

Hello,

The first thing important, is the way to encode the adress.

If you want to read the adress $05, you must use this formula:

  • BYTE = (Address * 4) + RW*2;

  • For Read operation RW = 0 and for Write operation RW = 1

  • ‘Address 4’ shifts the bit pattern to left by 2 and 'RW2’ by 1.

  • BYTE = 0x05*4 + 0;

  • BYTE = 0x14;

You will find very important information at this adress:

http://www.vti.fi/midcom-serveattachmen … ev_0.1.pdf

Now I can see my SCA3000 response on my oscilloscope, but only if I disconnect the MISO from the SDI of my PIC :frowning:

Regards

After stepping away from this for a few days, I decided to try Voltage Dividers to get the signal voltages for MOSI and the SPI clock down to the 3.3V range. My gut feeling was that the Sparkfun Logic Level board was outputting too low of voltages for the SCA3000.

I then took a look at the SCA3000 Datasheet, not the Manual, to discover the SCA3000 really prefers to operate at 2.5V, not 3.3V. If using 3.3V as with Sparkfun’s SCA3000 Breakout, it appears as if the I/O voltages should be within ~10% of the 3.3V.

Below is my attempt to get the I/O voltages correct so the devices can communicate. If you notice any gross errors or if you have suggestions to reduce the required operating power, please let me know. :roll:

I am now getting continuous output values instead of 0’s. I now have to work through the register shifts that Michastro suggested. Thank you Michastro!

Arduino Duemilanove (5V)                                    SCA3000 Breakout (3.3V)
------------------------     -------------------------      -----------------------
Pin 10 (SS or CS)  -->       Diode (NTE110, ~1.5k/40kohm),  CSB
			              		 10kohm to 3.3V *         
Pin 11 (MOSI)      -->       Voltage divider - 20kohm,      MOSI
			              		 66kohm to Ground **     
Pin 12 (MISO)      <--       Used Sparkfun Logic Level      MISO
			              		 converter, BOB-08745, to
				              	 boost voltage via TX circuit
Pin 13 (SPI clock) -->       Voltage divider - 33kohm,      SCK
				              	 66kohm to Ground
3.3V                                                        VIN

*  A voltage divider using a 1k & 10kohm (to 3.3V) resistor did not work since the CSB on the SCA3000 is normally high at 3.256V.  I used NTE Electronics diode #NTE110 since I was able to buy it locally.
** This voltage divider was adjusted from 33kohm and 66kohm since the MOSI pin on the SCA3000 breakout had ~143k ohm resistance to ground, so I had to adjust the divider.  I chose these high resistances since the SCA3000 only needs 10 - 50 micro-amps per logic circuit.

Ahhh success!!! :slight_smile: The wiring diagram from yesterday worked! Michastro, thank you for the advice on the bit shifting prior to trying to read from the SCA3000.

For anybody trying to read the temperature from the accelerometer, there is a huge typo in the manual. In section 2.6.1 of the manual, the formula should be Temp[°C] = 23°C + (TempDec - 256) / 1.8. The “LSB” references are typos. TempDec is the output of the combined MSB and LSB, and then bitshifted by 5.

Below is the output I was getting today from SCA3000. To get the three axes within the correct ranges of -1000 to 1000 mg, or milli-gravities, I had to put in artificial offset adjustments for each axis. (That irks me quite a bit, especially since the chip was supposed to be calibrated to within 1%.)

There seems a good amount of noise in my samplings. The example below is with the board stationary on a concrete floor. The Max to Min differences in just this small sample is X: 24 mg, or 32 counts, Y: 13.5 mg, or 18 counts, Z: 18.75 mg, or 25 counts. The readings were taken once per second, or 1 Hz. Any ideas or suggestions??? :roll:

SPCR: 1010010
mode   = 0
status = 0
Rev ID = 100001
Temperature MSB = 100000   32
Temperature LSB = 10100000   160
Temperature MSB & LSB = 10000010100000   TempDec: 261.00
Approximate Temperature in Celcius inside chip: 25.8   Temp in F: 78.4

Outputs are in mg, or milli-gravity:

X-axis: -11.75   Y-axis: -88.75   Z-axis: -986.75
X-axis: -14.75   Y-axis: -80.50   Z-axis: -989.00
X-axis: -22.25   Y-axis: -89.50   Z-axis: -989.00
X-axis: -10.25   Y-axis: -85.00   Z-axis: -988.25
X-axis: -23.75   Y-axis: -91.00   Z-axis: -996.50
X-axis: -27.50   Y-axis: -88.00   Z-axis: -997.25
X-axis: -30.50   Y-axis: -91.00   Z-axis: -995.00
X-axis: -19.25   Y-axis: -83.50   Z-axis: -991.25
X-axis: -26.00   Y-axis: -86.50   Z-axis: -991.25
X-axis: -14.75   Y-axis: -89.50   Z-axis: -994.25
X-axis: -18.50   Y-axis: -91.00   Z-axis: -1005.50
X-axis: -17.75   Y-axis: -88.75   Z-axis: -993.50
X-axis: -20.00   Y-axis: -83.50   Z-axis: -992.75
X-axis: -16.25   Y-axis: -89.50   Z-axis: -995.00
X-axis: -8.75   Y-axis: -86.50   Z-axis: -992.75
X-axis: -24.50   Y-axis: -82.75   Z-axis: -998.00
X-axis: -16.25   Y-axis: -89.50   Z-axis: -1004.00
X-axis: -23.75   Y-axis: -84.25   Z-axis: -993.50
X-axis: -5.75   Y-axis: -87.25   Z-axis: -986.75
X-axis: -7.25   Y-axis: -90.25   Z-axis: -998.00
X-axis: -6.50   Y-axis: -77.50   Z-axis: -991.25
X-axis: 1.00   Y-axis: -89.50   Z-axis: -993.50
X-axis: -20.75   Y-axis: -89.50   Z-axis: -998.00
X-axis: -9.50   Y-axis: -88.00   Z-axis: -1005.50
X-axis: -21.50   Y-axis: -90.25   Z-axis: -988.25
X-axis: -17.75   Y-axis: -77.50   Z-axis: -987.50
X-axis: -19.25   Y-axis: -83.50   Z-axis: -1001.75

Below is the code I used to read the SCA3000. The wiring to the SCA3000 is diagrammed in the previous post.

/* This is combo of code from VTI's function for reading the X-axis of the SCA3000 Accelerometer 
   and the Mode Register.  It is for diagnostic purposes only.
   
   See:  http://www.vti.fi/midcom-serveattachmentguid-f8d0194a36326993efdc5211fbef229a/tn55_c-code_example_for_sca3000_rev_0.1.pdf

   Reading the Temperature register is far easier than what the manual suggests.  See below.
*/

#include <Spi.h>
#define SPI_CSB 0x04 
#define SPI_PORT PORTB  // sets Pins 10-13 for SPI communication

#define X_MSB 0x05	// x-axis MSB for reading SCA3000 Accelerometer
#define Y_MSB 0x07	// y-axis MSB
#define Z_MSB 0x09	// z-axis MSB
#define TEMP_MSB 0x13   // Temperature sensor MSB for SCA3000
#define AccelMultiplier 0.09375  // Instead of bit shifting right and then retrieving
                                 // the sign bit, this just converts the result
                                 // into mg, or milli-gravity.
                                 // 0.09375 = 0.75 mg per count / 2^3, or a 3 bit shift
#define X_Offset -245   // X-axis offset - device dependent - units in milli-gravity, or mg
#define Y_Offset -82    // Y-axis offset
#define Z_Offset  97    // These offsets really should be in the Accel chip, not the microcontroller

byte b1,b2;
int n;
unsigned int temp;        // Temperature reading in counts   
float tempDec, tempC;     // Temperature in "decimal" counts and in Celcius
float Ax,Ay,Az;

void setup()
{ Serial.begin(9600);
  delay(20);
  Spi.mode(0);    // This requires the SPI library, but also initializes ports. 
//  SPCR = (1<<SPE)|(1<<MSTR)|(1<<SPR1)|(1<<SPR0); //Set SPI comm to slowest speed, or 250kHz
                                                  // Good speed to initially use for diagnostics
  SPCR = (1<<SPE)|(1<<MSTR)|(1<<SPR1); //Set SPI comm to slower speed of 1MHz to stay within
                                      // specifications of the SCA3000 chip (1.6 MHz max)
                                      // Top SPI speed = 4MHz;  this is 4MHz / 2^2, or 1MHz
  delay(35);  // To allow SPI communications to initialize and SCA3000 to boot up & stabilize
  int n = SPCR;  
  Serial.print("SPCR: ");
  Serial.println(n, BIN);
  n = SCA3000_Read_8bit(0x14);    // Read address 14 for Mode
  Serial.print("mode   = ");
  Serial.println(n, BIN);
  n = SCA3000_Read_8bit(0x02);    // Read address 02 for status
  Serial.print("status = ");
  Serial.println(n, BIN);
  n = SCA3000_Read_8bit(0x00);    // Read address 00 for RevID
  Serial.print("Rev ID = ");
  Serial.println(n, BIN);
  temp = 0;
  tempC = 0.0;
  n = SCA3000_Read_8bit(TEMP_MSB);    // Read Temperature MSB. cannot use 16bit read for Temps.
  temp = n << 8;                      // Bitshift left.  Make room for LSB.
  Serial.print("Temperature MSB = ");
  Serial.print(n, BIN);
  Serial.print("   ");
  Serial.println(n);
  n = SCA3000_Read_8bit(0x12);        // Read Temperature sensor LSB.
  temp |= n;                          // Combine LSB with MSB value
  Serial.print("Temperature LSB = ");
  Serial.print(n, BIN);
  Serial.print("   ");
  Serial.println(n);
  Serial.print("Temperature MSB & LSB = ");
  Serial.print(temp, BIN);
//  Serial.print("   ");
//  Serial.print(temp);
  Serial.print("   TempDec: ");
  tempDec = temp >> 5;                   // Bitshift by 5
  Serial.println(tempDec);
  tempC = 23 + ((tempDec - 256) / 1.8);  // This is what the formula should be from VTI manual, section 2.6
  Serial.print("Approximate Temperature in Celcius inside chip: ");
  Serial.print(tempC,1);
  Serial.print("   Temp in F: ");
  Serial.println((tempC * 9 / 5 +32),1);
  Serial.println();
  Serial.println("Outputs are in mg, or milli-gravity:");
  Serial.println();
 }

/* This example reads SCA3000 8bit register contents.
 * The MODE register address is 0x14.  Status is 0x02.  RevID is 0x00.
 * NOTE: The command byte of SPI bus is :
 * (MSB) A A A A A A A RW 0 (LSB)
 *       |           | |  *- allways zero
 *       |           | *--- Read / Write Bit
 *       \-----------*------ Register address, 0x14 at this example
 *
 * Because of that the real byte send to SPI bus must be calculated:
 *     BYTE = (Address * 4) + RW*2;
 * For Read operation RW = 0 and for Write operation RW = 1
 * 'Address *4' shifts the bit pattern to left by 2 and 'RW*2' by 1.
 *  BYTE = 0x14*4 + 0;
 *  BYTE = 0x50;
 * This calculation is done inside the function.
 *
 * Use of the following function:
 *
 * SCA3000_Read_8bit(0x14);
 *
 * SPDR - is the read/ write data to/ from SPI bus register
*/ 
//#define SPI_CSB 0x04 // This is PB2 at the port
//#define SPI_PORT PORTB

// Read an 8bit SCA3000 register and return its value.
int SCA3000_Read_8bit(unsigned int Address)
{
       int result;
       result = 0;
       Address = Address << 2;            // RW bit is set to zero by shifting the bit
                                          // pattern to left by 2
       SPI_PORT = SPI_PORT & (~SPI_CSB);  // Set CSB to zero
       SPDR = Address;                    // Write command to SPI bus
       while(!(SPSR & (1 << SPIF)))       // Wait until data has been sent
              ;
       SPDR = 0x00;                       // Write dummy byte to line
                                          // in order to generate SPI clocks for data read
       while(!(SPSR & (1 << SPIF)))       // Wait until data has been sent
              ;
       result = SPDR;
       SPI_PORT = SPI_PORT | SPI_CSB;     // Set CSB to one
       return result;
}

/* This example reads SCA3000 acceleration registers MSB and LSB.  This can only be used w/ X,Y,&Z
 * The register address of X channel is 0x05 (MSB), Y is 0x07, Z is 0x09, Temp is 0x13 (MSB)
 * Note:  No shifting of returned values is done within this subroutine.
 * NOTE: The command byte of SPI bus is :
 *       (MSB) A A A A A A A RW 0 (LSB)
 *             |           |  | *- always zero
 *             |           |  *--- Read / Write Bit
 *             \-----------*------ Register address, 0x05 at this example
 *
 * Because of the real byte sent to SPI bus must be calculated:
 *     BYTE = (Address * 4) + RW*2;
 * For Read operation RW = 0 and for Write operation RW = 1
 * 'Address *4' shifts the bit pattern to left by 2 and 'RW*2' by 1.
 *  BYTE = 0x05*4 + 0;
 *  BYTE = 0x14;
 * This calculation is done inside the function.
 *
 * Usage of the following function:
 *
 * int Xacc;
 *
 * Xacc = SCA3000_Read_16bit(0x05);
 *
 * This example has been written for an Atmel ATmega168 processor in a GCC environment.
 * Other processors or environments might need different names ports or SPI device names.
 * SPDR - is the read/ write data to/ from SPI bus register
 * (see ATmega168 document (doc2545.pdf) pages 159 - 167 for more information) 
 
   Note:  This function could be made to read all X, Y, and Z accelerations in a single read.
   See SCA3000 Manual, section 4.1.3.2 Example of decremented register read
 */

// Function takes in the 8-bit register address and returns 16-bit register value.
int SCA3000_Read_16bit(unsigned int Address)
{
    int result;
    result = 0;
    Address = Address << 2;           // RW bit is set to zero by shifting the bit
                                      // pattern to left by 2
    SPI_PORT = SPI_PORT & (~SPI_CSB); // Set CSB to zero
    SPDR = Address;                   // Write command to SPI bus
    while(!(SPSR & (1 << SPIF)))      // Wait until data has been sent
          ;
    SPDR = 0x00;                       // Write dummy byte to line
                                       // in order to generate SPI clocks for data read
    while(!(SPSR & (1 << SPIF)))       // Wait until data has been sent
          ;
    result = SPDR;                     // Get MSB of the result
    result = result << 8;              // Shift the MSB of the result to left by 8
    SPDR = 0x00;                       // Write dummy byte to line
                                       // in order to generate SPI clocks for data read
    while(!(SPSR & (1 << SPIF)))       // Wait until data has been sent
          ;
    result |= SPDR;                     // Get LSB of the result
    SPI_PORT = SPI_PORT | SPI_CSB;      // Set CSB to one
    return result;
}

void loop()
{
    Ax = ((SCA3000_Read_16bit(X_MSB) * AccelMultiplier) + X_Offset);    
    Serial.print("X-axis: ");
    Serial.print(Ax);
    
    Ay = ((SCA3000_Read_16bit(Y_MSB) * AccelMultiplier) + Y_Offset);    
    Serial.print("   Y-axis: ");
    Serial.print(Ay);
    
    Az = ((SCA3000_Read_16bit(Z_MSB) * AccelMultiplier) + Z_Offset);    
    Serial.print("   Z-axis: ");
    Serial.print(Az);
    
    Serial.println();
    delay(1000);
}

Yesterday’s post showed the noise in the output data. But today I am getting spikes that are wildly out of line. Please see below. :? I’m still taking samples at 1Hz. The board is stationary. Notice not just the wild swings in X, but the more subtle couple of negative values.

UPDATE – My last set of tests did not show these spikes, just the noise. I must have had a loose wire somewhere on the breadboard.

SPCR: 1010010
mode   = 0
status = 0
Rev ID = 100001
Approximate Temperature in Celcius inside chip: 24.1   Temp in F: 75.4

Outputs are in mg, or milli-gravity:

X: 40.7   Y: 821.2   Z: -569.0   Overall G's (mg): 999.9
X: 44.5   Y: 825.7   Z: -576.5   Overall G's (mg): 1008.1
X: 43.7   Y: 822.7   Z: -571.2   Overall G's (mg): 1002.6
X: 40.7   Y: 827.2   Z: -578.7   Overall G's (mg): 1010.4   
X: -46.9   Y: 822.0   Z: -576.5   Overall G's (mg): 1005.1
X: -2162.8   Y: 1459.0   Z: 1675.8   Overall G's (mg): 3100.8   Too High
X: 43.0   Y: 823.5   Z: -577.2   Overall G's (mg): 1006.6
X: 37.0   Y: 822.7   Z: -576.5   Overall G's (mg): 1005.3
X: 40.7   Y: 823.5   Z: -576.5   Overall G's (mg): 1006.1
X: -58.9   Y: 822.0   Z: -578.0   Overall G's (mg): 1006.6
X: 42.2   Y: 824.2   Z: -572.7   Overall G's (mg): 1004.6
X: 40.0   Y: 826.5   Z: -576.5   Overall G's (mg): 1008.5
X: 40.7   Y: 822.0   Z: -579.5   Overall G's (mg): 1006.6
X: 37.7   Y: 825.0   Z: -572.0   Overall G's (mg): 1004.6
X: 41.5   Y: 827.2   Z: -577.2   Overall G's (mg): 1009.6
X: 895.3   Y: 1728.0   Z: -573.5   Overall G's (mg): 2028.9   Too High
X: 45.2   Y: 827.2   Z: -577.2   Overall G's (mg): 1009.8
X: 39.2   Y: 828.0   Z: -576.5   Overall G's (mg): 1009.7
X: 37.7   Y: 821.2   Z: -570.5   Overall G's (mg): 1000.7

Hello,

I have no explaination for the wrong data you get :frowning:

For instance I have a big problem:

When the Miso of sca3000 is not connected, the signal output seem to be correct (seen on the screen of oscillescope).

But if I try to connect it to the BOB-08745, (Miso of SCA3000 to TXI and my pic to TXO), the signal is 0V, nothing, nada, rien!!!

I don’t understand why.

Regards

Michastro,

First of all, the erratic data I was getting was due to loose wires on a breadboard. Since I’ve soldered up the connections, I’ve had no issues. I’ve dealt with the “noise” by taking many readings and taking the average – I’m not dealing with a fast moving system.

I also hooked up the TXI of the BOB-08745 to the MISO of the SCA3000, and the TXO to pin 12 (as per my Feb 9th post). For the HV and LV of the BOB-08745, I hooked those up to 5V and 3.3V coming from the Arduino Duemilanove. And the GND to Ground. I don’t have an oscilloscope so I do not know what signal voltage is truly coming out of the BOB, but it was high enough for the Arduino to read it.

Also, for diagnostic purposes, I slowed down the SPI communications down to 250 kHz. I later moved it back up to 1 MHz. I have not tried it faster than that since the SCA3000 is not rated for 2 or 4 MHz. This, however, does not sound related to the problem you are having.

Sorry I don’t have anything definitive for you. Good luck …

I have exactly the same problem as Michastro. The MISO signal of the SCA3000 seems correct when disconnected from the processor, but it is not correct when it is connected (it is not zero though, it just gets many values from zero to 3.3V). The rest of the signals seem OK on the oscilloscope. I am using an AVR ATmega128@8MHz powered at 3.3V, so no level shift is needed. I have a separate 5V supply for the SCA3000 sparkfun board.

I have another setup with the ATmega128 at 16MHz and 5V and I use a homemade level shift with diodes and pullup resistors at the MOSI, CSK, CSB and RST lines of the SCA3000 and it works perfectly (with the same SCA3000 board). The software code is the same in both cases.

¿any idea about what is happening??

Regards

Héctor

Brent,

I have the same prob as you got, and I want to be sure of this :

finally did you use the 2,7 instead 3.3 voltage to make it works or it did not changed anything (you put it back to 3.3V) ?

Hi guys,

i hooked up my SCA3000 to my ATMEGA16 board working at 5v… will this have spoilt my SCA3000…please let me know soon…i have ordered a BOB08745 level translator… can you please please give the wiring diagram and will the SCA3000 work if i use BOB08745… please let me know soon…and also please send me the wiring diagram for miso,mosi ,clk and csb connections…

did you find success using the diode arrangement ???

any help will be really great on behalf of youll…do let me know soon…keeping my fingers crosseed…

and do i have to order a new sca3000 if i have hooked it directly to the 5v atmega ???

amrit,

I did have to buy a replacement accelerometer. Sorry, its been over a year since I played with it, and do not really recall all the details. However, I think I did hook it up directly with the 5V connections initially. It worked for a few trials, but then I believe it burned out. Then I bought another accelerometer.

I also apologize that I did not make good notes on exactly what I did – they are pretty much reflected in this post. I don’t have a wiring diagram to give you.

Best of luck,

Brent

Pin 10 (SS or CS) → Diode (NTE110, ~1.5k/40kohm), CSB

10kohm to 3.3V *

hi brent,

i really appreciate your previous reply,

i have copy pasted this from your wiring description in the above post…

can you please explain what the above means, i.e–> (NTE110 ~1.5k/40kohm)

i am not getting what that means,

is it the diode in series with 1.5 k or in series with 40 k or what? with the 10 k pull up to 3.3 v ?

cheers,

amrit