Robot project

I'm working on a project with my son. We are making a robot that will walk around the floor by itself. It should avoid obstacles with use of a ultrasonic sensor.

What I think is that after a while with driving around, it should take a break and wake to life by means of audio recording from a microphone.

But how do I make a sketch that should only go a certain period and then put arduino in a kind of sleep?

All suggestions are welcome.

By the time you figure out on how to make your robot actually walk, the shutting it down for a rest part will feel truly trivial.

It's just keeping track of time using the millis() timer. Take the time, check whether a certain period has passed, and if so take action. See Blink Without Delay for an example of how this works.