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?


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?

  • 1
    \$\begingroup\$ you need to add a bunch more detail of what you are trying to do if you want to get a helpful answer... \$\endgroup\$ – vicatcu Nov 4 '12 at 3:04
  • \$\begingroup\$ I added the details. \$\endgroup\$ – Rckt Nov 4 '12 at 13:28
  • \$\begingroup\$ A bit like a SMART Board? en.wikipedia.org/wiki/Smart_Board \$\endgroup\$ – jippie Nov 4 '12 at 15:26

I actually published a paper on this a couple years back. It is indeed difficult to track objects indoors with an IMU. As mentioned here previously, the only practical way to do it is with updates. I used passive RFID tags to update the position of my very low cost IMU (less than $100 prototype). The IMU works for short periods accurately but will begin to drift, all it needs is to occasionally pass near an RFID tag that has a unique ID and location associated with it. At that point not only do you know your current position, you can perform an affine transform on your previous path to get a more accurate picture of where you were. Your question is a bit vague on your application (I was tracking humans), but perhaps this dead reckoning with RFID fiducial updates would work for you. The paper is called "Indoor localization using pedestrian dead reckoning updated with RFID-based fiducials" if you'd like to look it up. It may give you some inspiration for your own method at least.

  • \$\begingroup\$ Thanks for you answer. I editted and added some details. Could you help with it? \$\endgroup\$ – Rckt Nov 4 '12 at 13:39
  • \$\begingroup\$ Ah, well given the details I think an fiducial updated IMU is not the best implementation. You don't actually need to track a 3D space and that's a much simpler problem. For a DIY smart board a infrared camera setup would probably work best. For reference check out Johnny Chung Lee's work with Wiimotes. I think that would be easier than getting into the Kalman filtering required for IMUs. \$\endgroup\$ – Samuel Nov 4 '12 at 18:27
  • \$\begingroup\$ Thanks for your different point of view to the problem. But I don't want to use a cam. So if you think it's possible with an IMU, what should the precision of the IMU has to be? Could you offer a model for me? \$\endgroup\$ – Rckt Nov 4 '12 at 20:21
  • \$\begingroup\$ Sure. I think it's best when you're starting out to go with an IMU that will have a good deal of community support, for instance, this one from Sparkfun. That's a 9DOF, but in reality I think you'll find the magnetometer fairly useless indoors. It's large too, so if you're fairly comfortable with embedded systems and you'd like to roll your own, I'd recommend the MPU60X0 from Invensense and an MSP430 microcontroller from TI. The processing is the most difficult part. Are you good with advanced math? \$\endgroup\$ – Samuel Nov 4 '12 at 20:51
  • \$\begingroup\$ The MPU-6050 is either SPI or I2C, you'll need some sort of microcontroller to talk to it. I know for certain it can work. However, you have to realize that this isn't a just-hook-it-up-and-it-does-what-you-want sort of thing. The IMU is going to give you raw accelerometer and raw gyroscope values which you'll have to integrate with respect to time (double integration for acceleration and single for the gyro since it's angular velocity). If you don't have significant embedded design and signal processing experience and can't easily understand Kalman filtering, this project may be beyond you. \$\endgroup\$ – Samuel Nov 5 '12 at 1:25

Using nothing more than inertial measurement unit (IMU) built out of accelerometers and gyroscopes is one way to determine location, but it suffers from error in the estimated position accumulating with time. The Apollo spacecraft had extremely precise IMUs, but it still needed to receive updated position and velocity information from radar trackers on Earth, and angle measurements to stars, to navigate accurately. IMUs work great for short-term localization, but for accuracy over time, even expensive IMUs are not enough.

Somehow you need to measure your position relative to landmarks in the environment. This is commonly done using either a laser or sonar range finder to measure distances, or using a video camera to estimate angles. If you don't even know the true locations of the landmarks you are using, then the task becomes the harder "simultaneous localization and mapping" (SLAM) problem.

ROS provides several packages for localization and SLAM. I suggest browsing through some of the demos and videos to get an idea of what's possible, and what might fit your application best.


Get two (or more) usb webcams looking into the room from different angles, and place an bandpass filter that only lets IR (infrared) light through in front of them. Hook up the cameras to a computer and find some software that will let you grab frames as bitmaps for you to read them. This works best if you can trigger the cameras simultaneously, but if the tracked object is not moving fast, this is not required. Install either IR LEDS or passive IR retroreflectors on your device (and shine IR light on it). Since it will be the brightest dot that the cameras will see (thanks to the IR notch filters), the algorithm to track this single bright dot should not be too complicated (especially being indoors, outdoors will complicate things quite a bit (I've done this by pulsing the leds very bright in synchronism with the camera shutter, having exposure time very short, around 400us, but you don't need this)). Then develop software to triangulate the position in space from the 2d location that each camera gives you. This position can be sent wirelessly to your device, so it knows where it is at. You also need to somehow guarantee that the marker is always visible, and this can be done by placing multiple cameras and only using data from those that can see it at any particular moment.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.