# Angular and linear velocity, cross product

## From linear to angular

Let’s consider the body C, rotating around the point O. The linear speed of point A is given by $\vec{V}$.

The angular velocity around O is given by :

$\vec{\omega} = \frac {\vec{OA} \times \vec{V}} { \| \vec{OA} \| ^2 }$

## From angular to linear

Assuming the angular velocity is known, the linear speed at point A is given by:

$\vec{V} = \vec{\omega} \times \vec{OA}$

## Example

close all;
clear all;
clc;

%% Parameters

% Coordinates of point O
O=[0;0;0];
% Coordinates of point A
A=[1;2;0];
% Coordinates of point B
B=[2;1;0];

% Speed applied at point A
VA=[0;2;0];

%% Compute angular velocity

% Compute vector OA
vOA=A-O;
% Compute angular speed around point A
wO=cross (vOA,VA)/(norm(vOA)*norm(vOA));

%% Compute linear speed at point B

vOB=B-O;
VB=cross(wO,vOB);

%% Draw system

plot3(O(1),O(2),O(3));
hold on;
line ([O(1) A(1)],[O(2) A(2)],[O(3) A(3)]);
line ([O(1) B(1)],[O(2) B(2)],[O(3) B(3)]);
text(O(1)+0.2,O(2)+0.2,O(3)+0.2,'O','FontSize',100);
text(A(1)+0.2,A(2)+0.2,A(3)+0.2,'A','FontSize',100);
text(B(1)+0.2,B(2)+0.2,B(3)+0.2,'B','FontSize',100);

% Draw speed at point A

% Draw speed at point O

% Draw speed at point B

% Display axis and legends
grid on;
axis square equal;
xlabel('X');
ylabel('Y');
zlabel('Z');
legend ([hFA,hTO,hFB],'Linear speed at point A','Angular velocity a point O','Linear speed at point B');


# Torque, Force and Cross Product

## From force to torque

Let’s consider the body C, rotating around the point O. The force $\vec{F}$ is applied on body C at point A.

The torque around O is given by the cross product between the vectors $\vec{OA}$ and $\vec{F}$ :

$\vec{\Gamma} = \vec{OA} \times \vec{F}$

## From torque to force

Assuming the torque is known, the force at point A is given by:

$\vec{F} = \frac {\vec{\Gamma} \times \vec{OA} } { \| \vec{OA} \| ^2 }$

## Example

close all;
clear all;
clc;

%% Parameters

% Coordinates of point O
O=[0;0;0];
% Coordinates of point A
A=[1;2;0];
% Coordinates of point B
B=[3;1;0];

% Force applied at point A
FA=[0;2;0];

%% Compute torque

% Compute vector OA
vOA=A-O;
% Compute torque at point A
TO=cross (vOA,FA);

%% Compute force at point B

vOB=B-O;
FB=cross(TO,vOB)/(norm(vOB)*norm(vOB));

%% Draw system

plot3(O(1),O(2),O(3));
hold on;
line ([O(1) A(1)],[O(2) A(2)],[O(3) A(3)]);
line ([O(1) B(1)],[O(2) B(2)],[O(3) B(3)]);
text(O(1)+0.2,O(2)+0.2,O(3)+0.2,'O','FontSize',100);
text(A(1)+0.2,A(2)+0.2,A(3)+0.2,'A','FontSize',100);
text(B(1)+0.2,B(2)+0.2,B(3)+0.2,'B','FontSize',100);

% Draw force at point A

% Draw torque at point O

% Draw force at point B

% Display axis and legends
grid on;
axis square equal;
xlabel('X');
ylabel('Y');
zlabel('Z');
legend ([hFA,hTO,hFB],'Force at point A','Torque at point O','Force at point B');


# Introduction to EAGLE – Create Solidworks 3D model from Eagle

This post explain how to create a 3D CAD model from a PCB design from Eagle. The following versions of the software are used :
• Eagle 6.6
• Solidworks 2014 (with CircuitWorks)

## Export from Eagle

First, the board outline must be specified in the layer 20 (Dimension). If there is no board outline, add a close shape on layer 20 with the Wire tool.

Run EagleIDFExporter.ulp and follow the instruction. The ulp should create two files with the extensions emn and emp.

## Import to Solidworks

Check that the CirciutWorks add-in is started. If not, in Tools > Add-Ins, select CircuitWorks (To use CircuitWorks in every SolidWorks session, select CircuitWorks under Start Up). With CircuitWorks, open the emn file (open the ECAD file). The board appears in the window.

It is possible to associate each component from the board to a 3D model. Once all the components are associated, click on Build model : CircuitWorks will generate a new assembly in the Solidworks main window :

