Monday, February 29, 2016

Printed Circuit Boards

Monday, Feb. 29th, 2016

I had lots of work today so it was hard to work on the robot.  I did, however, start to design a circuit board for the head unit to connect all these sensor outputs to in order to interface with the Arduino board and also the original connectors on the sensors.

Here is what I have so far:



The large connector at the top is the 25 pin male connector for the header that has the LED's and the keypad wiring in it.  The J2 and J3 are to get the keypad wires to the Arduino.  J4 is a header to connect the LED's to the Arduino and J5 and J6 are for the Light Detector and the Motion Detector.

I will have a few more connections on this board before I can make it.  The Sonar that was originally in the Hero robot is a Polaroid 6500 series model that is not made anymore and to use it for long range I need an interface board and a few IC's.  I will have to work that circuit out from the original one and see what I can come up with.

Also, I want to add a sound sensor and a newer sonar sensor into the robot without compromising the original looks too much so I will add the connections for those to this board.  I ordered a sound sensor and I have in my parts box a few SR04 ultrasonic sensors that I can work with for the lower part of the robot to have some sensors for not bumping into anything lower than the head.
I might actually go with a few of those ultrasonic sensors so that I have a 'surround' method of detecting which objects are closest or furthest from the robot for the purposes of navigation.

I have also seen temperature and humidity sensors and a new kind of passive infrared sensor that I will also most likely mount on the robot.

That will take up most of the sensors, and then I will move on to the arms...which should prove quite challenging, since the original Hero Jr. robot did not have any arms and the one for the Hero One robot was not very articulate.  My idea is to have arms with an elbow and a wrist joint and small grippers on the end.  But more on that later.

That is all for tonight...there will be more when I receive a few parts in the mail.


Sunday, February 28, 2016

Using the Light Sensor

Sunday, Feb. 28th, 2016

It is Sunday morning, and I could not sleep so I popped out of bed, made some coffee, and started thinking about mounting the head of the robot.  Then I realized that I completely forgot a couple of sensors.  One is the light sensor mounted on the front.



Here you can see the little light sensor opening just below the sonar sensor (more on that one later).

