Introduction: ​Build a Sonar Ring to Make Your Robot Aware of Its Environment

About: I'm a boyfriend, father, software developer and maker, grown up in Argentina and currently living in Toronto, Canada.

As part of my robot project Andar, I was needing to build a sonar ring to make Andar aware of its surroundings.

This is a tutorial on how to build a sonar ring with 12 ultrasonic range finders and an Arduino nano, as the one Andar robot uses.

NOTE: You can find more details an documentation about this project in its main web page, and the source code here.

Step 1: Gather the Materials

1. To be truth it the sonar can have whatever diameter you need on your robot. in my case, I used a 4" pvc coupling, since it had the perfect measures for Andar.
2. You will also need the sonar range finders. I used 12 HC-SR04 sensos. they are the cheapest available as far as I know.
3. Other things that should be listed are
4. Flat cable
5. Connectors
6. Solder
7. Some hours of time to assemble and test everything.

Step 2: Layout the Sensor Positions

You will need to divide the circunference of your cylinder in 12 equal sections.
Each of these vertical lines will be the axis of one ultrasonic range finder.
To mark where each line will be drawn, I used one of the free paper rulers that you get in Ikea to take measures of the furniture etc.(Ikea is a shop where you can buy home stuff in Canada). If you don't have one, you can even make the marks linearly on a a pease of scotch tape and then tape it arround the cilinder.
To draw the vertical lines you can use any box of any product that you can find in you kitchen and than is tall enough and that is a 90 degres with the base.

Step 3: Draw the Lines That Will Mark the Holes of the Ultrasonic Range Finders

you will need to draw 4 lines one for each of the emiter and receiver cilinders and the other two for the oscilator.
I placed the lines leaving 5mm free below and above the sonar sensor. we will use that space to place the bottom and top caps (if you want them, of course)
To be more specific, this is the detail on each of the four lines:
1. Bottom cilinder: Starting from the bottom, the first line should be at XX mm.
2. Top cilinder: Draw a second line at XX mm, also from the bottom.
3. Oscilator bottom: Draw a new line at XX mm from the bottom
4. Oscilator top: Draw this line at XX mm from the bottom

Now, the cilinder has all the point where we will need to drill.

Step 4: Start Drilling Holes

Now we will start making all the holes where we will be placing the ultrasonic range finders.

Use the marks drawn in the previous step to check where each hole should be made. Keep in mind that if you make a small hole first you will have more control over the position it is made. After that, you can use the correct bit.

Another recommendation I would make is to make the holes for just one sensor, test if it fits correctly, and if it does, go to the next group of holes. If you do everything together and you make a mistake, you will not be able to solve it.

As can be seen in the las image, the two oscilator holes should be connected.

Make sure that all range finders fit correctly in the expected positions. aif that is not the case (it wasn't for me at the beginning) correct the holes so you know that everything is going to fit.

Step 5: ​Create the Cable to Connect All the Sensors

If you worked with ultrasonic range finders before, you already know that they have (at least) 4 pins

• Vcc
• Trig
• Echo

So, as we will be working with 12 sonars, we are talking about 24 pins for Trig and Echo. And Arduino Nano does not have 24 digital pins to work with. Well, what we are going to do is to connect together Trig and Echo pins, so we can use only one signal pin per sensor. (This is not my idea, is part of an example that you can find in the NewPing library that I'm using in the code.

The thinkg is.. you will have to weld a looot of connections..

As you can see in the images, all Vcc are connected together. The same runs for all GND pins.

The rest of the cables are connected to the 12 pins for the Trig/Echo on each sensor.

Step 6: Arduino Nano Connections

Step 7: Install Your Sketch Into Arduino

Step 8: Connect to PC and Run the Sonar .net Application