HOW to program inclinometer sca100t with arduino uno

HI, i am a newbie programmer.

first of all, sorry for my bad english haha.

okey, now i'm doing a project using an inclinometer SCA100T-D01 with arduino uno.
The problem is i want to read the data (angle) from inclinometer with my arduino.
But i'm confused how to program it, does anybody know the code to program it ?

it will be pleasure if any body want to share how to program it,
thank you :slight_smile:

Do you have the module or just the IC? Google comes up with lots of info actually.

I just have the IC, i've tried some code for this project.
But never work sucsessfully, i still failed to get the data (angle).

i've tried some code for this project.

But you didn't post it.

Oh sorry,
this is the latest code i've tried

#include <SPI.h>

const int dataIN = 11; //MISO
const int dataOUT = 12; // MOSI
const int CSpin = 10; //Chip Select
const int SCLKpin = 13; //Serial clock

const byte MEAS=0;
const byte RWTR=8;
const byte RDSR=10;
const byte RLOAD=11;
const byte STX=14;
const byte STY=15;
const byte RDAX=16;
const byte RDAY=17;

void setup()
{
Serial.begin(9600);
SPI.begin();
SPI.setBitOrder(MSBFIRST);
SPI.setDataMode(0);

//inisialisasi input-output

pinMode(dataIN, INPUT);
pinMode(dataOUT, OUTPUT);
pinMode(CSpin, OUTPUT);
pinMode(SCLKpin, OUTPUT);
delay(500);
}

void loop()
{
int sudutx = readCommand(RDAX);
Serial.println("Sudut X = ");
Serial.println(sudutx);

int suduty = readCommand(RDAY);
Serial.println("Sudut Y = ");
Serial.println(suduty);
delay(1000);
}

word readCommand(byte Command)
{
byte inByte = 0;
word result = 0;
digitalWrite(CSpin, LOW);
delay(20);
SPI.transfer(Command);
result = SPI.transfer(MEAS);
result = result <<8;
inByte = SPI.transfer(MEAS);
result = result | inByte;
result = result >>5;
digitalWrite(CSpin, HIGH);
return(result);
}

with that code, the result is still Zero, both in X and Y axis, and somtime it change to 2047.
Please help me to solve this problem

Hi everyone, i'm a newbie programmer, so i still need many help from many people who have become an expert in arduino like you guys :slight_smile: .

here is the problem.

i finally get the data from inclinometer SCA100T with my arduino.
But the data (angle) is still in decimal.

the question is, does anybody know how to convert the data to become angle data in degree ?

please help me guys :slightly_frowning_face:

by the way, u can find the inclinometer SCA100T-D01 datasheet that i use in here

hope you will help me solve my problem guys, thank you :slight_smile:

sorry for my bad explanation,
i mean the data that i get in X and Y axis is a numbers , ex. 881, 1024, 1053, 715, . .

that is the Dout that i get, and i still need to use a formula to make that numbers become the data that i actually want (angle).

the formula is angle = arcsin((Dout - Digital offset value)/ sensitivity of the device)

Dout = the numbers that i get
Digital offset value = 1024, get it from datasheet
Sensitivity = 1638 also get from datasheet.

the problem is when i use that formula, the result that i get is 0, both in X and Y axis.

Show your code

Delta_G:
Do you know what happens when you do division with integers? Would it surprise you to find out that 12 / 7 == 0?

Yes, it would surprise me.

pampambudi:
i finally get the data from inclinometer SCA100T with my arduino.
But the data (angle) is still in decimal.

Hi pampambudi,

Could you post your working code?

It would be greatly appreciated.