Meet the robot

This summer I started a fun little project, a small wall avoiding robot. When power is connected to the robot, it will scoot around until it finds an obstacle wall. If it detects an obstacle between 5 and 20 cm away, it will turn about 90 degrees to avoid collision. If an obstacle appears nearer than 5 cm the robot will roll back to have enough space to turn. It is a very simple behavior I coded in this one.

As a basis for the robot I designed a chassis for the components and wheels and 3D printed them. It has 2 wheels and uses a plastic coaster (usually used for furniture) as a third point of support.

The robot uses a HC-SR04 distance sensor to "see" obstacles, two micro servos for movement and an Arduino Leonardo as a brain. To connect the sensor and the servos I used an Arduino sensor shield. On the bottom of the Robot a battery holder is attached to hold 4 standard AA batteries. I used a 9V battery first, but it was not enough to power the two motors. 

The micro servos are modified to turn 360 degrees following the tutorial on Letsmakerobots.

For the ones interested, the Arduino sketch for my robot is this one: (Parts of the distance sensor code comes from http://arduinobasics.blogspot.com.es/2012/11/arduinobasics-hc-sr04-ultrasonic-sensor.html)
 HC-SR04 Ping distance sensor:
 VCC to Arduino 5v
 GND to Arduino GND
 Echo to Arduino pin 7
 Trig to Arduino pin 8
Servo myservoR;  // create right servo object
Servo myservoL;  // create left servo object
int posR = 90;    // variable to store the servo position
int posL = 90;
#define echoPin 7 // Echo Pin
#define trigPin 8 // Trigger Pin
int maximumRange = 200; // Maximum distance range
int minimumRange = 0; // Minimum distance range
long duration, distance; // Duration used to calculate distance
void setup() {
 pinMode(trigPin, OUTPUT);
 pinMode(echoPin, INPUT);

 myservoR.attach(5);  //attach right servo signal to pin 5
 myservoL.attach(4);  //attach left servo signal to pin 4
void loop() {
 digitalWrite(trigPin, LOW);  // trigger impulse
 digitalWrite(trigPin, HIGH);

 digitalWrite(trigPin, LOW);
 duration = pulseIn(echoPin, HIGH); // listen to the echo

 distance = duration/58.2; //Calculate the distance (in cm) based on the speed of sound.

 if (distance >= 20){
 /* Drive forward */

 if (distance < 10 && distance > 5 ){
 /* Turn around */

  if (distance <= 5){
 /* Back up */

 //Delay 50ms before next reading.


My Nacho Recipe

This is the nacho recipe I make from time to time. It might be called the unhealthiest salad of all times,
What you need (for 2-3 servings).
  • 1-2 bags of tortilla chips
  • 4 Tsp creme fraiche (or sour cream)
  • 1 avocado
  • 1 tomato
  • 1 small onion
  • 1/2 tin of black olives
  • 3-4 pickled chilies
  • 100 g grated cheese
  • iceberg salad

Lets start! Spread out some chips in a bowl, sprinkle with cheese. Do this again, so you have two chips and cheese layers. Microwave this until the cheese melts.

Finely slice a bit of iceberg salad and spread it over the chips.

Add a few tablespoons of creme fraiche.

Now mush the avocado and spread it over the cream layer. You might want to add a bit of salt or the avocado layer is to bland.

Now, slice up the tomato, black olives, chilies and onion. Spread the mix over the avocado and you are done. Eat the nachos by using the tortilla chips as edible spoons.