Arduino Projects

SCA60C Angle Sensor with Arduino Interfacing and Programming

SCA60C angle sensor:

SCA60C angle sensor with Arduino– In this tutorial, I am going to introduce this VTI technology SCA60C angle sensor to measure the angle using Arduino Uno or Arduino Nano, this angle sensor can be used in robotics and other areas where you need to measure the angle. Let’s get started with this SCA60C angle sensor which is one of the important aspects of robotics and in many applications you constantly need to know the position of angle of some arm or some element in your robotics and this is very inexpensive way to do that it can display angle between 0 and 180 degrees and the resolution is 1 degree.  This is a getting started tutorial and I will try to explain the maximum basic things including the SCA60C angle sensor technical specifications, features, its interfacing with Arduino, and programming. I will start with a very basic Arduino program to measure the Angle and then I will print the angle values on the Serial monitor. Without any further delay, let’s get started!!!



Amazon Links:

Arduino Uno

Arduino Nano

SCA60C  Angle Sensor

Other Tools and Components:

Top Arduino Sensors:

Super Starter kit for Beginners

Digital Oscilloscopes

Variable Supply

Digital Multimeter

Soldering iron kits

PCB small portable drill machines

*Please Note: These are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!

Specification of the SCA60C angle sensor:

  • Single +5V supply
  • Low current consumption (2mA typ.)
  • Ratiometric output in relation to supply voltage (Vdd = 4.75….5.25V)
  • Enhanced failure detection features
  • Memory parity check during power up, and self-test cycle.
  • Built in connection failure detection.
  • Wide load drive capability (≥20 kOhm, ≤20 nF)
  • True DC response.




Features of the SCA60C angle sensor:

  • Available ranges ±0.5 g (±30 º), ±1 g (±90 º), ±1.5 g, ±1.7 g,
  • ±3.0 g
  • 8-pin plastic surface mount DIP package mountable with pick
  • and place machines
  • Enhanced failure detection
  • Digitally activated electrostatic self test (not for inclinometers)
  • Calibration memory parity check
  • Continuous connection failure detection
  • Bi-directional acceleration measurement
  • Controlled frequency response in the sensing element
  • Single +5 V supply; ratio metric voltage output in the range
  • Operating voltage from 4.75 V to 5.25 V
  • Lead-free reflow solderable lead-free component

Hardware of the SCA60C angle sensor:

SCA60C Angle Sensor

Now we will explain the SCA60C angle sensor module. This SCA60C angle sensor module is based on VTI technologies, angle sensor which consists of SCA60C1 with a subversion of N100060 this will giveyou the angle; based on this angle the voltage will be generated at the output pin. We can convert this voltage in to angle so the angle will be between 0 to 180 degrees and the output will be between some 0.45volts to 4.5 volts.

We using Arduino to display that angle and the SCA60C angle sensor module have two built in LEDs on the sensor board which will blink according to the position of the sensor if it is absolute flat you can set this with these two variable resistors or potentiometers present in the module. At the bottom of the module we have L393 which is an op-amp operational amplifier very precise.

SCA60C Angle Sensor

So this will turn on the LEDs at a specific value. So you can detect if the sensor is flat or not and the result of this will output to d01 pin. When the d01 will go low it will be detected by the comparator and the D02 will go high and the led will turn on and vice versa process will occur. The VCC will be connected to 5 volts; ground will be connected to ground. So for majority of the use theV0 pin is used to detect the angle. The length of this module is 34.2 mm, width is 21.1 mm and the thickness of the module is 8.4 mm.

Interfacing SCA60C Angle Sensor with the Arduino:

SCA60C Angle Sensor

  • Connect the ground of the SCA60C angle sensor with the ground of the Arduino
  • Connect the VCC of SCA60C angle sensor with the 5 V of the Arduino
  • Connect the Vo of the SCA60C angle sensor with analog pin 0 of the Arduino
  • Connect Do1 of the SCA60C angle sensor with the analog pin 1 of the Arduino
  • Connect Do2 of the SCA60C angle sensor with the analog pin 2 of the Arduino


SCA60C angle sensor Arduino Code:

const int anglePin =A0;
int angle =0;
const int angleCompensate =0;

const int d1Pin =A1;
int d1State =LOW;
int d1Delay =0;//watch 

const int d2Pin =A2;
int d2State =LOW;
int d2Delay =0;

char *lables[]={"Angle","Alarm D1","Alarm D2"};

void setup()

{

  Serial.begin(9600);          //  setup serial
  Serial.println("Electronic clinic SCA60C Angle Sensor");

}



void loop(){

  getAngle();
  d1Alarm();
  d2Alarm();
  
  
  // print out the value you read:
  Serial.print(lables[0]);// 
  Serial.print(":");
  Serial.print(angle);
  Serial.println("°");//degree symbol
//  Serial.print("  ");
//  Serial.print(lables[1]);
//  Serial.print(":");  
//  Serial.print(d1State);
//  Serial.print("  ");
//  Serial.print(lables[2]);
//  Serial.print(":");
//  Serial.println(d2State);  
//  Serial.println("======");
  delay(100);

}

void getAngle()
{
   angle =map(analogRead(A0), 96, 927, -90, 90) + angleCompensate; 
 
}

