What's wrong with this idea for recover energy from pressure? 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 ? 
 A: I'm having trouble understanding how this machine works (does the torque come from buoyancy? If so, you need gravity.), but the following statement is false.

At time=1, the pressure inside circles must changed. This step don't need energy (in theory) because all volumes are constant.

In order to change the gas pressure inside a container, you must either change the amount of gas or change the temperature of the gas, both of which require work or energy. For example, to increase the pressure from $P/2$ to $2P$, you have to force more air into the container (requiring work), or you must raise the temperature of the container (requiring heat input).
A: Your most obvious problem is:
"I suppose no friction."
This is an assumption that is never physically true and is a leading reason that perpetual motion machines, in general, never work. 
Even orbiting planets experience a tiny amount of friction from tidal forces on bodies that are never truly perfectly rigid that converts the kinetic energy of angular momentum into heat or other forms of internal motion and reduces angular momentum ever so slightly over time.
I also suspect that another main reason is that even in the absence of friction in the machinery (which is impossible) the Second Law of Thermodynamics in the fluid is in play, although it is a bit difficult to follow what is going on in the contraption to do a proper analysis of it.
A: you are only considering the torque on the device without the air inside. But the mass of air is moving within the device so it needs to be taken into the system on which you compute the torque. The torque on the whole systeme (device+air) is zero as expected. Action/Reaction if you want. Or no external force on the system. 
