I want to make a device that knows itselfs x and y coordinates in a 3d space, for example in a room. I can move the device anywhere in the room but I just need x and y coordinates. Is there anyway doing this by using accelerometers and/or gyroscopes? If not what is the easiest way to do this?
--Edit--
Here is the details. The device will be a kind of electronic pen. When I draw something to the wall with that device, I want it to be drawn in my computer screen too. The wall size is fixed. So, can an IMU give me the accurate coordinates on the wall during a few hours drawing period. If yes what should the precision or sensitivity of the IMU has to be?