12.26.2012

SolidWorks Drawings Update

This documentation is required for my cource work. I use SolidWorks Drawings, user friendly environment and fast view creation, drawings made in no time.
The file is in CAD design section. 2012.12.‎31, ‏‎20:43:38

12.15.2012

Acceleration

When I first tried to launch this robot, I've set the full speed to have a good show.
But I've noticed that the front had been raised significantly at full thrust.
If my robots front is raised each attack state, he's dead from the start.

It needs a Soft Start, maximum acceleration allowed to drive the platform.

Recently I've been playing to solve that problem.
Robot has tactile surface sensors - micro switches, which deactivate if the front is raised.

With the help of MegunoLink Tool, Analog reading, Serial communication and code adjustment, we can make an experiment. The Report is bellow.

My course project asks for 20:1 speed regulation range, so speed is 5% steps discrete.
A delay between steps is adjusted.

Adjustment results:
  • Full thrust: No Soft Start applied, as you already noticed that the front has raised, Switch1 readings shows that 0 value, which is OFF. 270ms flying.
  • 1 ms between steps: Not enough yet, 237ms flying.
  • 2ms between steps: 220ms flying blade.
  • 3 ms between steps: 193ms flying blade
  • 4 ms between steps: 159ms max flying blade, unstable yet.
  • 5ms between steps: Eureka the Golden middle! No flying blades.
Conclusion:
It might be better to add a millisecond as 20% more in reserve, because the dead zone for switches is 2mm (~0.1") between flying blade and surface. Rate of voltage change should be 92.5~111 V/s, provides a Soft Start for motors.

Update 2013.01.03: Another more accurate way to find out if the blade is being raised:
  1. Place a sheet of standard A4 paper on the surface of Dohyo in front of the vehicle;
  2. Soft start it to full speed;
  3. Do it several times;
  4. If the blade gets on top of the paper, that means it is still being raised, add a millisecond or two between 5% PWM duty cycle steps.
  5. If the paper is being pushed only, configuration is over and you're good to go.

Battery Resistance Measurement

Decided to check out the current peaks and measure the voltage drop on the battery.
The currents FB_L and FB_R are different, because motors have a little difference resistances.
Update 2013.01.04: Motors have the same resistance, the problem is somwhere in the right motor's power line, might be the R_DS(ON) Resistance of the H-bridge, because one of them was prieviously used. Soldering a fresh MC33887 may solve the problem.

Peak currents are 1,69A and 1,33A
Voltage before load 11,74V
Voltage during load 10,37V
So resistance R=(11,74-10,37)/(1,69+1,33)=0,454 Ohm

May be I'll add negative voltage feedback, to compensate the error during loads someday in future.

Love this feature.

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()];
}

Electromagnetic Interference Reduction

In the previous message, you've seen that measured current wasn't so smooth because of the comutation noise in the motor.
There are several ways of filtering the noises from the motors starting from simple to Hi End one:

A single-capacitor filter.
The capacitor is simply soldered across the motor terminals.
A two-capacitor filter.
Each capacitor has one lead attached to a motor terminal, and the other lead attached to the case.
A three-capacitor filter.
This is basically a combination of the one- and two-capacitor circuits.
A capacitor-choke filter.
These are usually assembled on a separate circuit board which is then soldered to the motor terminals.
A capacitor-choke filter sold by Graupner, designed to be soldered directly to any 05-sized can motor, such as a Graupner Speed 600. Graupner also sells a Speed 400 sized filter.

Not much of place soldering that stuff to my robot:
I personally suggest to twist it with a steel wire, to make it more effective.
Twisting the wires making up a circuit results in many smaller magnets with opposing polarity, which cancel each other out.

Citation: www.stefanv.com
Motor Isolation.
A simple isolated power supply for robot motors and circuits

A pseudo-isolated power supply for robot motors and circuits

Armature Current Measurement