So, the light sensor is really a photocell, or light detecting type of resistor.  It should be simple to hook up as there are only 2 wires.  The easiest way to deal with this type of sensor is to connect one end to 5V and the other to Analog 0 and a resistor then to ground.

  Here is a layout of an Arduino board with the LDR connected to A0, ground, and 5V.  By the way the tool I used for this diagram is called Fritzing and you can download it from the web (http://fritzing.org/home/) and use it to make wiring diagrams, and eventually to make circuit boards from.  Making a schematic diagram is also in Fritzing and so I made one up like the one below.

  So, armed with the diagram, I hooked up my board and created a little code to read the values from A0 and try to detect light.  The results were good, and so now the Light Detector is available.  I will connect it to the same board as the keypad, LED's, Motion Sensor, etc.  This will be a sensor board connected on top of the Arduino Mega as a shield.  But more on that later.

Here is the LDR connected to my Mega.

  And with a little bit of code, I can detect either light or dark.  I used ambient light for the standard (dark) and then shone a flashlight into the sensor for light.



Having used a smaller resistor in the circuit, ambient light is 0 and bright light goes up to about 127 on the values.  This is a pretty standard scale that we can use and it can be varied by changing the resistor in the circuit to use different values.

Here is the test code for the LDR in the circuit above:
/* Hero Jr. Light Sensor
   This is a simple light sensor test
   of the LDR mounted on the front of
   the robot.
   GSS 2/28/2016
*/

int LDR = 0;                  //analog pin to which LDR is connected, here we set it to 0 so it means A0
int LDRValue = 0;             //that’s a variable to store LDR values
int light_sensitivity = 10;   //This is the approx value of light surrounding your LDR

void setup()
  {
    Serial.begin(9600);      //start the serial monitor with 9600 buad
    pinMode(13, OUTPUT);     //we mostly use 13 because there is already a built in yellow LED in arduino which shows output when 13 pin is enabled
  }

void loop()
  {
    LDRValue = analogRead(LDR);     //reads the ldr’s value through LDR 
     delay(50);                      //This is the speed by which LDR sends value to arduino

    if (LDRValue > light_sensitivity) 
      {
        //It saw light, so do something.
        Serial.println("Bright Light! Bright Light!");
        Serial.println(LDRValue);
        digitalWrite(13, HIGH);
      }
    else
      {
        //It is dark, do something else.
        Serial.println("Sure is dark in here...");
        Serial.println(LDRValue);
        digitalWrite(13, LOW);
      }
  }

Saturday, February 27, 2016

Back to work! L.E.D. Testing and Motion Sensor

Saturday, Feb. 27th, 2016

I was out of town for a few days working at a customer's location.  This gave me some time to think about the issues of the robot steering and also how to make the L.E.D. panel by the buttons work.

So, today being Saturday, and me not really having anything pressing to work on, I started on the LED testing.  I also found that the Motion Sensor was mounted up there and so I took that out and tested it too.

The panel where the keypad is also contains a row of 8 red LED's and one green LED.  The green one is for power on, so that one will be fairly easy to work with.  The other 8 however will have to be tied to different functions and used when necessary.  They have to be in a matrix like the keypad (kind of) and so I got started with a test routine to see if I could make them work.



After some testing with the meter, I determined that they were all on one ground line and I separated the signal lines for each of them so that I could put them into an array of sorts in the code.  To make an LED work, you have to tie one end to a pullup resistor to make sure it has only the voltage necessary to work and not so much that you will burn it out, but it is a diode so you have to put them in the right order.

I made a series of connections on a small breadboard to make sure the ideas would all work out.  If they do, then I can solder all the connections to a small circuit board and place it inside the robot's head.

   I was able to connect everything on this little breadboard with 8 1k Ohm resistors to test up the lights.  In the picture you can see the 1st red light is on.  That was encouraging so I wrote some more code and got all of them to work.  You can see that in the video below.


How about that cyclon pattern with the LED's?!

So, having the LED's working, I decided to test the motion sensor.  This sensor came with the Hero Jr. robot and was made somewhere between 1982-1984.  I mention that to say that it might not be up to the standards of the current technology and I will probably mount other sensors on the robot later after the original work properly.

 This is a pretty good shot of the Colorado Electro-Optics OSM motion sensor.

The good thing about the sensor is that there are really only 3 connections.  Power, ground, and the signal line.  In this case I used a digital signal line since there was one provided.  There seems to be a connection for an analog sensor as well, and I might try testing that at some point to see if I can gauge distance with it, but there are much more efficient sonar ranging sensors now that I think sticking with the digital on/off one was easier to replicate the original functionality.  I checked the circuit board and wiring on the original and that is what it used.

I connected the 3 wires and then created a little code to see if I could get it to detect motion when I passed my hand over it or just moved about.


You can see from the shot on the right above that on the computer, it detected motion!

So, today being pretty successful, I will post the code for the two projects here that I used to test with and then go see about designing a circuit board for the LED's possibly for tomorrow's project.  Once those are done, I might be able to mount the control Arduino in the head and mount the head back on the robot!

Code for the LED Testing:
/* This is a test for the LED's on the front panel of the Hero Jr. Robot.
   The pins will all be connected from the main board where they are mounted
   to a small perfboard with some 1k Ohm resistors and then routed to the
   Arduino on pins 22-36 (even).
   GSS 2/27/2016
*/


int led0 = 22;
int led1 = 24;
int led2 = 26;
int led3 = 28;
int led4 = 30;
int led5 = 32;
int led6 = 34;
int led7 = 36;
int state0 = 1;
int state1 = 1;
int state2 = 1;
int state3 = 1;
int state4 = 1;
int state5 = 1;
int state6 = 1;
int state7 = 1;
int state;


void setup() {
  // put your setup code here, to run once:
Serial.begin(9600);
   pinMode(led0, OUTPUT);
   pinMode(led1, OUTPUT);
   pinMode(led2, OUTPUT);
   pinMode(led3, OUTPUT);
   pinMode(led4, OUTPUT);
   pinMode(led5, OUTPUT);
   pinMode(led6, OUTPUT);
   pinMode(led7, OUTPUT);


}

void loop() {
  // put your main code here, to run repeatedly:
  Serial.println("LED Test...");
  testLEDs();
  delay(4000);
  Serial.println("Cylon LED testing...");
  cylon(6);
}

void led(int number1) {

switch (number1) {
  case 0:
  state0 = !state0;
    digitalWrite(led0, state0);
    break;
  case 1:
  state1 = !state1;
    digitalWrite(led1, state1);
    break;
  case 2:
  state2 = !state2;
    digitalWrite(led2, state2);
    break;
  case 3:
  state3 = !state3;
    digitalWrite(led3, state3);
    break;
  case 4:
  state4 = !state4;
    digitalWrite(led4, state4);
    break;
  case 5:
  state5 = !state5;
    digitalWrite(led5, state5);
    break;
  case 6:
  state6 = !state6;
    digitalWrite(led6, state6);
    break;
  case 7:
  state7 = !state7;
    digitalWrite(led7, state7);
    break;
  }
}

void cylon(int times) {
   digitalWrite(led0, 1);
   digitalWrite(led1, 1);
   digitalWrite(led2, 1);
   digitalWrite(led3, 1);
   digitalWrite(led4, 1);
   digitalWrite(led5, 1);
   digitalWrite(led6, 1);
   digitalWrite(led7, 1);
   for (int i = 1; i < times; i++){
     digitalWrite(led0, 0);
    delay(100);
    digitalWrite(led0, 1);
    digitalWrite(led1, 0);
    delay(100);
    digitalWrite(led1, 1);
    digitalWrite(led2, 0);
    delay(100);
    digitalWrite(led2, 1);
    digitalWrite(led3, 0);
    delay(100);
    digitalWrite(led3, 1);
    digitalWrite(led4, 0);
    delay(100);
    digitalWrite(led4, 1);
    digitalWrite(led5, 0);
    delay(100);
    digitalWrite(led5, 1);
    digitalWrite(led6, 0);
    delay(100);
    digitalWrite(led6, 1);
    digitalWrite(led7, 0);
    delay(100);
    digitalWrite(led7, 1);
    digitalWrite(led6, 0);
    delay(100);
    digitalWrite(led6, 1);
    digitalWrite(led5, 0);
    delay(100);
    digitalWrite(led5, 1);
    digitalWrite(led4, 0);
    delay(100);
    digitalWrite(led4, 1);
    digitalWrite(led3, 0);
    delay(100);
    digitalWrite(led3, 1);
    digitalWrite(led2, 0);
    delay(100);
    digitalWrite(led2, 1);
    digitalWrite(led1, 0);
    delay(100);
    digitalWrite(led1, 1);
    
   }
   digitalWrite(led0, state0);
   digitalWrite(led1, state1);
   digitalWrite(led2, state2);
   digitalWrite(led3, state3);
   digitalWrite(led4, state4);
   digitalWrite(led5, state5);
   digitalWrite(led6, state6);
   digitalWrite(led7, state7);
   //Serial.println(">");
}

void testLEDs () {
  Serial.println("Test L E Ds");
   digitalWrite(led0, state0);
   digitalWrite(led1, state1);
   digitalWrite(led2, state2);
   digitalWrite(led3, state3);
   digitalWrite(led4, state4);
   digitalWrite(led5, state5);
   digitalWrite(led6, state6);
   digitalWrite(led7, state7);
// #1
  digitalWrite(led0, 1);
  delay(1000);
  digitalWrite(led0, 0);
  delay(1000);
  digitalWrite(led0, state0);
// #2
  digitalWrite(led1, 1);
  delay(1000);
  digitalWrite(led1, 0);
  delay(1000);
  digitalWrite(led1, state0);
// #3
  digitalWrite(led2, 1);
  delay(1000);
  digitalWrite(led2, 0);
  delay(1000);
  digitalWrite(led2, state0);
// #4
  digitalWrite(led3, 1);
  delay(1000);
  digitalWrite(led3, 0);
  delay(1000);
  digitalWrite(led3, state0);
// #5
  digitalWrite(led4, 1);
  delay(1000);
  digitalWrite(led4, 0);
  delay(1000);
  digitalWrite(led4, state0);
// #6 
  digitalWrite(led5, 1);
  delay(1000);
  digitalWrite(led5, 0);
  delay(1000);
  digitalWrite(led5, state0);
// #7
  digitalWrite(led6, 1);
  delay(1000);
  digitalWrite(led6, 0);
  delay(1000);
  digitalWrite(led6, state0);
// #8
  digitalWrite(led7, 1);
  delay(1000);
  digitalWrite(led7, 0);
  delay(1000);
  digitalWrite(led7, state0);

}

Code for the Motion Sensor Testing:
/*
  Digital Read Testing
 Reads a digital input on pin 3, prints the result to the serial monitor
 This example code is in the public domain.
 GSS 2/27/2016
*/

int ledPin = 13;

// the setup routine runs once when you press reset:
void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);  
  // make sure the LED is not on by default.
  digitalWrite(ledPin, LOW);
}