# Model of a mecanical differential

This post describes and explain the mathematical model of a car differential. We will consider the following device:

## Framework

First, let’s define the framework, axis and positive direction of rotation:

Let’s name each gear. The gear number $i$ is labelled with name $Z_i$ and is composed of $Z_i$ teeth:

## Right angle transmission

Let’s have a look at the right angle transmission:

This is a classical right angle gear, the transmission is given by:

$\omega_1.Z_1 = \omega_2.Z_2$

and

$\frac {\Gamma_1}{\Gamma_2} = \frac {Z_1} {Z_2}$

We will no longer consider this transmission in the following.

## Carrier’s frame

We will now work in a new referential attached to the carrier and focus on gears $Z_3$, $Z_4$, $Z_5$ and $Z_6$. The term $\omega^c_i$ is the angular velocity of gear $Z_i$ expressed in the carrier’s referential.

According to the previous direction of rotation, the transmissions between gears $Z_3$, $Z_4$, $Z_5$ and $Z_6$ are given by:

$\begin{matrix}\omega^c_4.Z_4=\omega_3^c.Z_3 \\\omega^c_3.Z_3=\omega^c_5.Z_5\end{matrix}$

Note that the gear $Z_6$ is redundant with the gear $Z_3$. The relation between gear $Z_4$ and $Z_5$ is given by:

$\omega^c_4.Z_4=-\omega^c_5.Z_5$
$\frac{\omega^c_4}{\omega^c_5}=-\frac{Z_5}{Z_4}=-1$

As $Z_4=Z_5$, the relation between angular velocities is :

$\omega^c_4=-\omega^c_5$

## Global frame

Let’s now come back in the global referential. The carrier angular velocity is given by $\omega_2$. In the carrier’s referential, the angular velocity of gear gear $Z_4$ is equal to $\omega_4$. The angular velocity of gear $Z_4$ in the global referential is thus given by:

$\omega_4=\omega_2+\omega^c_4$

With the same reasoning, we can also express the angular velocity of gear $Z_5$ in the global referential:

$\omega_5=\omega_2+\omega^c_5$

Gathering the previous equations gives the following system:

