Does this thought experiment violate the second law of thermodynamics? Consider an adiabatic box with an adiabatic board in the middle, which separates the box into two parts. There is a small hole in the board next to a coil, and the hole has a door which opens when the current in the coil reaches a certain value.
Now, if I put some gas in the right half of the box, where each molecule has a magnetic dipole moment, only fast molecules will produce enough current in the coil by induction to open the door.
After some time, the faster molecules will come to the left side and the slower molecules will be left on the right side, so the entropy in this isolated system decreases spontaneously. Does this violate the second law of thermodynamics? What's the problem with this setup?

 A: This ratchet-like Maxwell's demon has the same problem as all of the other ones: the door/coil mechanism itself will heat up, and become useless. 
Before thinking about this one, think about the simpler scenario where there's just a door, that opens if a fast particle hits it hard enough. Since particles have energy on the order of $kT$, the door must require around that much energy to open. But by the equipartition theorem, once the door itself is at temperature $T$, it will have $kT$ of thermal energy! So after a while the door will be wildly swinging open and shut on its own, and become totally useless.
This machine adds a second stage: now, your particle's $kT$ of kinetic energy goes into making a current in the coil, and the current in the coil opens the door. However, thermal noise applies to circuits, too; after a while, your coil will reach temperature $T$ and have $kT$ of Johnson noise, giving a randomly fluctuating current. As in the previous case, this will make your door randomly open and close, making the device fail.
A: Given: The speed of gas on two side is equal initially. Gas in RHS is magnetised.
As current will be induced in coil, this would be due to expense of Kinetic energy of magnetised gas. So, actual velocity of magnetised gas will decrease while passing.
This makes velocity on LHS less.
Now, to answer what if velocities on left is still lower. It changed entropy?
To answer this
We need to look at gate now.
Yes you opened door, but how did you close it.
You can not close it without bringing magnetised gas particle back.
Each particle you transfer, you increase Pressure Energy on RHS.
So, you actually cannot transfer many particles on LHS, as it would increase pressure on RHS and more gas particle will be forced back towards right.
Now, yes you can change entropy of system, but energy of that is supplied by various other forms.
Second Law of Thermodynamics : In
any cyclic process the entropy will
either increase or remain the
same.
Hence, second law of thermodynamic allows entropy increase.
A: It is true, "the second law of thermodynamics" is **not violated*. In order to see this clearly, I am providing the following scenario: 
Given:
1 - Each side starts with the same number of "molecules" (100).  Ten (10) will be fast (F), and 90 will be normal (N) speed.
2 - Each normal molecule has one unit of energy and the fast molecule has two.
3 - It takes one unit of energy to magnetize a molecule.
4 - It takes one unit of energy to open the "door."  
So, at the start, the left side has (10F x 2 + 90N x 1 =) 110 units of energy.  The right side is the same, but since the 10F molecules are also magnetized (M), it has (10MF x 3 + 90N x 1 = ) 120 unit of energy. Ten extra units of energy (from outside the system) are given to the right side.  
When a fast magnetized molecule passes through the loop, it uses up one unit of energy and becomes a magnetized normal molecule (MF -> ) MN that goes to the left side.  The next time this happens, a fast molecule (F) from the left side moves to the right side and the MN molecule stays in the right side.
This repeats until there are no more MF molecules.
At the end, there are 90N + 5MN + 5F molecules on the left side (110 unit of energy) and 90N + 5MN + 5F molecules on the right side (110 unit of energy).  The extra 10 unit of energy the right side had, were used up in opening the door, which is heat going back outside the system.       
