Interlink Electronics Ring Sensor User Manual
Page 11

www.interlinkelectronics.com
9
Ring Sensor
Integration Guide
Calculating the Touch Angle from Vtheta
The voltage Vtheta was measured by applying 256 counts over an angle of 240°. Voltage can
therefore be converted to angle by multiplying by 240/256. Conveniently, 240/256 reduces to the
ratio 15/16. If the touch was in zone 1, 120° must be added to the angle. If the touch was in zone 2,
240° must be added to the angle. And if the touch was in zone 3, no offset is required. Finally, the
result should be checked to see if it exceeds 359°. The following code example shows the complete
conversion of Vtheta to angle theta:
theta=(v_theta*15)/16; //convert from voltage to angle
if(1==zone)
//Add necessary offsets
theta+=120;
else if (2==zone)
theta+=240;
else if (3==zone)
theta+=0;
if(theta>359)
//sanity check angle
theta-=360;