$\left \{ \begin{array}{r c l}\omega_4 &=& \omega_2+\omega^c_4 \\\omega_5 &=& \omega_2+\omega^c_5 \\\omega^c_4 &=& -\omega^c_5\end{array} \right .$
$\left \{ \begin{array}{r c l}\omega_4 &=& \omega_2-\omega^c_5 \\\omega_5 &=& \omega_2+\omega^c_5 \end{array} \right .$
$\left \{ \begin{array}{r c l}\omega^c_5 &=& \omega_2-\omega_4 \\\omega_5 &=& \omega_2+\omega^c_5 \end{array} \right .$

Solving the system provides the final equation of the model:

$\omega_2 = \frac{1}{2}(\omega_4+\omega_5)$

## Torque

The relation between gears $Z_3$, $Z_4$ and $Z_5$ is given by:

$\begin{matrix}\frac{\Gamma_4}{\Gamma_3}=\frac{Z_4}{Z_3} \\\frac{\Gamma_5}{\Gamma_3}=\frac{Z_5}{Z_3}\end{matrix}$

As $Z_5=Z_4$ :

$\frac{\Gamma_4}{\Gamma_3}=\frac{\Gamma_5}{\Gamma_3}$

And finally :

$\Gamma_4=\Gamma_5$

## Power

The input power must be equal to the output power:

$P_{in}=P_{out}$

As $P=\Gamma.\omega$, the output torque can be rewrite as:

$P_{out}=P_4+P_5=\Gamma_4.\omega_4+\Gamma_5.\omega_5$

As $\Gamma_4=\Gamma_5$, the previous equation can be simplified:

$P_{out}=\Gamma_4.(\omega_4+\omega_5)$

As $\omega_4+\omega_5=2.\omega_2$, the previous equation can be rewriten:

$P_{out}=\Gamma_4.(2.\omega_2)=\Gamma_2\omega_2=P_{in}$

Finally:

$2.\Gamma_4=\Gamma_2$

## Conclusion

The relation on velocities is given by:

$\omega_2 = \frac{1}{2}(\omega_4+\omega_5)$

The relation on torques is given by:

$\frac{\Gamma_2}{2} = \Gamma_4=\Gamma_5$

# Brushless hall sensor frequency calculator

The following forms help to calculate the speed of a motor based on the Hall effect sensor signal and vice versa.

## Formula

$F_1[Hz]=N[rpm].N_{Poles}$

$F_2[Hz]=2.N[rpm].N_{Poles}.N_{Phases}$

# Geometric model for differential wheeled mobile robot

In the following, the geometric model is a mathematical transformation where the inputs are the angular velocities of the wheels (usualy measured with encoders) and the output is the pose (position and orientation) of the mobile robot in the working space.

## Problem specification

We focus here on a differential wheeled mobile robot. Such robot is composed of two wheels aligned on the same axis. Here is an illustration of Rat-Courci, a small differential wheeled robot designed for the Micromouse competition:

The wheel diameter is given by $D=2.r$ where $r$ is the radius. The distance between the center of the robot and the wheels is given by $l$, the distance between wheels is $2.l$ according to the following illustration:

We’ll assume that the following parameters are known:

• $r$ is the radius of the wheels

• $l$ the distance between the center of the robot and the wheels

• $\omega_l$ and $\omega_r$ are the instantaneous angular velocities of respectively the left and right wheels

Our goal is to calculate the pose of the robot according to the upper figure:

• $x$ and $y$ are the coordinates of the robot

• $\psi$ is the angular orientation of the robot

## Elementary displacement calculation

First, let’s calculate the linear velocity of each wheel:

$\begin{array}{r c l} v_l &=& r.\omega_l \\ v_r &=& r.\omega_r\end{array}$

The average velocity of the robot is then given by:

$v_{robot}=\frac {v_l + v_r} {2}$

The robot velocity can now be projected along the $x$ and $y$ axes:

$\begin{array}{r c l} \Delta_x &=& v_{robot}.cos(\psi)&=&\frac {r}{2} ( \omega_l.cos(\psi) + \omega_r.cos(\psi))\\ \Delta_y &=& v_{robot}.sin(\psi)&=&\frac {r}{2} ( \omega_l.sin(\psi) + \omega_r.sin(\psi))\end{array}$

The angular velocity of the robot is given by the difference of the wheels linear velocities:

$2.l.\Delta_{\Psi}=r.\omega_r - r.\omega_l$

Previous equation can be reformulated as:

$\Delta_{\Psi}=\frac {r.\omega_r - r.\omega_l} {2.l}$

The elementary displacement of the robot is given by the following relation:

$\left[ \begin{matrix} \Delta_x \\ \Delta_y \\ \Delta_{\Psi} \end{matrix} \right]=\frac{r}{2}.\left[ \begin{matrix} cos(\psi) & cos(\psi) \\sin(\psi) & sin(\psi) \\\frac{1}{l} & \frac{-1}{l}\end{matrix} \right].\left[ \begin{matrix} \omega_r \\ \omega_l\end{matrix} \right]$

## Absolute position

The absolute position can be calculated thanks to the following equations :

\begin{array}{r c l}
x_{i}&=&x_{i-1}+\Delta_x \\
y_{i}&=&y_{i-1}+\Delta_y \\
\Psi_{i}&=&Psi_{i-1}+\Delta_{\Psi}
\end{array}

where

• $x_{i}$ and $y_{i}$ are the coordinates of the robot at time step $i$

• $\Psi_{i}$ is the orientation of the robot at time step $i$

Of course, this model has some limitations. The result is highly dependant on the accuracy of the robot (mechanical assembly, wheel diameter, distances …). We assume that wheels rotate without any slippery problems which is not true in practice. We also assume that the sampling rate is fast enough to assume that $\Delta_x$, $\Delta_y$ and $\Delta_\Psi$ will remain elementary displacements.

# Convert revolutions per second [rpm] to radians per second [rad/s] and vice-versa

## Explanation

$rpm$ stands for revolutions per minute. The aim is to convert $N$ (expressed in $rpm$) to $\omega$ (expressed in $rad.s^{-1}$). If $N$ revolutions are performed in one minute, $\frac {N}{60}$ revolutions are performed in one second. As one revolution is equal to $2\pi$ radians, the conversion can be done thanks to the following formula:

$\omega[rad.s^{-1}] = \frac {2\pi}{60}.N[rpm]$

and vice-versa:

$N[rpm] = \frac {60}{2\pi}.\omega[rad.s^{-1}]$

More options on Calculatrix.

# Inside the maxon EC brushless DC motor

This serie of pictures shows how are made the Brushless Flat DC motors from Maxon. This is an EC45 flat (reference 339285):

The cap can be removed:

Magnets are located in the cap (black ring):

12 windings (4 series of 3 phases):

Three hall sensors are located between windings:

The cap is monted on ball bearings:

Top of cap (with printed references):

# Configurable gear for solidwork

In this post, you will find a configurable gear for Solidworks.