The caterpillar is growing quickly, the more it eats the bigger it gets. Eventually the caterpillar will shed from its first skin and grow a bigger skin.. There is no time for sleep for a caterpillar as it only has a few weeks to store as much energy as needed to change into a butterfly.
It is now time for the the caterpillar (larva) to then make a chrysalis (for butterflies) or a cocoon (for moths). The caterpillar must find a sturdy branch and spin some sticky silk threads to help it become secure and hang onto the branch. It spins some thread around its middle section (called the belt) and produces a patch of coiled thread at its tail end (called the pillow). It's skin will be shed for the last time and a shell will form underneath its shed skin. This shell hardens into a protective case which is the chrysalis. The caterpillar turns into a soft, squidy jelly like blob.
(source: The Life Cycle of Butterflies and moths - www.lifeofabutterfly.com)
One day, a Common Eggfly Butterfly (Hypolimnas bolina) caterpillar crawling out of the backyard and climbed my bedroom door. Then the caterpillar hung itself above the bedroom door and remained motionless until the next morning when the caterpillar turn into chrysalis.