// the loop routine runs over and over again forever:
void loop() {
   // if the digital value is high, turn on the LED and notify the serial monitor:
   // the value will be high if motion is detected...
   if (digitalRead(3) == HIGH) {
     digitalWrite(ledPin, HIGH);    // turn on the yellow LED
     Serial.println("I detect motion...");
    }
   else {
     // if no motion is detected...
     digitalWrite(ledPin, LOW);     // turn off the yellow LED
     Serial.println("...");
   }

  delay(1);        // delay in between reads for stability

}

Monday, February 22, 2016

Figured out the Keypad

Monday Feb. 22nd, 2016

I did not have a lot of time to work on the robot today, but I did figure out how to make the keypad work.
On the 'head' of the robot is a keypad and several LED's.



On the back of the head I found a board with all the connections on it tied to the keypad and the LED's.



There is some wiring on the back that runs to the microphone and the sonar sensor, but I will decipher those another day.  I pulled out the keypad board and set about testing with a meter to see what I could figure out about this board.



I was able to figure out that the keypad was a pretty simple grid of 4 rows and 4 columns tied together from little disc's on the back of each key on the rubber keypad cover.  When you press a button, then the little disc makes contact with the row and column of the key pressed and you get a closed contact.
I wired the rows and columns together on an Arduino board using pins 4,5,6,7 for the rows and 8,9,10,11 for the columns, using 8 pins for the keypad in total.



