This article is the seventh is a series of articles about building a “real” robot, one that can carry a reasonable payload and is capable of machine learning. If you haven’t seen the other articles you can read the whole series here.

Introduction

Today I put a few more final touches on the wiring of the DB1 robot, tested it and then hooked it up to an external power supply. Then I gave the motors a quick test to see if everything is working.

Along the way, I discovered a wiring error, which I corrected before applying power, and also found out that the robot has a bit of a weight problem. Not an overweight problem, more of a balance or underweight issue.

I also wrote a quick sketch to test out the motors, the motor driver boards and the brand new Arduino Mega clone that has replaced the old one.  And I added a couple of spacers to the front wheel assemblies to move the wheels a bit further away from the robot body.

Build a Real Robot Part 7

Read on for more details.

Wiring Changes

In the last installment of this series, I showed you how I wired the power distribution for the robot.  A series of wires, terminal strips and 3-pin connectors were used to distribute 5-volts and 12-volts throughout the robot chassis.

There were a few items left undone last time, so I took care of them this week.

Aviation Connector Wiring

One thing that I had not connected the last time we got together was the 4-pin aviation connector. As you might recall, this connector has two purposes:

  • During the development phase it will be used to deliver 5 and 12 volts from an external power supply.  I’ll take current readings to determine the robots battery requirements.
  • After the development phase I will use the connector to hook up a battery charger to rejuvenate the robots power cells.

This is a nice big connector, which I mounted on a sheet of acrylic on the rear of the robot. The acrylic itself is fastened to the back piece of Actobotics channeling using 4 0.625 inch threaded spacers.

Rear Power Connector

By the way, if you want to cut a big hole in acrylic, as I did for the connector, I found that drilling a smaller hole and then using a step-bit works very well.

On the female (robot side) connector I soldered four wires as follows:

  • Pin 1 – Ground (Black)
  • Pin 2 – +5-volts DC (Red)
  • Pin 3 – Ground (Black)
  • Pin 4 – +12-volts DC (White)

I then connected those wires to a new 12-position terminal strip that I mounted on the rear channel, right under the acrylic used to hold the modules for the Navigation Layer.  This terminal strip is divided into three sections, in the same fashion as all of the other 12-position terminal strips on the robot.

Rear Power Terminal Block

From the terminal strip, I connected wires to the three power distribution strips on the baseplate, the 6-terminal ones. I used two wires for each connection to reduce resistance and improve the current handling capabilities.

By using the 12-position terminal strip I will be able to easily reconfigure the use of the aviation connector as a battery recharger connector when the time comes, without the need to resolder everything.

Wiring Test

The pins on the aviation connector are an ideal place to test all of the wiring from, as everything eventually ends up here.

I used a multimeter to test the connections for continuity and short circuits. And right away I discovered a problem!

It turns out the on the 12-position terminal strip mounted on the front of the robot, underneath the chassis, I had accidentally connected the 5-volt (red) wire to a ground terminal, effectively shorting out the 5-volt supply line.

This was certainly not a good thing! I corrected my error and everything tested out just fine, including the tower wiring.

Moral of the story is – always test your wiring before applying any power!

Labels and Terminal Strip Covers

I used a label maker to create labels for all of the connectors, as well as for the main power distribution terminal strips.  While I know what they all do it is still a good idea, as months or years from now it will make it a lot easier to troubleshoot.

I also made labels for the connectors on the power distribution board on the Navigation Layer.

I installed plastic terminal strip covers on many of the terminal strips. I covered the two 6-position terminal strips that distribute the 12-volts ands 5-vlts to the rest of the robot.  I did not cover the strip that centralizes the ground connection, as I was concerned that the terminal strip cover would rub against the wires from the aviation connector.

Power Distribution Terminal Strips

In addition to the two 6-position terminal block covers, I installed covers on all of the 12-position terminal blocks, with the exception of the one I just mounted for the power input from the aviation connector. That terminal block sits directly under the acrylic plate that holds the Navigation Layer electronics so it is already well protected.

The plastic terminal block covers fit quite snugly on the terminals so I don’t anticipate that I’ll have problems with them coming loose during operation, but of course that remains to be seen.

