Part Number: LDC1000
Dear TI Community
I have just spent 3 days solid interfacing the LDC1000 to audrino it works but the proximity meausrments are noisy
I have now evaluated the LDC100 EVM using the TI GUI. it works well and I will embed it into a vibration sensing application using a Bentley Nevada proximity probe.
The next step is to interface the LCD1000 with my own microcontroller.
I started of with a pic 18f252 all the connections were correct used a logic analyser to check all spi packets looked correct. but the LDC1000 never replied with any data.
Next i tried an audrino nanao as I had one in the lab. A user called "Pelonomi Moila" Posted on this form a full code and pdf on how to interface the audrino to the ldc100.
I wired it all up and hurray it works 1000-32768 count printed to serial port from audrino this is the in the proximity register from ldc1000 as i hold metal closer and further to targert.
So it works but there is a big but. I am getting lots of noises the signal is jumping and jittering very noisy if I set the metal target distance so the proximity register reads 10,000 then the reading is very jumpy
10,000 next reading 9400, next 10,254, etc etc.
So I spent hours unsoldering the ldc1000 and put it back on the ldc1000 evm module again and magivally the reading then goes perfectly stable Rp is now 10,000 10,001 9,999 very smooth now.
Then soldered it back to the audrino again and the data goes all jumpy noisy unstable jumping 800 to 1000 bits between each reading when the metakl target is at rest.
The example audrino program I uses does not have an external clock on the LDCLK Pin. And it does not setup the 0x04 and 0x05 register
I do not want to read the frequency registers i only want to read the proximity registers.
Is this correct ? if I only want to read the proximity registers and not the frequency registers then I do not need to add an external 8MHz clock to the LDCLK pin and dont need to setup register 0x04 and 0x05 ??
Or do you have to connect up an external 8MHX clock and set up the the LDC config 0x05 and Clock config 0x05 registers to get the proximity reading to work smoothly without all the noise im getting? Is the noise because I dont have an 8MHz crystal and havent set up regiser 0x04 and 0x05
My proximity reading works but its soo noisy i cant work with it ive come a long way but the noise is unbareable the signal is awfully noisy i have tried tuning rp min rp max comparator theshold high and low nothing gets rid of the noise.
i have put 100nf capacitos accross the 5v analog rail to gnd
across the 3.3v I/o rail to gnd
nothing in the world gets rid of the noise as soon as i unsolder it all and put it back on the LDC100 evm usb stick proximity readings are all perfectly smooth no noise only jumping +/- 3 bits in 32768 but on audrino reading is jumping +/- 800 bits allover random noise.
Audrino code posted below works well reads proximity 100-37768 but very very noisy reading from proximity register adress ox21LSB 0x22 MSB
I have come to far to give up now how can i get ris of the noise is it because i havent connected 8Mhz clock and setup register 0x04 and 0x05 even though i dont care about freq register only proximity register i need
Thanks for looking please give advice
CODE::::::
*
Author: Pelonomi Moiloa
24 June 2014
Code to read proximity data from proximity registers
Note: Sensor frequency, LDC configuration and CLK configuration register setup is
only neccessary when needing to read frequency data
*/
#include "SPI.h" // include arduino SPI library
const int CSB = 10; // chip select bit for Arduino Uno
void setup()
{
unsigned int data = 0;
Serial.begin(9600);
// start SPI library/ activate BUS
SPI.begin();
pinMode(CSB, OUTPUT);
SPI.setBitOrder(MSBFIRST);
SPI.setDataMode(SPI_MODE0); // CPOL = 0 and CPH = 0 mode 3 also works
SPI.setClockDivider(SPI_CLOCK_DIV4); // set SCLK @ 4MHz, LDC1000 max is 4MHz DIV2 also works
//Start initialisation of LDC1000
// set power mode to idle to configure stuff
digitalWrite(CSB, LOW);
SPI.transfer(0x0B);
SPI.transfer(0x00);
digitalWrite(CSB, HIGH);
delay(100);
// Set RpMax
digitalWrite(CSB, LOW);
SPI.transfer(0x01);
SPI.transfer(0x0E);
digitalWrite(CSB, HIGH);
delay(100);
// Set RpMin
digitalWrite(CSB, LOW);
SPI.transfer(0x02);
SPI.transfer(0x3B);
digitalWrite(CSB, HIGH);
delay(100);
// disable all interrupt modes
digitalWrite(CSB, LOW);
SPI.transfer(0x0A);
SPI.transfer(0x00);
digitalWrite(CSB, HIGH);
// set thresh HiLSB value
digitalWrite(CSB, LOW);
SPI.transfer(0x06);
SPI.transfer(0x50);
digitalWrite(CSB, HIGH);
delay(100);
// set thresh HiMSB value
digitalWrite(CSB, LOW);
SPI.transfer(0x07);
SPI.transfer(0x14);
digitalWrite(CSB, HIGH);
delay(100);
// set thresh LoLSB value
digitalWrite(CSB, LOW);
SPI.transfer(0x08);
SPI.transfer(0xC0);
digitalWrite(CSB, HIGH);
delay(100);
// set thresh LoMSB value
digitalWrite(CSB, LOW);
SPI.transfer(0x09);
SPI.transfer(0x12);
digitalWrite(CSB, HIGH);
delay(100);
// set power mode to active mode
digitalWrite(CSB, LOW);
SPI.transfer(0x0B);
SPI.transfer(0x01);
digitalWrite(CSB, HIGH);
delay(100);
// end of Initiailsation
//Check to see if values were written to registers correctly
/*
// Read Rpmax
digitalWrite(CSB, LOW);
SPI.transfer(0x81);
data = SPI.transfer(0x00);
Serial.println(data);
digitalWrite(CSB, HIGH);
delay(500);
// Read Rpmin
digitalWrite(CSB, LOW);
SPI.transfer(0x82);
data = SPI.transfer(0x00);
Serial.println(data);
digitalWrite(CSB, HIGH);
// Read thresh HiLSB value
digitalWrite(CSB, LOW);
SPI.transfer(0x86);
data = SPI.transfer(0x00);
Serial.println(data);
digitalWrite(CSB, HIGH);
delay(500);
// Read thresh HiMSB value
digitalWrite(CSB, LOW);
SPI.transfer(0x87);
data = SPI.transfer(0x00);
Serial.println(data);
digitalWrite(CSB, HIGH);
delay(500);
// Read thresh LoLSB value
digitalWrite(CSB, LOW);
SPI.transfer(0x88);
data = SPI.transfer(0x00);
Serial.println(data);
digitalWrite(CSB, HIGH);
delay(500);
// Read thresh LoMSB value
digitalWrite(CSB, LOW);
SPI.transfer(0x89);
data = SPI.transfer(0x00);
Serial.println(data);
digitalWrite(CSB, HIGH);
delay(500);
*/
}
void loop()
{
unsigned int val = 0;
unsigned int dataLSB = 0;
unsigned int dataMSB = 0;
unsigned int proximitydata = 0;
// Read proximity data LSB register
digitalWrite(CSB, LOW);
SPI.transfer(0xA1); // 0x80 + 0x21
dataLSB = SPI.transfer(0x00);
digitalWrite(CSB, HIGH);
delay(100);
// Read proximity data MSB register
digitalWrite(CSB, LOW);
SPI.transfer(0xA2); // 0x80 + 0x22
dataMSB = SPI.transfer(0x00);
digitalWrite(CSB, HIGH);
delay(100);
proximitydata = ((unsigned int)dataMSB << 8) | (dataLSB);// combine two registers to form 16bit resolution proximity data
Serial.println(proximitydata);
}