Daniel M. Bartolini | NYU Interactive Telecommunications Program | Sensor Workshop | Tom Igoe | Fall 2005

Monday, October 03, 2005

Devantech SRf04 Sonar Ranger


Sonar, in general, is a fascinating system that takes place in nature on a regular basis. Shout across a room and listen for the echo. Your voice moves away from you at the speed of sound. It moves back to you then at the speed of sound. It doesn’t come back to right away, however because it has to travel its said distance one way and then another. Do a little math (sound travels at 340.29 meters/second at sea level) and you can figure out how far away something is from you based on how quickly the sound returns.

This is where sonar is used- to measure distance and location based on return time of sound from an emitter. My favorite example of this in nature is the way bats operate when navigating and hunting. They use a process called “echolocation” to determine their distance to an object, including tiny little bugs they like to eat. Bats emit their voices, normally, at an ultrasonic range, so most of the time, we never hear them in their process of navigation and hunting. All of this information is highjacked from the following: http://science.howstuffworks.com/bat2.htm .


One of my favorite uses of Sonar technology comes from the marine world, and I don’t really mean the trillion dollar submarine development branch of the Navy and federal government, but something way more mundane: fish finders. Nothing better than sitting in a boat all day, out on a nice calm lake, trolling slowly along with the movement of schools of fish that you can “see” underneath the boat. Okay, there are many things better than that, but I still like the technology of the fishing world. For example,
Humminbird makes some wonderful gear for tracking fish and navigating various aquatic terrain: http://humminbird.com/products.asp?ID=361

The Devantech SRF-04 Ultrasonic Sonar Ranger
The SRF-04 Sonar Ranger ( http://www.acroname.com/robotics/parts/R271-SRF04.html ) is a fairly low cost method of working with Sonar for the purposes of range detection. This particular interface works well for proximity (Z-axis), but it does not provide any feedback in terms of positioning on an X or Y axis.

-insert 1 front picture; one back picture-

This particular module is very popular for use in smaller robotics manufacturing and engineering. When you hunt down information about the unit, it is often tied to both home and academic research products that use the sensors as navigation tools for their robots. An example fitting of ITP’s often humorous approach to robotics: http://www.acroname.com/robotics/gallery/bugbot/bugbot.html

A good question to ask would be: why use this type of ranger when here are other methods, many of them cheaper? Take, for example, the Sharp range of IR: sensors:http://www.acroname.com/robotics/parts/R120-GP2Y0D02YK.html They are a little less bulky, and, come on, the concept of working with IR just sounds sexier. But there are two main reasons why the sonar sensors are a good solution to navigational needs, over the IR sensors:
1) They can detect further distances
2) IR and light tracking and sensing can be a giant pain. You take an IR sensor outdoors into the natural sunlight which puts off an immense amount of natural IR light, and your robot is, in effect, blind.

Sonar rangers do have their own quirks, which I will get to, but outdoor projects may be easier to negotiate with sonar.

Electrical Characteristics
Unfortunately, I was not able to find a specific data sheet for this product. Googling Devantech leads you here: http://www.robot-electronics.co.uk/ However, on both the Acroname and Parallax sites, you can find very handy data-sheet-esque reports that have code examples (mostly for the Basic Stamp and BX): http://www.acroname.com/robotics/parts/R93-SRF04p.pdf Also, when you purchase a unit from Acroname, they send you a small booklet which is a nicely condensed version of the Parallax data-report. The reports outline the following behaviors for this unit:

- It operates on +5v and uses between 30 and 50 mA (30 is typical)
- Emits at a frequency of 40khz (way beyond anything we can hear, though I am interested to see what it might do to a dog)
- The MAX range for detection is 3 meters (roughly 8.5 feet)
- The MIN range for detection is 3 centimeters (a little more than an inch)
- According to Lab testing, the sonar can detect the top of a broom handle, which is 3cm in diameter, from a distance greater than 2 meters (almost 6 feet). Testing this theory is a bit tricky, and as my tests later showed, that kind of accuracy is irrelevant due to other concerns.