Navigation Layer Wiring

I also did a little bit of wiring on the Navigation Layer.

Navigation Layer Hookup

I connected the two Cytron motor controllers to the power distribution board. There are two sets of connections here.

  • The 12-volt power for the Cytron motor controllers.
  • The output of the motor controllers.

I also made a short power cable for the voltage input to the power distribution board and connected it to another 3-pin connector. This will make it a lot easier to remove and reinstall the board, as I don’t need to remove the wires from the power input terminals each time.

Power Distribution Board

And, finally, I connected the motors to the 4 bullet connectors on the power distribution board. The motors are connected in reverse polarity to one another , this is necessary as they face in opposite directions from each other.

Wheel Spacers

One modification that I did that did not have to do with wiring was to add a ⅛ inch spacer to each of the front wheels.

I did this because I thought that the wheels were coming very close to the chassis, they don’t actually touch but the space between the wheel and the chassis was extremely tiny.

I placed the spacers between the surface of the hub and the wheel and used longer screws to mount the wheel s to the hub through the new spacers.

The spacers I used are Actobotics part number 545492.

Motor Testing

Now that I have all the power connections hooked up it’s time to test the motors.  DB1 has been stationary for far too long!

When I build something complex, such as this robot, I like to test out the sub-assemblies individually and then together. This lets me know if I have a problem with a component so that I can rectify it immediately.

I’m going to do exactly that with DB1, starting with the motor drivers.

Cytron Motor Tests

The Cytron MD10C Motor Drivers that I’m using in this design have a built-in testing feature. It’s nothing fancy, just a couple of push buttons that will spin the motor in one direction or the other.

Cytron MD10C Motor Drivers

Despite the simplicity of this test, it does prove a number of things if executed successfully:

  • It proves that the controllers are receiving power and are connected correctly to the motors.
  • It proves that the motors themselves are working.
  • It is a reasonable test of the functionality of the motor controllers, although it does not test the PWM function.

The motor controllers also have a couple of LEDs to indicate motor direction.

As expected, the motors worked correctly. I also tried using both of them at the same time to see if I had any power supply issues, it all seemed to work properly.

On to the next test!

Arduino Mega 2560 Tests

I don’t have a proper motor controller built yet, that will actually be the subject of the next couple of installments in this series.

I do, however, have an Arduino Mega 2560 that will become the master controller in the Navigation Layer.  And I can use it, temporarily, to do some motor testing.

As a bonus, this also tests some of the functionality of the Arduino Mega 2560 itself.  It also completes the testing of the Cytron motor drivers, as it exercises both the PWM (Pulse Width Modulation) and DIR (Direction) inputs.

Arduino temporary hookup

I hooked up the Arduino to the two Cytron motor controller inputs as follows:

  • Arduino Pin 11 to Left Cytron PWM input.
  • Arduino Pin 10 to Right Cytron PWM input.
  • Arduino Pin 8 to Left Cytron DIR input.
  • Arduino Pin 7 to Right Cytron DIR input.

I also connected a ground connection from the Arduino to the GND pins on the input connectors of each Cytron motor controller.

I then ran the following sketch:

 

The sketch is pretty basic, I’m sure you could expand upon it and write a better one. I didn’t place the motor routines into functions, instead I just wrote it all line by line.

The main activity is in the Setup, nothing actually happens in the loop. After a two second delay the motors are both sent spinning at a speed of 200 (out of 255) for one second.  They are then stopped for a second.

The motors are then reversed for one second, at the same speed of 200. And once again the robot stops for a second.

Finally the robot spins, this is done by moving both motors at full speed in opposite directions.  It does this for two seconds and then stops.

As the code is all executed in the Setup it will go through the motions once after the Arduino is powered up or reset. This makes it easy to repeat the test by pressing the Reset button on the Arduino Mega 2560.

Test Results

I powered the Arduino Mega 2560 using the USB connector on the power distribution board. It is actually meant for the Raspberry Pi but it was an easy way to power up the Arduino for the test. Eventually, I’ll use a shield on the Arduino to power it directly from the power distribution board.

