background image

How it works

Before you can write your own programs for Mr. Tidy you need to understand how the sensors work and how 
the motors can be controlled. 

Front sensors:

Each front sensor consists of 1 infrared LED and two infrared phototransistors. The two phototransistors are 
wired in parallel to increase the range. These are analog sensors. As ambient infrared light will affect their 
readings the software needs to take two readings. 

The first reading is taken with the IR LEDs turned on. This value is a total of both ambient light and light from 
the IR LEDs reflecting off nearby objects. The brighter the light, the higher the value.

The second reading is taken with the IR LEDs turned off. This value is the ambient light only. By subtracting 
the ambient light value from the total light value you are left with a value equivalent to light reflected by 
nearby objects.

You will see in the sample software that a small time delay (IRdelay) is used after the IR LEDs change 
states. This is required to get the best results from the phototransistors. This value is set in the constants tab 
and can be adjusted if necessary.

Bright sunlight should be avoided as it will result in high ambient light values and reduce the sensitivity of the 
sensors.

Side and rear sensors:

The side and rear sensors are similar to the front sensors but have only one phototransistor so their range is 
about half that of the front sensors. These are analog sensors but are connected to digital inputs as we only 
need to know if an object is within range. Ambient light will affect their range and may even trigger a false 
detection if it is very bright.

The side and rear sensors have a visible LED wired in parallel with 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 detection which only requires the IR LEDs to be on for very 
brief amounts of time.

IR receiver:

The IR receiver is a true digital sensor. Unlike the other IR sensors this sensor is designed to detect IR light 
modulated at 38KHz. It does not respond to the overall intensity of the light so ambient light is ignored. As 
with the analog sensors, it’s range can be reduced by bright sunlight.

The output of this sensor is normally high. When the receiver detects IR light modulated at 38KHz it’s output 
goes low. This sensor is ideal for detecting signals from a universal TV remote or IR navigation beacons.  If 
two or more robots need to communicate with each other then this sensor could receive data from another 
robot that was modulating it’s IR LEDs at 38KHz. 

Colour sensing:

This robot uses a Red, Green, Blue (RGB) LED and a Light Dependant Resistor (LDR) to detect colour. 
Colour sensing is achieved by shining different colours of light onto an object. By measuring how much of 
each colour is reflected back the objects colour can be determined. In the sample software the voltage 
across the LDR is measured while shining red, green and then blue light onto the object. The voltage is also 
measured with the RGB LED off to get an ambient light reading which is subtracted from the red, green and 
blue readings so that the values represent the reflected light only.

The sample software then compares the red, green and blue values to the average value to provide a simple 
3 bit result. This is not the most accurate method and should be refined if precise colour matching is 
required. As the red, green and blue elements of the RGB LED are driven by PWM outputs the sensor can 
be easily calibrated.

13

Summary of Contents for MR. Tidy

Page 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...

Page 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...

Page 3: ...Main board Features 3...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Reviews: