A thermometer shows the temperature when liquid inside it moves up or down on a scale. Find out how it works when you make your own in this project.
As water heats up, it expands and becomes less dense, rising to the surface. When it cools down, it contracts, becoming more dense and sinking down. This cycle is called convection. (Water is unique, however - when it gets cold enough to freeze, the molecules line up in an open crystalline structure that is actually less dense than the liquid form. This is why ice floats.) When the water in your bottle thermometer heated up, it expanded. But since the bottle was sealed, it had nowhere to go but up through the straw.
Real thermometers don't use water inside because it doesn't respond to temperature change very quickly. Try filling your bottle with 50% rubbing alcohol and 50% water. Does the liquid move up and down the straw faster? Why do you think this is?
With your homemade thermometer you aren't actually measuring temperature, just seeing temperature changes. If you have a real thermometer, you can use it to make a scale on your homemade thermometer: let your bottle get to room temperature and then mark the straw with what the actual room temperature is. Then set the bottle in the sun and do the same. Mark several different temperature levels and then watch your thermometer for a day and see how accurate it is.