After making the connections, I fired up Visual Studio and created a quick program to test the keypad output based on the examples in the keypad library for Arduino.



The output worked perfectly!  I was able to trap the keypad presses the first time through.
The code to run a keypad is not very complicated, you set the row and column pins and build a small array of the keys and then create a keypad object that traps the keypress.  In the end of the program, I used a switch statement to see if certain keys were pressed and then light the LED on the Arduino. The code I used is shown below.

/*  Keypadtest for Hero Jr. Robot
 *
 *  Demonstrates the simplest use of the  keypad library.
 *
 *  The first step is to connect your keypad to the
 *  Arduino  using the pin numbers listed below in
 *  rowPins[] and colPins[]. If you want to use different
 *  pins then  you  can  change  the  numbers below to
 *  match your setup.
 *
 */
#include <Keypad.h>

const byte ROWS = 4; // Four rows
const byte COLS = 4; // four columns
// Define the Keymap

char keys[ROWS][COLS] = {
  {'C','D','E','F'},
  {'8','9','A','B'},
  {'4','5','6','7'},
  {'0','1','2','3'}
};

// Connect keypad ROW0, ROW1, ROW2 and ROW3 to these Arduino pins.
byte rowPins[ROWS] = { 4, 5, 6, 7 };
// Connect keypad COL0, COL1 and COL2 to these Arduino pins.
byte colPins[COLS] = { 8, 9, 10, 11 };

// Create the Keypad
Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

#define ledpin 13

void setup()
{
  pinMode(ledpin,OUTPUT);
  digitalWrite(ledpin, LOW);
  Serial.begin(9600);
}

void loop()
{
  char key = kpd.getKey();
  if(key)  // Check for a valid key.
  {
    switch (key)
    {
      case '2':
        digitalWrite(ledpin, HIGH);
        break;
      case 'C':
        digitalWrite(ledpin, LOW);
        break;
      default:
        Serial.println("You Pressed Key: " );
        Serial.println(key);
    }
  }
}



Sunday, February 21, 2016

Motor Controller Mounted.

Sunday Feb. 21st, 2016

Today I mounted the Arduino that will be controlling the 2 motors and the motor shield.  I mounted it to the inside of the front support wall so that I could have access to the ports for power and USB connections for programming when needed.



With the controller mounted, I ran the motor wires through a few wire ties and connected them up to the board for testing on the robot.



Once the final testing has been done and the motor controller programmed, I can shorten the wires a little and enclose them in protective casing and keep them tied out of the way.  I anticipate mounting another board on this back plate and then most likely the batteries for the micro-controllers in this location as well, but there will have to be some testing on that idea as I get closer.



