2021-07-07 01:23 AM
I have got 2 new IIS3Dwb IC from same lot , I made custom PCB for those, connected to shaker and getting acceleration values and showing it through my own developed application.
Problem: Z axis seems defecting /sensitive much higher than x and y axis irrespective of vibration direction orientation.
When no vibration present every axis values seems ok and showing 1g level of gravity.
Both ic s showing same issue
Tried magnet, glue mount but no improvement.
Tried different vibration source , different vibration frequency
Changing pcb orientation didn’t help.
Not using int pins, mcu controlling sampling speed 12.5 khz sampling speed and 6.3khz bandwidth with 16g sensitivity.
Using single axis mode, fifo disabled
Pcb layout below.
When no vibration getting 1g so I believe my g conversion math is ok.
Below is my code in arduino IDE ( not complete code pasted due to length)
//IIS3DWB
#define IIS3DWB_WHO_AM_I 0x0F // should be 0x7B
#define IIS3DWB_CTRL1_XL 0x10
#define IIS3DWB_CTRL3_C 0x12
#define IIS3DWB_CTRL4_C 0x13
#define IIS3DWB_CTRL5_C 0x14
#define IIS3DWB_CTRL6_C 0x15
#define IIS3DWB_CTRL7_C 0x16
#define IIS3DWB_CTRL8_XL 0x17
#define IIS3DWB_OUT_TEMP_L 0x20
#define IIS3DWB_OUT_TEMP_H 0x21
#define IIS3DWB_OUTX_L_XL 0x28
#define IIS3DWB_OUTX_H_XL 0x29
#define IIS3DWB_OUTY_L_XL 0x2A
#define IIS3DWB_OUTY_H_XL 0x2B
#define IIS3DWB_OUTZ_L_XL 0x2C
#define IIS3DWB_OUTZ_H_XL 0x2D
#define IIS3DWB_FIFO_CTRL4 0x0A
----then---
SPI.begin();
SPI.beginTransaction(SPISettings(5000000,MSBFIRST,SPI_MODE3));
writeRegister(IIS3DWB_CTRL1_XL,0x04); // power down and 16g mode
writeRegister(IIS3DWB_FIFO_CTRL4,0x00); // disable fifo
writeRegister(IIS3DWB_CTRL8_XL,0x00); // low pass 6.3khz
writeRegister(IIS3DWB_CTRL6_C,0x01); // single axis mode start with x
writeRegister(IIS3DWB_CTRL1_XL,0xA4); // power on again and 16g mode START WITH 16G
---------then -----
SPI.begin();
SPI.beginTransaction(SPISettings(5000000,MSBFIRST,SPI_MODE3));
writeRegister(IIS3DWB_CTRL1_XL,0x04); // power down and 16g mode
writeRegister(IIS3DWB_CTRL6_C,0x01); // single axis mode x axis
writeRegister(IIS3DWB_CTRL1_XL,0xA4); // power on again and 16g mode START WITH 16G
delay(50);
for(int j=0; j<2048; j++){ ///////loop
////TURN ON ACC
//
memset(rawData, 0, sizeof(rawData)); // reset
readBytes(IIS3DWB_OUTX_L_XL, 6, &rawData[0]); // Read the 6 raw accel data registers into data array
x = (int16_t)(((int16_t)rawData[1] << 8) | rawData[0]) ; // Turn the MSB and LSB into a signed 16-bit value
// make a string for assembling the data to log:
accvalue[j] = x;
}
SPI.end();
------then smilarly for y and z-----
SPI.begin();
SPI.beginTransaction(SPISettings(5000000,MSBFIRST,SPI_MODE3));
writeRegister(IIS3DWB_CTRL1_XL,0x04); // power down and 16g mode
writeRegister(IIS3DWB_CTRL6_C,0x03); // single axis mode z axis
writeRegister(IIS3DWB_CTRL1_XL,0xA4); // power on again and 16g mode START WITH 16G
delay(50);
for(int j=0; j<2048; j++){ ///////loop
memset(rawData, 0, sizeof(rawData)); // reset
readBytes(IIS3DWB_OUTX_L_XL, 6, &rawData[0]); // Read the 6 raw accel data registers into data array
z = (int16_t)(((int16_t)rawData[5] << 8) | rawData[4]) ;
prevCycle = startCycle+6350;
delay(10); /// sampaling timing controll
// make a string for assembling the data to log:
accvalue[j] = z;
}
currentMillis =micros()-bMillis;
accvalue[2050] =currentMillis;
////TURN OFf acc
//SPI.end();
-----------some more functions -----------
////// accelerometer access fuction
void readBytes(uint8_t reg, uint8_t count, uint8_t * dest)
{
digitalWrite(accspi, LOW);
SPI.transfer((reg & 0x7F) | 0x80);
SPI.transfer(dest, count);
digitalWrite(accspi, HIGH);
}
void writeRegister(char registerAddress, char value) {
digitalWrite(accspi, LOW);
SPI.transfer(registerAddress);
SPI.transfer(value);
digitalWrite(accspi, HIGH);
}
I compared IIS3dwb output with LIS3DSH output placing same place same orientation , when shaking at 500 hz lis3dsh showing y axis is having high g and its correct as shaker is shaking in Y axis. However IIS3dwb showing Z axis is sensing higher g values than y axis. Which is surely not true. To crosscheck I changed axis orientation against vibration orientation, but still z axis is sensing high g
In fft view also all axis showing correct frequency but z axis is showing much higher amplitude
Now I am clueless what is wrong, is both IC faulty? or something wrong in settings
Thanks for reading any help appreciated.
2021-08-11 10:17 AM
@Eleon BORLINI @Douglas MILLER
Thanks for reply
1> yes both INT pins floating , I will try after connecting both to ground.
2> I will try 10Mhz and let you know
3> I have already set 26.6 odr but no difference check my reply one month ago
4> already tried set bdu bit default but no improvment
5> I will try FiFO but my processor already timed to take readings with fixed gap.
6> vibration setup is always same while using my pcb and ST adaptor board.
I tried vibrating at 700hz even 100hz which is under bandwidth range of both LIS3DH and IIS3dwb. Also my vibration setup vibrating in Y axis and LIS3DSH and Industrial vibration meter both showing same but not IIS3DWB.
let me mention again
1> I am getting correct acceleration in all 3 axis while no vibration
2> I am getting correct acceleration in X and Y axis while vibrating , while shaker shaking in Y axis IIS3D also showing Y is more than x but problem is Z is much higher than both X and Y
3> Even while Z axis vibrating more but its keeping 1g in the middle after offset adjust 0g in the middle so I don't think point 1,2,3,4,5 you mentioned will change anything.
can you please test IIS3DWB yourself (if you have) while vibrating and send me its output in CSV format
or can you please invite IIS3DWB developer team in this discussion.
2021-08-12 12:47 AM
Hi @SMaju.1 ,
I can share some data regarding bandwidth measures via private message, where each point of the file is the RMS value for the specific frequency.
As test bench for BW characterization, we use a shaker from Spektra and a laser vibrometer for closing the loop. The shaker is like the one here below:
-Eleon
2021-08-26 05:21 AM
Hi,
Is the raw data read out of the IIS3DWB already vibration data, or do you have to have algorithm to convert the raw data to vibration (frequency and magnitude) information?
Thanks
2021-08-26 05:34 AM
hi @MT.6
no IIS3DWB is accelerometer and its raw output is acceleration( g force) over time and after integration those values you get velocity in time domain. for frequency and magnitude you need to apply FFT algorithm
2021-10-11 05:28 AM
Hello,
we are facing the same situation where Z-axis measurement are higher than the other two (X and Y), is there any update on this???
Thank you
2021-10-12 05:39 AM
Hi @trinitry ,
Do you have the HP filter enabled? if so, can you disable it and check?
-Eleon
2021-10-13 02:10 AM
Hello @Eleon BORLINI
we are using the HSDataloging as it is, in the code i see the following init function
static void IIS3DWB_Sensor_Init(void)
{
uint8_t reg0;
uint16_t iis3dwb_wtm_level;
iis3dwb_device_id_get( &iis3dwb_ctx_instance, (uint8_t *)®0);
iis3dwb_reset_set(&iis3dwb_ctx_instance, 1);
iis3dwb_read_reg(&iis3dwb_ctx_instance, IIS3DWB_CTRL1_XL, (uint8_t *)®0, 1);
reg0 |= 0xA0;
iis3dwb_write_reg(&iis3dwb_ctx_instance, IIS3DWB_CTRL1_XL, (uint8_t *)®0, 1);
/* Calculation of watermark and samples per int*/
iis3dwb_wtm_level = ((uint16_t)IIS3DWB_Init_Param.ODR[0] * (uint16_t)IIS3DWB_MAX_DRDY_PERIOD);
if (iis3dwb_wtm_level > IIS3DWB_MAX_WTM_LEVEL)
{
iis3dwb_wtm_level = IIS3DWB_MAX_WTM_LEVEL;
}
else if (iis3dwb_wtm_level < IIS3DWB_MIN_WTM_LEVEL)
{
iis3dwb_wtm_level = IIS3DWB_MIN_WTM_LEVEL;
}
iis3dwb_samples_per_it = iis3dwb_wtm_level;
/*Set fifo in continuous / stream mode*/
iis3dwb_i2c_interface_set(&iis3dwb_ctx_instance, IIS3DWB_I2C_DISABLE);
iis3dwb_fifo_mode_set(&iis3dwb_ctx_instance, IIS3DWB_STREAM_MODE);
/*Set watermark*/
iis3dwb_fifo_watermark_set(&iis3dwb_ctx_instance, iis3dwb_wtm_level);
/*Data Ready pulse mode*/
iis3dwb_data_ready_mode_set(&iis3dwb_ctx_instance, IIS3DWB_DRDY_PULSED);
/*Set full scale*/
if(IIS3DWB_Init_Param.FS[0] < 3.0f)
iis3dwb_xl_full_scale_set(&iis3dwb_ctx_instance, IIS3DWB_2g);
else if(IIS3DWB_Init_Param.FS[0] < 5.0f)
iis3dwb_xl_full_scale_set(&iis3dwb_ctx_instance, IIS3DWB_4g);
else if(IIS3DWB_Init_Param.FS[0] < 9.0f)
iis3dwb_xl_full_scale_set(&iis3dwb_ctx_instance, IIS3DWB_8g);
else if(IIS3DWB_Init_Param.FS[0] < 17.0f)
iis3dwb_xl_full_scale_set(&iis3dwb_ctx_instance, IIS3DWB_16g);
/*Set 2nd stage filter*/
iis3dwb_xl_hp_path_on_out_set(&iis3dwb_ctx_instance,IIS3DWB_LP_6k3Hz);
/* FIFO_WTM_IA routing on pin INT1 */
iis3dwb_pin_int1_route_t pin_int1_route;
*(uint8_t*)&(pin_int1_route) = 0;
pin_int1_route.fifo_th = 1;
iis3dwb_pin_int1_route_set(&iis3dwb_ctx_instance, &pin_int1_route);
/*Enable writing to FIFO*/
iis3dwb_fifo_xl_batch_set(&iis3dwb_ctx_instance, IIS3DWB_XL_BATCHED_AT_26k7Hz);
HAL_NVIC_EnableIRQ(IIS3DWB_INT1_EXTI_IRQn);
}
as i can understand the HP filter is not enabled.
As a side question, in this init function where it calculates the iis3dwb_wtm_level it uses the IIS3DWB_MAX_WTM_LEVEL set to 256, could you please elaborate on this calculations.
Thank you for your support
2021-10-15 04:54 AM
Hi @trinitry ,
the watermark level can be set to maximum 256 since the variable value is defined on 8 bits, i.e. WTM 8:0 in registers FIFO_CTRL1 (07h) and FIFO_CTRL2 (08h) (see datasheet, p. 28). 1 LSB = 1 sensor (6 bytes) + TAG (1 byte) written in FIFO.
I agree with you that the high pass filter is not enabled in your code.
Can you run the acquisition bypassing the FIFO?
-Eleon
2021-10-21 06:54 AM
Dear Eleon,
would you please elaborate on this suggestion.
Thank you
-trinitry
2021-10-22 06:15 AM
Hi @trinitry ,
I was just suggesting to run the acquisition in continuous mode.
-Eleon