How is pressure kept constant in Charles' Law? Generally, a piston is kept on top of a cylinder containing the gas. The gas is heated and it expands causing a change in the volume. I was wondering how might one keep the pressure constant. Websites on the Internet have illustrated this by keeping a single weight on the piston throughout all the measurements. Does this really guarantee a constant pressure? As the height of the piston increases (if the gas is expanding) then shouldn't the atmospheric pressure fall? My book mentions that if it happens slowly enough then the pressure can be considered as constant, however I don't understand what the speed of the piston's motion has anything to do with maintaining constant pressure. Please Help.
 A: If the weight and piston are motionless the weight will exert a constant downward force on the piston.  This force is balanced by an equal upward force caused by the gas pressing against the inner surface of the piston.
If the piston accelerates, then the two forces will no longer balance because a net force is needed to make the piston and the weight on top of it change their motion.  The imbalance lasts the entire time the piston and weight are accelerating.
If you imagine very slow motion that only accelerates for a brief period at the very start and finish, and proceeds at constant speed the rest of the time, then the situation comes very close to that when the piston doesn't move--the forces balance almost the whole time.
A: @user55515 has correctly dealt with the effect of the velocity of the piston.
With regard to the pressure changing on the piston because of the rise of the piston:  the change in atmospheric pressure with height is so slow that it is completely negligible over the dimensions of any realistic apparatus.
With regard to "weather" changes in the total pressure, your concerns are correct.  In the simple experiment you describe, the total pressure in the cylinder is made up of the pressure exerted by the mass on the piston, and the atmospheric pressure.
At the high-school experimental level, the errors caused by ignoring changes in the atmospheric pressure component are usually small.  The experiment is done over a short period of time, and atmospheric pressure changes are usually small and slow.
One way of compensating for this error is to connect an absolute pressure gauge (like this) to the gas in the cylinder:

For clarity, the arm (B) is connected to the cylinder, the arm (A) is sealed, and this arm (A) has a vacuum over the mercury column.  Under these conditions, the scale measures the absolute pressure in the cylinder.
In practise, one could adjust the temperature, wait for the volume to settle down, and then adjust the "fixed" weight, compensating for changes the atmospheric component to keep the absolute pressure constant.
You could even replace the fixed weight with an upward pulling spring, to carry out experiments below atmospheric pressure.
A: When a gas expands rapidly and irreversibly (say in a cylinder), two things are happening:


*

*The pressure and temperature in the cylinder are not uniform spatially, and vary with position within the cylinder.  So one cannot assign a unique value to these parameters, and one can therefore not apply an equation of state globally to the gas, such as the ideal gas law

*There are viscous stresses present within the gas that are determined by the rate at which the gas is deforming, and these affect the force per unit area that the gas exerts on the piston face (where the work is being done).  This is why, in an irreversible expansion, the speed of the piston has an effect, since the piston speed affects the rate of gas deformation.  This effect is not present during a reversible expansion.
Now, with this in mind, let's consider an even more extreme case in which, rather than heating the gas rapidly to cause it to experience an irreversible expansion, we suddenly change the force that we are applying to the gas, which would make it expand even faster (and more irreversibly).  Suppose we have a frictionless piston with a mass m, and a mass M sitting on top of piston.  These are situated on top of the gas, and initially, the system is in thermodynamic equilibrium.  To simplify things, we will assume that the cylinder and piston are sitting within a vacuum chamber, so that we do not have to deal with a surrounding atmospheric pressure.  At time t = 0, the equilibrium relationship for the system is$$F_0=P_0A=(M+m)g\tag{1}$$where $F_0$ is the initial equilibrium force exerted by the gas on the lower face of the piston, A is the area of the piston, and $P_0$ is the initial equilibrium pressure of the gas.  Now, at time zero, we suddenly remove the mass M from the piston, and allow the system to expand rapidly and irreversibly until it finally equilibrates at a new equilibrium state.  If we perform a force balance on the piston during the expansion, we obtain the following:$$F(t)=mg+m\frac{dv}{dt}\tag{2}$$, where dv/dt is the acceleration of the piston and F(t) is the force per unit area exerted by the gas on the piston (including viscous stresses) as a result of the rapid irreverisble expansion.  
If we multiply Eqn. 2 by v = dz/dt, and integrate with respect to time, we obtain:  $$\int_{0}^{z(t)}{Fdz}=mgz+\frac{1}{2}mv^2\tag{3}$$
The left hand side of Eqn. 3 represents the work done by the gas on the piston.  The term mgz represents the change in potential energy of the piston, and the term $\frac{1}{2}mv^2$ represents its change in kinetic energy.  What will typically happen in this situation is that the piston will overshoot its equilibrium position, and then change direction and move downward again.  But then the force of the gas will increase and cause the piston to stop once more, and then move upward again.  So the frictionlesss piston in this situation will exhibit an oscillation, analogous to simple harmonic motion.  However, the motion will be damped by the viscous stresses that are present within the gas.  So, even though the piston is frictionless, it will still exhibit a damped oscillation.  And, eventually, after a long time, it will come to a stop at the final equilibrium position.  At that very long time, we will have:$$\int_{0}^{z(t=\infty)}Fdz=mgz_f=\frac{mg}{A}\Delta V$$
where $\Delta V$ is the change in volume.  So, for this irreversible expansion, the total cumulative work done by the gas on the piston is exactly the same as if the force per unit area exerted by the gas were constant at a value of mg/A during the entire expansion (even though it actually varied substantially).  So, if we blindly said that the gas pressure  was constant at mg/A during the entire expansion, we would end up getting the right answer for the work (but for the wrong reason).