With everything hooked up, I turned on the power supply. After a two-second delay DB1 started going through the motions – forward, backward and a spin.

DB1 Robot test drive

It worked, but it wasn’t perfect.

The front wheels didn’t seem to have enough traction, so instead of going straight, it veered off a bit. And the spin was not exactly perfect either.

When I placed some weight on the front of the robot it ran as expected. The extra weight (I used a ream of printer paper) pushed down upon the wheels enough to make it run properly.

DB1 with paper

Eventually, there will be more weight on DB1, the batteries and the tower will both add a lot of mass to the robot. So that might be all that is required to solve the issue.

Otherwise, I may have to look at using different wheels, ones with more of a tread on them.

But for right now it looks like the robot is capable of moving, and that all of the components are working properly.

Conclusion

That brings us to the end of today’s robot build. Next time we get together we will look at the motor controller board that I’m designing for DB1. It will control both motors and use the I2C bus to get commands from the Arduino Mega 2560.

Stay tuned!

Build a Real Robot – Part 7 – Motor Test
Summary
Build a Real Robot - Part 7 - Motor Test
Article Name
Build a Real Robot - Part 7 - Motor Test
Description
In part 7 of the Build a Real Robot series I will be testing the motors. I'll also show you some wiring enhancements that I made to the DB1 robot.
Author
Publisher Name
DroneBot Workshop
Publisher Logo
Tagged on:

12
Leave a Reply

newest oldest most voted
Steve Garrison

Were the 1/8″ hub spacers added to just the front wheels or to the Omni wheels as well?

Michael LaForge

Hello, Bill the test sketch has a few issues You have two copies of the setup() function and didn’t close the first one. On line 81, add a }, then figure out if the setup starting on line 22 is the one you want or the setup starting on line 94. You also have two copies of loop and stuff in between that needs to be deleted or moved into a function. Regards ,Geordy

Michael LaForge

Also amazing project i am following along with my K-9 build each week

Michael LaForge

/* DB1 Robot PWM Motor Test db1_motortest.ino Uses Arduino Mega to test motors DroneBot Workshop 2019 https://dronebotworkshop.com */ // Left PWM output pin #define leftpwm 10 // Right PWM output pin #define rightpwm 11 // Left motor direction pin #define leftdir 8 // Left motor direction pin #define rightdir 7 void setup(){ // Define Pins as Outputs pinMode(leftpwm,OUTPUT); pinMode(rightpwm,OUTPUT); pinMode(leftdir,OUTPUT); pinMode(rightdir,OUTPUT); //Delay for 2 Seconds delay(2000); // Move Forward for 1 second analogWrite(leftpwm,200); analogWrite(rightpwm,200); digitalWrite(leftdir,1); digitalWrite(rightdir,1); delay(1000); // Stop for 1 second analogWrite(leftpwm,0); analogWrite(rightpwm,0); delay(1000); // Move Reverse for 1 second analogWrite(leftpwm,200); analogWrite(rightpwm,200); digitalWrite(leftdir,0); digitalWrite(rightdir,0); delay(1000); // Stop for 1… Read more »

Michael LaForge
dave

I am using the exact same wheels from servocity. I improved traction by scuffing them with some 36 grit sandpaper perpendicular to the direction of travel.

Keep up the good work. I am following along.

Right now I am learning bit more about connectors. In an upcoming episode it would be great to cover standards (best practices) for which type of connectors to use for different purposes in robotics.

Steve Garrison

Bill, when you ordered the motors with encoders from ServoCity, did they include cables for the rotary encoders? Mine did not include them so wondered if something got left off the order.

Heads-Up: Just noticed that Real Robot parts 6 and 7 (while listed below in What’s New) are not linked to “Robots,” in the main menu at the top of the page.

Welcome to the Workshop!

The DroneBot Workshop website will be undergoing a “facelift’ and getting some exciting new features.

These changes will be done over a period of several days.  During this time the website will be operational but some features or pages may be temporarily unavailable.

I apologize for any inconvenience this may cause. Hopefully, these changes will make the site an even more useful resource for you.

I would be interested in getting your feedback on the website once these updates are completed.

Thanks for your understanding.

Bill