Klein Bot

Kleins, robots, electricity

Blog

Try saying 'Klein Bot Blog' three times quickly

view:  full / summary

Larson (Cylon) Scanner version 2

Posted by Klein on March 3, 2013 at 10:05 PM Comments comments (0)

I've updated the code to be more configurable (to any arbitrary animation) and handle variable brightness better. There's still something wrong with the "timeBetween" control of scanner speed, but it works ok now.


const int NUMFRAMES = 22;

const int NUMPINS = 12;

 

unsigned long timeBetween = 80; // milliseconds between frames

unsigned long microsStart = 0;

unsigned long timeSinceStart = 0;

int activePin = 0;

int activeFrame = 0;

 

int frameVals[NUMFRAMES][NUMPINS] =

  {

    {  0,  0,100,200,500,999,  0,  0,  0,  0,  0,  0 },

    {  0,  0,  0,100,200,500,999,  0,  0,  0,  0,  0 },

    {  0,  0,  0,  0,100,200,500,999,  0,  0,  0,  0 },

    {  0,  0,  0,  0,  0,100,200,500,999,  0,  0,  0 },

    {  0,  0,  0,  0,  0,  0,100,200,500,999,  0,  0 },

    {  0,  0,  0,  0,  0,  0,  0,100,200,500,999,  0 },

    {  0,  0,  0,  0,  0,  0,  0,  0,100,200,500,999 },

    {  0,  0,  0,  0,  0,  0,  0,  0,  0,100,999,500 },

    {  0,  0,  0,  0,  0,  0,  0,  0,  0,999,500,200 },

    {  0,  0,  0,  0,  0,  0,  0,  0,999,500,200,100 },

    {  0,  0,  0,  0,  0,  0,  0,999,500,200,100,  0 },

    {  0,  0,  0,  0,  0,  0,999,500,200,100,  0,  0 },

    {  0,  0,  0,  0,  0,999,500,200,100,  0,  0,  0 },

    {  0,  0,  0,  0,999,500,200,100,  0,  0,  0,  0 },

    {  0,  0,  0,999,500,200,100,  0,  0,  0,  0,  0 },

    {  0,  0,999,500,200,100,  0,  0,  0,  0,  0,  0 },

    {  0,999,500,200,100,  0,  0,  0,  0,  0,  0,  0 },

    {999,500,200,100,  0,  0,  0,  0,  0,  0,  0,  0 },

    {500,999,100,  0,  0,  0,  0,  0,  0,  0,  0,  0 },

    {200,500,999,  0,  0,  0,  0,  0,  0,  0,  0,  0 },

    {100,200,500,999,  0,  0,  0,  0,  0,  0,  0,  0 },

    {  0,100,200,500,999,  0,  0,  0,  0,  0,  0,  0 }

  };

 

void setup() {

  // put your setup code here, to run once:

  for (int i=0; i<NUMPINS; i++) {

    pinMode(i, OUTPUT);

  }

  //Serial.begin(9600);

}

 

void loop() {

  // each loop

  for (int i=0; i<NUMPINS; i++) { digitalWrite(i, LOW); }

  activeFrame = int((millis()/timeBetween)) % NUMFRAMES;

 

  // spend 1000 microseconds turning pin i on/off

  microsStart = micros();

  timeSinceStart = 0;

  while ( timeSinceStart < 1000 ) {

    for (int i=0; i<NUMPINS; i++) {

      if ( frameVals[activeFrame][i] > timeSinceStart ) {

        digitalWrite(i,HIGH);

      } else { digitalWrite(i,LOW); }

    }

    timeSinceStart = micros()-microsStart;

  }

 

}

 

 


Larson (Cylon) Scanner

Posted by Klein on March 2, 2013 at 4:40 PM Comments comments (0)

Here is the first working code that the kids produced for the Larson, a.k.a. Cylon, scanner for their FIRST competition robot.


int timeBetween = 100;

int millisCounter = 0;

int delayTime = 0;

int activePin = 0;

 

void setup() {

  // put your setup code here, to run once:

  pinMode(0, OUTPUT);

  pinMode(1, OUTPUT);

  pinMode(2, OUTPUT);

  pinMode(3, OUTPUT);

  pinMode(4, OUTPUT);

  pinMode(5, OUTPUT);

  pinMode(6, OUTPUT);

  pinMode(7, OUTPUT);

  pinMode(8, OUTPUT);

  pinMode(9, OUTPUT);

  pinMode(10, OUTPUT);

  pinMode(11, OUTPUT);

  pinMode(12, OUTPUT);

 

}

 

