The workings are explained here: http://mihalysprojects.weebly.com/blog/making-a-weather-station-using-the-raspberry-pi-i2c