Friday 18 July 2014

Bat Navigator prototype

Hi everyone, it's me, Sirio.

From the last post, I added a third ultrasonic sensor to the project.
The purpose of this sensor is to detect obstacles like tables or chairs, that are too low to be detected by the other two sensors. If an obstacle is detected, then the pitch of the two piezo transducers goes down. At the moment I implemented it as an all-or-none detection, so the user doesn't actually know how high the obstacle is, just that it is there.

I want to change it later so that the new central sensor has its own beeping using the two piezos, so I won't post the code here, as it is just a temporary fix. The reason why I went with a temporary fix is that I actually couldn't wait to build and test the glasses, see if they actually worked, and see how well they worked.

Today I built the glasses.

So, here I present you the Bat Navigator version 0.1!


And here some close-ups of the glasses!

A nice mess

Frontal view, note the Epoxy sustaining the central sensor apparatus

I made some custom connectors using Epoxy and ferrules (i.e. stuff I've found at the local electronics store)

Notice the flexible tube which permits the regulation of the central sensor angle, idea from Valerio Biscione. Flexible tube scavenged from an innocent reading light.
Nice, right?
Me and my friend Valerio tested them out today.

Our testing procedure consisted of the following steps:
- One of us wears the glasses, and closes his eyes.
- The other one spins him around a few times.
- The one who wears the glasses tries to walk around the building without hurting himself.
- The other one makes sure that he succeeds in not dying falling down some stairs
- A third person plays pranks on the one with the eyes closed (essential part of testing)

The Bat Navigator actually works much better than I expected, I was able to navigate the building, even if at a really slow pace. I got the hang of it almost immediately, recognizing walls and their orientation, corridors, and tables. I'm pretty confident that if I keep working on it, it could actually become a feasible way to navigate indoor environments without using eyesight.

It will be a while before I update the blog again, as the next steps will either involve adding another couple of sensors to the side and figure out a way to convey that information without producing information overload for the user, or building a second prototype where everything is mounted on the glasses (so something that can actually be used normally). Both of the options require a good amount of work, and I won't have that kind of time in the near future.
Maybe I will continue working on this from the second half of August, but, until then, I'll have to focus on my central projects :)

In the mean time, I want to thank Ricardo for giving me precious advice on how to go about building this prototype, and Valerio for his many tips, ideas and help in testing the Bat Navigator.

Bye bye now,
I'll keep you posted! (In a while)

Sirio


Monday 14 July 2014

Let's dance to the sound of piezos

Hi everyone, it's me, Sirio.

As I wrote in the last post, I found out that vibration motors do not have much "expressive power", not as much as I thought anyway. For this reason, I am switching to piezoelectric transducers, which offer a greater range of expression, are easy to control and wire up, and consume almost nothing.

At first, I wanted the piezos to produce a fixed pitch, and vary the volume of the sound as a function of the distance of the obstacles detected by the ultrasound sensors. Turns out, it is not that easy to do so with a piezoelectric transducer, as it would be with a buzzer.

Then I tried to vary the pitch of the produced sounds as a function of the distance of the obstacles, but I didn't like the result. I thought it would be quite annoying to listen to this continuous change of pitch while using the glasses for some time. The good thing is that it worked quite well as a theremin!

(Sorry about the noise, but piezo transducers produce very low sounds)

In the end, I decided to keep volume and pitch fixed, and vary the beeping rhythm, like in parking sensors:


The circuit here is quite simple - the mess you can see in the video is actually just because I was too lazy to tidy everything up. Each ultrasonic sensor is connected to Ground, to the 5V pin, and to a single digital pin (one for each sensor). In fact, with the NewPing library, you can use a single pin to ping the sensor, and to receive the reading.
The piezo transducers were just connected each to a digital pin and to ground. I think I will add some resistance to adjust the volume later on, and maybe a linear potentiometer to control the volume manually.

Now I can guide you through the code I've used here.
I'll explain the key functions and then show the complete code, I'm assuming you already know the basics for C coding.
This is the function which is called continuously as the Arduino is turned on. What it does is:
- Ping the US sensors.
- Average out the last READINGS readings, where READING is a number defined before.
- Shift the distance down of MIN_DISTANCE. This is used so that the piezos can already beep at the highest speed when an obstacle is presented at MIN_DISTANCE.
- Make the piezos beep.
The first and last actions in this list are actually carried out by two functions which are external to the loop. Let's have a look at the function which pings the sensors.


This function pings the sensors one at a time, retrieving the distance for each one. To do that, it makes sure that enough time has passed since the last ping (PING_INTERVAL).
Also, it both the US have been pinged, it updates the reading_n variable. That variable is used in the loop function to populate the reading arrays.

Now for the function that makes the piezos beep.
This function makes the piezo beep more or less frequently depending on the distance of the left and right obstacles.
When the right time interval has passed, the function starts a beep. A beep here is a square wave sent to a piezo for a certain PULSE_DURATION time.

The pitch of the beep sound is controlled by the R and L_BEEP_LOW_RATIO. Given that this function is called by the loop every 1 ms, if for example L_BEEP_LOW_RATIO = 2, then a series of HIGH - LOW - LOW is sent, where each signal lasts a millisecond.
The frequency of the resulting square wave is 1/3 of 1000 Hz (again, because the function is called every millisecond, 1000 times a second).

Finally the complete code, hopefully it should be easy enough now to read through.

OK, that's it for this post, hope you enjoyed it! For the next post, I will probably implement a third sensor to sense low-frontal objects (but I want to use only two piezo transducers).

I'll keep you posted!