Adding Bumper Sensors

Today I decided to ditch the old bumper sensors since they were built into the original motherboard of the robot, and added new ones in their place.

Design is simple, a push button where the old sensor used to be. I filed down a protoboard to fit in the location, soldered a push button onto the board and attached leads to it. I carefully hot glued the boards in the location (lots of hot glue in hopes they might actually stay.

IMG_2051[1] IMG_2053[1] IMG_2054[1] IMG_2055[1] IMG_2056[1]

To test if the sensors were working I wrote up a quick sketch to check. It just serial rights left or right depending on which button is pushed.

IMG_2058[1]

Code below:

int rightSensor = 2;
int leftSensor = 3;

void setup() {
Serial.begin(9600);
pinMode(rightSensor, INPUT);
pinMode(leftSensor, INPUT);
}

void loop() {
if(digitalRead(rightSensor)){
Serial.println(“right”);
}
if(digitalRead(leftSensor)){
Serial.println(“left”);
}

delay(1);
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s