Skip to content

Testing My Robot’s Eyes

December 6, 2011

I’m working on building my first robot, but I’m still trying to decide all of its functions. What I do know is this:
1) It will be pretty primitive.
2) It will have wheels or treads instead of feet.
3) I’m going to try to make it look cute

So I’m testing out its eyes right now. They look like eyes, but technically it’s a ear and a mouth. My robot will use echolocation (like bats) to be aware of its surroundings and avoid obstacles.

One side transmits a high frequency wave and the other waits for it to return. The timing allows us to determine the distance from a solid object.

This module was so cheap on ebay, I was a bit skeptical as to how well it would work. It works great. It’s surprisingly accurate. I tested it with this short snippet of code:


#include <Ultrasonic.h>

Ultrasonic ultrasonic( 12, 13 );

void setup()
{
  Serial.begin( 9600 );
}

void loop()
{
  Serial.print( ultrasonic.Ranging(INC) );
  Serial.println( " in" );
    
  delay(1000);
}

Automatic Toilet Flusher?

If I wanted to, I could add something like this in the code:


distance = ultrasonic.Ranging(INC);
if(distance<DISTANCE_TO_WALL){
    counter++;
}
else{
    if(counter>20000){
        flush_toilet();
    }
    counter=0;
}

… and hook up a servo to the arduino and it would be an automatic toilet flusher that flushes the toilet after you step away from the toilet. The commercial sensors you see on toilets nowadays use IR sensors rather than ultrasonic sensors like this one… but this ultrasonic sensor, using my code, would eliminate the annoying random premature flushes (while placing your toilet seat cover on the toilet seat, or while you’re sitting on your toilet). But to be honest, I don’t want my robot’s eyes to sit atop a toilet all day. No. I wouldn’t do that to him/her.

From → Hacks

One Comment
  1. this thing is high powered

Leave a comment