How Does This Thing Work?
I hooked this sensor up to a Microchip Pic 18F252. They are pretty much my favorite that I have worked with thus far, mostly for size, convenience and functionality.

First, how it interfaces:
-insert picture of pins-
The INIT and ECHO pins go to any digital I/O pin on the Pic. You pulse the INIT pin for a minimum of 10uS, at 5V (TTL Level). This is the trigger for the sensor to send the 40khz tone. You ask the Pic to listen on the ECHO pin for 10mS for that tone coming back to the sensor. Using PicBasicPro, the PULSIN command allows you read the voltage coming back to the Pic. If we take that time and divide it by the constant of the Speed of Sound, we can determine distance. On the Pic with a 4mhz clock, you use 14. As Tom Igoe notes in his book Physical Computing, due to the differences in timing between the PULSOUT and PULSIN commands, this value differs from one microcontroller to the next. The BX, for example, uses 74 as its constant. That is included in the data report found on the Acroname page.

When I hooked up a multimeter to the ECHO pin, the voltage coming back ranged from .65V to 3.5V consistently, giving some idea as to the range the PULSIN command translates.

Below is the code I used to test this with a 4mhz clock. It is taken directly from the book Physical Computing by Tom Igoe and Dan O’Sullivan.
___________________________________________________________________________
Define osc 4

distance var word ‘variable to store the distance
conversionFactor con 14 ‘constant for the speed of sound

initPin var portc.4 ‘what I used on the 18f252
echoPin var portc.3

txPin var portc.6

serout2 txPin, 16468, ["start"]
pause 500 ‘ pause the whole thing half a second before reading

MAIN:
pulsout initPin, 1
Pulsin echoPin, 1, distance
distance = distance/conversionFactor
serout2 txPin, 16468, ["Distance = ", DEC distance, "inches", 10, 13]
pause 100
goto MAIN
______________________________________________________________
The end result of testing, with the sensor pointed at a roughly 15 foot ceiling, and using my hand as a movable target, was a seemingly maximum distance of 61 inches, and a minimum distance of 3 inches. As we can see, not quite what the guides give us as the parameters for the sensor.
<pictures: board, board and sensor, screen shot>

Problems
When I tilted the sensor angle, so the emitters were parallel with the table, and pointed it into space where I knew any items were out of range, I figured I would get roughly the same results as before. This was not the case. I kept getting readings of things being as close as a foot away, even though there were no items in front of the sensor.

When I went back to the Acroname page to see if there are any circuits for calibrating these devices, I came across a link to the following page:
http://www.robot-electronics.co.uk/htm/reducing_sidelobes_of_srf10.htm

The user here describes the problem inherent to the ranger.
In the data provided with the sensor, Acroname lab tests show a roughly 45 degree angle of dispersion for the frequency. But that means it goes out in a 360 degree cone, not just on the X-axis. Subsequently, the floor of the work area became a “target.” The user here found that the best height for eliminating this distortion was at 5 feet. He describes this on a SRF10 ranger. The 04 has a shorter range, so the height would be a bit lower, but you still have to consider the floor a factor in measurement. He also discusses a solution for creating a narrower cone, eliminating distortion from object “way off boresight” (the angle where the sonar is aimed...straight ahead).

<picture of Acroname graph>

Monday, September 26, 2005

Hamamatsu CMOS Image Sensors

A note before beginning: I do not have any code or examples of this sensor in use yet, as I do not yet have my sensor. Also, as this is an image sensor, it will ultimately require a processor faster than a PIC chip to be able to do any sort of image processing.

S8377/S8378 Series
http://usa.hamamatsu.com/assets/pdf/parts_S/S8377_S8378.pdf

