3D room mapping with sonar (Final)

Here is the completed room mapping final project! Since last time, I’ve added a very useful smoothing option that makes the plot look less like a bunch of random jagged edges and more like a recognizable shape. There’s also an option to choose different types of shapes to plot with, which makes for some pretty artsy-looking results. It is surprisingly fun to play around with the smoothing options, textures, and shape types, as you can see me doing in the video.

The Arduino/Processing source code can be found here, and if you just want to play around with the plotting program (I’ve included some sample files), you can download an exe file here. You’ll need the ControlP5 library if you want to modify/run the Processing code (not necessary for the exe).


7 thoughts on “3D room mapping with sonar (Final)

    1. Yeah, I guess if I were using micro-servos instead of these standard-size servos, it would be much easier to have it be smaller. The Arduino can be powered with a 9-volt battery, and with a data-logging shield (or some other sort of data storage thing), the data can be saved without needing to be connected to a computer.


  1. Glad to see another touhou fan who’s into Arduino, I’ve got a final project based on Arduino as well, something like the Ardupilot for a UAV if you’ve heard of it, but I wanted to make my own from scratch. Got to learn how 3D vectors work first though but it looks like you already have this down!

    Was tempted to use datalogging on my system, But planning to just wire up an XBee and communicate direct to a computer. I guess with a scanner the potential to crash into the ground is not the sort of problem you’d expect with a UAV.

    Hmmm.. I’m starting to blabber here. How did you find accessing and using the data stream from the Arduino for your program? Best I have at this time is using terminal software to record data realtime and read it later, but I ideally need to make something better myself, to do what you’ve done here basicly.

    Still, nice work! I like how simple the scanner unit is on the other video.


    1. Right now I basically have two separate Processing programs, one for receiving the data from the serial port and saving it to a text file, and the other one just plots the data from a text file. I mean, theoretically I could have it plot the data in real time but the way I’ve written the program depends on it already having a set number of data points (so it knows which two points to connect, which adjacent points make surfaces, etc).

      I don’t really know anything about Ardupilots or UAVs or have any experience with XBees though!


  2. In fairness me neither – I’m just getting started! I almost discarded the idea of using Processing as I couldn’t find anything in the reference about serial connection, but given you’ve got it to work with serial and uploaded your source code as an example I’ve actually got something to get started with now, so I think I’ll give Processing a shot. So many languages and out there these days its hard to make a choice.

    Be nice if I could get away with save and plot later, but given the idea is to catch the problems before they crash it I dont think I’ll get away with that! Then, again, I’ve still got to figure out how to plot experimental GPS data that I already have saved. I’ve pulled appart some saved data using the arduino as thats all I knew how to program, (sending raw and getting processed back) but its far from ideal for litterally thousands of entries about 200 bytes long each.


    1. Processing is pretty easy to use, and the graphics part of it is relatively straightforward as well (I imagined it to be harder, especially with 3D, but it wasn’t too difficult).

      Also, there’s nothing in the “reference” page specifically, but it’s there in the “libraries” page here.


  3. Ah! I see now. Seems pretty similar to Arduino looking at the serial examples. (also somewhat reminds me of danmakufu somehow when I had a look at the drawing commands) Thanks for this!


Comments are closed.