« October 2006 | Main | December 2006 »

November 25, 2006

srf range finders with arduino

atmel1.jpg

The tricky part to using the srf series range finder with the arduino is the I2c bus interface it is a fairly straightforward protocol (a good reference is at http://www.robot-electronics.co.uk/htm/using_the_i2c_bus.htm) but would take a lot of typing if you did it from scratch. It is basically a handshake method where the arduino slaves the srf range finder to its clock pulses and tells it when and from where the rangefinder will send information. It sends out info on the leading edge of the clock pulse and receives it on the falling edge, but the signals state (bit passing) never changes while the clock state is high, except to signal a start or stop to a communication. So the easiest way to communicate with your range finder is to use the code found on the Wiring web site (it is the sibling of arduino but even more user friendly it seems) and use the “wire” library (here’s the link http://wiring.org.co/reference/libraries/Wire/index.html). I took that code and modified it to include changing the address, the sensitivity and the range settings for the srf range finder (it should be talked about although maybe a bit muddled in the pamphlet that comes with the range finder). Also be sure to use the arduino 06 platform when implementing the library or it won’t compile, that was a big problem for me. So either use the code on the Wiring web site or take a look at mine (in the extended entry along with the pins to use) I hope this helps. Good luck!
Ps it took me a really long time to do the water colors so i hope you enjoy them.

atmel.jpg


#include Wire.h
////////////////////use below pins for input and out put/////////////////////////
/////////*************On the Arduino, SDA is on analog input pin 4, and SCL on analog input pin 5.****************///////////////////////


// I2C SRF10 or SRF08 Devantech Ultrasonic Ranger Finder
// by Nicholas Zambetti
// and James Tichenor

void setup()
{
Wire.begin(); // join i2c bus (address optional for master)
Serial.begin(9600);
// start serial communication at 9600bps
}

int reading = 0;

void loop()


////////////////sensitivity adjust/////////////////////////////////////////////
{ Wire.beginTransmission(0x70); // transmit to device #112 (0x70)
// the address specified in the datasheet is 224 (0xE0)
// but i2c adressing uses the high 7 bits so it's 112
Wire.send(0x01); // sets register pointer to the command register (0x01) reg 1
Wire.send(0x21); // command sensor to analog gain (sensitivity of sensor)
// use 0x51 for centimeters
// use 0x52 for ping microseconds
Wire.endTransmission(); // stop transmitting
//////////////////////range select////////////////////////////
Wire.beginTransmission(0x70); // transmit to device #112 (0x70)
// the address specified in the datasheet is 224 (0xE0)
// but i2c adressing uses the high 7 bits so it's 112
Wire.send(0x20); // sets register pointer to the command register (0x10) reg 2
Wire.send(0x00); // command sensor to analog range (distance)
// use 0x51 for centimeters
// use 0x52 for ping microseconds
Wire.endTransmission(); // stop transmitting

//////////////////////////// step 1: instruct sensor to read echoes ///////////////////////////////////////
Wire.beginTransmission(0x70); // transmit to device #112 (0x70)
// the address specified in the datasheet is 224 (0xE0)
// but i2c adressing uses the high 7 bits so it's 112
Wire.send(0x00); // sets register pointer to the command register (0x00) write
Wire.send(0x50); // command sensor to measure in "inches" (0x50)
// use 0x51 for centimeters
// use 0x52 for ping microseconds
Wire.endTransmission(); // stop transmitting

//////////////// step 2: wait for readings to happen ///////////////////////////////////////////////
delay(70); // datasheet suggests at least 65 milliseconds

////////////// step 3: instruct sensor to return a particular echo reading ////////////////////////////
Wire.beginTransmission(0x70); // transmit to device #112
Wire.send(0x02); // sets register pointer to echo #1 register (0x02)
Wire.endTransmission(); // stop transmitting

//////////////// step 4: request reading from sensor /////////////////////////
Wire.requestFrom(0x70, 2); // request 2 bytes from slave device #112

/////////////// step 5: receive reading from sensor ////////////////////////////
if(2 <= Wire.available()) // if two bytes were received
{
reading = Wire.receive(); // receive high byte (overwrites previous reading)
reading = reading << 8; // shift high byte to be high 8 bits
reading |= Wire.receive(); // receive low byte as lower 8 bits
Serial.println(reading); // print the reading
}

delay(250); // wait a bit since people have to read the output
}


/*

// The following code changes the address of a Devantech Ultrasonic Range Finder (SRF10 or SRF08)
// usage: changeAddress(0x70, 0xE6);

void changeAddress(byte oldAddress, byte newAddress)
{
Wire.beginTransmission(oldAddress);
Wire.send(0x00);
Wire.send(0xA0);
Wire.endTransmission();

Wire.beginTransmission(oldAddress);
Wire.send(0x00);
Wire.send(0xAA);
Wire.endTransmission();

Wire.beginTransmission(oldAddress);
Wire.send(0x00);
Wire.send(0xA5);
Wire.endTransmission();

Wire.beginTransmission(oldAddress);
Wire.send(0x00);
Wire.send(newAddress);
Wire.endTransmission();
}

*/

November 20, 2006

ez-sensor.jpg
srf10.jpg

I had many hours working with these guys especially the srf10 in the above picture; I had to learn about the I2c bus communication to get it running. I did find code for it finally on the wiring website there is code from the wire. class that makes bus communication a snap but you have to down load the arduino 06 if you want to call the class in arduino. the other sensor the sense ez is a real plug and play sensor and the focal area of the sound cone is very narrow and really accurate i can't recommend this sensor enough. i will post the code when i finish writing it but it is very simple to use. the srf10 has a much bigger range but it detects anything in a 180 degree sweep from center up to three feet on the sides and below it so you have to either really point it up or raise it three feet off the ground. not so good for my application.

ranging device

servo.jpg

i got the servo working finally, although i couldn't get the port addressing to work from tom igoes code example. just allot of repeat typing. it runs off of 12 volts and sinks about 250mA under a load so if i use a battery it won't be running for that long. ill have to think about that i am using a hbridge right now i can't decide if i need the enable pin or if i should switch to a darlington array for easier wiring.

November 17, 2006

notes

some observations

Observations
TV and UPS

Taken from notes and attempted to make semi readable.

My observations deal with TV’s in public or social spaces and ups package-tracking devices. First the TVs; I watched the interactions that took place between the audience in a laundry mat and the TV that was mounted on the wall. The audience watches the TV as a group, everyone is aware of the reactions that are accruing. As social information comes in off the TV it is gauged and agreed upon by the viewers in the room mostly with the help of laugh tracks. People also look to the TV to deemphasize their own psychic space in the room to turn from being judged to judging. It is not viewed as a machine not even as a surrogate. To change the channel is a bold move.

The specific information might be questioned but the role of the TV in space is solid, it is the center of decisions. It gets an objective placing in the social thought processes, it doesn’t have a personality it is personality. It is seen as a fixture, a unilateral place of reference. The only interaction possible is a change of reference by switching channels, you can’t say what is, but only choose what reference you will listen to from the ones presented. This causes a full emersion with the TVs space, it is hard to use the laundry mats references and the TVs at the same time. Why are people less willing to use the laundry mats reference over the TVs, the shows are not that exiting? You are not in the TV space so you are not required to participate or rather you don’t have the power to change it so you don’t have responsibility to do anything. What if you did have an impact on the physical/ mental space?

Ups package tracking devices. The tracking devices that are used by the ups guys are very interesting. The interface on them is one of the most dynamic that I have seen. I asked to take a quick look at the device last time I was getting a package. The face of the device was very simple but was used for many functions. The interface was based on the doubling up of buttons when performing different functions. Very much like telephone buttons with the letters and numbers. The button functions were very intuitive on the ups device and configured as needed from a general to specific input that automatically changed with the progression of the interaction. The functions I saw were scheduling, location and package data entry, they all were either chosen or ran automatically based on the last entry. The data retrieval was streamlined to take the most pertinent info for the best results first and then if that didn’t generate an answer more specific data could be added to the request. Also the physical layout was very nice in terms of the inputs, it had a lcd read write screen and then a QWERTY input board and four other scroll and search buttons that allowed you to sort and look at information in different ways. It got me thinking about how the functionality of a personal device changes with an adequate interface and cuts down on processing and programming. I think it will be a very large issue with the advent of the “all in one devices” that are becoming what our personal organizers cameras and telephones are now. Physical design is more a representation of idea than the software inside; the thing in terms of what it is to you and what it can do must inform you. A shoe can also hammer in a nail. Lines denote time linear progression with a start and end circles give you a unlimited scroll but no reference points a grouping of buttons denote their function as much as whats on the button. Are you able to be hit two at a time or can they only function individually