Showing posts with label DIY. Show all posts
Showing posts with label DIY. Show all posts

Tuesday, 5 May 2015

DAGU, Line Tracing Car V2 Product Review

I purchased this kit car from Hobby King and had no intention of doing a product review until I was all but finished the build, it was great fun building it, took me back to when I used to build electronic kits on a very regular basis and I thought it is a fantastic starting kit for the young robot pilots out there. The kit comes complete, well 99.9% complete, you need to supply your own batteries which is best in my opinion. DAGU from China makes the kit and in Dagu form it is a well made kit and the price was very good, actually it was fantastic given what you get, $14.85AUD in my book is cheap but the killer was the freight, I purchased two items and it cost $22.90AUD to get them posted to Australia from China so the total cost was $26.30AUD when you share the post between the two items. On the plus side it only took 8 days to get here instead of the normal 20 plus days it can take.


                                   The Instruction manual DG-2000V2

The instruction manual is very good and easy to read given the English translation is at times a bit funny but good enough to totally understand. The illustrations are very good but you will need your glasses on to see some of the numbering on the circuit diagram. As always you need to read all the instructions first that way you won't make silly mistakes as you build the robot car like I did so be patient and read.

                                     The Line Tracing Car V2 Finished

                                               The Car from Above

The control circuit is built around a Quad 2 Input NAND gate (Not AND Gate) 74HC00 and two sets of Red LEDs and Photo transistors mounted in a plastic light shielding holders and is wired in a voltage divider network that can be set by two 500K variable resistors as they call them (potentiometer) and two C2120 NPN transistors wired to switch the negative side of each motor to earth. I added two 0.1uF capacitors across the motor power supply terminals (they didn't come in the kit) at the motor terminals to act as filters to help protect the transistors. The circuit is simple and it works very well, I set both pots to 0.8V and this setting worked perfectly first try, a bit of simple maths gave me that voltage from the 74HC00 data sheet that can be downloaded from the net, rough maths at that let me tell you.

                                 The Light Shield and 74HC00 NAND Gate

The only little bit that wasn't 100% was the polarity of the RHS motor wiring, it had to be reversed to get it to run the correct way but that is simple with permanent magnet motors you just swap the wires around and away it went, otherwise the instructions are perfect. The car is built on the PCB which forms the chassis and the gear set are open so you can see the operation of the gear train which is perfect for learning how a gearbox works. The complete kit is one of the best learning kits I have ever built, it's easy, fun and the finished product is fun as well.

                                      The Gear Train, Motor and Wheel

                                    The Rear Wing and associated LEDs

The rear wing has two Red LEDs and three RGB LEDs, the red LEDs are connected in parallel to the output from the 74HC00 that goes to the base of the transistor so it comes on when ever the LH or RH motors are working and the three RGB LEDs have a chip inside them that switches the LEDs through the three colours Red, Green and Blue at random and they are powered all the time and it looks fantastic as the car follows the line on the floor, table or whatever you set up the track on.

                             The Ball Caster, Axle Mount and Light Shield

You can see the Light Shield on the right in the above image, the Red LEDs were mounted in the front holes and the photo transistors were mounted in the rear holes and both were of different sizes so you couldn't make a mistake and it even had flats so you could get the components around the correct way when you put them through the holes, an excellent set up for the beginner. The other thing that worried me a bit was the metal ball caster, it was mounted on the printed circuit side of the PCB so I cut out two small bits of plastic and insulated the board with them just in case the caster rubbed through and shorted the circuit, I also didn't over tighten the mounting screws, just to be safe.
My final verdict of this kit is 8 out of 10 and I highly recommend it to the novice robot pilot, all you need is good soldering skills and the patients to follow the instructions and you will have a lot of fun with this kit and with the finished car. The Line that it Follows is simply Black Electricians Tape on a white surface, my kitchen table is white but you could use a few white cardboard sheets taped together and it needs to be used in a room with dull light for best results, so have fun, cheers.















                      

Thursday, 30 April 2015

Continuous Rotation Futaba S3003 Servo Modification

In my posts I have made reference to Continuous Rotation Servos and indicated that you can find instructions on the Internet or included it in a post with other builds, well I have decided to show how I did it when I purchased some new Futaba S3003 Standard Servos and needed to modify them so I took a series of images so I can demo that process. These servos cost me $11.00 on eBay with free postage from inside Australia so they were cheap enough given it was an Aussie purchase. Remember this is for entertainment only but it worked perfectly for me and should for you.

                          The Servo and Tools Required for the Conversion


                                      A Multimeter is also a must have

In image one you can see the tools and parts required for the conversion, the only electrical components are two 2K7 Ohm through hole resistors and a standard servo or two and some silicone lubricant. Not in the image is my Soldering Iron and solder. By "standard servo" I mean the ones that are normally used for RC Planes and Cars, they only turn through 180 degrees or so and when finished they will be able to turn continuously when the correct signal is applied to them. We do this because they are by far the cheapest servos available and they make fantastic high torque fast motors, well fast enough for robotics use anyway. The only special bit of kit that you will need is a good multimeter as in image two, I recommend you invest in a good quality meter, that way it will last you for many years and give accurate readings over it's life time.

                                          My Servo has Four Screws

Okay lets get to it, first look for the screws that hold the servo together, see above, and get the screwdriver to match the screws, pick the correct one so you don't damage the heads of the screws, it easy to do so be careful. If the servo only has two screws undo one then the other but if it has four then I recommend you undo one then undo the diagonally opposite screw and so on, good practise and helps prevent warping the cover, yes I know over done but it's still good practise.


                                 Inside the Servo with End Cap Removed

Screws out, now carefully remove the end cap, take note of the layout and if needed take a photograph so you can put it all back the same way. On my servo I wasn't able to lift the PCB (Printed Circuit Board) out but you may be able to do so with yours, carefully test it to see if it can come out, if it has wires connecting the position sensing potentiometer (Pot) to the PCB it should come out. Take careful note of how the wires are connected to the PCB, that is where the wiper of the pot is connected and the two outer terminals of the pot as well, draw it so you don't get it wrong, it's very important. Also be careful not to brake the other wires off. Lets take a moment and test the potentiometer so we know which one is the wiper, now 99% of the time the middle pin is the wiper but you never know with cheap servos. First test the two outer pins with the meter set to Ohms, the omega symbol on the dial, you should get 5K0 Ohms, remember that, it's important. Now test from one outer pin and the middle pin, it should read somewhere between 0 and 5K0 Ohms, now turn the pot shaft and the resistance should change as you turn the shaft, that is the wiper terminal of the pot and it must go to the centre of the voltage divider network that we make with the two 2K7 Ohm resistors. The 5,000 ohms was important because we need to use two resistors in series that total 5,000 ohms, we can use 2K2 or 2K7, I like to use 2,700 ohms (2K7 Ohms), its gives 5,400 ohms which to me is better than 4,400 ohms, yes i know 6 of one and half a dozen of the other, I'm fussy and I like to be safe, it's up to you really. Also use 1% 0.25W resistors, that way the voltage divider is exactly half the supply voltage and that signals the 90 degree or centre position of the servo. That way you can set a Stop position in the sketch for your robot by requesting the 90 degree position, any thing less or more will make the motor rotate one way or the other and it keeps going because the position feedback never changes, you can also change the speed but that's out of the scope of this story and I need to study it more to be sure. Anyway back to the job.


                                The Gearbox Housing Comes OFF as well.



                                  The Gearbox Cover and Gears Removed

My servo had to be totally dismantled at this stage, you will also need to do this, so carefully remove the gearbox cover and take special note of how it all goes together, take a photograph so you get it right or it won't work. You will see why you need to do this a bit later. So, with mine apart I had to remove the pot and PCB together, you will see that the output shaft is connected to the position sensing potentiometer (Pot), the bigger brass looking shaft in the gearbox, you need to push this shaft out of the motor housing without breaking anything.

                                  The Pot shaft is on the Left, the big one


                                 Apply pressure to the Shaft to pop it out

Put the pot shaft against your bench, see image above, and firmly push it out of the motor housing, it is held in by a plastic clip so it will need a bit of pushing but be careful not to break anything.

                           The PCB and Pot came out Together in my Servo


                                     Unsolder the Pot Pins from the PCB

You need to cut the wires AT THE POT if yours is connected by wires or like mine you will need to unsolder the pins at the PCB, use a solder sucker and be careful not to unsolder the surface mounted components that are also connected to the pins, take you time and be very careful because they are hard to put back on, Clean out the holes so we can solder the two 2K7 Ohm Through Hole Resistors to the PCB or if your Pot had Wires you need to connect the resistors to the wires that you cut off at the pot.

                               Twist the Resistor Leads Together Like This


                                     Now Bent the Other Two Like This

Now twist two of the resistor leads together as in the first image above and then bend the other two as in the second image above. So if your servo had wires you will need to cut some heat shrink, three bits about 10mm long and slide them over the three cut wires, put the wire that went to the wiper onto the twisted pair of leads from the resistor and solder it, now slide the heat shrink up and heat it so it insulates the connection and leads, solder the other bent leads to the other two wires and solder them and insulate them with the heat shrink. It doesn't matter which way they go because we are making a voltage divider network and the wiper is the critical connection and goes to the middle of the voltage divider, that is the twisted pair of leads. In my servo it was a bit easier to do, see image below.

                                The Resistors Mount on the PCB as above


In my servo the resistors mount on the underside of the PCB and solder to the PCB, the important one is the twisted pair again and they must go where the wiper of the pot was, once again making a voltage divider network and the middle goes to the wiper connection. Take care not to damage the PCB and or the surface mount components on the PCB.



                          Mount a torch in your little vise or bench like this


              Now Inspect the PCB for Bridges or Damage as shown above




Mount a torch as in the first image above and position the finished PCB as in image two above  so you can see the light through the PCB and inspect it for solder bridges or damage, this makes it very easy to see any faults. no need to use heat shrink on this pair of resistors. Now put it all into the motor body making sure nothing can short out and in the same position as it was originally, look at the photographs to make sure it's all as it was.


                                    We Need to Modify the Output Shaft
We now need to modify the output shaft so it can rotate continuously, the stopper on the shaft that you can see on the right in the image above must be carefully removed. I use a very small hobby saw and cut it off at the top of the gear teeth, once removed I use a diamond file to make it flush with the teeth and flush with the shaft at the other end, be careful not to damage the teeth or the shaft and give it a good clean to remove the bits that you cut and file off.

Now put a bit of extra silicone lubricant on the gears and put the gears back together, look at the photograph to make sure they are as they should be and put a bit more silicone lubricant on the gears and output shaft, especially where the bush is for the output shaft itself.

                                  Gearbox Back Together and Lubricated


                          Note the extra Lubricant at the Output Shaft Itself


Now put both covers back on making sure that all gears and wiring are in their original positions and nothing gets caught up or damaged, put the screws back in and torque them so that you do diagonally opposites as you go. Once together you need to test them.


                                        The Test Setup on the Bench

Set up a test using an Arduino UNO or what ever you have and the Arduino IDE and the example sketches that come with the IDE, the servo should rotate one way continuously and then the other and not make strange noises and run freely both ways. The wiring for the servo is Red = 5V "+" and it is always the centre pin in the 3 pin plug, Black or Brown = 0V "-" and then Orange, White or Yellow = Signal from the Arduino or tester, now program the arduino with a sketch for servos and make sure the servo works as intended, remember the servos work on 5Volts and the arduino can power them but I recommend to power them from the battery or power supply directly, easier on the arduino regulator, just remember to join all 0Volt or earths together. Cheers, and have fun, Terry.

Monday, 13 April 2015

LadyBug_Bot_V1.0

Yes another robot, and it's for entertainment only as always, but as with 98% of my robot builds there is some major or simple difference between them, this one is no different, it uses bump sensors (read micro switch) with an antennae glued to it. This robot has a few options that can be included. WARNING, only use 4 X 1.2 Volt rechargeable batteries, 1.5's will KILL the Arduino.
Now as always I stand on the shoulders of the many great women and men who went before me and in this case it's "J D Warren" of "Arduino Robotics" Book Fame, this one of his simpler projects but teaches you a lot about using servos and bump sensors. This is my version of that robot.
So, I decided to go with a Lady Bug theme and began with the planing stage as always and made up the template for the chassis, like my other builds I used 3mm thick MDF and 10mm dowel to hold the top to the lower chassis. I wanted to use what I had in stock to keep it as cheap as possible and went with Micro Servos, 9g versions, anyway more on this later.

                                     Simple template made of plastic


                                      The MDF Marked for cutting out

As I'm not the best at wood work I need to keep it as simple as possible, but you can let your imagination go wild and make what ever you like. I also cut out the motor brackets at the same time, I already have the template for them and I reuse it on most builds and it can be modified to take the large servo and micro servos as required. Don't forget to drill everything and get it ready for painting etc so you can do other parts of the build while the glue and paint dry.

                   The Main or Lower Chassis with Motor Mounts Glued in Place


                            Upper and Lower Chassis Components Drying

Okay, the chassis is on the way so I started on the Bump Sensors or Micro Switches, they have three terminals, a Common, Normally Open and Normally Closed, we need the Common and Normally Open terminals for this build but it could as easily be the other way around or both if you want, it's all in the Sketch/Code. So the "C" and "NO" terminals on the switch could have numbers or letters or both or nothing, lets test them with your multimeter to make sure, it's easy to tell the NC and NO as well as the C by using the beeper in the meter, with the switch in it's normal position the C and NO will make no sound and the C and NC will beep BUT in the switched position C and NO will beep and the C and NC terminal will go quiet, simple really.

                             These are the Rear 3 Micro switches made up


 Black wires on the C or Common Terminal and Yellow on the Normally Open
                  Note the heat shrink, Black on Black and Yellow on Yellow


                  The 3 Black wires joined together and Heat Shrink applied

I like to use set colours for each job, Black is always the 0Volt or Earth, Red is always Positive or 5Volts or 3.3 Volts etc. Yellow is normally used as signal wires from sensors and to motors etc but I will also use green but they will be, front green and back yellow. My point is choose a colour scheme and stick to it, I have done this for 40+ years in the Auto Electrical game, I've also used the DIN Number system because we were the Bosch Warranty Agents for many years so it's in my genes.

If you don't have continuous rotation servos you will need to modify them, I had normal micro servos so I had to do my mod, see Tubby Bot V1.0 or search the www, it's fiddly but not hard and the servo example in the Arduino IDE can be used to test them after the mod is done. Go and check the paint, if dry add more paint as desired, you choice really.

               I used two larger Micro Switches for the front or antennae sensors

The terminals were bigger so I had to use a bit of red heat shrink, it's all I had in that size other than black. Now to make up the antennae, I used straws, the plastic ones you get for the kids parties, once I had tried it out on a test straw I made up the real ones, practise first as the hot glue and glue gun melt the straws quickly.

                             I put a small bend on the switch contact shaft

I guessed the angle for the switch contact shaft and cut the straw to a longer length than required, that way if it melted a bit I could trim them back to the size I wanted, worked that out after the 5th try, yes I'm quick.

                         Straw cut and fitted over the switch contact shaft

This is where it got tricky, you have to be quick with the hot glue and I filled the straw with the glue at both ends and let it cool and then trimmed to the correct length, as you will see it worked a treat, be careful that no glue gets on the under side of the shaft so it won't foul the operation. If you do let it cool totally and trim the excess with a good blade.

                            The finished antennae mounted on the chassis

I painted the straws and mounted the switch on each side of the "head" of the lady bug bot. Caster is up front this time as you can see and it works very well that way.

        The switch was mounted with tie wire and hot glue put over the wire

I used tie wire to mount the switches and then used hot glue to cover the wire and add extra support for the switches, I did this front and rear, it made it very easy to mount the switches and glue them in place. I also use hot glue to hold the wires in place. apply the glue, wet your finger, (your choice as to how) and then press the glue down into shape, works very well, yes hot glue is my new best friend and yes I use a BOSCH glue gun, only the best.

             Motor mounted in the motor bracket and wires hot glued down

Note that the motors are bolted on and I use flat washers to spread out the load, that way the bolts don't pull through the MDF, much stronger and looks good. I had to trim a flat on one side of the washer, I cut a small moon shaped piece off the washer so it missed the bit that sticks out the top of the servo. Easy with quality side cutters.


                         
                         Motors, Bump Sensors, and Caster mounted

                 Bus Bar, Motor Harness and Lower Chassis sensor wiring

I like to make up a bus bar for the power and earths and I also use two pins with a joiner as the switch, cheap and easy to make up and handy for testing and programming etc. Battery holder I mounted on the top of the chassis and I used an Arduino Pro Mini so it is secured to the middle support with a cable tie, it's very cheap, has good memory for robotic purposes and I have a lot of them.


                                   The rear sensor/micro switch mounted

                             The tie wire holding the switch on at the rear

                       The chassis ready for the Arduino and sketch/code

Once all the components were mounted and glued in place I loaded the sketch into the Arduino Pro Mini and did a test run, it needed lots of mods to suite the servos and I was using this computer, Banana Pi running Ubuntu with Arduino IDE but the IDE kept changing things, I didn't change the direction settings but it changed between two uploads along with other strange things so I swapped to the Windows Laptop made the alterations to suite my motors and it worked perfectly. It took three goes to get the motors perfect but they are now spot on and the grand kids love it, and that after all is what it's all about.

                   Battery holder on top cover over the caster for balance


 The Motor Connector and Home made Plug, note the black negative terminal


                                              The 3 rear sensors


                         The Arduino Pro Mini mounted to centre support


                                      The motors, wiring and sensors

As I said the sketch/code was written by JD Warren of Arduino Robotics Book Fame I did change things a bit to match the servos and resistors that I used in the conversion so that the stop setting was in fact stop, one motor was 97 (not 90) and the other was 98, you will need to change the settings in the code to match your servos, this is not a sketch that will work with other motors and if you want that you will need to look elsewhere. Okay here it is with comments.

Sketch, Arduino_Bug_bot_code

// Bug-bot v1.2
// (2) Servo motors (modified for continuous rotation) with tank-steering setup (pins 9 and 10).
// (5) bump sensors total - 2 in front (pins 2 and 3) and 3 in rear (pins 14, 15, & 16).
// All sensors are normally HIGH (1) using arduino internal pull-up resistors.
// Sensors are brought LOW (0) by contacting the switch connected to GND.
// Either set of sensors can be used (front or back), by changing Mode Switch on pin 4.
// Pin 4 (HIGH or LOW) changes the bots default direction and sensors.
//

// include the Servo.h Arduino library
#include <Servo.h>

// create instances for each servo using the Servo.h library
// for more information, see: http://arduino.cc/en/Reference/Servo
Servo servo_L;
Servo servo_R;

//////////////////////////  Variables used for testing (you can change these) /////////////////

// use to determine direction of bot and which sensors to use.
int mode_pin = 4; // connect the mode switch to digital pin 4

int antennae_L = 3; // connect left antennae sensor to digital pin 3
int antennae_R = 2; // connect right antennae sensor to digital pin 2

int bumper_R = 14; // connect right bump sensor to Analog pin 0, which is pin 14 when used as a digital pin
int bumper_C = 15; // connect center bump sensor to Analog pin 1 (digital pin 15)
int bumper_L = 16; // connect left bump sensor to Analog pin 2 (digital pin 16)

// Value to change servo stopping point pulse - use Code 7-2 to determine the specific pulse for each motor
int servo_R_stop = 90;  // set the Neutral position for Right Servo - change as needed
int servo_L_stop = 90;  // set the Neutral position for Left Servo  - change as needed

// integers to use for updating Servo motors
// change these values to change the various motor actions
int stop_time = 1000;  // stop for 1000 millliseconds = 1 second
int backup_time = 700; // backup for 700 milliseconds = .7 seconds
int turn_time = 300;   // turn (either direction) for 300 milliseconds = .3 seconds

//////////////////////////  End of variables used for testing ////////////////////////////////

// value names used to hold timing variables.
unsigned long timer_startTick;

// value names used to hold antennae states
int antennae_R_val;
int antennae_L_val;

// value names used to hold bumper states
int bumper_R_val;
int bumper_C_val;
int bumper_L_val;

// Set the forward and reverse speed values for the Right Servo based on the Neutral position
int servo_R_forward = servo_R_stop - 50;
int servo_R_reverse = servo_R_stop + 50;

// Set the forward and reverse speed values for the Left Servo based on the Neutral position
int servo_L_forward = servo_L_stop + 50;
int servo_L_reverse = servo_L_stop - 50;

// end of variables


// Begin Setup
void setup(){

  Serial.begin(9600); // start Serial connection at 9600 bps

  servo_L.attach(9);  // attach servo_L to pin 9 using the Servo.h library
  servo_R.attach(10); // attach servo_R to pin 10 using the Servo.h library

  pinMode(mode_pin, INPUT);  // declare input
  digitalWrite(mode_pin, HIGH); // enable pull-up resistor

  pinMode(antennae_R, INPUT);  // declare input 
  digitalWrite(antennae_R, HIGH); // enable pull-up resistor
  pinMode(antennae_L, INPUT);  // declare input 
  digitalWrite(antennae_L, HIGH); // enable pull-up resistor

  pinMode(bumper_R, INPUT);  // declare input 
  digitalWrite(bumper_R, HIGH); // enable pull-up resistor
  pinMode(bumper_C, INPUT);  // declare input 
  digitalWrite(bumper_C, HIGH); // enable pull-up resistor
  pinMode(bumper_L, INPUT);  // declare input 
  digitalWrite(bumper_L, HIGH); // enable pull-up resistor
}
// End Setup


// Begin Loop
void loop(){

  ////////////////////////////////////////////////////////
  // if the switch_pin is LOW, use the Antennae sensors
  ////////////////////////////////////////////////////////
  if (digitalRead(mode_pin) == 0){

    antennae_R_val = digitalRead(antennae_R); // read Right antennae
    antennae_L_val = digitalRead(antennae_L); // read Left antennae

    // Use Antennae sensors
    // check to see if either antennae sensor is equal to GND (it is being touched).
    if (antennae_R_val == 0 || antennae_L_val == 0){

      // now check to see if only the Left antennae was touched 
      if (antennae_R_val == 0 && antennae_L_val == 1){
        // if so, print the word "Left"
        Serial.println("Left"); 
        // reset timer
        timer_startTick = millis();
        // Stop motors
        stop_motors();
        // back up a bit
        backup_motors();
        // turn Right for a bit
        turn_left();
      }

      // otherwise, if the Right sensor was touched and the Left was not,
      else if (antennae_R_val == 1 && antennae_L_val == 0){
        // print the word "Right"
        Serial.println("Right"); 
        // reset timer
        timer_startTick = millis();
        // Stop motors
        stop_motors();
        // back up a bit
        backup_motors();
        // turn Left for a bit
        turn_right();
      }     

      else {
        // otherwise, both antennae sensors were touched
        // print the word "Both"
        Serial.println("Both"); 
        // reset timer
        timer_startTick = millis();
        // Stop motors
        stop_motors();
        // back up a bit
        backup_motors();
        // turn either direction
        turn_left();
      }     
    }

    else {
      // otherwise no sensors were touched, so go Forward!
      forward_motors();
    }

    // print the states of each antennae
    Serial.print("Right sensor");
    Serial.print(antennae_R_val);
    Serial.print("    ");
    Serial.print("Left sensor");
    Serial.print(antennae_L_val);
    Serial.println("    "); 
    // End Antennae sensors

  }
  ///////////////////////////////////////////////////////////
  // Else, if the switch_pin is HIGH, use the Bumper sensors
  ///////////////////////////////////////////////////////////
  else{

    // read the bumper sensors
    bumper_R_val = digitalRead(bumper_R);
    bumper_C_val = digitalRead(bumper_C);
    bumper_L_val = digitalRead(bumper_L);

    // Use Bumper sensors
    // check to see if the right bumper was touched
    if (bumper_R_val == 0){
      // if so, print the word "Right"
      Serial.println("Right"); 
      // reset timer
      timer_startTick = millis();
      // Stop motors
      stop_motors();
      // back up a bit
      ahead_motors();
      // turn Left
      turn_left();

    }

    // check to see if the left bumper was touched
    else if (bumper_L_val == 0){
      // if so, print the word "Left"
      Serial.println("Left"); 
      // reset timer
      timer_startTick = millis();
      // Stop motors
      stop_motors();
      // back up a bit
      ahead_motors();
      // turn Right
      turn_right();
    }

    // check to see if the center bumper was touched
    else if (bumper_C_val == 0){
      // if so, print the word "Center"
      Serial.println("Center"); 
      // reset timer
      timer_startTick = millis();
      // Stop motors
      stop_motors();
      // back up a bit
      ahead_motors();
      // turn Left
      turn_left();
    }


    else{
      // otherwise no sensors were touched, so go Forward (which is actually Reverse when the direction is switched)!
      reverse_motors();
    }

    // print the states of each bumper
    Serial.print("Right Bumper: ");
    Serial.print(bumper_R_val);
    Serial.print("    ");
    Serial.print("Left Bumper: ");
    Serial.print(bumper_R_val);
    Serial.print("    ");
    Serial.print("Center Bumper: ");
    Serial.print(bumper_L_val);
    Serial.println("    "); 
  }
  // End Bumper sensors
}
///////////////////// End Loop /////////////////////




// Beginning motor control functions

void stop_motors(){
  // stop motors for the amount of time defined in the "stop_time" variable
  while(millis() < timer_startTick + stop_time){
    servo_L.write(servo_L_stop);
    servo_R.write(servo_R_stop);   
  } 
  timer_startTick = millis();  // reset timer variable
}


void backup_motors(){
  // backup for the amount of time defined in the "backup_time" variable
  while(millis() < timer_startTick + backup_time){
    servo_L.write(servo_L_reverse);
    servo_R.write(servo_R_reverse);   
  }
  timer_startTick = millis();  // reset timer variable
}

void ahead_motors(){
  // go forward for the amount of time defined in the "backup_time" variable
  while(millis() < timer_startTick + backup_time){
    servo_L.write(servo_L_forward);
    servo_R.write(servo_R_forward);
  }
  timer_startTick = millis();  // reset timer variable
}

void turn_right(){
  // turn right for the amount of time defined in the "turn_time" variable
  while(millis() < timer_startTick + turn_time){
    servo_L.write(servo_L_forward);
    servo_R.write(servo_R_reverse);
  }
}

void turn_left(){
  // turn left for the amount of time defined in the "turn_time" variable
  while(millis() < timer_startTick + turn_time){
    servo_L.write(servo_L_reverse);
    servo_R.write(servo_R_forward);
  }
}

void reverse_motors(){
  // go reverse indefinitely
  servo_L.write(servo_L_reverse);
  servo_R.write(servo_R_reverse);   
}

void forward_motors(){
  // go forward indefinitely
  servo_L.write(servo_L_forward);
  servo_R.write(servo_R_forward);
}
// End motor control functions

// End Code









The major area to be changed is the "int servo_R_stop = 90" line and or
"int servo_L_stop = 90", if you have wired everything else as per the sketch, and don't forget the switch for the mode of operation, D4 earthed "0" will have it moving toward the antennae up front and open  "1" with the internal pull up resistor turned on will have it operate in reverse and it will rely on the 3 rear sensors. If you want to use this feature you will need to fit a switch to D4 and to 0 Volts, I'm not using the feature at the moment but will when I sort out rear sensor plates that fit on to the rear micro switches. So I have the D4 terminal earthed. You can drop me a line at terrencej.banana.pi@gmail.com if you like and play nice please or I won't reply. Once again this will NOT work with normal DC permanent magnet motors so please don't ask, I won't answer you.

Okay or OK, a very short video to show that it does work in the forward direction, it also works the other way but I didn't video it, Cheers and enjoy.


Smile and be nice to one another, it really does make your day better, TJ. Remember, it's all in the sketch.