With the help of MegunoLink 1.0.6 application form Blue Leaf Software You can measure all sorts of dynamic processes, such as armature current of the motor using arduino analog input and serial communication.
Use just two lines for two motor current feedback:
  Serial.println("{FB_L,T," + String(analogRead(FB_L))+'}');
  Serial.println("{FB_R,T," + String(analogRead(FB_R))+'}');

12.14.2012

Arduino Source Code Update


Split the code into tabs to have an easier access:

  1. Destroyer_3000.ino for global functions and variables;
  2. FSM.ino for Finite State Machine functions;
  3. Loop.ino for critical actions and functions;
  4. Motor.ino for motor speed control;
  5. PWM.ino just for prescaler choice;
  6. Serial_Monitor.ino for sensor data monitoring;
  7. Setup.ino for all the data setup and single run functions;
  8. definitions.h for all global constants.
//http://www.arduino.cc/playground/uploads/Code/FSM_1-6.zip
#include <FiniteStateMachine.h>
Added some more states:
State idleRunState = State(idleRunEnter, idleRunUpdate, NULL); State spinState = State(spinEnter, spinUpdate, spinExit); State lineAvoidState = State(lineAvoidEnter, lineAvoidUpdate, NULL); State attackState = State(attackEnter, attackUpdate, NULL); State overfallAvoidState = State(overfallAvoidEnter, overfallAvoidUpdate, NULL); FiniteStateMachine stateMachine = FiniteStateMachine(idleRunState);
The data sum of 8 sensors might have the result from 0~255 as a byte, so it is not efficient to write a switch-case for that. In order to find all combinations, use windows calc.exe in programmer mode for 1 byte in decimal units. Click "+", "1" and keep clicking "=" to increment the value, check the binary code while clicking.


"B00010001" states that proximity sensor on the left side and left line sensor are active at the same time, but priority is to avoid the line of the Dohyo, so the number "17" will be included in the interval which activates the "lineAvoidState".

During finite state, just toggle constant forward speed for patrolling.
/*IDLE RUN STATE*/ void idleRunEnter(){   motor(50, 50); }
Update it with continuous sensor readings, several if's will do the transitions.
(Update 2012.12.14 17:57): Fixed the condition for attackState, was the same as spinState's, in result robot runs stright forward as forever in idleEnter function, no line detection.
void idleRunUpdate(){   SensorSum();   if(sensorSum==1||sensorSum==3||sensorSum==8||sensorSum==12){     stateMachine.transitionTo(spinState);   }   if((sensorSum>=16 && sensorSum<=63)||(sensorSum>=208 && sensorSum<=255)){     stateMachine.transitionTo(lineAvoidState);   }   if(sensorSum==2||sensorSum==4||sensorSum==6||sensorSum==7||sensorSum==14){     stateMachine.transitionTo(attackState);   }   if((sensorSum>=64 && sensorSum<=79)||(sensorSum>=128 && sensorSum<=143)||(sensorSum>=192 && sensorSum<=207)){     stateMachine.transitionTo(overfallAvoidState);   } }
Under line avoid state are some setups on the enter: a timer, mask, a switch. 2 line sensors are used, so there is 3 combinations of them: left, right and both. Each result drives the system accordingly.
/*LINE AVOID STATE*/void lineAvoidEnter(){   timeOld=millis();   sensorMask=!(sensorSum & 48);   switch(sensorSum & 48){     case 16: timer=600; motor( 0, -50); break;     case 32: timer=600; motor(-50, 0); break;     case 48: timer=1000; motor(-50, -50); break;   } }
While avoiding the line, scan the sensor readings for a change and ignore the previous sensor, while in state in order not to tristate the state. The state will transit back if timer is out or there is a positive sensor result. But there is a condition for both activated line sensors, it will transit to spin state if no sensor was found after timeout.
void lineAvoidUpdate(){   SensorSum();   if(sensorSum & sensorMask > 0 || millis()-timeOld >=timer*8){     if(sensorMask==!48 && millis()-timeOld>=timer*8){       timeOld=millis();       stateMachine.immediateTransitionTo(spinState);     }     stateMachine.immediateTransitionTo(idleRunState);   } }
Analogical situation in the spin state.
/*SPIN STATE*/void spinEnter(){   timeOld=millis();   sensorMask=!(sensorSum & 9);   switch(sensorSum & 9){     case 0: timer=1000; motor(-50, +50); break;     case 1: timer=1000; motor(-50, +50); break;     case 8: timer=1000; motor(+50, -50); break;   } } void spinUpdate(){   SensorSum();   if(sensorSum & sensorMask > 0 || millis()-timeOld >=timer*8){     stateMachine.immediateTransitionTo(idleRunState);   } } void spinExit(){ }
Functions not programmed yet.
void attackEnter(){ } void attackUpdate(){ } void attackExit(){ } void overfallAvoidEnter(){ } void overfallAvoidUpdate(){ } void overfallAvoidExit(){ }

