Using an Arduino, ultrasonic sensor and a lot of coding, my aim is to create a small and portable sonar. The actual goal is to gift it to my 7-year-old nephew, who's quite fond of his cardboard submarine - and what's a cardboard submarine without a sonar?
The Arduino Uno is reading the sensor (in this case an ultrasonic rangefinder that's being rotated by a servo motor), and that data is being drawn to a 2.2" display.
I find it's best to rapid prototype most physical designs and that is exactly my strategy with this project. I spent as little time as possible coming up with the design for this first casing, in the comfort that it was going to be fast and heavily modified with future revisions. Inspired by not very much at all I simple started hacking away! Sending what I dreamed up over to the 3D printer and hoping for the best.
(Drawn up in Fusion360 and very sloppily rendered in Blender)
Luckily, this strategy is already paying off as I immediately encountered some poor design choices that we're valuable lessons to learn now and not on version 50. Such lessons as 'make sure there's enough room to actually fit the part in' for example.
Also, as luck would have it, I've decided to add another small feature to the project which is a potentiometer that allows the user to select the range of the sonar/range finder before selecting the function you'd like to use. So the second version of the housing will have to already have to account for the extra hardware.
I'm very much enjoying this build! Having the first physical prototype in hand is such a wonderful feeling and I'm looking forward to the next round of revisions.
After getting the sonar functioning with the display I started to become more paranoid over 'is this enough?' or 'how can I make this more than a little one-trick project?'
Thinking of my 7-year-old nephew, who this project is going to be gifted to, and how a sonar is great for stationary games but what about when he's on the move? I initially tested the ultrasonic sensor by building a simple rangefinder that worked very quickly and accurately, so why not make this until do both with the option to choose? So that's exactly what I did.
On boot-up you're now presented with an option to use the unit as a sonar or a rangefinder! One button lets you alternate the selection, and if the button is held it confirms the selection and runs that option. The coding for this was a pain in the butt, but I got there in the end!
I'm rather enjoying how primitive the display is, oddly enough. It's a nice creative constraint and, I think, adds a nice character to the visuals.
The display arrived and I had to wrestle with it a little to get it working.
I had no idea the Arduino has such a rough time refreshing and drawing to displays, so now I have to figure out the most optimal way for the Arduino to check and only draw that it absolutely needs to... which I'm simultaneously dreading and welcoming.