Mapping a room while you're moving about it is called "SLAM" (for "Simultaneous Locating and Mapping" IIRC.)
There are some functions to do SLAM in the ROS toolkit. It requires a lot more computing power than an 8051 or Arduino will have, though. Perhaps you could do it with a Raspberry Pi, or a small PC.
If you're not a skilled software developer, though, then this is probably not something you can achieve yet. It's pretty gnarly stuff.