12.12.2012

Specifications

I present my mini sumo robot "Destroyer 3000"

Parts:
Aluminum body;
2 aluminum wheels with casted PU tires;
3 cell LiPo 0.8Ah battery

Mechanical:
2x 12V 1000RPM motors;
2x Pairs of 1:2 Bevel gears;

Electronics:
1x Arduino Nano v3.0;
2x Freescale MC33877 drivers;

Sensors:
1x TSOP31236 IR receiver;
4x SHARP 340K 40cm proximity sensors;
2x TCRT1000 Line sensors;
2x Overfall detection microswitchs;


A photo render of 3D CAD design

The design files are in CAD design section


Line Sensor Test



Arduino controlled mini sumo robot is being tested on official Baltic Robot Sumo Mini Dohyo surface.

Line sensors:
Vishay Telefunken Reflective Optical Sensor with Transistor Output TCRT1000

The robot on the video is preprogrammed with arduino sketch using Alexander Brevig's Finite State Machine library: FSM

Finite State Machine

finite-state machine (FSM) or finite-state automaton (plural: automata), or simply a state machine, is a mathematical model of computationused to design both computer programs and sequential logic circuits. It is conceived as an abstract machine that can be in one of a finite number of states. The machine is in only one state at a time; the state it is in at any given time is called the current state. It can change from one state to another when initiated by a triggering event or condition, this is called a transition. A particular FSM is defined by a list of its states, and the triggering condition for each transition. Wikipedia 

Finite-state machine



A sketch for Moore Automata Model, which is going to be reduced in process with the help of StateWorks reference.

"Modeling Software with Finite State Machines:
A Practical Approach"
Wagner F., Schmuki R., Wagner T.,
Wolstenholme P.

Publication Date: May 16, 2006
ISBN: 0-8493-8086-3
Number of Pages: 392 
CRC Press

Here is The Theory of Computation Lectures explaining the FSM

Cheap Powerful Electric Gearmotors

Bought 2 powerful motors for a mini sumo from Ebay for $11 each.


Specifications:

  • Static Torque: 1.5 N*cm
  • Voltage: 12V DC
  • RPM: 1000RPM
  • Diameter: 25mm
  • Length: 52mm
  • Shaft diameter: 4mm (D-profile)
  • Weight: 76g
Measured parameters:
  • Inductance: 0.9 mH
  • Resistance: 2.5~3 Ohm
  • BEMF or Torque constant: 0.112
  • Inertia: 1.071e-4 kg*m^2
  • No-load Current: 0.11 A at 12V
  • No-load Torque: 1.232 N*cm
  • Electromagnetic time constant: 0.36 ms
  • Mechanical time constant: 21.34 ms
By connecting a signal generator to a motor with a resistor in series to measure current with an oscilloscope.

Image from DSO203

Measure Time Constant of a dynamic process and multiply it with Full active resistance in series, to find out the Inductance.