3D room mapping with sonar

My final project for the Arduno microcontroller class is this 3D room mapping thing. It still needs some work but here’s basically what it looks like. An ultrasonic distance sensor is mounted on a servo (which is mounted on another servo), and records the distance of objects located at various angles. Two angles and a distance from the center make up a spherical coordinate system, and those coordinates can be plotted.

The second video features a plot with a resolution of 4 degrees for each servo. It takes a really long time to scan a whole half-sphere at that resolution. In the program, I made it so that there’s a threshold distance between points that determines whether or not a surface is drawn between those points; it can be changed in the program, as can be seen in the video. I’ll probably post the source code and all that after the project is completely finished.

Anyway, I looked it up yesterday and apparently there have been similar projects, although it doesn’t seem to be plotting as large of a surface (which makes sense considering the range of an IR sensor, though those are much more precise, I’d imagine). I think the main issue with this is that my room has lots of sharp corners and things blocking the way, so the sonar might be less accurate than it would be otherwise.

10 thoughts on “3D room mapping with sonar

    1. It’s fairly accurate, I’d say. Much less accurate when it’s pointed at a corner of a room or something like that, though; it detects distance by emitting sound, so the sound waves bounce off stuff and the accuracy depends on the kind of surface(s). Or at least this is what I’d like to believe.

      There’s a dead zone very close to the sensor (about 6 inches); anything closer than 6 inches will read as 6 inches.

      Like

  1. You need a spherical room =) I’m surprised it measures so quickly. Sound is pretty slow (‾ 1000 ft/sec) so for it to go 10 feet and back it would be about 0.02 seconds. That thing is flying through 180 degrees/45 measurements (if I understand at all what is going on) pretty quickly.

    Like

    1. Oh yeah, actually the video was from an earlier trial, with much less precision. The second video took much much longer to generate.

      I tried doing it with a 2 degree resolution yesterday night and it took over 20 minutes. Though it got kinda messed up somehow after about 158 degrees on the first servo, so I had to stop it; if it had continued, it probably would’ve taken 25 to 30 minutes, even.

      It can take measurements once every 50 milliseconds (about 0.05 seconds), but I’m taking about 10 measurements for each angle and averaging them.

      Like

  2. Have you finished this project? Hope you have another post about it, it seems very interesting. I have several things due next week (finals week) myself, I’m sure you are super busy this time of semester.

    Like

    1. Haven’t gotten much time to work on it since this post, but it’s due on the 22nd; I’ll have another post about it once it’s finished.

      Like

  3. Have you considered making it scan bidirectionally, i.e. taking measurements while the horizontal servo is travelling in reverse, too, and moving the other servo when the horizontal one reaches either end? It might save a little (though probably not much) time. Or was this one of the changes you made between making the first video and the second video?

    Like

    1. I’ve been considering doing that for awhile now, but haven’t gotten around to doing it yet, because it’d end up making the plotting slightly more complicated (but only slightly)

      Like

Comments are closed.