Once the board was mounted I connected a power supply up to the board (you can see the red/black wires running to the board power on the bottom of the board in the picture above) and then plugged in a USB cable to the board and ran some tests.  The motors work just fine as the test motors did and the steering motor turns freely.
Then it hit me!  The steering motor is a stepper motor, so it will turn just fine, but without some kind of switch to tell it when it has reached either the center, or the left/right extremes, how will it ever know how to get back or where it is starting from once the power is switched off and then back on? If you turn off the power to the stepper and leave it partly turned, then turn the power back on again, it will never know where it is starting from.

<sigh> Another issue I did not think of at the moment.  I am kind of used to servo motors that know where they are and so you can tell them to turn right 90 or left 90 and then back to the center or 0 position and they will remember their location.

I will have to think up some way of mounting switches on this to make sure I know where it is positioned.

While that is happening, I am going to test the keypad and lights to see how I can control them.  If you do not remember what those look like...here is a shot of the head again...



That keypad and those lights to the right of it need to be programmable for functions the robot has so I am off to think up how to make a key matrix and program that from the master micro-controller that will be inside this robot.


Saturday, February 20, 2016

Motor Testing Successful!

Feb. 20th, 2016

Today allowed me a little time to set up the two motors on a board and do a little testing with an old power supply I made some years ago.
The main goal was to see if this motor control board would handle the two motors together without killing the board or the Arduino.