void loop() {

  // put your main code here, to run repeatedly:

  millisCounter = millis();

//  delayTime = (millisCounter / timeBetween);

 

//  activePin = (millisCounter / 100)% 22;

//  if (activePin >= 11) {

//    activePin = activePin - 11;

    

//  }

 

  switch (activePin) {

    case 0:

      pinOn(0, 400);

      pinOn(11, 300);

      break;

    case 1:

      pinOn(1, 500);

      pinOn(0, 400);

      break;

    case 2:

      pinOn(2, 600);

      pinOn(1, 500);

      break;

    case 3:

      pinOn(3, 700);

      pinOn(2, 600);

      break;

    case 4:

      pinOn(4, 800);

      pinOn(3, 700);

      break;

    case 5:

      pinOn(5, 900);

      pinOn(4, 800);

      break;

    case 6:

      pinOn(6, 900);

      pinOn(5, 800);

      break;

    case 7:

      pinOn(7, 800);

      pinOn(6, 700);

      break;

    case 8:

      pinOn(8, 700);

      pinOn(7, 600);

      break;

    case 9:

      pinOn(9, 600);

      pinOn(8, 500);

      break;

    case 10:

      pinOn(10, 500);

      pinOn(9, 400);

      break;

    case 11:

      pinOn(11, 400);

      pinOn(10, 300);

      break;

    case 12:

      pinOn(10, 500);

      pinOn(11, 400);

      break;

    case 13:

      pinOn(9, 600);

      pinOn(10, 500);

      break;

    case 14:

      pinOn(8, 700);

      pinOn(9, 600);

      break;

    case 15:

      pinOn(7, 800);

      pinOn(8, 700);

      break;

    case 16:

      pinOn(6, 900);

      pinOn(7, 800);

      break;

    case 17:

      pinOn(5, 900);

      pinOn(6, 800);

      break;

    case 18:

      pinOn(4, 800);

      pinOn(5, 700);

      break;

    case 19:

      pinOn(3, 700);

      pinOn(4, 600);

      break;

    case 20:

      pinOn(2, 600);

      pinOn(3, 500);

      break;

    case 21:

      pinOn(1, 500);

      pinOn(2, 400);

      break;

    

  }

 

  activePin += 1;

 

  if (activePin == 22) {

    activePin = 0;

  }

 

//  delay(50);

 

}

 

void pinOn(int pin, int pwr) {

  digitalWrite(pin, HIGH);

  delay(pwr/10);

  digitalWrite(pin, LOW);

  delayMicroseconds(1000-pwr);

 

 

}


Robot Rally Mission Aborted

Posted by Klein on November 2, 2012 at 8:35 PM Comments comments (0)

Octowobble is *not* going to Atlanta tomorrow. I couldn't get anyone (including Ben) to come with me, and I was looking at two all nighters to get ready. In addition, we're visiting family on Sunday, and I wasn't looking forward to even more driving this weekend.

I'll keep working on the robot over the next year, and next fall, hopefully, it won't be such a mad rush to get ready. (yeah right).

Until next year -- sleep tight, Octowobble.

Registered

Posted by Klein on October 28, 2012 at 9:00 AM Comments comments (0)

Octowobble is (finally) registered for the Robot Rally. At this point it looks like only 5 others are registered.


Form Name: Robot Rally Registration

Date of Submission: Sun, 28 Oct 2012 07:01:35 -0600

URL : http://kleinbot.webs.com

Site Name : Kleinbot

Robot's Name : Octowobble

Contest: Polyathlon: Simple Line Follower,Advanced Line Follower,Beacon Killer,Beacon Killer with Obstacles,Dead Reckoning,Bulldozer

Processor Type : Arduino Mega / AVR

Navigation: IR Bumpers,Beacon

Other Nav Systems: Polarized light beacon, IR line sensor

Robot Info: This is my third year entering Octowobble. First year, I placed 2nd; last year, I placed dead last (and only because I put the robot on the course). This year I'm aiming for somewhere between the extremes.