Intro:
CMOS image sensors (complimentary metal oxide semiconductors) are image sensors that are in fact large photodiode arrays. They act as massive logic chips, in this case turning their pixels on and off as the value of light changes. CMOS sensors, because of their logic capabilities, consume less power than many comparable ICs, making them ideal for many manufacturers who can sacrifice speed for affordability.

CMOS is actually a major class of ICs, beyond being an image sensor. For a much more thorough explanation of CMOS ICs and their uses, check out Wikipedia: http://en.wikipedia.org/wiki/CMOS God bless that site.

My interest is in these ICs as image sensors specifically. CMOS sensors are finding their way currently back into higher end optical devices and cameras, which have traditionally used CCD (charge-coupled devices) for image capture. The reason is that CCDs, due to advanced fabrication processes, allow more light to hit each of the photodiodes in each pixel. CMOS sensors have the same arrangement of pixels as CCDs, but, due to cheaper construction, have an array of transistors next to each diode, which amplifies the signal. The advantage is that each pixel can be read independently if it is so desired. The disadvantage, however, is the transistors can block light hitting the pixels. For a more detailed comparison of the two, check out the following:
http://electronics.howstuffworks.com/question362.htm

For a high end example of where CMOS imaging technology is being implemented, check out Sony’s very small HD camcorder, the HDR-HC1: http://sonystyle.com

For a lower level example of the use of CMOS image processors, the CMUcam and vision board, used for motor control and robot vision, is a pretty cool instrument, one which also interfaces with lower level microprcessors like the PIC: http://www.seattlerobotics.com/cmucam.htm

Electrical Characteristics:
The Hamamatsu S8377/S8378 image sensors operate on +5V DC supply voltage, and can be powered on a breadboard. There is, however, a driver circuit for this sensor which simplifies the amount of input signals, and amplifies and simplifies the output signals. The datasheet for that circuit can be found at http://www.datasheetcatalog.com

Much like the Q-Prox capacitance touch sensors we often use, these sensors have a gain selection which impacts the sensitivity of the sensor. The sensors are typically set to “High Gain” when they have an input on the Gain Terminal of 0V. When you give that pin +5V, the sensor is actually set “Low.”

Operation
The sensors have input pins for the following:

Vdd (supply voltage)
: +5V

Vg (gain selection voltage)
: +5V = “Low” and 0v = “High”
CLK (clock pulse): varies- the oscillator-in pin accepts pulses which operate the sensor’s internal Shift Register. The shift register is responsible for outputting all logic data from the chip, and the data rate is equal to the speed of the clock.
-as a note, the maximum input frequency is 500khz.

ST (start pulse)
: this is responsible for starting the storage of signals in the shift register. The ST acts as a gate for the data in the shift register. It seems that when this pin receives a pulse of +5V it starts the register operation. Another pulse tells the data to be output. The frequency of the pulse on this pin determines the signal storage time.

Monday, September 12, 2005

Sensors In Daily Life
John F. Kennedy Airport

I went to pick my parents up at the airport, and the entire encounter with the terminals was full of sensor interaction. I thought about taking pictures to illustrate some of them, but realized that some guy walking around JFK taking pictures of the security a few days before September 11th probably wasn't going to go over very well with travellers.

- EZ Pass scanners on the Whitestone Bridge: no need to come to a complete stop- RFID
- Pressure Sensor in the parking lot: as you pull up to the automated booth, your car activates the ticket dispenser so you can park.
- IR sensors to activate many of the doors
- Security Cameras: Charged Coupling Devices (CCD capture chips)
- Automatic Toilets: IR sensors
- Ticket Reader upon exiting the parking lot

At Home:
- Temperature Monitors in my laptop and desktop computers
- Smoke Detector
- DV Camcorder

Oh wait, how about my toungue with al of its regions and taste buds? Excellent sensors. Same would then go for the nose, the eyes, and your skin. All excellent sensors we use on a fairly substantial basis.

Hello World.