void d1Alarm()
{

  float vo = analogRead(d1Pin) * (5.0 / 1023.0);
  if(vo < 3.5)
  {
    d1State =HIGH;
    delay(d1Delay);    
  }else{
    d1State =LOW;    
  }

}//d1Alarm() end


void d2Alarm()
{

  float vo = analogRead(d2Pin) * (5.0 / 1023.0);

  if(vo < 3.5)
  {
    d2State =HIGH;
    delay(d2Delay);    
  }else{
    d2State =LOW;    
  }  

}//d1Alarm() end

SCA60C angle sensor Arduino Code Explanation:

Now let me explain the code we are defining constant integer angle pin and assign it to the analog pin A0.

Const int anglePin =A0;

Now declare another variable angle and assign it value equal to zero.  This variable will hold the angle.

int angle =0;

The angle compensate if you want to change the 0 instead of 0 you call it 20 degrees or 90 degrees or 180 degrees you can add this and the angle will be reflected accordingly.

Const int angleCompensate =0;



We are defining the d1 pin to analog pin A1 and declare a variable which will be the state of d1  which will be low at the beginning and also d1 delay the delay time is a time if the alarm is detected or the device is destabilized and the alarm is on you can keep it waiting for certain time.

Const int d1Pin =A1;

int d1State =LOW;

int d1Delay =0;//watch

The same we are defining for the d2 pin and assign it to the analog pin A2 and also declare the d1state and d1 delay variables.

Const int d2Pin =A2;

int d2State =LOW;

int d2Delay =0;

Then we put here the title which would be displayed on the screen as you can see alarm angle and alarm d1 and alarm d2.

char *lables[]={“Angle”,”Alarm D1″,”Alarm D2″};

SCA60C Angle Sensor

This is a text it is coming if you are using it for some robotic purpose you can say towards arm or towards the machine or up or down whatever so it will be the display this angle if it is some angle you put angle if it is position of something at certain way. So you can change the text otherwise just leave it as.

Demonstration of the SCA60C angle sensor Sensor:

In the demonstration as you can see when I try to keep it flat we can get zero degrees on the serial monitor as you can that you see here

SCA60C Angle Sensor



When I tilt the sensor around 90 degrees or we rotate it in opposite direction to 90 degrees it will gives us +90 degrees and – 90

SCA60C Angle Sensor

But we can adjust this and fix it for our purpose by using the compensate we can put 90

Const int angleCompensate =  90;

When we upload it and now if rotate either clockwise or anti clockwise 90 degrees it will gives us 90.

If you are installing it at some angle you can do so for example if you have already 20 degrees inclination so you can put 20 in the inclination angle

Const int angleCompensate =  20;

This 20 will be your zero and then based on that you can go to any angle that you want two pins that are used for alarms and you can adjust your flat angle for example by using two potentiometer to keep it flat you just rotate the potentiometer and if you rotate it this will not turn on at this value. Let’s say zero and if we rotate the potentiometer to set the value. Then at zero it will show an angle so at zero we can keep it off and if you want to get the values when the alarm runs that you can see D2 is zero because the light is zero and if I rotate the sensor now as you can see the D2 is now 1:

SCA60C Angle Sensor

If I go in opposite way now the d1 will be turned on and you can see on the screen you can take some action if the device is tilted from zero degrees.

SCA60C Angle Sensor

So these two lights will show when I am deviating from zero degrees and you can detect it if you use this to analog one or two that are already in the code line to print it and you can use the d1 state and you can take action:

//  Serial.print(”  “);

//  Serial.print(lables[1]);

//  Serial.print(“:”);

//  Serial.print(d1State);




Now the similar procedure can be used for d1 state:

//  Serial.print(”  “);

//  Serial.print(lables[2]);

//  Serial.print(“:”);

//  Serial.println(d2State);

//  Serial.println(“======”);

if you don’t want to use these two pins because these pins are used for the d1 and d2 and they are occupying analog one pin and an analog  pin two so if you do not need those alarm feature just disconnect these two pins and just use analog zero pin and you do not need to connect any wire to d1 or to d2. So this way can use only one analog pin if the analogpins are needed for other purpose.

voidgetAngle()

{

angle =map(analogRead(A0), 96, 927, -90, 90) + angleCompensate;




}

This function will be called when we will use the d1 pin because according to that function the on board led on the module will be turned on and off.

void d1Alarm()

{




Float vo = analogRead(d1Pin) * (5.0 / 1023.0);

if(vo< 3.5)

  {

    d1State =HIGH;

delay(d1Delay);   

}else{

    d1State =LOW;   

  }




}//d1Alarm() end

Similarly this function is used for d2 pin which will read the data from the analog pin A2

void d2Alarm()

{




Float vo = analogRead(d2Pin) * (5.0 / 1023.0);




if(vo< 3.5)

  {

    d2State =HIGH;

delay(d2Delay);   

}else{

    d2State =LOW;   

  } 

}//d1Alarm() end


SCA60C angle sensor Benefits

  • Exceptional reliability, unprecedented accuracy and excellent stability over temperature and time
  • Outstanding overload and shock durability
  • No additional components required

SCA60C angle sensor Applications

  • Acceleration measurement
  • Inclination measurement
  • Motion measurement
  • Vibration measurement

Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

One Comment

  1. Thank you so much for posting and explaining your code to the Internet. I don’t really understand what the alarms are used for however and how they work. Can you give a further explanation?

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button