Battery testing

Posted by Klein on October 22, 2012 at 10:35 PM Comments comments (0)

(6 Oct 2012)

After my AA NiMH batteries overheated in my home-made charger, I thought to test them. I had 13 good batteries out of my pack of 16.

The test rig is shown in the photos. The rig is a spring for the load (~1.2 ohm), a travel clock (PowerPuff girls!) for the timer, and a voltmeter to monitor progress. This puts about an amp load on the battery (the spring gets hot). The clock stops at about 0.8 volt, and I stood by to remove the battery after the clock stopped. Good batteries ran about 2 hours, spot-on for their rating of 2000 mA-hr. Bad batteries drained in 5 to 15 minutes.

Photos uploaded

Posted by Klein on October 9, 2012 at 12:25 AM Comments comments (0)

Over the next couple of weeks I'm going to upload some old pictures that I've taken, but not taken time to share. Rather than writing a lot of detail up front, let me know if you have questions, and I'll write up information as requested.


Enjoy!

Kleinbot

It's been how long?

Posted by Klein on July 19, 2012 at 12:40 AM Comments comments (1)

Apologies for neglecting to post a follow-up to the 2011 contest results, but I've been hiding in shame. I put Octowobble on the line following course and so got a minimum score for showing up. The behavior was so erratic that I didn't try any more contests - I just posted an "Out of Order" sign on the bot and tried to enjoy the day.

 

Scores and pictures are available on the botlanta site.

Robot Rally Registration

Posted by Klein on October 18, 2011 at 11:40 AM Comments comments (0)

Registered for the 2011 Robot Rally today! Start the countdown clock ... 24 days.


Robot Rally Registration

Date of Submission: Tue, 18 Oct 2011 09:37:23 -0600

Name : Tim Klein

URL : http://kleinbot.webs.com

Site Name : KleinBot

Robot's Name : Octowobble

Polyathlon: Simple Line Follower,Advanced Line Follower,Beacon Killer,Beacon Killer with Obstacles,Dead Reckoning,Bulldozer

Processor Type : AVR(Arduino)

Navigation: IR Bumpers,Beacon,Other

Other Nav Systems: Pololu reflectance line sensor, wheel encoders

Robot Info: Octowobble finished in second place at last year's Rally. Tim and Ben (father and son) have been working on the improvement list, and hope to have a more consistent performance this year. The robot is named "Octowobble" because it's octagonal body shape. The 'wobble' was added because it sounds good. Much of the robot is made from salvaged materials -- Roomba wheels and edge sensors, a surplus aluminum sign, erector set, and a couple of plastic Easter eggs.


Back to school, back to work

Posted by Klein on October 17, 2011 at 11:20 PM Comments comments (0)

Well, we didn't get much done before the school year started in early August, so progress ground to a halt while Ben worked on (non-robotic) school work. However, this past weekend was between academic quarters and part of Fall Break, so Ben got lots of time with Minecraft and I got him to help a little with Octowobble.


The result - we worked out a motor driver bug and finished up the edge sensors.


Driver bug - The motor drivers (LMD18200) weren't consistently driving the motors. They would whine and the wheels would only turn if pushed. Once started they ran well with good speed and power. I reviewed the data sheet and noticed that the example schematics used large caps on the supply lines. A small note in the docs suggested 100 uF per amp of running current. Adding a 330 uF did the trick (overkill, but that's what I had on hand).


Reluctant to disassemble the drivers that I had already built, and inspired by Dale's implementation (Polymax Improvements 2009), I used the extra LMD18200s that I ordered last year and built new freeform driver assemblies, attached directly to the body. Putting the drivers next to the motors reduces line loss, and the large body mass makes for a great heat sink. (I'll post pictures of this soon. It'll make more sense then.)


Finally, we copied the single working edge sensor and glued those in under the shell. I've yet to use them in working code *on* the robot, but off-robot testing and voltmeter readings suggest they will work ok.

Edges and Wheel Tics

Posted by Klein on July 23, 2011 at 11:47 PM Comments comments (0)

We've been spending a few hours here and there in July without much progress. Some things are getting done, however. Circuits for the motor encoder and edge sensors are coming along. Software is mostly working. The two have to evolve together.

I've posted more pictures in the 2011 Robot Rally album.


Rss_feed