12.15.2012

Over Fall Sensor

I have always had a problem with my previous Mini Sumo "Raizo" (Seeker II/IIx inspired) the second place winner at RobotChallange 2010 in Austria.
Every time the slope type opponent pulled it's front my robot had the full throttle, which cause over falling. So I thought about tactile surface sensor and not just on but two.
2 microswitches act as a tactile sensors as you can see bellow in photo, where they have been installed.
Each of them going to sense the side, where opponents blade has got under the platform.
Both of them generate an analog signal, which is measured with one of analog inputs of Arduino and decides which one of them is activated.
The method is called Resistor Ladder or R-2R network (digital to analog conversion, or DAC).
A resistor ladder is an electrical circuit made of repeating units of resistors. Cited: Wikipedia "Resistor Ladder"
A part of schematic sheet
Vout = Vref × VAL / 2N;
N = 2 → 2N = 4;
Vref = 5V;
Vout (00, VAL = 0; 11, VAL = 3);
Minimum single step Vout = 5 × 1 / 22 = 1.25V;
Maximum output
Vout = 5 × 3 / 22 = 3.75V;

The truth table
Vout
S1
S0
10bit value
0
0
0
0
1.25
0
1
256
2.50
1
0
512
3.75
1
1
768

So in order to make it work together with the other sensors in one byte we do this chain of substitutions:
  • Make an array of possible weight in the byte:
const byte microswitch[]={0, 64, 128, 192};
  • Create a function with return values, which are dependent on the measured value:
/*SWITCH DETECT*/
byte Switch(){
  int switchVal=analogRead(SWITCH);
  if(switchVal==0)                   return 3;
  if(switchVal>200 && switchVal<300) return 2;
  if(switchVal>400 && switchVal<600) return 1;
  if(switchVal>700 && switchVal<800) return 0;
}
  • Add the microswitch weigth value, which has been chosen from array.
/*SENSOR DATABYTE*/
void SensorSum(){
  sensorSum = sharp_sl[digitalRead(SHARP_SL)]
            + sharp_fl[digitalRead(SHARP_FL)]
            + sharp_fr[digitalRead(SHARP_FR)]
            + sharp_sr[digitalRead(SHARP_SR)]
            + vishay_l[digitalRead( TCRT_L )]
            + vishay_r[digitalRead( TCRT_R )]
            + microswitch[Switch()];
}

No comments:

Post a Comment