The board I am using here is the Adafruit Motor Stepper Servo Shield V2
( https://www.adafruit.com/products/1438 )
This board will allow you to hook up 2 stepper motors, or up to 4 DC motors up to 1.2A per channel and 3A peak current.  Since I did not know the current these motors are rated at, I was going to have to test and see if all would work.

First I hooked up the steering motor because it was the stepper motor and would be more complicated.  I wanted to get that working, knowing the wheel motor would be much simpler.
The stepper in this case is a 6 wire unipolar stepper.  The two coils each have a center tap which I connected together and connected to the ground on the board.  Each of the wires for the two other poles I connected to the Motor3 and Motor4 + and - connections.



I next connected the red and black wires from my homemade power supply up to the board to the Positive and Negative motor supply (see picture above).

Then I was able to go into the Arduino software and make a quick sketch to see if the motor would work...and success!  I had a rotating stepper motor!

I ran that stepper for a while to see if anything got hot and after several minutes all the components and the motor were still cool so I decided to take the next step and connect the DC wheel motor to see if both motors would work without issues.



I connected the DC Motor with the gearbox attached to it on to the board on the Motor1 connection and then went back into the software to make a test of that motor alone first to make sure it would work and not get anything too hot.

I made a quick sketch in the Arduino software and this motor worked well also!

So, it was time to take the plunge and made some code that would run both at the same time.

I could have stayed in the Arduino IDE, but since I am used to Visual Studio, I fired it up and made a program to test both motors simultaneously.  Now, on the robot, both motors would really only turn on at the same time when the robot was turning either right or left.   When going straight the steer wheel is really just released so that it does not draw any current.

After a little work on the program, I had a quick test  that ran the wheel motor forward, then moved both motors to turn right, then ran the wheel motor backward, then both motors together in a left turn.

That program was totally successful so now I have a good test program to start with when the board is mounted up on the robot and connected to the motors for some rolling tests.

I will include the program here for anyone to look at who might be curious.

/* Greg Spahn Feb. 20th 2016
 *  The eventual goal will be to make a motor library that
 *  has the functions of:
 *  Forward
 *  Left
 *  Right
 *  Backward
 *  Stop
 *  
 *  For now the testing will be for each function to see if they will work with
 *  this motor board and both motors connected to one micro controller powered
 *  by the one 12v battery.
 *  
 */

#include <Wire.h>
#include <Adafruit_MotorShield.h>
//#include "utility/Adafruit_MS_PWMServoDriver.h"

// Create the motor shield object with the default I2C address
Adafruit_MotorShield AFMS = Adafruit_MotorShield(); 

// WHEEL MOTOR
// DC Wheel Motor connected to M1 on motor board.
Adafruit_DCMotor *wheelMotor = AFMS.getMotor(1);

// STEER MOTOR
// Steer Motor is a stepper motor with 48 steps per revolution (7.6 degree)
// to motor port #2
Adafruit_StepperMotor *steerMotor = AFMS.getStepper(48, 2);


void setup() {
  // Set up serial port at 9600 bps
  Serial.begin(115200);
  Serial.println("Motorshield v2 - Motor test");

  AFMS.begin();        // create with the default frequency 1.6KHz

  
  // Set the speed to start, from 0 (off) to 255 (max speed)
  wheelMotor->setSpeed(200);
  wheelMotor->run(FORWARD);
  wheelMotor->run(RELEASE);
  // Set the speed of the steering motor (stepper).
  steerMotor->setSpeed(10);  // 10 rpm 

}

void loop() {
  uint8_t i;
  uint8_t j;

  // j is going to be the stepper speed.
  j=1;

// Move Forward 
  Serial.print("\nFORWARD...");
  wheelMotor->run(FORWARD);
  for (i=50; i<200; i++) {
    wheelMotor->setSpeed(i);  
    delay(10);
  }

delay(5000);

// Move Right
 Serial.print("\nTURN RIGHT...");
 wheelMotor->run(FORWARD);
 for (i=50; i<200; i++) {
  wheelMotor->setSpeed(i);
  steerMotor->step(j, FORWARD, DOUBLE);
  delay(5);
 }

delay(1000);

// Move Backward
  Serial.print("\nBACKWARD...");
  wheelMotor->run(BACKWARD);
  for (i=50; i<200; i++) {
    wheelMotor->setSpeed(i);  
    delay(10);
  }

delay(5000);

// Move Left
 Serial.print("\nTURN LEFT...");
 wheelMotor->run(BACKWARD);
 for (i=50; i<200; i++) {
  wheelMotor->setSpeed(i);
  steerMotor->step(j, BACKWARD, DOUBLE);
  delay(5);
 }

delay(1000);

// Stop
  Serial.print("\nRELEASE MOTOR...");
   wheelMotor->run(RELEASE);
  delay(2000);
}

Thursday, February 18, 2016

Working on Stepper Motor Controller

Thursday Feb. 18th, 2016

Long day of work today.  Not too much time to tinker.
I did manage to take the motor controller kit down to the robot shop and solder up the board so that I can test a little this weekend to see how it works.

The board is made by Adafruit, Ind. and they usually have pretty high quality items for my projects so I order from them when I can.  This board will handle 2 steppers as long as they are 1.5 amps per phase or lower.  I do not have the specs on the motor in the Hero Jr. so I am going to test it and see if I get a good result or not.  I know it was powered by a 12 Volt battery and so I will have to have a 12 Volt and 6 Volt system in the robot to keep everything working properly.  Good thing there is plenty of room in the bot for batteries!

I will have to write a little code this weekend and see how the motors work.  I will post the code as I move along and that way I can keep track of the functions as I go along.

Tuesday, February 16, 2016

Wheels and Motors are back on!

Tuesday, Feb. 16th, 2016

After a long day at work, I came home somewhat exhausted, but in dire need of some robot work to clear my head a little.

Hero to the rescue!

I had cleaned the motors and mounts some and decided to remount the wheels, and both motors so that I could prepare for the micro-controller that was going to run them.  So here he is with all the wheels re-attached and both motors attached.  Shown here is the drive motor, which is attached through the L-shaped bracket to the steering stepper motor mounted above.

This motor is attached directly to the wheel and drives it through this DC motor attached to a gearbox (the square box it is mounted to).


The steering motor is a stepper motor, also attached to a gearbox (for torque at low speeds).  The shaft coming out of that motor attaches to a collar on the L-bracket you see above and rotates it plus or minus about 90 degrees from center to the right or left.

Steering Motor in place above drive motor and bracket
Since the stepper motor does not move like the drive motor, I am going to shorten the wiring up and attach it to the stepper driver as soon as it arrives and do a little testing.



The code for this project will likely all be in C++ created in Visual Studio along with the Visual Micro add-in for debugging the micro-controller live as the code is running.
For anyone interested in this, Microsoft makes available a free version of Visual Studio (msdn.com) and the Visual Micro debugging tools are free to download from visualmicro.com and test with.  If you want the pro version of the debugging tools for personal use, they are very reasonably priced ($25.00) for a a single license to test with.  I purchased that to use since the pro version as some live debug tools I want to try out.  You can use these tools in most versions of Windows so there is really no downside to trying them.  If you are not a Windows user, you can stick to some of the other Arduino IDE tools for Mac and even one for Linux...see the Arduino.cc site for more details.

The code for the motors will be for an Arduino and so it will be fairly straight forward for me to program, but I will likely create a few of my own drivers for the motor boards so that they can be called on other projects as a library of my own.
I will document and post the code here for all to see as I progress.

Well, I have to be off for the night as I have an early day again tomorrow travelling onsite to work with a customer.  More on this robot as the week progresses.


Monday, February 15, 2016

Monday Feb. 15th, 2016

Here are a few pictures of the current state of the robot.  I have it completely dis-assembled and somewhat cleaned, the rivets I needed replaced with bolts have been drilled out and now it is time for the re-assembly with new electronics to enhance the little bot's capabilities.



The head has been removed, but I have not removed the sensors in it yet as I might want to use the keypad and sensors that are there and add a few more as well.
All of the circuit boards are still intact, just put away and so all the wiring you see now is just what was attached to the components, leading up to the circuit boards.


I have the drive wheel isolated, and since it is a 12Volt DC motor, I have an H-bridge mounted now inside the chassis for that to be controlled from.



This is a small but fairly powerful motor and I will continue to use it to drive the robot until I can devise another drivetrain method that is more efficient.



As the top had a large clearance hole for the main circuit board to sit in, I mounted a clear piece of acrylic in there to mount my new boards to.  This one may be replaced with a thicker one to mount a servo on for the head assembly if I want that to rotate.

I have the newly mounted H-bridge here...partially wired up and waiting for connection to the Arduino.


Monday Feb. 15th, 2016

I still do not have a clear idea of exactly how I will run the motors…but…I know for sure I can run the two motors from one Arduino board.
I also know that I can send and receive data on any of the pins on one Arduino from another Arduino or from a PC.
So…while this tumbles around in my head, I continued the dis assembly and cleaning.

I have a couple of these and 1 or 2 will remain intact and the other will be the one I am rebuilding.





After drilling out a few more rivets, I drilled other clearance mounting holes and then cut a piece of clear acrylic for mounting on top of the top shoulder mount where the head will mount.

<I might make this piece much thicker to allow a servo to mount on it for a method of rotating the head.>

The rear bottom where the back wheels mount  had a tray riveted in and I drilled that out so that I can run bolts into it in case I need to reverse it and keep the tray facing the opposite direction.

I am going to mount a couple of Arduino boards to the front plane so that I can control a few sensors.
I will mount a couple more Arduino boards on the back of the front plane to control the arms.
The motor control boards will go on the top of the bottom tray where the direction motor mounts.
The speech and communication boards will likely mount on the top under the head.  I could mount them underneath that top mount if protection is necessary.


I remove all the components from the robot and disassembled his frame so that I could use nuts and bolts instead of having rivets in the frame, which makes it harder to mount everything.

 
Sunday 2/14/2016

I need 1 robot chassis, with separate computers controlling the individual functions of:
Movement
Sensor Input
Left Arm
Right Arm
Speech
These 5 computers will be run in parallel, each capable of using their computer core independently but simultaneously with the others in response to commands.
The commands need to come from either another computer via wireless or bluetooth, verbally, or in response to input from sensors.



Start of Conversion Process.

First remove existing circuit boards and wiring.
Keep all boards and wiring intact for later use or resale.

I removed all the existing wiring, clips, retainers and circuit boards and put them in a separate box so that later I could either re-use them, examine them, or sell them on eBay if necessary.

Cleaned up all the existing chassis parts in preparation for mounting new circuit boards.

Cleaned drive motor and tested existing motor line conditioning filter to make sure the components are ok.
Mounted H-Bridge and connected drive motor for testing.
Tested Drive motor and it is smooth in rotation - both directions.  There is a little jitter switching from one direction to the other and I will have to see if I can make an electronic brake that discharges the capacitors to keep the power from causing jitter.

**Problem**  The rotation motor is a 6 wire stepper motor and it cannot be hooked up to the same H-Bridge with the DC drive motor.  Not enough inputs/outputs.  If I use 2 separate H-Bridges, then I cannot have them both tied to the direction and drive control in the interface…
This is going to cause some issues.  I might need to add another computer in here to deal solely with the drive interface so that I can control both motors with one board and still have only one I2C connection to give them signals.

**Research** Can both motors be controlled from one Arduino with an H-Bridge and Stepper Driver and have the Arduino talk to another computer via I2C for direction, distance and speed inputs?

**Research** Can I find another motor that will mount in the same place as the stepper and have it be another simple DC motor and control the rotation accurately?

**Research** How much power is needed in the rotation motor to turn the robot when either stationary or moving?
What is total weight of robot and how many ounce inches of torque do I need to provide…and now much power will this take (voltage)?


<sigh> I thought I was going to get further today but I ran into more questions than I have answers for … gotta do some research.