In this case: It's a theoretical study, just for find my error. No gravity. No buoyancy. All volumes are constant. I suppose no friction. Outside, the pressure of air is constant at $P$ (atmospheric pressure for example at 1 bar). A basic device is composed of an arm and a circle. There is a gas inside each circle at a constant pressure. The black arm can turn around the blue axis. The circle is fixed to the arm. The circle doesn't turn around itself. I have drawn 2 basic devices but it possible to have $N$ devices: in the third image, I have drawn 16 basic devices. Walls between circles can be removed when it is necessary: red in the drawing. Two gaskets not drawn prevent the gas to escape. The system suppresses wall like that a part of each circle receives a torque on it. Like all circles don't turn around the same center, the torque is not the same. The pressure inside a circle can be $2P$ or $\frac{P}{2}$ and the pressure is constant because the volumes are constant.
There is a difference of torque:
The sum of torque of this basic device at $time=0$ is $F_1d_1\cos\theta-F_2d_2\cos\theta$. Like the distance $d1$ is greater than $d2$, the torque is higher counterclockwise from $time=0$ to $time=1$. So, the sum of the torques is not 0, the system gives an energy.
The device turns from $time=0$ to $time=2$.
The device turns from $time=0$ to $time=0.5$
At $time=1$, the pressure inside circles must change. This step doesn't need energy (in theory) because all volumes are constant. With a device with 16 basic devices I can, for example, exchange 2 circles with $2P$ with 2 circles with $\frac{P}{2}$ if the angular velocity of the all device is low.
It's possible to use another method for exchange the pressure: use an external device. The temperature will increase when the external device changes the pressure inside the circles, so it's necessary to give an energy to its external device but this energy is at the higher temperature. I don't lose any energy in this step with an external device.
Even in a short time (without changing the pressure inside circles) the device can't have a net torque on it from $time=7$ to $time=1$.
The third drawing shows a device with 16 circles, 2 circles at each time, all 16 arms turn counterclockwise at the same angular velocity. Two circles work together. At the exact position: $time=1$ $time=3$ $time=5$ and $time=7$ there is no work because there isn't a difference of torque.
Inside circles, the pressure is $2P$ from $time=7$ to $time=1$, from $time=3$ to $time=5$. Inside circles, the pressure is $P/2$ from $time=1$ to $time=3$, from $time=5$ to $time=7$.
Gaskets rotate like the following image shows:
Maybe the device lost an energy with the gaskets but I don't see how.
So my question is: what wrong, where I lost energy for compensate the energy I won in the difference of torques ?