Uno-Bot1 A study in the minimal

I was tinkering with some parts and I said to myself... "thats enough to build a very small bot" and Uno-Bot1 was born! The heart is the Uno (Arduino) and takes more than half the bot! The rest is a clear perfboard construction area and some gear-motor-wheels recovered from a previous tiny bot. It also has a PING))) rangefinder and is in need of an h-bridge to drive the motors (or I will just run them forward using some easily pwm'd power transistors. A 9V rechargeable battery will go underneath (velcro?). Again, this is another ugly picture from my webcam, but I will put a better picture up when my friend gets to it with his digital camera. Construction: Super-Glue and double-sided foam tape! (Oops, just noticed I used my old "Duemilanove" board, but I am keeping the Uno-Bot1 name, as my Uno would be a drop-on replacement. GOOD! I feel more at ease experimenting with the older board anyway! I look forward to seeing what this little one can do. The differential drive wheels are at a fairly wide stance and it is a "tail-dragger" which is a pretty common configuration.

 


This is a companion discussion topic for the original entry at https://community.robotshop.com/robots/show/uno-bot1-a-study-in-the-minimal

Nice, I like scrapbots.I

Nice, I like scrapbots.

I just think you will get rid of your 9V very quick. They can’t deliver a lot of oomph!
Mine didn’t even have enough power to power an Arduino, 2 LED’s, one servo and an ultrasonic servo.

Better go with a couple of rechargeable  AA’s instead, bit bigger, weighs a bit more but it gives more output.

Cute and minimalist.

These are great. My local FabLab is working on some minimalist robot designs. A cheap obstacle avoidance robot like this would be great. Would you consider posting a Fritzing circuit design, a parts list, and the Arduino sketch?

Agree.

Maybe 5 volts (regulated) for the CPU and 6 Volts unregulated (same ground) for the motors would work well. Seems these little parts (specially the grearmotors) tend to take a lot of power these days.

If it were to stay in the sun all day I would considera solar cell recharger, but then rain would probably spoil the fun!

Nature has done an AMAZING job of providing humans with energy they can use and we are just now finding out how ahard it is to provide robots with simular, long lasting power…

(Cept’ for that darn Ennegizer Bunny!) LOL

Sorry. no parts list yet, but a sketch and and zipped Ftritzing.

Hope this helps.

Code revision and battery life…

 

Here is the latest revision of the robot software. It still can use some work. The actions of this tiny robot seem quite “biological” and it is a blast to watch. Keep close to it because it tends to get itself in “trouble”, a lot. It reminds me of the actions of a fly…

(I am using a 9 Volt Rechargable battery and it seems to have a quite usable life. Seems tiny bots with tiny motors take only a tiny amount of power. At least it lasts longer than I am willing to chase it! Now if I were a lot younger…)

/* tinybot_testx

 this controls a tiny bot 

 vision is limited to forward

 so the bot gets creative…

 

 (this robot behaves quite biologically and

  watching its “self-directed” motions can be

  interesting! And fun! :slight_smile:  

 

 By Will F. 7/11

 This example code is in the public domain.

 */

 

long randNumber; // Randomness - Biological!

const int pingPin = 7;

const int fast = 220;

const int medium = 185;

const int slow = 65;

const int maximum = 250;

const int minimum = 50;

long distance;

 

 

void setup() {

  // initialize serial communication:

  Serial.begin(9600);

  randomSeed(analogRead(0));

  pinMode(13, OUTPUT);

}

 

int choice()

  if (randNumber > maximum) // maybe go right

  {

    goRight();

  }

 

  if (randNumber < minimum) // maybe go left

  {

    goLeft();

  }

}

 

int go()

{

  analogWrite(5, medium);

  analogWrite(6, medium);

}

 

int stop()

{

  analogWrite(5,0);

  analogWrite(6,0);

}

 

int goRight()

{   

  analogWrite(5, medium); // Turn!

  analogWrite(6, slow); 

  delay (320);            // Give it N msec to keep turning 

}

 

int goLeft()

{

  analogWrite(5, slow); // Turn!

  analogWrite(6, medium); 

  delay (320);          // Give it N msec to keep turning 

}

 

