# Controlling an H-belt with Replicape

The HipsterBot has an H-type belt configuration for controlling the X and Y axes. What’s special about this is that there are two stepper motors connected together with one long belt. If the steppers move in opposite direction, they control the X-axis. If they move in the same direction, they control the Y-axis. Therefore, the need for a linear mapping from a cartesian coordinate system into an H-belt coordinate system arises. In the RepRap community, the X-axis is usually the axis where the extruder sits, note that this is not the case here.

The advantage to this setup is that (with a Bowden extruder) there are no moving stepper motors to add weight to the carriage, so the speed can be high. The disadvantage is that there is some elasticity in the belt.

Luckily there’s a paper for that! So this is the formula for translating rotational movement of the two pulleys into linear motion of the cart:

$Latex formula$

In contrast translating rotational movement into linear motion in a normal system where the two steppers are not connected, you would have switch out the matrix with an identity matrix times r:
$Latex formula$
This makes intuitively sense since a full rotation of each of the steppers would move the carriage 2*pi*r. I mean think about it…

Anyways, for the H-type belt, the motion to travel is known (you press the move forward 10mm) and the stepper rotations are unknown, so the equation has to be solved in relation to phi_1 and phi_2. This means inverting the matrix and dotting with the x,y vector:
$Latex formula$

In Python this becomes trivial when using numpy:

```if self.axis_config == "H-belt":
A = np.matrix('-0.5 0.5; -0.5 -0.5')
b = np.array([x, y])
X = np.dot(np.linalg.inv(A), b)
x = X[0, 0]
y = X[0, 1]```

<3 Math <3

BTW what is show in the picture is the carriage with the hot ends. Some samples of professionally made versions are on their way from China: