Infinite Energy from Bobbing Could this device theoretically continue in motion forever? If not, why not? (click below for images):
Device description.
Device process.


*

*The device is less dense than air, so it rises. The propeller spins slightly (maybe) charging the device battery.

*After rising some distance X, the device compressor turns on to deflate the device.

*The device becomes more dense than air and falls quickly spinning the propeller, charging the battery.

*After falling X, the compressor releases and the device becomes less dense than air, going back to step 1.


The logic here is that there must be some distance X that the device can rise than will generate more energy than what is needed by the compressor.
Here is the underlying math to help:
$$PE = mgh$$


*

*$m$ = mass of the device

*$g$ = coefficient of gravity

*$h$ = height device has traveled up 

*$PE$ = potential energy of the device as it travels up


$$CW = nRT(\ln(V_b) - \ln(V_a))$$


*

*$n$ = number of moles of gas in balloon of device

*$R$ = ideal gas constant

*$T$ = temperature of the gas

*$V_b$ = volume of the balloon after compression

*$V_a$ = volume of the balloon before compression

*$CW$ = work to compress the balloon


As $h$ increases $PE$ increases but $CW$ stays the same resulting in energy gain of the system.
 A: Your final sentence has the problem: "there must be some distance X that the device can rise than will generate more energy than what is needed by the compressor"
I think every attempt to prove this kind of thing has shown that there actually is not some distance which would meet these requirements.
A: The problem is that neither the potential energy nor the energy necessary to compress the gas is of any importance here. We can set the energy of the compression to zero and still would not gain any energy in this model! So for any real device with losses we certainly can't gain energy. 
This can best be shown in an experiment by connecting a propeller to a balloon but is also clear from basic principles: Starting from step 1 the device will slowly lift upwards, the propeller will start to rotate as the passing air is causing a force on it. Now you want to drive a generator with this propeller. So what happens if you engage some kind of clutch to connect generator and propeller? The coupled balloon-propeller device will rotate around it's own axis. The energy is used to increase the angular momentum, not to charge the battery. 
The same happens in step 3 (Let's neglect what happens with the rotation between 2 and 3). Again the propeller starts to turn and if the clutch is engaged both will rotate together and the battery is not charged. 