// nice conversion to inches

long microsecondsToInches(long microseconds)

{

  // According to Parallax’s datasheet for the PING))), there are

  // 73.746 microseconds per inch (i.e. sound travels at 1130 feet per

  // second).  This gives the distance travelled by the ping, outbound

  // and return, so we divide by 2 to get the distance of the obstacle.

  // See: http://www.parallax.com/dl/docs/prod/acc/28015-PING-v1.3.pdf

  return microseconds / 74 / 2;

}

 

int Pinger() // Very sensitive object detection!

{

  // establish variables for duration of the ping, 

  // and the distance result in inches and centimeters:

  long inches, duration;

 

  // The PING))) is triggered by a HIGH pulse of 2 or more microseconds.

  // Give a short LOW pulse beforehand to ensure a clean HIGH pulse:

  pinMode(pingPin, OUTPUT);

  digitalWrite(pingPin, LOW);

  delayMicroseconds(2);

  digitalWrite(pingPin, HIGH);

  delayMicroseconds(5);

  digitalWrite(pingPin, LOW);

 

  // The same pin is used to read the signal from the PING))): a HIGH

  // pulse whose duration is the time (in microseconds) from the sending

  // of the ping to the reception of its echo off of an object.

  pinMode(pingPin, INPUT);

  duration = pulseIn(pingPin, HIGH);

 

  // convert the time into a distance

  return inches = microsecondsToInches(duration);

}

 

void loop()

{

  distance = Pinger();

  Serial.print(distance ); // debug

  Serial.print("in, ");

 

//test5: // Right Motor 

  //analogWrite (5, medium);

  //delay(100);

  //goto test5;

 

//test6: // Left Motor

  //analogWrite (6, medium);

  //delay(100);

  //goto test6;

 

  randNumber = random (300); // Lovely randomness

  Serial.print("random, "); // more debug

  Serial.print(randNumber);

  Serial.println();

 

  if (distance < 20) // too close!

  {

    digitalWrite(13, HIGH); // Blink

    stop();                 // Stop!

    delay(1000);            // Give stop a second

    digitalWrite(13, LOW);

    choice(); // Possibly chose another direction

  }

 

  if (distance < 5) // stop collision!

die:

  {

    analogWrite (5, 0); // STOP!

    analogWrite (6, 0);

    digitalWrite(13, HIGH); // Blink

    delay(1000);

    digitalWrite(13, LOW);

    delay(1000);

    goto die;

  }

 

  go(); // Move!

 

  choice(); // Duh! Which way do I go?

 

}

 

 

Do I read your code correctly?

Near the end you have a label called die. It looks like if you get too close to something you just stop and your program gets stuck/caught in an endless loop. Is that intentional?

Wow! Neural Nets

I see more and more youtube videos of Arduino based bots being controlled by Neural Networks. Turns out the 32k of space on the ATmega 328 is more than enough room for this! (Most are not even using the Arduino Mega!)

So far I haven’t seen any code for this (and I want it BADLY!) Anyone here doing anything like this at all???

BTW: So far I am enjoying working with UnoBot1 much more than I do the Phoenix. (Most of the UnoBot1 is my design, while most of the Phoenix isn’t.)

I really like my little “scrapbot”! :slight_smile:

(This little fella can be FAST too, these little blue gear-motors are MUCH faster than they look! I am grateful I have PWM to throttle them back… :slight_smile:

 

quick search for some code

Leads me to believe that you will need/should have a reasonable understanding of Neural Nets. I got a few hits, but, they really seemed to indicate that there is a learning curve and it is associated with the task.

You could check:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1194558017

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1289314501/all

http://www.ibm.com/developerworks/library/l-neural/

for some hints and direction.

Yes, that is what it is there for!

Thanks for noticing birdmun,

My bots so far don’t use an H-Bridge so reverse isn’t possible. Best I can do is “spin” and try to get out of a bad situation, but that doesn’t always work. :frowning:

So I decided rather than stalling the motors I would stop a bad situation before I did some damage.

It seems to work for me…