background image

Motor control:

Each of the 4 motors on the robot are driven by a “H” bridge. This is a circuit commonly used to control DC 
motors when direction as well as speed needs to be controlled. 

F

ield 

E

ffect 

T

ransistors (FET) are used on 

this robot as they are more efficient than 

B

i-polar 

J

unction 

T

ransistors (BJT) thus allowing more power to be 

delivered to the motors. Each “H” bridge includes a current sensing circuit to allow the robot to monitor the 
current being drawn by a motor and each motor has a simple optical encoder to measure rotation. 

Each motor has 2 processor pins dedicated to control and another 2 dedicated to feedback. These pins are 
defined in the “IOpindefinitions.h” tab. Using the left motor as an example:

Lmotordirpin

 controls the direction of the left motor. When this pin is HIGH or “1” then the left wheels will 

run forward. Making this pin LOW or “0” will cause the left wheels of the robot to run in reverse.

Lmotorpwmpin

 controls the speed of the left motor using 

P

ulse 

W

idth 

M

odulation (PWM). The Arduino IDE 

uses the command analogWrite() to generate PWM using values from 0 to 255. A value of 0 will cause the 
motor to stop completely. A value of 255 will run the motor at full power. 

At low speeds the motor may stall. A simple method of preventing the motor from stalling at low speed is 
alternate it’s speed between the speed you want and a low value that will not stall. For example, if you want 
a speed of 23 and you know the motor will not stall at speeds of 60 and higher then write your program so 
that at speeds below 60 the program will alternate the speed between the desired speed and 60. 

This will cause the motors power to pulse at a level that can overcome a stall. While the robots movements 
will not be as smooth it will allow the robot to achieve much lower speeds.

Lmotorencpin

 is the digital signal from the motors optical encoder. The encoder reads black and white 

marks on the motor gear train and outputs a “1” when a black mark is read and a “0” when a white mark is 
read. In the sample software, external interrupts are used to monitor these pins and count when they change 
states. 

As this encoder cannot determine direction the sample software uses the direction the motor is travelling in 
to determine if it should add or subtract from a value. If the motor needs to change direction then it should be 
allowed to come to a complete stop first to ensure an accurate count.

Lmotorcurpin

 is an analog signal that represents the current being drawn by the motor. Using the 

analogRead() command in the Arduino IDE will give a value of approximately 400 when the motor is drawing 
1A. This can be useful not only for determining if the motor has stalled but also if the robot needs 
maintenance. If for example dust or dirt gets into the gears then the robot may continue to operate but the 
average current draw of the motor will increase. If the motor draws less current than expected then perhaps 
the robot has fallen so that the left wheels can spin without load.

Amotorlimpin

 and 

Gmotorlimpin

 are the digital input pins for the Arm and Gripper limit switches. The digital 

inputs are normally held at 1 or HIGH by internal pullup resistors. A low or 0 indicates that a switch is closed.

Using motor feedback:

By monitoring the encoders and current sensors of the robots motors various functions can be achieved. The 
wheel encoders allow the robot to measure speed and distance travelled allowing the robot to make a map of 
an area to improve navigation. Current sensing of the wheel motors in conjuction with the encoder 
information allows the robot to map inclines such as ramps.

Monitoring the current draw of the arm motor when lifting an object can be used to judge the weight of an 
object and determine if the gripper needs to apply more pressure to hold the object. 

Using the arm encoder to determine if the arm is moving or has stalled as the motor current for a heavy 
object might be similar to the stall current.

The gripper encoder allows the robot to estimate the size of the object and the gripper motors current draw 
can be used to determine how much pressure is being applied.

14

Содержание MR. Tidy

Страница 1: ...ic platform ideal for students and hobbyist alike The 2DOF arm and array of sensors make this robot capable of so much more than just line following and object avoidance An open framework makes experi...

Страница 2: ...Contents Main board features Assembly Installing the software Understanding the sample software How it works Trouble shooting Using the diagnostic software Specifications 3 4 9 10 13 15 16 21 2...

Страница 3: ...Main board Features 3...

Страница 4: ...arm is attached to the base Start by removing the nuts and spring washers shown in the photo bellow Do not completely remove the screws This will allow you to use a screwdriver to join the two sectio...

Страница 5: ...brass spacers and remove the main board STEP 4 Insert 6x AA UM3 NiMh batteries Do not use alkaline batteries as they cannot supply enough power for the robot and cannot be recharged Note how the batte...

Страница 6: ...ure the battery cable is behind the mounting post so it cannot jam in the gears STEP 6 Mount the arm onto the base with 3x8mm screws as shown The screwdriver goes between the gears from above It may b...

Страница 7: ...STEP 7 Now that the arm is mounted we need to tie the wires to the frame and connect all the wires to the main board Pay careful attention to the orientation of the plugs 7...

Страница 8: ...nection may damage the receiver STEP 9 Check your connections carefully before turning the robot on When you turn it on it should start by playing a simple tune The robot will then open its gripper lo...

Страница 9: ...to program we have chosen to make it compatible with the Arduino IDE and have included a USB interface This manual assumes that the Arduino IDE version 18 or later is being used Although the robot co...

Страница 10: ...rduino programming environment as this is easier for beginners You will see several tabs at the top these tabs help organise the program making it easier to use The first tab shows you the main progra...

Страница 11: ...n here This is basically a scribble page The fourth tab contains a list of constants Normally these values do not change They are listed here to simplify program adjustments such as calibration of the...

Страница 12: ...begin operation The loop function is the main core of the program and repeats continuously until the robot is shutdown or reset This function can be broken into several steps 1 Check the timer and ch...

Страница 13: ...h their IR LED Unlike the front sensors these LEDs are individually controlled allowing the visible LEDs to be used to display patterns or the status of the robot This does not interfer with object de...

Страница 14: ...is read and a 0 when a white mark is read In the sample software external interrupts are used to monitor these pins and count when they change states As this encoder cannot determine direction the sa...

Страница 15: ...ght With the gripper and arm encoders check that the encoder disk is as close as possible to the encoder PCB Load the diagnostic program and connect 12V DC to the recharging socket Check the encoder w...

Страница 16: ...have the Arduino Programming Environment loaded on your computer version 18 or later Open the program Mr_Tidy_PCB_diagnostic Go to the tools menu and select the Arduino Mega as your board type Make s...

Страница 17: ...o low Now run the serial monitor this allows you to communicate with the robot Make sure the baud rate in the lower right corner of the serial monitor window is set to 9600 The robot should start by p...

Страница 18: ...ues in the constants tab and then upload the program again When the red green and blue readings on the serial monitor are the same then the sensor is calibrated Write these values down so they can be...

Страница 19: ...eadings used by the sample software to determine what action to take The optional sensor alignment rings may affect the sensitivity of the sensors but will help maintain their alignment if the robot b...

Страница 20: ...wheels are not in contact with the ground Below you can see a photo of the gripper motor with it s drive gear removed Remember the arm and gripper motors have two gears that need to be removed If you...

Страница 21: ...frequency 38KHz Motor control 4x FET H bridges rated at 4A continuous with current sensing Position feedback 2x Wheel encoder resolution 24 counts per revolution 1x Arm encoder resolution 27 counts p...

Отзывы: