Home
Activity manual version 1.0 Standard
Contents
1. POP BOT will read the sensor detection value in each step and show on the SLCD16x2 screen After checking all 9 positions the controller will select the highest value as result Because sensor gives the highest value at target position Thus the result of this activity is POP BOT can detect the right direction of target object A17 1 Open the Arduino IDE and create the sketch code from Listing Al 7 1 Al 2 Set the POP BOT into Program mode Upload the sketch to the robot A17 3 Disconnect the download cable A17 4 Set the target object position For example 67 5 degree angle and 15 cm far from POP BOT 124 POP B
2. After that controller will select the highest value position to shows on SLCD Screen as follows Va POP BOT The Arduino Compatible Mobile Robot kit e 127 Activity 18 POP BOT Ball seeker This activity is modified from Activity 17 We apply the code fo real world application The POP BOT moves and seeks the target object the ball The mission will be complete when POP BOT moves to the ball position stop and beep A18 1 Open the Arduino IDE and create the sketch code from Listing A18 1 A18 2 Set the POP BOT into Program mode Upload the sketch to the robot A18 3 Disconnect the download cable A18 4 Set the target object position freely on the field Place the POP BOT on the field Turn on and observe operation POP BOT starts with driving the servo motor to seek the ball The seeking is similar the Activity 17 operation but faster and do not display the value to SLCD POP BOT will move to direction that gives The sensor value maximum If fhe sensor value is lower than 20 it s mean no any object on this direction POP BOT will turn around to change the opposite direction Addition POP BO
3. E 9 amp 4 12Vdc p e268 s 1 Press and hold RESET black switch BIN og NE T 2 Press and hold BL white switch r e E o B s JH B ee sees co elle POP BOT 2 1 4 Release the RESET switch 2 1 5 Release the BL switch following If Blue LED on POP 168 is turned on and not blink then POP 168 had entered Bootloader mode and ready to uploaded 3 Release RESET black switch 4 Release BL white switch 5 Blue LED on the POP 168 module B oe P is turned on Indicates POP 168 is me BAR RU entered to Program mode POWER POP BOT 40 POP BOT The Arduino Compatible Mobile Robot kit 2 2 Use POWER T swtich on RBX 168 board and BL switch on POP 168 module 2 2 1 Turn off the POP BOT 2 2 2 Press and hold BL switch 1 Turn off POWER switch ZEBRA ooo00 oz222 oloo9929 a Sim ina o POWER BAT sy LAKE 2 Press and hold BL white switch POP BOT 2 2 3 Turn on fhe POWER s
4. Check lost object condition if Maximum lt 20 Spin Right 150 delay 600 T Turn around if value lt 20 else if Maximum gt 280 Check ball position Servo Move PosValue MAX Point Beep Beep to finish while 1 else switch Position Seeking routine case 0s Spin Right 200 delay 320 Forward 200 delay 400 Maximum break case I Sprn Right 200 delay 240 Forward 200 delay 400 Maximum break case 23 Spin Right 200 3 delay 160 Forward 200 delay 400 Maximum break Gase 3 Spin Rrzghui200 delay 80 Forward 200 delay 400 Maximum break POP BOT The Arduino Compatible Mobile Robot kit e 129 case 4 Forward 200 delay 400 Maximum break Case 5 Spin Left 200 delay 80 Forward 200 delay 400 Maximum break case 6 Spin Left 200 delay 160 Forward 200 delay 400 Maximum break case Fs Spin Letti200 j delay 240 Forward 200 delay 400 Maximum break case 8 Spin Lefti200 j delay 320 Forward 200 delay 400 Maximum Calculate the selected position int MAX Point int 1 Old 0 max_ for i 0 i lt 9 i 1 if GP2 i gt Old Old GP2 i max 1 j j Maximum Old return max Servo position control void Servo Home Servo Move 460 Servo Move 460 Servo Move 460 Servo Move 460 void Servo Move int val
5. int i for i 0 i lt 5 i digitalWrite 7 HIGH f Set port 7 to Servo output port delayMicroseconds val Positive pulse delay digitalWrite 7 LOW delay 20 Negative pulse delay 130 POP BOT The Arduino Compatible Mobile Robot kit void Forward int speed analogWrite 3 speed digitalWrite 5 LOW analogWrite 6 speed digitalWrite 9 LOW void Motor Stop digitalWrite 3 LOW digitalWrite 5 LOW digitalWrite 6 LOW digitalWrite 9 LOW j void Spin Left int speed analogWrite 5 speed digitalWrite 3 LOW analogWrite 6 speed digitalWrite 9 LOW void Spin Right int speed analogWrite 3 speed digitalWrite 5 LOW analogWrite 9 speed digitalWrite 6 LOW Beep function void Beep int i for i 0 1 lt 600 1i digitalWrite 14 HIGH delayMicroseconds 150 digitalWrite 14 LOW delayMicroseconds 150 Listing A18 1 BallSeekerRobot pde file the Arduino sketch file for POP BOT to seek and catch the ball
6. S EE K K K k k ke k k ek khe ke khe kk hehe ke ke ke k k ke kk he e ke k k kk ke ke k k k k ke k k k ke k k k ke k k k k k k k k k k k k k k k k k k k k k k k ke ke k k k POP BOT V1 0 Running Forward Backward Full Speed kk ke RR A ke ke ke khe ke ke kk ke ke kk ke ke ke kk RII IR III RI III ke ek kk heck RII III I ke ke ke void setup pinMode 3 OUTPUT pinMode 5 OUTPUT pinMode 6 OUTPUT pinMode 9 OUTPUT Motor A1 Motor A2 Motor B2 Motor B1 NVS VN void Forward Robo Spinner Go Forward Rountine digitalWrite 3 HIGH digitalWrite 5 LOW digitalWrite 6 HIGH digitalWrite 9 LOW j void Backward Robo Spinner Go Backward Rountine digitalWrite 3 LOW digitalWrite 5 HIGH digitalWrite 6 LOW digitalWrite 9 HIGH void loop Forward delay 1000 Backward delay 1000 Koko kok kk ee ke kk ek khe ke kk ek ke ke kk ke ke kc kk ke ke kc kk ck kk ke ek ke ke ke ke ke e e ke ke e e Listing A1 1 Forward Backward pde file the Arduino sketch file for driving POP BOT to forward and backward direction 46 POP BOT The Arduino Compatible Mobile Robot kit Activity 1 2 Circle shape movement control With setting the different speed for each motor it cause the robot move in circle shape You can try with
7. We can use the PWM signal from analogWrite function to adjust the LED brightness or amplify to drive the DC motor The Arduinois pin that assigned to PWM output will out the PWM continue until do the analogwriteQ function in new period or excecute digitalkead and digitalWrite funtion at same pin Arduino POP 168 module has 4 analog output pins it includes pin 3 5 6 and 9 Di3 Di5 Di and Di9 The analogWrite function fornat is analogWrite pin value hus pin as The Arduino s port pin 3 5 and 9 value as Duty cycle value 0 fo 255 POP BOT The Arduino Compatible Mobile Robot kit 45 Activity 1 POP BOT basic movement Activity 1 1 Forward and Backward movement AT 1 Open the Arduino IDE and create the sketch code from Listing Al 1 A 2 Set the POP BOT into Program mode Upload the sketch to the robot Al 3 Turn off power and Remove the download cable A1 4 Make sure the robot is on a flat surface Turn on the power and observe the operation The POP BOT moves forward See both LED motor indicators light in green color Affer 1 second both indicators change color to red and the robot moves backward If This is incorrect you will need to re connect the motor cable to its opposite port polarity Do this until your robot moves correctly Once ifs done Use this motor port configuration for all your programming activities from now on The robot will move forward and backward continually until you turn off its power
8. o o oe o 1 Gane sat cursor wont be shifted D O Display OFF 1 Display ON 5 Display Setting EM O Cursor OFF 1 Cursor ON DRESS B O Cursor not blink 1 Cursor blink 6 Shift Display R L S C O Cursor shift 1 Display Shift R L O Left shift 1 Right shift 8 Set CGRAM Address N 0 1 8 Duty 1 1 16 Duty 9 Set DDRAM not recommend to set this bit Address use jumper setting instead F 0 5x7 dot size 1 5x10 dot size Standard instrction command set summary except Initial LCD is addition command A0 to A7 are CGRAM or DDRAM Address Initialize make I D 1 S 0 D 1 C20 B 0 N21 F 0 DDRAM Address 00 Serial input timing diagram meyr se oo pr o2 oo 04 os ne 07 stop a T Processing time T 5 ms P MIN Figure 6 2 SLCD16x2 command summary and timing diagram 56 POP BOT The Arduino Compatible Mobile Robot kit 6 1 5 LCD Characters Most of the LCD characters Figure E cannot be changed because they are stored In the ROM However the first eight symbols corresponding to ASCII O through 7 are stored in the RAM By Writing new values to the character generator RAM CGRAM you can alter these characters as you want in 5x8 dots size 00h 20h 30h 40h 50h 60h 70h DOh EOh FOh 0 32 40 48 56 64 72 80 88 96 104 112 120 160 168 176 184 192 200 208 216 224 232 240 248 i NOTE Custom characters occupy ASCII 0 7 ASCII 8 15 repeat the custom characters ASCII 128 159 are used for Extended Mode
9. the PWM duty cycle is 20 Motor will rotate with lowest speed because the voltage drop is only 0 9V When increase the duty cycle in Figure 5 2 B and C voltage is applied to DC motor increase Its speed is increase foo In Figure 5 2 D the voltage is applied to DC motor full level because duty cycle is 10076 Thus controlling the PWM duty cycle is a method of motor speed control POP BOT The Arduino Compatible Mobile Robot kit 43 5 2 Arduino with PWM Arduino has a special function to generate PWM signal and outs to any digital pins It is analogWriteQ User can adjust PWM duty cycle from 0 to 100 with value between 0 to 255 AT value 0 no PWM signal is occured Voltage output as OV At value 51 Ihe PWM signal has positive pulse width 20 of period The duty cycle is equal to 2076 At value 127 The PWM signal has positive pulse width half of period The duty cycle is equal to 5076 At value 191 The PWM signal has positive pulse width 75 of period The duty cycle is equal to 7576 At value 255 The PWM signal has full positive pulse width The duty cycle is equal to 100 The figure 5 2 shows the PWM signal at any duty cycle Figure 5 2 shows the PWM signal at any duty cycle 44 POP BOT The Arduino Compatible Mobile Robot kit Output voltage of PWM signal is average value relate the duty cycle You can calcualte from this relation below Outout voltage on time off time max voltage
10. 4 to 30 cm e 4 5 To 5 V power supply and 33mA electric current e Ihe output voltage range is 0 4 to 2 4V when supplied by 5V GP2D120 Infrared Ranger module has 3 terminals Power input Vcc Ground GND and Voltage output Vout To read the voltage values from the GP2D 120 you must wait till after the acknowledgement period which is around 32 to 52 9 ms The output voltage of GP2D120 at a range of 30 cm and 5V power supply is between 0 25 to 0 55V with the mean being 0 4V At the range of 4 cm the output voltage will change at 2 25V 0 3V 14 POP BOT The Arduino Compatible Mobile Robot kit 1 5 POP BOT cable information The POP BOT mobile robot kit includes some signal cables for the interfacing between the controller board sensor module and the computer They includes the JST3AA 8 cables for interconnection to the sensor module UCON 4 the USB to RS 232 converter cable for interfacing with the computer 1 5 1 JST3AA 8 cable This is an INEX standard cable 3 wires combined with 2mm The JST connector is at each end 8 inches 20cm in length Used for connecting between microcontroller board and all the sensor modules in the POP BOT robot kit The wire assignment is shown in the diagram below 2mm pitch 2mm pitch GND i i al G SData m k Ei 1 5 2 UCON 4 USB to Serial port converter cable This is used to connect between the computeris USB port and the RBX 168 controller board The cable s end
11. 5 to 13 5Vdc e 2 Servo motor output connect with the digital port 7 Di7 and 8 Di8 e Piezo speaker connections do not show in the figure 1 2 it is fixed at bottom circuit board of RBX 1689 board It is connected with POP 168 AnO Dil4 pin RS 232 port support the USB to serial converter cable l Motor indicator Supply voltage terminal POWER switch E DC motor output 14 Speaker 3 MotorA1 5 MotorA2 9 MotorB1 6 MotorB2 POWER indicator POWER Low battery Program mode button as id on the Arduino POP indicator EEG Q e module gt 2 2 Arduino POP 168 S ze lt RESET univeral port E S Port function _ B O Number Digij al gt Ax Analog pih x A6 A7 RESET switch Servo motor output o SERVO PORT leo e o LED and Button for demonstration I O interfacing O O O O O O O O O O O D ooo0000000000 Analog input Arduino POP 168 module Figure 1 2 The layout of RBX 168 controller board The Arduino Compatible Mobile Robot kit 9 POP BOT O ON LNO 32 ol zs GND o COAUAS pa uA o OTY GT dN9 1X3 d 0cc A vd OSPIdON 0899Sq4 CONHIS 8Id OT gu A or QN fol toauas 2 WAt T 6X TOAYAS ZIC Jo A d YOLOW O AE9 T O B Em m g T tuts Te Je uM E 4 zia MT Fs JeF i jaa S er WE ORC OE 9 Ae Ou a31 WMd 61C aie HIQ 8 YOLOW 02 9q31 GY O HIG V HOLOW III E O l OD o ZN id a As o Fo
12. 90 deg Right90 else it Cnb 3 Cntbs 6 nts 4 Check for turning left 180 deg Left180 else else turn left 90 deg Left90 POP BOT The Arduino Compatible Mobile Robot kit 89 Turn right 90 degree function void Right90 Forward 150 delay 50 Spin Right 200 delay 100 while analogRead 6 lt Ref delay 50 Turn left 90 degree function void Left90 Forward 150 delay 50 Spin Left 200 delay 100 while analogRead 7 lt Ref delay 50 Turn left 180 degree function void Left180 Spin Left 200 delay 300 while analogRead 7 lt Ref delay 50 Movement function void Forward int speed analogWrite 3 speed digitalWrite 5 LOW analogwrite 6 speed digitalWrite 9 LOW void Spin Left int speed analogwrite 5 speed digitalWrite 3 LOW analogwrite 6 speed digitalWrite 9 LOW void Spin Right int speed analogwrite 3 speed digitalWrite 5 LOW analogwrite 9 speed digitalWrite 6 LOW void Motor Stop digitalWrite 3 LOW digitalWrite 5 LOW digitalWrite 6 LOW digitalWrite 9 LOW Listing A12 1 WhiteLineDetect pde file the Arduino sketch file for POP BOT moves along the white line and detects junctions to piering the ballon at the destinations 90 POP BOT The Arduino Compatible Mobile Robot kit A12 4 Place the POP BOT at the S
13. Ctrl At Startup v Minimum Read Timeout msec 0 O Minimum Write Timeout msec 0 8 Go back to the USB Serial Port Properties Now the COM port number at the title bar will change to COMA Click on The OK button USB Serial Port COM4 Properties 2 leg m General Port Settings Driver Details Bits per second Data bits 8 Parity Stop bits Flow control 9 Remove the UCON 4 cable from USB port and re plug again Check the USB serial port address The new address must be COMA Now the UCON 4 cable ready for using with Arduino IDE software 36 POP BOT The Arduino Compatible Mobile Robot kit 4 2 Getting start POP BOT with Arduino Run Arduino IDE by clickng the Start gt All Programs gt POP 168 Software Package gt Arduino The first launch of Arduino show the screen below Ell Arduino 0011 Alpha CO 5i 4 2 1 ARduino POP 168 hardware configuration 4 2 1 1 Select microcontroller chip select the menu Tools gt Board gt POP 168 or Arduino Mini can use both versions Bl Arduino 0011 Alpha File Edit Sketch Tools Help Auto Format Ctrl T Copy for Forum Archive Sketch Board Arduino BT Serial Port Arduino NG or older vw ATmega Burn Bootloader Arduino NG or older w ATmegal 6s POP 168 n Arduino Mini Arduino Diecimila LilyPad Arduino POP BOT The Arduino Compatible Mobile Robot ki
14. Robot kit 119 11 POP BOT object seeking ability From chapter 10 we learn about how to control servo motor with our POP BOT The important factor is SoffwaresServo library In this chapter will concentrate about servo motor control and sensor reading application The sensor that is used in this chapter is CP2D120 We will modify POP BOT to Object seeking mobile robot 11 1 POP BOT modification to Object seeking mobile robot 11 1 1 Additional part list ot n3 ss gt Straight joiner x 4 3x15mm screw x2 3x10mm screw x 4 gY 0O 2mm self tapping 3mm nut x 4 GP2D120 with cable Right angle joiner x2 screw x 2 W 10mm plastic spacer x 2 33mm metal spacer x 2 Standard servo motor 120 POP BOT The Arduino Compatible Mobile Robot kit 11 1 2 Modify procedure 1 Remove all sensors from POP BOT chasis Now we have the simplest form of the POP BOT mobile robot 2 Remove the servo horn Attach 2 of 33mm metal spacers and 10mm plastic spacers with both mounting holes of servo motor by using 3xl5mm screws following the photo that is shown below Servo mounting hole 33mm metal spacer 10mm plastic spacers 3x15mm screw 3 Mount the servo motor that is attached spacers from step 2 with the robot chasis at the front by using 3x10mm screws Tighten the screws from bottom POP BOT The Arduino Compatible Mobile Robot kit e 121 4 Attach 2 pieces of Straight joiner with the
15. a more human readable layout Auto Format was previously called Beautify e Archive Sketch Compress the current sketch to the zip file e Export Folder Open the folder that contain the curretn sketch e Board Choose the Arduino hardware For POP BOT choose POP 168 or Arduino Mini e Serial Port Allows to select which serial port to use as default for uploading code to the Arduino I O Board or monitor data coming from it The data coming from the Arduino I O Board is printed in character format in the text area region of the console 3 3 5 Help This menu contains many information in HTML format for supporting the Arduino user e Getting Start Opens the How to start Arduino e Troubleshooting Suggest the solution when meet the problem in Arduino e Environment Describe about Arduino environments e Reference Opens the reference in the default Web browser Includes reference for the language programming environment libraries and a language comparison e Frequently Asked Question See the popular question and answer about Arduino e Visit www arduino cc Opens default Web browser to the Arduino homepage e About Arduino Opens a concise information panel about the software POP BOT The Arduino Compatible Mobile Robot kit 29 3 4 Tools bar Verify Compile Checks your code for errors Stop Stops the serial monitor or unhighlight other buttons New Creates a new sketch Open Presen
16. any object at the front of the robot and see its operation The robot will check the distance of the object in 8cm range If not any obstacle robot will move forward continue If found the object if will move backward turn left and move forward again Es bo EUM Be Ue Z LY 7 SS E 5 e SERE backward Spin left 108 POP BOT The Arduino Compatible Mobile Robot kit a ee k k k k k k k k k k k k k k k k k k k k k k k k k ke k k k k k k POP BOT V1 0 Filename TouchlessObjectRobot pde kk kk K k kk khe k kk ke ke ek ck ke ke ek ke k ke kk ke k ke k k ke k k k k ke k k k k k k k k k k k k k k k k k k kk kk k kk kkk ke ke ke ke ke ke ke ke eee int dp void setup pinMode 3 OUTPUT sets the digital pin as output pinMode 5 OUTPUT pinMode 6 OUTPUT pinMode 9 OUTPUT void Forward int speed analogWrite 3 speed digitalWrite 5 LOW analogWrite 6 speed digitalWrite 9 LOW void Backward int speed analogwrite 5 speed digitalWrite 3 LOW analogwrite 9 speed digitalWrite 6 LOW void Spin Left int speed analogWrite 3 speed digitalWrite 5 LOW analogwrite 9 speed di
17. by Arduino POP 168 microcontroller module Based on ATmegal 8 microcontroller e Programmable via serial port and support the USB to serial port converter e Support variety of sensors such as Infrared refelctor for line tacking Touch sensor for object avoiding Infrared ranger or Distance sensor for touchless object avoiding e Support the wired remote control included PlayStation controller e Support the wireless serial data communication module suhc as Xbee XBee Pro and Bluetooth e Includes 16x2 Serial LCD module for monitoring and display operting status e 2 Servo motor driver port Support small RC servo motor 4 8 to 6V e Requires 4 of AA batteries The Alcaline Evolta and Rechargeable Ni MH are recommendded 20 POP BOT The Arduino Compatible Mobile Robot kit 2 2 Part list RBX 168 board with POP 168 x1 Box holder x 1 Circle wheel and tire x 2 DC motor gearbox x 2 33mm metal spacer x 4 Serial LCD module x 1 te GP2D120 distance sensor x 1 Infared reflector x 2 au V M 2mm self tapping screw x 2 Right angled metal Plastic joiners shaft 2x2 x2 m7 PEERI LEE bm 9 m iii Plastic spacer set Screw and Nut set POP BOT The Arduino Compatible Mobile Robot kit e 21 2 3 Buiding procedure 1 Attache both DC motor gearboxes with the Box holder by 3x8mm flat screws 3x8mm flat screws 3x8mm flat screws 2 Attache 2 of 33mm metal s
18. can adapt the POP BOT to edge detection Start assembling the mechanical parts place the sensors in the right position and create the Arduino sketch for the table surface testing 8 1 Additional part list uj n9 K Em n e 3x10mm screw x 4 3mm plastic spacer x 2 12 hole Straight Joiner x 2 3mm nut x 4 8 2 Modify procedure 1 Remove all Touch sensors and Line tracking sensors from the POP BOT chasis Now we have the simplest form of the POP BOT mobile robot 94 POP BOT The Arduino Compatible Mobile Robot kit 2 Attach the ZX 03 Infrared reflector sensor with 12 hole Straight joiner at the first hole by using 3x10mm screw 3mm plastic spcaer and 3mm nut following the photo is shown below Do 2 sets of these first hole 12 hole Straight joiner 3mm nut 3mm spacer ZX 03 Infrared reflector sensor 3 Fix both sensor structures from step 2 at the left and right hand side of front of POP BOT chasis by using 3x10mm screws and 3mm nuts following the photo below Next connect the left sensor cable to A7 port and right sensor to A6 port You can adjust the sensor arm position To suite your conditions Photo shows the sensor connections on POP BOT Sensor arm controller board POP BOT The Arduino Compatible Mobile Robot kit 95 Activity 13 POP BOT Edge detection This activity demonstrates this interesting behaviory POP BOT moves on the table and never drop off from the table
19. from Listing A16 1 Al6 2 Set the POP BOT into Program mode Upload the sketch to the robot A16 3 Disconnect the download cable A16 4 Connect the standard RC servo motor to SERVO PORT 7 or 8 of POP BOT controller board STANDARD SERVO MOTOR A16 5 Turn on the POP BOT See its operation After power on Servo motor is driven by POP BOT The horn motion is moving from last left to last right position and back fo last left position continally POP BOT The Arduino Compatible Mobile Robot kit e 115 J EF K K K k k k k k k ee ek ke ke ke ke ke ke khe kk k k k k ke k k k k k k k k k k k k k k k k k k k k k k k k k k k ke ke k k k POP BOT V1 0 Filename SimpleServo pde Simple servo motor controlling Kk A RA kk ke ke kk ke hee kk k ke kk ke ke ke kk RII I ke ke ek ke ke ke kk khe ke kk heck IIIA I ke ke ke ke ke ke e int 1 void setup Servo Motor pinMode 8 OUTPUT Servo Motor pinMode 7 OUTPUT Servo Motor void loop for i 0 i lt 100 i digitalWrite 7 HIGH digitalWrite 8 HIGH delayMicroseconds 500 digitalWrite 7 LOW digitalWrite 8 LOW Set Servo Di7 j Set Servo Di8 z Positive Delay delay 20 Negative delay j for 1 0 1 lt 100 i digitalWrite 7 HIGH Set Servo Di7 digitalWrite 8 HIGH Set Servo Di8 delayMicroseconds 2300 Positive delay digitalWrite 7 LOW digitalWrite 8 LOW delay 20 Negative d
20. gives POP BOT the ability for distance measurement and obstacle detection using an infrared light Your POP BOT can avoid obstacles without having to make any physical contact 9 1 1 GP2D120 features e Uses Infrared light reflection To measure range e Can measure a range from 4 to 30 cm e 4 5 to 5 V power supply and 33mA electric current e Ihe output voltage range is 0 4 to 2 4V when supplied by 5V Output voltage V Infrared LED transmitter Infrared Receiver GP2D120 Vout GND Vcc 0 supply fo 0 4 8 12 16 20 24 28 32 Distance cm 38 3 9 6 ms Use Kodak R 27 gray white Pe peers ae ee paper The white side has a 9095 reflection rate made Not stable 1st output Y 2nd output S n output aa GEI P from a material that reflects light for range measurement Figure 9 1 GP2D120 pin assignment operation and characteristic curve 100 POP BOT The Arduino Compatible Mobile Robot kit GP2D120 Infrared Ranger module has 3 terminals Supply input Vcc Ground GND and Voltage output Vout To read the voltage values from the GP2D120 you must wait until after the acknowledgement period which is around 32 to 52 9 ms The output voltage of GP2D120 at a range of 30 cm and 5V power supply is between 0 25 to 0 55V with the mean being 0 4V At the range of 4 cm the output voltage will change at 2 25V 0 3V 9 1 2 How the IR Ranger Module works Measuring range can be done in many ways The e
21. hole of CP2D120 module by using 3x10mm screws and 3mm nuts 5 Attach 2 pieces of Right angle joiner with the servo horn at the inside hole position by using 2mm self tapping screws 6 Connect the GP2D120 structure from step 4 at the end of Right angle joiners Ww 7 Attach the GP2D120 and servo horn structure from step 6 with servo shaft Tighten it with a servo screw 122 POP BOT The Arduino Compatible Mobile Robot kit 8 Connect the servo motor plug to Servo out port 7 Be sure the servo motor plug correctly Lastly connect GP2D120 to 19 SCL A5 port of POP BOT POP BOT The Arduino Compatible Mobile Robot kit e 123 Activity 17 POP BOT Object seeking This activity demonstrates how to seek an object by moving the servo motor Ihe POP BOT that is attached the GP2D120 with servo motor horn will move the servo and check the distance from sensor to the target object There is 9 steps in moving and checking following the illustration below a Position A t S a o
22. k k k k k k k k k e k k k k k k ke k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k POP BOT V1 0 Filename CrossingLineDetect pde POP BOT tracks the black line and beep when detect the crossing line K K A ke K k k ek ke ke k kk k ke ek k k ke ek ke k ke kk ke k ke k k ke k ke k k ke k k k k k k k k k ke e k kkk kkk kk kk kkk ke ke ke ke ke ke ke ke e ke eee int Ref 700 int Left Right int Cnts0 7 void setup pinMode 3 O0UTPUT pinMode 5 O0UTPUT Motor A2 pinMode 6 OUTPUT Motor B2 pinMode 9 OUTPUT Motor B1 pinMode 14 OUTPUT PIEZO Speaker Motor A1 OT NN NS void loop Left analogRead 7 Read value from left sensor Right analogRead 6 Read Value from right sensor if Left gt Ref amp amp Right gt Ref Both sensors detect the white surface Forward 150 else if Left Ref amp amp Right lt Ref Both sensors detect the black line It s mean crossing line Cnt Motor Stop for j 0 j lt Cnt j POP BOT The Arduino Compatible Mobile Robot kit 77 Beep delay 100 Forward 150 delay 100 else if Left lt Ref Left sensor detects the black line Spin LEEt 255 else if Right lt Ref Right sensor detects the black linek Spin Right 255 void Beep Beep routine int i for i 0 i lt 600 i digitalWrite 14 HIGH delayMicroseconds 150 digita
23. not limited to 8 servos but you must call the SoftwareServo refresh method at least once every 50ms or so fo keep your servos updating 10 2 1 Standard Methods attach int Turn a pin into a servo driver Calls pinMode Returns O on failure detach Release a pin from servo driving write inf set the angle of the servo in degrees O to 180 read return that value set with the last writeQ attached return if the servo is currently attached 10 2 2 Extra Methods refresh You must call this at least once every 50ms fo keep the servos updated You can call it as offen as you like if won t fire more than once every 20ms When it does fire it will take from 5 to 2 5 milliseconds to complete but won t disable interrupts setMinimumPulse uintl16 1 set the duration of the O degree pulse in microseconds default minimum value is 544 microseconds seiMaximumPulse uint16 1 set the duration of the 180 degree pulse in microseconds default maximum pluse value is 2400 microsconds http www arduino cc playground ComponentLib Servo POP BOT The Arduino Compatible Mobile Robot kit e 113 10 2 3 Safety Quirk Even though you attach a servo it won t receive any control signals until you send its first position with the writeQ method to keep it from jumping to some odd arbitrary value 10 2 4 Size The library takes about 850 bytes of flash and 6 8 x servos bytes of SRAM 10 2 5 Limitations This library do
24. of gray on paper and distances over a short range if the light in the room remains constant The suitable distance from sensor to line or floor is during 3 to 8 mm The output voltage is during 0 1 to 4 8V and digital value from10 bit A D converter is 20 to 1 000 Thus ZX 03 will suitable to apply to line tracking sensor TCRT5000 TCRT5000 OUT _ 510 High output voltage 510 Low output voltage Infrared LED Infrared LED Photo transistor Photo transistor i Wi Er White surface j M Black surface Figure 7 1 The operation of ZX 03 Infrared reflector sensor board with white and black surface 64 POP BOT The Arduino Compatible Mobile Robot kit 7 2 Line tracking activity preparation 7 2 1 Demonstration field component preparation All activities are described in this chapter use the imake your own demonstration fieldi They includes whte surface with black line and black surface with white line field You must make your own field using the items below not provided in this kit 1 Polypropylene board or PP board white and Black sheet Size is 90 x 60 cm However the sizing can change depending on your applications and resoucres 2 Black and white electrical tape 1 inches width 2 rolls per color 3M brand is recommended 3 Scissors or a Cutter 7 2 2 Set the reference value for line tracking activity with analogRead function POP BOT can detect the difference between lines and surface by reading the
25. speed digitalWrite 9 LOW void Spin Right int speed analogWrite 3 speed digitalWrite 5 LOW analogwrite 9 speed digitalWrite 6 LOW Listing A7 1 PingPong pde file the Arduino sketch file for Ping pong movement demonstration of POP BOT 72 POP BOT The Arduino Compatible Mobile Robot kit Programming concept The steps of programming in this activity are 1 Find the value between thwe white surface and black line 2 Read the sensor values and store to compare 3 Check the condition as follows Case 1 Both sensors detect the white surface Action Robot moves forward Case 42 Only the left sensor detectes the black line Action Robot spins right to change direction for moving to the black lines opposite side Case 3 Only the right sensor detectects the black line Action Robot spins leff fo change direction for moving fo the black lines opposite side Case 4 Out of 3 conditions above Action Up to programmer purpose 4 Back to step 2 A 5 Place the POP BOT on the Ping pong field Turn on the robot Observe the robot moverent In this program determine the turning time to 150 millisecond approximation It cause fhe turning angle see the illustration below Programmer can adjust the time value to make the suitable angle for control the movement path correctly If the time value is more the angle is narrow It cause the robot moves back to same path
26. this procedure as follows Al 5 Create a new sketch file and write the following C Codes shown in Listing A1 2 AT 6 Set the POP BOT into Program mode Upload the sketch to the robot A1 Tum off power and Remove the download cable A1 8 Make sure the robot is on a flat surface Turn on the power and observe the robot Ihe robot moves with circle shape continually until you press the button switch at Di4 pin of POP BOT controller board to stop the robot movement S 5 EK k K k ek k k ke k k kk ke ke ke ke ke k ke ke k k k e k k ke k k k ke k k k k ke k k ck k k k kk kk k k k k k ke k k k ck k k k k k k k k ke ke e e k ke k k POP BOT V1 0 Filename MotorSpeedControl pde Left Motor Lowspeed and Right Motor Highspeed Robo Spinner Run in Circle K K k kk k k ke k k k k kk k ke ke k k k k e k k k k kk k k k k k k k k k k k k k k kk kk k k kk kkk kkk kkk kkk kkk kk kkk ke ke ke kkk void setup f pinMode 3 OUTPUT Ilf Motor AI pinMode 5 OUTPUT Motor A2 pinMode 6 OUTPUT Motor B2 pinMode 9 OUTPUT Motor B1 pinMode 2 INPUT Switch Left pinMode 4 INPUT Switch Right e j void Forward int Lspeed int Rspeed analogWrite 3 Lspeed 2 digitalWrite 5 LOW analogWrite 6 Rspeed digitalWrite 9 LOW void Motor Stop digitalWrite 5 LOW d
27. white surface the black line the black line From all scenarios you can make the C program as follows in the listing A8 1 A8 1 Open the Arduino IDE and create the sketch code from Listing A8 1 A8 2 Set the POP BOT into Program mode Upload the sketch to the robot A8 3 Disconnect the download cable 74 POP BOT The Arduino Compatible Mobile Robot kit a ke khe ek ke ke kk ke ke ke ke kk ke ke k ke ke kk che ek k e k ke k k kok k kok k k k k k ke k k k k k k k k k k k k k k k k k k ke k k k k k k POP BOT V1 0 Filename SimpleLineTracking pde POP BOT tracks the black line kkkkkkkkkkkkkkkkkkkkkkkkkkkkk kkk kkk kk kkk kkk kk kkk kkk kkk kkk kkk kkk kkk kk kkk kkk kk kkrk int Ref 500 int Left Right void setup f pinMode 3 OUTPUT pinMode 5 OUTPUT pinMode 6 OUTPUT pinMode 9 OUTPUT Motor A1 Motor A2 Motor B2 Motor B1 NVS V void loop Left analogRead 7 Read value from left sensor Right analogRead 6 Read value from right sensor if Left gt Ref amp amp Right gt Ref Both sensors detect white surface Forward 150 else if Left Ref Left sensor detects black line Spin Blerti250 else if Right lt Ref Rightt sensor detects black line Spin Right 250 void Forward int speed analogWrite 3 speed digitalWrite 5 LOW analogwrite 6 speed digitalWrite 9 LOW j void Spin Left int speed analogwrite 5 speed d
28. 1 3 Disconnect the download cable 84 POP BOT The Arduino Compatible Mobile Robot kit kok kok k kok k ee ke k k kk che ek k ek k k k k k kk k k k k kk k kk k k k k k k k k k k k k k kc k k k e k k k k POP BOT V1 0 Filename MultiCrossingLineDetect pde POP BOT move following the line and check the crossing line to do complex movement He AA I ke kk I IK KI ke ok ke ke ke khe ke KKK KKK khe o kok KKK KK KK KKK KKK KK IKK k KK KK RK KK KK int Ref 700 int Left Right int Cnt 0 void setup f pinMode 3 OUTPUT pinMode 5 OUTPUT Motor A1 pinMode 6 OUTPUT Motor A2 Motor B2 Motor B1 pinMode 9 OUTPUT T PIEZO Speaker pinMode 14 O0UTPU void loop while Cnt lt 11 Left analogRead 7 Read value from the left ZX 03 sensor Right analogRead 6 Read value from the right ZX 03 sensor if Left Ref amp amp Right lt Ref Found crossing point Cross else if Left gt Ref amp amp Right gt Ref Move across the line a short while Forward 150 else if Left Ref Only left sensor detects the black mes Spin Left 150 Spin left a short while else if Right lt Ref Only right sensor detects the black Spin Right 150 Spin right a short while Forward 200 delay 200 Spin Left 200 Turn around delay 2000 Motor Stop Beep while 1 void Cross Cnt if
29. 2 Motor B2 Motor B1 Read value from the left ZX 03 sensor Read value from the right ZX 03 sensor Both sensors are on the table Both sensors out of the table Only the left sensor outs of the table Only hte right sensor outs of the table Listing A13 1 EdgeDetect pde file the Arduino sketch file for POP BOT detect and move on the table POP BOT The Arduino Compatible Mobile Robot kit 97 2 The left sensor is out from talbe s edge POP BOT moves backward and spin right then moves forward again 3 The right sensor is out from talbe s edge POP BOT moves backward and spin leff then moves forward again zarmpatible The Arcduinc POP EOT robot kil monie POP BOT The Arduino Compatible Mobile Robot kit e 99 9 POP BOT touchless object avoiding 9 1 GP2D120 4 to 30cm Infrared distance sensor From chapter 7 we have many examples about interfacing the Infrared reflector sensors They are one kind of analog sensor In this chapter we will concentrate in interfac ing with another analog sensors It is Infrared distance sensor or Infrared ranger GP2D120 We have some of example about using this sensor and applications One of the special sensors in robotics is the Infrared Distance sensor Some people call it the IR Ranger With the GP2D120 module it
30. 2 Edit The Edit menu provides a series of commands for editing the Arduino files e Undo Reverses fhe last command or the last entry typed e Redo Reverses the action of the last Undo command This option is only available if there has already been an Undo action e Cut Removes and copies selected text to the clipboard e Copy Copies selected text to the clipboard e Paste Inserts the contents of the clipboard at the location of the cursor and replaces any selected text e Select All Selects all of the text in the file which is currently open in the text editor e Find Finds an occurance of a text string within the file open in the text editor and gives the option to replace it with a different text e Find Next Finds the next occurance of a text string within the file open in the text editor 28 POP BOT The Arduino Compatible Mobile Robot kit 3 3 3 Sketch This menu provides a series of commands for compile the code and manage library e Verify Compile Verify and compiles the code e Stop Stops current activity e Add file Opens a file navigator Select a code files to add it to the sketches data directory e Import Library Import the addition library e Show Sketch folder Opens the directory for the current sketch 3 3 4 Tools This menu provides commands about tools for developing the Arduino sketch and setting up the Arduino hardware e Auto Format Attempts to format the code into
31. 2K Windows XP and Windows Vista are registered trademarks of the Microsoft Corporation All product and service names mentioned herein are the trademarks of their respective Owners POP BOT The Arduino Compatible Mobile Robot kit 3 Contents 1 POPBAO BOT S da azsuzataaa ATT 5 2 x Bulang 2 O BO FIO ONS TODO aaa dc 19 S 9 0 Glee pa or 95 AOA DE EE 25 4 POP BOT program development by ArdUlno lt lt lt lt lt lt lt lt eczcc lt lt cczz 3 gt d POPSBOT MOVeSMen ccm aaa r dadaadada dada 4 OO POPSBOT Nitin SSG LED zao initia heme afecotandu ue deu am tret 53 Z POPBOT MS MOCO me E T T TIT 63 9 UE eo Ke i olopnte e ULT 93 2 POP BO MOUCIICSS ODIO TOMVOLI I asset etes o matt ha oat ctu ntes ta os dip enoni MUN Sedi 99 16 POP BOSS VO MOTO GC IV idos tn thnk thet dd a hooodne 109 U POP5BOLOPSC SSK GBM casa Eta Aston EU Nach um DR re dutttu buo donati i 119 1 1 POP BOT The Arduino Compatible Mobile Robot kit e 5 POP BOT part list Part list of POP BOT mobile robot kil 1 POP 168 The Arduino mini compatible microcontroller module RBX 168 Robot controller board with 4 AA battery holder switch module with JST cable 2 sets Infrared Reflector board with JST cable 2 sets 2 3 4 5 GP2D120 Infrared distance sensor with JST cable 6 Serial LCD 16 characters by 2 lines module with LED backlight and cable 48 1 ratio 4 5V DC motor gearbox with IDC cable 2 sets 8 Standard servo
32. 8 cable has the both ends as 2 00mm housing It will be connect to JST connector of any port of POP BOT controller board and the input connector of SLCD16x2 After connecting set all jumpers as follows i Select command mode to Standard ST Select the lines display to 16 digit per line 16 i Select baudrate to 9600 bps 96 Select the interface signal to Direct DD POP BOT The Arduino Compatible Mobile Robot kit 55 6 1 4 Data and Command sending Once the SLCD16x2 is properly connected and configured data and command can be sent serially For data sending you can send any message such as iHelloi via serial I O directly iHelloi message will be shown on your LCD For command sending you can send standard instruction set to LCD see Figure 8 2 and precede it with the instruction prefix character ASCII 254 OFE hex or 11111110 binary SLCD16x2 treats the byte immediately after prefix as an instruction then automatically returns to data mode An example To clear screen on LCD clear instruction is 00000001 binary or ASCII 1 send 254 and 1 to SLCD16x2 where parentheses in symbols mean single bytes set to these values j D7 D6 D5 D4 D3 D2 D1 DO Don t care bit 1 Initial LCD o o o o o o o o S O Automatic cursor shift after byte 1 Cursor not moved IMEEM o o o 3 yo O Aer byte decrease cursor position 1 After byte increase cursor position sua o
33. Arduino IDE and create the sketch code from Listing A10 1 Al0 2 Set the POP BOT into Program mode Upload the sketch to the robot A10 3 Disconnect the download cable A10 4 Make the border field following the illustration below Ihe white surface area is 90 x 60 cm and black line width is 1 inches 2 5 em 40 cm 70 cm POP BOT The Arduino Compatible Mobile Robot kit e 8 S EEK K Kk k k k ek k k k k k k k k ke k k ke k k k kk k ek k k k k ke ke k k k k k k k k k k k k ke k k k k k k k k k k k k k k k k k k k kk k k kk k k k POP BOT V1 0 Filename RightTurnLineTracking pde POP BOT move following the line and turns right 90 when detect the crossing line HA AK I KK KKK IKK KK KK KKK KK KKK KK KK KK KK KKK ko KKK KKK IK KKK KKK KKK k KKK KKK IK KKK KKK KKK KK KKK int Ref 700 int Left Right void setup pinMode 3 OUTPUT Motor A1 De pinMode 5 OUTPUT Motor A2 pinMode 6 OUTPUT Motor B2 pinMode 9 OUTPUT Motor B1 pinMode 14 OUTPUT PIEZO Speaker void loop Left analogRead 7 Read value from the left ZX 03 sensor Right analogRead 6 Read value from the right ZX 03 sensor if Left Ref amp amp Right lt Ref Detect the crossing line Right90 else if Left gt Ref amp amp Right gt Ref Over the line Forward 150 else if Left lt Ref Only the left sensor detects the black line Spin Lette 150 else if Right lt Ref Only t
34. By using 2 of infrared reflectors that are fixed at the front of robot you can detect the outer area of the table Itis similar to line tracking code If sensors detect the surface they will give a higher data Once the sensors are out of the table there is no infrared ray reflected from the surface to sensor and thus the return value from sensor will be low or near zero You can use this behavior to make the code to control the POP BOT to move on the table and detect the table s edge A13 1 Open the Arduino IDE and create the sketch code from Listing A13 1 Al13 2 Set the POP BOT into Program mode Upload the sketch to the robot A13 3 Disconnect the download cable A13 4 Place the POP BOT on the table You must remove all objects from the table Tum on POP BOT and observe the robotis movement POP BOT moves forward until fhe sensor out from the table s edge POP BOT will change the movement direction following These scenarios 1 Both sensors are out from table s edge POP BOT moves backward and spin right Then moves forward again 96 POP BOT
35. Centimetre unit LCD CMD 0x80 Select LCD first Line MySerial print RAW Data s Show raw data LCD CMD 0x8A MySerial print gp2 DEC LCD CMD 0xCO Select LCD second Line MySerial print Distance Show distance in Centimetre unit LCD CMD 0xCA MySerial print distance DEC LCD CMD OxCE MySerial print CM delay 200 j Program desciption 1 Initial the serial data communication Set 16 A2 pin to serial port 2 Loop to read the analog signal at An5 port of POP BOT controller board and display at SLCD screen 3 Convert raw data to distance data in centimetre unit by using this formular cm 2914 gp2 5 1 4 Convert the result to ASCII format and send to SLCD16x2 module for displaying 5 Loop to get data from GP2D120 every 0 2 second Listing A14 1 GP2D120 LCD pde file the Arduino sketch file for GP2D120 reading of POP BOT O L POP BOT The Arduino Compatible Mobile Robot kit 107 Activity 15 touchless object avoiding robot With the GP2D120 module it adds the distance measuring and Obstacle detection using infrared light feature to your robot Your POP BOT can avoid obstacles without having to make any physical contact A15 1 Open the Arduino IDE and create the sketch code from Listing A15 1 Al15 2 Set the POP BOT into Program mode Upload the sketch to the robot A15 3 Disconnect the download cable A14 4 Place the POP BOT on thefloor Try to place
36. Cne L U Motor Stop else if Cnt 8 Check for Forward Forward 200 delay 300 else 1E Cnt s8 Cnt 4 Crnt 10 941 Check for Turn right 90 degree Right90 else else Turn Left Left90 POP BOT The Arduino Compatible Mobile Robot kit e 85 Turn 90 degree function void Right90 Forward 150 delay 50 sp m Righti 290 5 delay 100 while analogRead 6 gt Ref delay 50 Turn left 90 degree function void Left90 Forward 150 delay 50 Spin Left 200 delay 100 while analogRead 7 gt Ref delay 50 void Beep int i for i 0 i lt 600 1 1 digitalWrite 14 HIGH delayMicroseconds 150 digitalWrite 14 LOW delayMicroseconds 150 void Forward int speed analogwrite 3 speed digitalWrite 5 LOW analogwrite 6 speed digitalWrite 9 LOW void Spin Left int speed analogwrite 5 speed digitalWrite 3 LOW analogwrite 6 speed digitalWrite 9 LOW void Spin Right int speed analogwrite 3 speed digitalWrite 5 LOW analogwrite 9 speed digitalWrite 6 LOW void Motor Stop digitalWrite 3 LOW digitalWrite 5 LOW digitalWrite 6 LOW digitalWrite 9 LOW Listing A11 1 MultiCrossingLineDetect pde file the Arduino sketch file for POP BOT moves along the black line and detects the crossing line to solving the Multtcrossing line mission 86 POP BOT The Arduino Compatible Mobile Rob
37. Command only LCD character set Built in character on HD44780A or SED1278F0A Create your symbols by pointing to the CGRAM location then write the first line whose bits form the desired pattern and point to next CGRAM adaress to write bits later Repeat this procedure until 8 times one character your character is ready to use now CGRAM 0 is located on CGRAM Address 0x00 to 0x07 CGRAM 1 on 0x08 to OxOF CERAM 2 on 0x10 fo 0x17 until CGRAM 7 on 0x38 to Ox3F See figure below Bitmap Layout Defining custom symbols Example Load arrow symbol on CGRAM 3 a program ee iat es odd Byte Values would send the following bytes to the SLCD controller binary decimal xxx00000 254 01011000 b 0 254 01011001 b 4 254 01011010 b 2 add 254 01011011 b 31 xxx11111 254 01011100 b 2 xxx00010 254 01011101 b 4 254 01011110 b 0 254 01011111 b 0 xxx00100 4 xxx00000 xxx00000 LJLILIL IL LI LILIE fj LILLE LI EEE IU POP BOT The Arduino Compatible Mobile Robot kit e 57 Standard LCD Instruction set Only the instruction register IR and the data register DR of the LCD can be controlled by the MCU Before starting the internal operation of the LCD control information is temporarily stored into these registers to allow interfacing with various MCUs which operate at different speeds or various peripheral control devices The internal
38. Each joiner can connect for lenght expansion They are 4 pieces of 3 sizes 3 5 and 12 holes type Total 12 pieces 1 6 6 Box holder It is injected plastic box for supporting The RBX 168 controller board It has some of 3mm hole for fixing with any platform POP BOT The Arduino Compatible Mobile Robot kit 17 1 6 7 Right angle metal shaft It is 7 5mm width right angle metal shaft Each shaft has 3mm hole for inserting the screw To fix with another structures The set includes 4 pieces of 1x2 2x2 and 2x5 holes metal shaft 1 6 8 Screw and Nut set Includes 2 of 2mm self tapping screws 4 of 3x8mm M3 screws 30 of 3x10mm M3 screws 4 of 3x15 mm M3 screws 4 of 3x40mm M3 screws 10 of 3x8mm flat head screws and 30 of 8mm M3 nuts i em intimi en 8000 9000 SISSY mg ry OOOO 0000 1 6 9 Metal spacer They are metal parts for supporting the plate and sensor board They are made from nikle plating metal Includes 6 of 33mm metal hexagonal spacers Each standoff has 3mm thread through hole 1 6 10 Plastic spacer They are some mechanical parts for supporting the plate and sensor board This kit includes 4 pieces set of plastic spacer 8mm 10mm 15mm and 25mm 4 sets LEEEG EEEE Ine Arduino ympatiole monie robot ki POP BOT The Arduino Compatible Mobile Robot kit 19 2 Building POP BOT mobile robot 2 1 POP BOT features e Move with DC motor gearboxes and wheels e Controlled
39. In the other hand the time value is less The robot should move out of the line or possible to moves parallel the lines with do not detect the lines 9 L POP BOT The Arduino Compatible Mobile Robot kit 73 Activity 8 Robot moves along the black line The robot moving along the line can be in 3 different scenarios 1 Both sensors read values that are white The robot will move forward Thus this program is written so that the robot moves forward normally 2 The left sensor detects the black line This occurs when the robot is slightly turned to the right Thus the program is written for the robot to move back left to resume its normal path 3 The right sensor detects the black line This occurs when the robot is slightly turned to the left Thus the program is written for the robot to move back to the right to resume its normal path Scenario 1 Scenario 2 Scenario 3 Both sensors detect Left sensor detects Right sensor detects the
40. M port not higher than COM Thus user must make sure the USB serial port address not higher than COMS If higher please do following procedure 1 Connect the UCON 4 cable to Computer USB port 2 Check the COM port address by clicking at Start gt Control Panel gt System 3 Select the Hardware tab and click on the Device Manager button 4 Check the hardware listing At the Port listing you will found USB Serial port COM x If COM port is higher than COM this example is COMIO please click on the right button mouse and select to Properties F Parts COM amp LPT E Communications Port COMI a Communications Port COM JH Printer Port LPT1 USB Serial Port COM10 SR Processors Update Driver e Sound video and game con Disable System devices Uninstall amp Universal Serial Bus controll Scan For hardware changes Properties Opens property sheet Far the current se 34 POP BOT The Arduino Compatible Mobile Robot kit 5 Ihe USB Serial Port COM10 Properties window will appear Select the Port Setting tab and set all value following the figure below and click on the Advance button USB Serial Port COM10 Properties General Port Settings Driver Details Bits per second Data bits r Panty Mane Stop bits E Flow control None Advanced j Restore Defaults Cancel 6 The Advanced Setting for COMIO will appear Cl
41. OT The Arduino Compatible Mobile Robot kit a k oko k ke ke k kok ke ke ke kk ke ke k kok kk k ek k ek k k k k k kk ke k k k k k k k k k k k k k k k k k k k k k k k k k k k e k k k k POP BOT V1 0 Filename SeekingObject pde Moves servo and seek object position to show the result on SCLD kk kk koe kk kkk kk kkk kkk kk kkk ke kk ke ke ke kk ke hee kk ke ke kk RR I ke ke kk kk kk kk kk IO ke ke ke ke ke ke ke e ke ke include SoftwareSerial h Hdefine rxPin 16 Hdefine txPin 16 SoftwareSerial MySerial SoftwareSerial rxPin txPin int PosValue 460 610 760 1050 1340 1500 1660 1940 2220 Servo position value int GP2 9 int j Maximum MAX Point void setup Jem ENO MERGE eee pinMode 7 OUTPUT Servo Motor pinMode 14 OUTPUT PIEZO Speaker pinMode txPin OUTPUT SLCD pin MySerial begin 9600 Communication With SLCD delay 1000 LCD Clear LCD Clear Screen void loop for j 0 j lt 9 j 1 Check 9 positions Servo Move PosValue j Move servo motor GP2 j analogRead 5 Read value from GP2D120 nop Clear LCD Show Text 0x80 Position LCD Show 0x89 j LCD Show Text 0x8A LCD Show 0x8D GP2 j Show value on SLCD delay 1000 MAX Point GET Point Servo Move PosValue MAX Point Move servo to target poition It is selected from the most of 9 sensor values LED Clear LCD Show Text 0x80 Selected Show maximum value LCD
42. POP BOT The Arduino Compatible Mobile Robot kit ok ok kok k oko k k k K k k k k k k k k k k K k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k ke k e k k k k POP BOT V1 0 Filename WhiteLineDetect pde POP BOT move following the line and check the junction to do complex movement for piering the ballon at the 3 destinations HA KI KK KK KK HK KK IK IK IK IK IK KK IK KKK KK KK KKK KKK KK KK IK IK IK IK IK KK IKK KKK oko KKK k k k k EKER EK EK EK int Ref 400 int Left Right int Cnt 0 void setup vA pinMode 3 OUTPUT Motor Al pinMode 5 OUTPUT Motor A2 pinMode 6 OUTPUT Motor B2 pinMode 9 OUTPUT Motor B1 pinMode 14 OUTPUT PIEZO Speaker void loop while Cnt lt 12 Left analogRead 7 Read value from the left ZX 03 sensor Right analogRead 6 Read value from the right ZX 03 sensor if Left lt Ref amp amp Right lt Ref Detect the black crossing line Cross else if Left gt Ref amp amp Right gt Ref Detect the white line Forward 150 else if Left lt Ref Only the left sensor detects the line Spin Ragne 450 4 Turn right else if Right lt Ref Only the right sensor detects the line Spin Left 150 Turn left j j while 1 Endless loop void Cross Cnt if Cne 12 4 Motor Stop else Xf Cnts 2 COntsslO Jf Check for turning right
43. Robot kit e 7 S EE KK K k k k k k k k k k k k k k k k ke ke k ke k ke k k k k e ke k k k k ke ke k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k ke ke k k ke ke k k k POP BOTV1 0 Filename PingPong pde POP BOT moves zigzag with 2 parallel lines kkkkkkk kkkkk kkk kkkkk kkkkkk kkkkkkkkkkkkk kkkkk kkkk kkkkkkkkkkkkkkkkkkkkkkkkkkk kkkkkkkx int Ref 500 int Left Right void setup pinMode 3 OUTPUT Motor Al pinMode 5 OUTPUT Motor A2 pinMode 6 OUTPUT Motor B2 pinMode 9 OUTPUT Motor B1 void loop Left analogRead 7 Read value from the left ZX 03 sensor Right analogRead 6 Read value from the right ZX 03 sensor if Left gt Ref amp amp Right gt Ref Both sensors detect the white surface Forward 150 else if Left lt Ref amp amp Right lt Ref Both sensors detect the black line Backward 150 delay 100 else if Left lt Ref Only the left sensor detects the line Spin Raght 150 delay 420 else if Right lt Ref Only the right sensor detects the line Span Lhe5t ii50 delay 420 void Forward int speed analogWrite 3 speed digitalWrite 5 LOW analogwrite 6 speed digitalWrite 9 LOW void Backward int speed analogwWrite 5 speed digitalWrite 3 LOW analogwrite 9 speed digitalWrite 6 LOW void Spin Left int speed analogwrite 5 speed digitalWrite 3 LOW analogwrite 6
44. Serial print i DEC Show position on LCD OET 9 lt 1 digitalWrite 7 HIGH Set Servo Di7 digitalWrite 8 HIGH Set Servo Di8 delayMicroseconds i Positive pulse delay digitalWrite 7 LOW digitalWrite 8 LOW delay 20 Negative pulse delay void Beep O int i for i 0 i lt 600 i digitalWrite 14 HIGH delayMicroseconds 150 digitalWrite 14 LOW delayMicroseconds 150 Listing A16 2 SwitchControlServo pde file the Arduino sketch file for POP BOT control servo motor by buttons demonstration 118 POP BOT The Arduino Compatible Mobile Robot kit Programming_operation Purpose of this activity is demonstrates the controlling servo motor position by Pushing the buttons We need to add 2 buttons to change the servo motor position and send the position value To display in Serial LCD of POP BOT You can use this value for a reference for servo motor controlling The code will check the button pressing both Di2 and Di4 port If the button at Di2 is pressed i variable will increase value each 20 If the button at Di4 is pressed i variable will decrease value each 20 The variable value is used to define the pulse width of servo motor controlling When the value is changed to last ending position both maximum and minimum beep function will be executed to drive a beep signal to inform developer to know the operation ne ATC COME mobile rek kit POP BOT The Arduino Compatible Mobile
45. Show 0x8A MAX Point LCD Show Text 0xC0 Value LCD Show 0xC8 Maximum Beep delay 5000 LCD Clear Clear LCD screen Calculate target position int GET Point int 0Eds0 ymax for i 0 1 lt 9 i if GP2 i gt 0ld Old GP2 1 max 1 j j Maximum Old return max POP BOT The Arduino Compatible Mobile Robot kit 125 Servo position control void Servo Move int val int S for i 0 i lt 20 i digitalWrite 7 HIGH Set port 7 to servo port delayMicroseconds val Positive pulse delay digitalWrite 7 LOW delay 20 Negative pulse delay Beep function void Beep Ine des for i 0 1 lt 600 i digitalWrite 14 HIGH delayMicroseconds 150 digitalWrite 14 LOW delayMicroseconds 150 SLCD Function void LCD Show int Position int x MySerial print OxFE BYTE Clear Screen MySerial print Position BYTE MySerial print x DEC Show Data in Decimal void LCD Show Text int Position char x MySerial print OxFE BYTE Clear Screen MySerial print Position BYTE MySerial print x Show text void LCD Clear MySerial print OxFE BYTE Clear Screen MySerial print 0x01 BYTE RK KK KK HK ce ce ck KK ke ck ck ke ck KA ck ck I ck I I FO IO A RR eR Listing A17 1 SeekingObjectTest pde file the Arduino sketch file for POP BOT object seeking opera
46. T The Arduino Compatible Mobile Robot kit Activity 2 2 Trapped in a corner situation When the POP BOT is in a corner it is caught in between whereby to the left or right is a wall This causes continuous hitting of the walls and thus trapping the robot in this corner The solution is to modify your exiting C Code from Listing A2 1 to that which is shown in Listing A2 2 A2 6 Open the Arduino IDE and create the sketch code from Listing A2 2 A2 Set the POP BOT into Program mode Upload the sketch to the robot A2 8 Turn off power and Remove the download cable A2 9 Prepare the demonstration area by placing and securing boxes or objects on the surface same in Activity 2 1 A2 10 Place the robot on the demonstration area Turn on the power and observe the robot The robot will move forward and check for collision If this happens over 5 times consecutively the robot will spin 180 degrees to change its direction kok k k kok k k ke k kk kk k kk k kk k e k k ke k k k ke k k k k ke k k k k k k k ke k k ke k k k k k k k kk k k k k k k kc kk ke e e kk k k POP BOT V1 0 Filename CornerEscape pde Robot escapes from corner K K k kk koe ke kk ke k ek k ke k kk k ke k k ke k ke kk k k k k k k k k k k k k k k k k k k k k k k k k k k k k k kk kk k kk kkk kkk kkk kkk int Count 0 int Flag 0 void setup pinMode 3 OUTPUT Motor Ai pinMode 5 OUTPUT Motor A2 pinMode 6 OUTPUT Motor B2 pinMode 9 OU
47. T will compare the sensor value as more than 280 it s mean POP BOT hold the ball ready Because value over 280 is very near distance from POP BOT and ball If the sensor value doest not reach to 280 the POP BOT still seek the ball with same operation POP BOT detects the ball successfully 2 spin to ball direction 128 POP BOT The Arduino Compatible Mobile Robot kit a ee kk kok k kk kk k k k k k k k k k k k k k k k k k k k k k k k k k e k k k k POP BOT V1 0 Filename BallSeekerRobot pde Seek ball and move to it Kk ke kk ke ke kk khe ke kk ke ke e kk ke ke ek ke ke ke kk ke ke ke kk ke ke ke kk ke ke kk ee kk eee ck koe kk kc kk ke ke ke ke ke ke ke ke ke ke eee int PosValue 460 610 760 1050 1340 1500 1660 1940 2220 Servo position value int GP2 9 int j Maximum Position void setup pinMode 3 OUTPUT Jf Motor A1 pinMode 5 OUTPUT Motor A2 pinMode 6 OUTPUT Motor B2 pinMode 9 OUTPUT Motor B1 pinMode 7 OUTPUT Servo Motor pinMode 14 OUTPUT PIEZO Speaker Be p delay 2000 j void loop Motor Stop Servo Home for j 0 j lt 9 j Set the seeking point 9 positions Servo Move PosValue jl Move servo motor GP2 j 2analogRead 5 Read valei from GP2D120 Position MAX Point
48. TART point see the field illustration Turn on and observe the robot movement Step 1 POP BOT moves along the line from START point Step 2 POP BOT detects the first junction and turn left fo moves fo the first destination at the left side of field fee os ter E Turn 1 Ji i En around BI START gt melo Step 3 POP BOT moves back from the first destination pass the junction again Step 4 POP BOT detects the junction second time and turn left fo moves to the second destination at the middle of field S EE ETELEI LR 9 0 0 ele i omc Turn e ll We I around START POP BOT The Arduino Compatible Mobile Robot kit e 9 Step 5 POP BOT moves back from the second destination pass the junction again Step 6 POP BOT detects the junction third time and turn left to moves to the last destination at the right s
49. TPUT Motor Bl pinMode 15 INPUT Left Switch pinMode 17 INPUT Right Switch void loop Forward 150 POP BOT The Arduino Compatible Mobile Robot kit e 5 if Count gt s Trapped in a croner more than 5 times Counts Backward 150 Escape from corner delay 2000 Spin Right 200 delay 800 if digitalRead 15 0 if Flag 1 Count inc Test left switch Check previous state else Countz0 Flag z0 Backward 150 Normal operate delay 500 Spin Right 200 delay 400 if digitalRead 17 0 if Flag 0 Count NSN Test right switch Check previous state else Countz0 Flag 1 Backward 150 Normal operate delay 400 Spin Left 200 delay 400 J EK kk e kc ek khe kk ke ke khe ke kk ke ke ke ke kk he ek ke ke kk ke ke khe kk ke kk ee kk kc kk ke ke koe ek ke ek ke ke e ke ke e e ke e e void Forward int speed analogWrite 3 speed digitalWrite 5 LOW analogWrite 6 speed digitalWrite 9 LOW void Backward int speed analogWrite 5 speed digitalWrite 3 LOW analogWrite 9 speed digitalWrite 6 LOW void Spin Left int speed analogWrite 5 speed digitalWrite 3 LOW analogwrite 6 speed digitalWrite 9 LOW void Spin Right int speed analogWrite 3 speed digitalWrite 5 LOW analogWrite 9 speed digitalWrite 6 LOW Kkkkkkkk kk kk khe ek heh
50. TPUT pinMode 6 OUTPUT pinMode 9 OUTPUT Motor A1 Motor A2 Motor B2 Motor B1 e LeftSwitch J 1 1 1 dD GD GD D D D D D D D 1 pinMode 2 INPUT pinMode 4 INPUT M MY X SOS SO RightSwitch void Forward int speed analogWrite 3 speed digitalWrite 5 LOW analogwWrite 6 speed digitalWrite 9 LOW void Spin Left int speed analogWrite 5 speed digitalWrite 3 LOW analogWrite 6 speed digitalWrite 9 LOW void Spin Right int speed analogWrite 3 speed digitalWrite 5 LOW analogWrite 9 speed digitalWrite 6 LOW o em em ex ex o void loop if digitalRead 2 0 Switch Di2 Press while 1 Forward 125 delay 900 Spin Left 125 Turnleft 90 degree delay 400 if digitalRead 4 0 Switch Di4 Press while 1 Forward 125 delay 900 Spin Right 125 Turnright 90 degree delay 400 Listing Al 3 Rectangle Running pde file the Arduino sketch file for A Square shape movement A 48 POP BOT The Arduino Compatible Mobile Robot kit Activity 2 POP BOT Bumper Activity 2 1 Simple collision detection This activity is program the robot to detect the collision of both switches at the fro
51. The Arduino Compatible Mobile Robot kit 8 RK KKK ke ck KK coke kkk kkk kkk k kkk kkk k ck kkk k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k ck ckckck ck k kk KK POP BOT V1 0 Filename EdgeDetect pde AK kc ck eK eR koe ck ck cce ck ck ck ck cce ke cce ck kc ck ck II IK II RK ckckck ck ckckckckckckckckok ck ckckock ck kck kK int Ref 300 int Left Right void setup pinMode 3 OUTPUT pinMode hg pinMode 6 OUTPUT pinMode 9 OUTPUT 5 OUTPUT void loop Left analogRead 7 Right analogRead 6 if Left gt Ref amp amp Right gt Ref Forward 150 else if Left lt Ref amp amp Right lt Ref Backward 150 delay 200 Spin Right 150 delay 500 else if Left Ref Backward 150 delay 300 Spin Right 150 delay 400 else if Right lt Ref Backward 150 delay 300 Spin Left 150 delay 300 Movement function void Forward int speed analogWrite 3 speed digitalWrite 5 LOW analogwrite 6 speed digitalWrite 9 LOW void Backward int speed analogwrite 5 speed digitalWrite 3 LOW analogWrite 9 speed digitalWrite 6 LOW void Spin Left int speed analogWrite 5 speed digitalWrite 3 L0OW analogWrite 6 speed digitalWrite 9 LOW void Spin Right int speed analogWrite 3 speed digitalWrite 5 LOW analogWrite 9 speed digitalWrite 6 LOW MA ki Motor Al Motor A
52. The Arduino compatible OP BOT mobile robot kif Activity manual version 1 0 Standard c Innovative Experiment Co Ltd www inexglobal com i INNOVATIVE EXPERIMENT 2 POP BOT The Arduino Compatible Mobile Robot kit Cerdits POP 168 Module RBX 168 Robot controller board are trademarks of Innovative Experiment Co Ltd POP BOT POP BOT logo INEX and INEX logo are trademarks of Innovative Experiment Co Ltd AVR Atmel Atmel logo AVR Studio are registered trademarks of Atmel Corporation WINAVR is trademark of SourceForge Inc AVR GCC is copyright of Free Software Foundation Inc Arduino is an open source project supported by many The Team is composed of Massimo Banzi David Cuartielles Tom Igoe Gianluca Martino and David Mellis Nicholas Zambetti has contributed since the beginning Yaniv Steiner and Giorgio Olivero have been supporting the project and are working at using it with the Instant Soup platform The Arduino platform used to include the avr gcc tool chain uisp and the Procyon AVR LIB by Pascal Stang Ihe Arduino language syntax is based on Wiring by Hernando Barragan The Arduino environment is based on Processing by Ben Fry and Casey Reas Thanks to all the people who are supporting arduino FTDI is a trademark of Future Technology Devices Intl Ltd I2C is a registered trademark of Philips Semiconductors Microsoft Windows are registered trademarks of the Microsoft Corporation Windows
53. V following this formula volt Raw data x 5 1023 POP BOT The Arduino Compatible Mobile Robot kit 105 Activity 14 Reading GP2D120 data A14 1 Open the Arduino IDE and create the sketch code from Listing A14 1 Al4 2 Set the POP BOT into Program mode Upload the sketch to the robot A14 3 Disconnect the download cable A14 4 Place the POP BOT on the table Put an object in front of the GP2D120 Tum on the POP BOT Try to move an object in and out from GP2D120 sensor Observe the result at SLCD screen B ooo ze e a Eo Q Er a T T a 1 04 onuas 20 Adjust the distance of object between 4 to 30cm 106 POP BOT The Arduino Compatible Mobile Robot kit ee ke k k ke k k kok k k k k k k k k k k k k k k k k k k k kk k k k k POP BOT V1 0 Filename GP2D120withSLCD pde x Show GP2D120 data on SLCD16x2 module kk k k k RAH k k k kk k k k k ck k k k k k k k kk k k k k k k k k k k k k k k k k k k k k k k k k k k k k k kk kkk kkk kk kkk ke ke ke kkk include lt SoftwareSerial h gt define rxPin 16 f SLED pin define txPin 16 Same pin SoftwareSerial MySerial SoftwareSerial rxPin txPin int gp2 float distance void setup pinMode txPin OUTPUT MySerial begin 9600 delay 1000 void LCD CMD int Command MySerial print OxFE BYTE Command MySerial print Command BYTE void loop gp2 analogRead 5 distance 2914 gp2 5 1 Convert to
54. al port converter drive compile Upload the code USB port lt gt Upload the code via USB port 1 Connect UCON 4 cable to USB port and POP BOT 2 Check the USB Serial port address 3 Choose POP BOT to Program mode upload mode 4 Upload the code Run the code After uplaod the code successfully press RESET switch on the POP 168 module of POP BOT The POP BOT run following the uploaded code Figure 4 1 Programming development diagram of POP BOT by using Arduino IDE 32 POP BOT The Arduino Compatible Mobile Robot kit 4 1 Preparing the UCON 4 USB to RS 232 serial port converter cable The POP BOT requires computer interface and Arduino for uploading the code Normally use RS 232 serial port or COM port For modern computer provide the main interface port as USB Therefore the USB to RS 232serial port converter is required In ther POP BOT kit preaprares the UCON 4 cable for this purpose Before using the UCON 4 cable you must install the suitable driver and check some configuration 4 1 1 Driver installation Double click at USBDriverlnstallerV2 0 0 exe file from POP BOT bundled CD ROM to start the driver instalation The installation dialogue box will appear below FTDI Driver Installation e 1 FTOI CDI Drivers have been successfully installed 4 1 2 Check the USB serial port address 1 Plug the USB cable to USB port and POP BOT controller board Wait a moment 2 Check th
55. ance POP BOT The Arduino Compatible Mobile Robot kit e 103 9 2 POP BOT modification for GP2D120 9 2 1 Additional part list Ra 5449 My Straight joiner x 4 Obtuse joiner x2 OOOO J 0000 3x10mm screw x 4 3mm nut x 4 Right angle joiner x2 GP2D120 with cable 9 2 2 Modify procedure 1 Remove all sensors from POP BOT chasis Now we have the simplest form of the POP BOT mobile robot 2 Attach 2 pieces of Straight joiner with the hole of GP2D120 module by using 3x10mm screws and 3mm nuts Next connect the Obtuse joiners at the end of each Straight joiner following Straight joiners and Right angle joiners 104 POP BOT The Arduino Compatible Mobile Robot kit 3 Fix the GP2D120 sturcture from step 2 at the front of POP BOT chasis by using 3x1Omrm screw and 3mm nut at the position following the photo below Connect the GP2D120 cable to 19 SCL A5 of POP BOT controller board Now the POP BOT with IR ranger is ready for progreamming 9 3 How to read data from GP2D120 of POP BOT POP BOT has POP 168 microcontroller module It works with Arduino software Arduino has a special function to read the value from analog port It is analogRead function The value in braces is analog input number O to 7 For POP BOT provides only 3 to 7 The analogReadQ function is return the integer data from O to 1023 It is 10 bit A D converter result You can calculate the raw data in Volt unit
56. asiest to understand is through ultra sonic where sound waves are sent to the object and the time it Takes to reflect back is measured This is because sounds waves do not travel fast and can be measured by present day equipment However in the case of infrared light the time it takes to hit an obstacle and reflect back can not be measured because infrared light travels fast No measurement equipment is available yet Therefore the following theory must be used The infrared light is sent out from a transmitter to the object in front by passing through a condense lens so that the light intensity is focused on a certain point Refrac tion occurs once the light hits the surface of the object Part of the refracted light will be sent back to the receiver end in which another lens will combine these lights and deter mine the point of impact The light will then be passed on to an array of photo transistors The position in which the light falls can be used fo calculate the distance L from the transmitter to the obstacle using the following formula POP BOT The Arduino Compatible Mobile Robot kit e 101 Therefore L equals Fx A X Thus the distance value from the phototransistors will be sent to the Signal Evalua tion Module before it is changed to voltage resulting in a change of voltage according to the measured distance 9 1 3 Reading GP2D120 with A D converter The GP2D120 s output voltage will change according to the detect
57. atus If compile no error it reports Done compiling and the Text area will display message of binary sketch size 4 2 4 Uploading the sketch to POP 168 module Downloading the machine code from compiling to Arduino hardware is called Uploading You must prepare the Aruino hardware ready for uploading by setting the POP 168 to Bootloader mode The procedure is 1 Connect the POP BOT with your computer COM port by CX 4 cable or via USB to serial port converter Connect direct to COM port if available Connect to USB port gt gt USB to Serial port converter CX 4 cable UCON 232S Computer alayan MOTOR Tipe OB SOOS bk Slain aw SERVO PORT o O A Number Digital o o Di Di4 Analog pin x JO J POP BOT POP BOT The Arduino Compatible Mobile Robot kit 39 2 Set POP 168 module to program mode It has 2 options 2 1 Use RESET switch on RBX 168 board and BL switch on POP 168 module 2 1 1 Turn on POP BOT 2 1 2 Press and hold RESET switch on the RBX 168 controller board 2 1 3 Press and hold BL switch on the POP 168 module
58. ches oz in or kilogram centimetre kg cm It tell you know about this servo motor can drive a load weight in 1 oz to move inche or Ikg weight to moved centimeter 1oz 0 028ko or Ikg 25 2740z Normally the RC servo motor has 3 40 kg cm 4 oz in torque htto www societyofrobots com actuators_servos shtm POP BOT The Arduino Compatible Mobile Robot kit e 111 x lt lt 1 to 2 millsecond pulse a Servo motor control pulse lt 20ms period J 9 4 1 millisecond pulse b 1 millisecond pulse causes servo horn moves anti clockwise direction to last left position X lt lt 1 5 millisecond pulse c 1 5 millisecond pulse causes servo horn moves to center position STAISPARD SERVO MOTOR gt 2 millisecond pulse d 2 millisecond pulse causes servo horn moves clockwise direction to last right position STANDARD SERVO MOTOR Figure 10 4 Timing diagram of pulse control servo motor 112 POP BOT The Arduino Compatible Mobile Robot kit 10 2 Arduino with Controlling servo mofor The heart of controlling the servo motor of Arduino POP 168 is Soffwareservo library Because POP BOT hardware does not use the PWM pin to make the servo motor output We use general purpose port to servo output Di and Di8 The Softwareservo library can drive servos on all of your pins simultaneously The API is patterned after the wiring org servo library but the code is different You are
59. click Ihe installation will start i Setup Arduino 0015 c Welcome to the Arduino 0015 Setup Wizard This will install Arduino 0015 on your computer It is recommended that vau clase all other applications before continuing Click Next ta continue or Cancel to exit Setup ee ore POP BOT CD ROM contains the Arduino software V15 all example codes for POP BOT activities and nescessary library files You can get the latest version of Arduino at www arduino cc However you need to ensure the correct path of POP BOT library after you upgrade the new version of Arduino IDE Introduction paragraph is from Arduino website www arduino cc 26 POP BOT The Arduino Compatible Mobile Robot kit 3 2 Arduino environment After starting Arduino IDE the main window will appear as shwon in the figure 3 1 The Arduino includes the environments as follows e Menu Select the operation command e Toolbar Includes all most command button e Tabs Allows you to manage sketches with more than one file each of which appears in its own tab e Text editor Text editor area for creating the sketch e Message area Shows the program operation status such as compiling result e Text area Ihe space demonstrates compiling information and Serial data Terminal window if enable El Arduino 0011 Alpha File Edit sketch Tools Help oo oi 5 Tools bar Tab The basic Arduino example Turns on an LEP on for on
60. ditional batteries for servo motor It is important features of POP BOT robot POP BOT can drive 4 motors 2 of DC motors and 2 of servo motors 10 1 Servo motor introduction Figure 10 1 shows a drawing of a Standard Servo The plug is used to connect the servo motor to a power source Vdd and Vss and a signal source a microcontroller I O pin The cable conducts Vdd Vss and the signal line from the plug into the servo motor The horn is the part of the servo that looks like a four pointed star When the servo is running the horn is the moving part that the microcontroller controls The case contains the servois control circuits a DC motor and gears These parts work together to take high low signals from the microcontroller and convert them into positions held by the servo horn Figure 10 2 shows the servo motor cable assignment It has 3 wires with difference color Black for GND or Vss or Negative pole Red for Vdd or Servo motor supply voltage and White sometime is yellow or brown wire for signal Figure 10 1 Standard servo motor physical 110 POP BOT The Arduino Compatible Mobile Robot kit SIGNAL 4 8 6V GND a S type plug b J type plug Figure 10 2 Standard Servo motor cable Figure 10 3 Standard Servo motor plug assignment type The servo motor plug standard has 2 types S type and J type are shown in the figure 10 3 Controlling of the servo motors is used using pulse controlling The control pulse is po
61. e Virtual COM port or USB Serial port address by clicking Start gt Control Panel gt System gt Hardware gt Device Manager System Properties System Restore Automatic U pdates Remote General Computer Mame Hardware Advanced Device Manager e The Device Manager lists all the hardware devices installed 3 on your computer Use the Device Manager ta change the properties of any device Device Manager i POP BOT The Arduino Compatible Mobile Robot kit 33 3 See the list of USB serial port and remember the COM port adaress to work with UCON 4 cable Normally if will create COMBS or above In this example is COMA JEA Device Ma nager File Action View Help Home m mma Bluetooth Devices d Computer See Disk drives a Display adapters d DYD CD ROM drives cy Floppy disk controllers A Floppy disk drives IDE ATA ATAPI controllers j IEEE 1394 Bus host controllers 2 Keyboards l Mice and other pointing devices 1 Modems d Monitors BS Network adapters tf Ports COM amp LPT A Communications Fort COM E Communications Pork COM Printer Port LPTL jy USB Serial Port COM k Processors Sound video and game controllers System devices Universal Serial Bus controllers BIPAC 7000 ADSL USE Modern Inkelir 8a2801DB DBM USE 2 0 Enhanced Host Controller 24CD EEE 4 1 3 UCON 4 cable with Arduino operation notice Normally Arduino software can interface with CO
62. e ke ke ke ke koh kk ke e ke ke ke kk ke ke khe kk heck kk e kk ck kk kk ke ee ke ke ke kk e ke ke e e ke e ek Listing A2 2 CornerEscape pde file the Arduino sketch file for trapped in a corner solution of POP BOT POP POP BOT The Arduino Compatible Mobile Robot kit 53 6 POP BOT with Serial LCD The Serial LCD or SLCD16x2 is the 16 characters 2 lines LCD module that commu nicates by serial interface It receives data serially and displays on the LCD Accept serial data at 2400 or 9600 baud rate Normally LCD interfacing requires at least 6 wires but SLCD16x2 need only one signal wire This display module is suitable for POP BOT robot 6 1 SLCD16x2 information 8 1 1 Features e Serial Input or Invert Non invert TTL CMOS logic level e 1 8 or 1 16 Duty can be selected by jumper e Scott Edwardsis LCD Serial Backoack command compatible addition with Extended Command that make LCD control easier e Easy to interface with the microcontroller e Operation with 5 Vdc supply QW UN UNUNOWOUNON uei nase saree Tunc 100 CONNECTOR L R7 ARD S Ega D mf o Screen brightness to adjustment ETON ETI66 SSSR Data Signal input Cy A i 1 l b TU Ft a c 2000 innovative Experiment TOV supply Command mode Line display Baudrate Extended EX 8 digit per line 8 9600 bps 96 Interface signal Invert logic or RS 232 IN Standard ST der paring 2400 bps 24 Figure 6 1 Deta
63. e second then off for one second and sB fS We use pin Ls because depending on your Arduino board it has either a built in LED or a built in resistor so that you need only an LED http www arduino cc en Tutorial Blink int ledPin 13 LED connected to digital pin 13 Text Editor void setup i run once when the sketch starts 1 pinMaodeiledPin OUTPUT sets the digital pin as output void loop i run over and over again 1 digitalWrite ledFin HIGH sets the LED on delay 1000 waits for a second digitallriteiledPin LOM sets the LED oEE delavil 0 0n waits for a second Done compiling Message area Text area Binary sketch size 1096 bytes iof a l4336 byte maximum k 1 Figure 3 1 Arduino environment POP BOT The Arduino Compatible Mobile Robot kit 27 3 3 Menu bar 3 3 1 File The Arduino calls the code as Sketch This menu contains many commands like open save and close the sketch as follows e New Creates a new sketch named is the current date format sketch YYMMDDa e Sketchbook Open Open the exist sketch Example Open the example sketch e Save Save the current sketch e Save as Save the current sketch as another name e Upload to I O board Uploads your code to the Arduino I O board POP 168 module Make sure to save or verify your sketch before uploading it e Preference Set some preference of Arduino environment e Quit Exit the Arduino IDE 3 3
64. e speed is dependent on Ton time ON time of motor At this time DC motor will receive the full voltage Vm If Tonis width is more DC motor is received more voltage It rotate in high soeed The ratio of Ton time in percentage with period T is called Duty cycle You can calculate this as follows Ton dut C Oee ee REO ee 5 Tuae Ton Toff Su PWM f 5 2 requency m Ton 4 Toff T a Oe pon EEE Average DC motor voltage drop Supply voltage x duty cycle 5 3 Figure 5 1 The PWM signal for driving DC motor 42 POP BOT The Arduino Compatible Mobile Robot kit Duty cycle x100 20 t ms Average voltage 4 5 x 20 0 9V 4 8 12 16 20 24 28 32 Vm V 10ms 4 5 10 D le uty cycle 20 X t ms Average voltage 4 5 x 50 2 25V 100 50 4 8 12 16 20 24 28 32 Vm V 18ms us Duty cycle x100 90 t ms Average voltage 4 5 x 90 4 05V 4 8 12 16 20 24 28 32 Vm V 20ms Duty cycle x100 100 a voltage 4 5 x 100 4 5V ms 4 8 12 16 20 24 28 32 Figure 5 2 Shows the relation between the different duty cycle and voltage accross the DC motor Although the duty cycle is determine the motor speed But DC motor can operate at limit frequency If the PWM frequrency is over the limit DC motor will stop because its operation reach to saturation point The example PWM signal in figure 5 2 has 20 milliseconds period and 50Hz frequency In Figure 5 2 A
65. elay Listing A16 1 SimpleServo pde file the Arduino sketch file for POP BOT control servo motor demonstration O L 116 POP BOT The Arduino Compatible Mobile Robot kit Activity 162 POP BOT button control servo motor This activity add more codes to improve the controlling servo motor by buttons on POP BOT controller board A16 6 Open the Arduino IDE and create the sketch code from Listing Al 6 2 A16 7 Set the POP BOT into Program mode Upload the sketch to the robot A16 8 Disconnect the download cable A16 9 Connect the standard RC servo motor to SERVO PORT 7 or 8 of POP BOT controller board lt m o PERVO PORT 000000 A 2 WL G S 000000000000 oje oje 7 TX STANDARD SERVO MOTOR Control servo motor with both buttons A16 10 Turn on the POP BOT Press the button at Di2 and Di4 and see the servo motor operation Di2 button is used to control Servo motor moving to last right position Di4 button is used to control Servo motor moving to last left position When the servo horn moves to the last ending POP BOT will beep a sound to inform user know about the final position You can press and hold or press and release to control s
66. ello Show HELLO POP BOT The Arduino Compatible Mobile Robot kit 59 Activity 3 SLCD16x2 simple programming A3 1 Open the Arduino IDE and create the sketch code from Listing A3 1 A3 2 Set the POP BOT into Program mode Upload the sketch to the robot A3 3 Reset the POP BOT and observe the SLCD16x2 operation The SLCD 16x2 shows message below J EE K K K k k kk ek koe ke khe ek ke ke ke ke ke k k ke kk ke ek k ke kk ke kk k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k ke ke k k ke ke k k k POP BOT V1 0 Filename SimpleLCD pde Show message on SLCD kk kk kk kk ke ke ke khe ke ke ke khe ke kk ke ke ke ke kk ke ek kk ke ek ke ke ke kk ke ke ke kk ke ke kk kk kk RII I ke ke kk ke ke ke ke ke e ke ee e include SoftwareSerial h Hdefine rxPin 16 define txPin 16 SoftwareSerial MySerial SoftwareSerial rxPin txPin void setup digitalWrite txPin HIGH delay 1000 pinMode txPin OUTPUT MySerial begin 9600 delay 1000 void loop MySerial print OxFE BYTE MySerial print 0x80 BYTE MySerial print POP BOT MySerial print OxFE BYTE MySerial print 0xC0 BYTE MySerial print Hello World while 1 Listing A3 1 SimpleLCD pde file the Arduino sketch file for demonstration the simple operation of Serial LCD with POP BOT 7a 60 POP BOT The Arduino Compatible Mobile Robot kit Activity 4 Control the SLCD16x2 with command You ca
67. er Mode switch RESET uj GND Blue LED operation indicator Program mode Turn on Run mode Indicates the Di 13 port logic status l ISP connector eo eo eo pin assignment a Di 6 PWM PD6 VDD 5Vdc Di 9 PWM PB1 Di 8 PBO Di 7 PD7 Di 5 PWM PD5 Di 4 PD4 Di 3 PWM PD3 Di 2 PD2 Green LED power GND B nnm B Di 13 PBs sCK Blue LED GND nn RESET GND OO Di 10 PB2 SS PWM VDD Oo Di 11 PB3 MOSI PWM POP 168 GND BM OOF BM Di 12 PB4 MISO OO0000000000 An 6 AN6 An 7 AN7 O An4 SDA PC4 An5 SCL PC5 Figure 1 1 Schematic diagram Pin assignment and simple connection of POP 168 microcontroller module 8 POP BOT The Arduino Compatible Mobile Robot kit e Screw terminal block for battery connections It supports 4 8 to 12Vdc and has an on board power switch e 5Vac switching regulator power supply circuit Its regulates the supply voltage for POP 168 module and all sensor ports e 2 push button switch are connected with the digital port 2 Di2 and 4 Di4 Also connnedt with LED for indicator the operation e 5 Universal port support Analog input function and Digital input output function Anl Dil5 to And Dil9 e 2 Analog input port An and An7 Both port pin are analog input only e C bus port An4 SDA and And SCL e 5 232 serial port interfacing e 2 ch DC motor driver with indicators Support motor voltage 2
68. ervo position POP BOT The Arduino Compatible Mobile Robot kit e 117 i ke khe ek ke ke kk ke ke khe ek he ke kk ke kk ke ek k e ke k ke kk ke ke k k k k ck k k k k k k k ke k k e ke k k k k k k k k k k ke k k k k k k POP BOT V1 0 Filename SwiechControl Servo pde Control a servo motor with 2 button switches at Di2 and Di4 Show on SLCD kk kk ke check kk khe ek ke ke ek ke he ke ek ke ke ke ke kk he ke kk ke ke kk ke ke ke kk ke hee kk ke ck kk ck heck kk II IO kk ee ke ke ke e ke eee include SoftwareSerial h define rxPin 16 define txPin 16 SoftwareSerial MySerial SoftwareSerial rxPin txPin int Old i i 1500 j 0 k void setup pinMode 8 OUTPUT Servo Motor pinMode 7 OUTPUT Servo Motor pinMode 14 OUTPUT PIEZO Speaker pinMode 2 INPUT Left Switch pinMode 4 INPUT Right Switch pinMode txPin OUTPUT SLCD pin MySerial begin 9600 Communicate With SLCD delay 1000 1 1500 Centre value for Servo Motor void loop if digitalRead 2 0 Press an Increment switch if 1 lt 2500 Check the maximum value 1 20 If less than increase the variable value else Beep if digitalRead 4 0 Press a Decrement switch 15400 Check thre minimum value 1 20 If more than decrease the variable value else Beep if i Old i MySerial print OxFE BYTE Clear Screen MySerial print 0x01 BYTE My
69. es not stop your interrupts so millis will still work and you won t lose incoming serial data but a pulse end can be extended by the maximum length of your interrupt handles which can cause a small glitch in the servo position If you have a large number of servos there will be a slight 1 to 3 degrees position distortion in the ones with the lowest angular values 10 2 6 An Example The following code lets you control Servo on pin by potentiometer on analog 2 Finclude lt SoftwareServo h gt SoftwareServo myservo create servo object to control a servo Int potpim 2 analog pin used to connect the potentiometer int val variable to read the value from the analog pin void setup myservo attach 7 attaches the servo on pin 7 to the servo object void loop val analogRead potpin reads the value of the potentiometer value between 0 and 1023 val Map val 0 1023 0 179 scale it to use it with the servo value between 0 and 180 myservo write val sets the servo position according to the scaled value delay 15 waits for the servo to get there SoftwareServo refresh 114 POP BOT The Arduino Compatible Mobile Robot kit Activity 16 POP BOT controls servo motor This activity demonstrates the simple example about control the standard RC servo motor with POP BOT controller board Activity 16 1 Simple servo conirolling A16 1 Open the Arduino IDE and create the sketch code
70. g the Turn off display command 0x08 and Turn on display command 0x0C and swap It cause the message t Fc will be blink Part M The operation is same Part 2 but ee the message on top line as and bottom line as Exrerirert Listing A4 1 SLCDrunningText pde file the Arduino sketch POP BOT file for demonstration more function of Serial LCD operation POP BOT The Arduino Compatible Mobile Robot kit 63 7 POP BOT line tracking Line following or Line tracking is a popular and common activity in robotics learning The purpose of this activity is to learn about how to interface analog sensors In the POP BOT robot kit it has a pair of Infrared reflector sensor for this activity Two IR Reflector sensors will be installed at the bottom of the POP BOT so that it can detect both white and black lines 7 1 ZX 03 Infrared reflector sensor The heart of this sensor is ICRT5000 reflective object sensor It is designed for close proximity infrared IR detection There s an infrared diode behind its transparent blue window and an infrared transistor behind its black window When the infrared emitted by the diode reflects off a surface and returns to the black window if strikes the infrared transistor s base causing it to conduct current The more infrared incident on the transistor s base the more current it conducts The figure 7 1 shows the operation of ZX 03 sensor When used as an analog sensor the ZX 03 can detect shades
71. gitalWrite 6 LOW void loop int i for i 0 i lt 5 i Loop 5 times for noise filter gp2 gp2 analogRead 5 gp2 9p2 5 if gp2 gt 290 Found object Backward 200 Move backward to change direction delay 300 Spin Left 200 delay 350 Change direction else Forward 200 Moving forward Program description 1 Starting POP BOT beep at once You can use this signal to check the RESET state of robot when its battery is low If the robot beep during movement it means robot s battery is low 2 Read value from GP2D120 to store into gp2 variable 5 times Calcultes to get the average value for protecting the error reading from movement 3 Check the gp2 value more than 290 or not If yes it means now robot far from object less than 8cm approximation Program will control the robot to move backward 0 25 second and spin left 0 5 second to change the direction for avoiding the object 4 If gp2 value is less than 290 robot still moves forward Listing A15 1 Robot Survey pde file the Arduino sketch file for POP BOT touchless object avoiding demonstration PO POP BOT The Arduino Compatible Mobile Robot kit 109 10 POP BOT with Servo motor activity POP BOT features more of the RC servo motor output POP BOT can drive 2 of small RC servo motors simultaneously POP BOT controller supplies the servo motor supply voltage to Servo output headers already User does not require ad
72. har and so on 58 POP BOT The Arduino Compatible Mobile Robot kit 6 2 Things to know about interface Arduino with SLCD16x2 The procedure of Arduino POP 168 with Serial LCD interfacing is 1 Include the SoftwareSerial h library with include command 2 Define the POP 168 port pin with define command as follows Hdefine rxPin 3 Set Di 3 as serial receiver pin or rxPin define txPin 2 Set Di 2 as serial transmitter pin or txPin SoftwareSerial mySerial SoftwareSerial rxPin txPin 3 At setup you need to set the transmit pin to High logic delay and set baudrate to 9600 with myserial begin 9600 command The sample setup code is shown below digitalWrite txPin HIGH set txPin high as recommended delay 1000 define pin modes for tx rx pins pinMode rxPin INPUT pinMode txPin OUTPUT mySerial begin 9600 set baudrate It is recommendded setup code for Arduino when interface with Serial LCD or SLCD16x2 module The important commands for interfacing with SLCD16x2 module of POP BOT are 1 Initialized command mySerial print OxFE BYTE mySerial print Command BYTE 2 Clear LCD screen mySerial print 0x01 BYTE 3 Move cursor to top left position or HOME position mySerial print 0x80 BYTE 4 Move cursor to left position of bottom line mySerial print OxCO BYTE 9 For writing the message user must put message and covered by v mySerial print H
73. he right sensor detects the black line Spin RQight 150 Turn right 90 degree function void Right90 Forward 150 delay 50 Spin Right 200 delay 100 while analogRead 6 gt Ref delay 50 Movement function void Forward int speed analogwrite 3 speed digitalWrite 5 LOW analogwrite 6 speed digitalWrite 9 LOW void Spin Left int speed analogwrite 5 speed digitalWrite 3 LOW analogwrite 6 speed digitalWrite 9 LOW void Spin Right int speed analogWrite 3 speed digitalWrite 5 LOW analogwrite 9 speed digitalWrite 6 LOW Listing A10 1 CrossingLineDetect pde file the Arduino sketch file for POP BOT moves along the black line and detects the crossing line 82 POP BOT The Arduino Compatible Mobile Robot kit A10 5 Place the POP BOT over the line Turn on and observe the robot movement POP BOT moves along the line Every time robot detects fhe crossinhg line if Turn right with 90 degrees angle and continues to follow the line j EEE zea es EIG 3 e TED o j n n 2 o OO ele eet e HH I 20 The
74. ick on the COM Port Number box to change to COM4 or another port in range COMI to COM9 Advanced Settings for COMTO COM Port Number COM10 COMI in use USE Transfer Sizes COM in use a COM3 in use Cancel Select lower setting COM 4 hance problems at low baud rates Select higher setti EOE in dn ance COM Receive Bytes COME COMY Transmit Bytes CUMTU ransmit Bytes CMT COM12 COM13 BM Options CDM14 Miscellaneous Options COM15 Select lower setting COM1E E Serial Enumerator COM1 Latency Timer ma SUM18 Serial Printer Cancel IF Power OFF Set ATS On Close Disable Moder Ctrl At Startup Minimum Read Ti Timeouts Event On Surprise Removal E ull Minimum Write Ti POP BOT The Arduino Compatible Mobile Robot kit 35 7 Set the value following the figure below Especially at the Latency Timer msec suggested to set to 1 and check the box at Serial Enumerator Click OK button Advanced Settings for COM10 COM Port Number COM4 USB Transfer Sizes Select lower settings to correct performance problems at low baud rates Select higher settings for faster performance Defaults Receive Bytes 4096 Transmit Bytes 4096 BM Options Miscellaneous Options Select lower settings to correct response problems Serial Enumerator Serial Printer Cancel If Power Off Latency Timer msec 1 Timeouts Event On Surprise Removal Set ATS On Close Disable Modem
75. ide of field Turn around Step 7 POP BOT moves back from the last destination pass the junction again Step 8 POP BOT detects the junction last time and moves forward to go back the START point for finishing the mission m E 5j E Be t lel le T 9 OIsszssessssss OIsss232355525 CLS CZI CT ollo CZ ess eee Oo E 1 Sa U E EN POP BOT POP BOT The Arduino Compatible Mobile Robot kit 93 8 POP BOT Edging detection In Chapter 7 we used the infrared reflector sensors to detect the lines Do you know these sensor able to do more This chapter will show an activity about using infrared reflector sensors for surface detection to control the robot move on the table and not fall off the edge of the table With a simple change of the position of the sensors and a simple program you
76. igitalWrite 3 LOW analogwrite 6 speed digitalWrite 9 LOW j void Spin Right int speed analogWrite 3 speed digitalWrite 5 LOW analogwrite 9 speed digitalWrite 6 LOW Listing A8 1 SimpleLineTracking pde file the Arduino sketch file for POP BOT moves along the black line POP BOT The Arduino Compatible Mobile Robot kit 75 A8 4 Make the simple black line field following the illustration below The white surface area is 90 x 60 cm and black line width is 1 inches 2 5 cm A8 5 Place the POP BOT on the Black line field Turn on the robot Observe the robot movement The POP BOT will move along the black line It is possible that the robot moves out of the line You can improve the precision by editing the program with adjusting the sensor reference value and adjust to the position of both infrared reflector sensors 5 76 POP BOT The Arduino Compatible Mobile Robot kit Activity 9 Line crossing detection From the activity 8 you can improve the POP BOT robot so that it moves along the black line and detects the junction or line with the same 2 sensors All you have to do is to edit your program code When the robot moves to the black line T junction both sensors will detect the black line You must add the program for supporting this scenario The improved C program is shown in the Listing A9 1 3888 Bass BARAI J X EK K K k k k k k k ke k kk k k
77. igitalWrite 3 LOW digitalWrite 6 LOW digitalWrite 9 LOW void loop ra Forward 80 255 Circle running if digitalRead 4 0 if Switch Press Motor Stop Stop while 1 kkkokkk kk ke kk ek ke ke kk ke ke ke ke kk ke ke ke kikki ke e kk ke ke khe kk heck koe ke kc kk ke ck koe kk ke ke ke ke e e ke ke e ke ke e e ke x Listing A1 2 MotorSpeedControl pde file the Arduino sketch file for circle movement of POP BOT POP BOT The Arduino Compatible Mobile Robot kit 47 Activity 1 3 Square shape movement control A1 9 Create a new sketch file and write the following C Codes shown in Listing A1 3 A 1 10 Upload the sketch to the robot Turn off power and Remove the download cable Al 11 Turn on the power and observe the robot The robot will be activated if SW or SW2 is being pressed If you Press SWI the robot will move forward and turn leff continually making a square If you press SW2 the operation is vice versa S E F F k kk ke ke khe ke khe e ke ke ke kk ke kk ke kk ke ke ke ke ke kk che e kk ek ke ke kk ke kk k k k k k k k k k k k k k ck k k k k k k k e k k ke e k k k k Robo Spinner V1 0 Filename Rectangle Running pde Running 90 Degree Turnleft And Turnright kk kk khe ke RR ke kk ke hee kk hee kk ke ke ke kk ke ke e kk ke ke ek ke ke ke kk ck ke ke kk ke hee kc kk kk koh kk ke kc ke ke ke ke ke ke ke e ke ke void setup pinMode 3 OUTPUT pinMode 5 OU
78. ils of SLCD16x2 s jumper selections Direct logic DI 54 POP BOT The Arduino Compatible Mobile Robot kit 6 1 2 Setting up In the figure 6 1 it shows the detail of SLCD 16x2 backside THe user will see 4 jumpers configurated as follows 1 Mode command jumper Selects the command modes SLCD16x2 has 2 modes One is Standard command ST This mode compatible with Scott Edwardsis LCD Serial Backpack Another mode is Extended mode command EX For POP BOT activities select Standard command mode ST 2 Lines jumper Selects the line displays 1 8 and 1 16 Duty 1 8 Duty means displaying 8 digit per line 1 16 Duty means displaying 16 digit per line or more Normally set to 1 16 3 Baudrate select jumper 2 selections as 2400 and 9600 bps bit per second with 8N1 data format 8 bit data no parity bit and 1 stop bit For POP BOT set to 9600 4 Interface signal jumper 2 selections as Invert logic TTL CMOS level IN and Direct logic TTL CMOS level DI For POP BOT set fo DI SLCD 16x2 provides a brightness adjustment with variable resistor at BRIGHTNESS position Interfacing connector has 3 pins 5V Supply voltage Serial data input S and Ground G 6 1 3 Interfacing SLCD16x2 with POP BOT The JST3AA 8 cable is required for connecting between SLCD with POP BOT controller board This cable wire assignment can show below 2 54mm pin space 2 00mm pin space a 4 F S al 5V I D The JST3AA
79. ilt in resistor so that you need only an LED http www arduino cc en Tutorial Blink v int ledPin 13 LED connected to digital pin 13 void setup run once when the sketch starts pinMode ledPin OUTPUT sets the digital pin as output void loop run over and over again digitalUrite ledPin HIGH sets the LED on delay 1000 waits for a second digitalUrite ledPin LOW sets the LED off delay 1000 waits for a second lt 38 POP BOT The Arduino Compatible Mobile Robot kit 4 2 3 Compile the sketch After open the sketch file and edit ready you can compile theis sketch by selecting the menu Sketch gt Verify Compile or click on the button 3 Bl Arduino 0011 Alpha Fie Edit Sketch Tools Help Verify Compile R Stop Import Library Add File The basic Arduino example then off for one depending on or a built in resistor so second and so on your Arduino board that Ctri R gt Show Sketch Folder Ctri K Turns on an LED on for one second We use pin 13 because a built in LED you need only an LED it has either http www arduino cc en Tutoria l Blink int ledPin 13 LED connected to digital pin 13 void setup when the sketch starts pinMode ledPin OUTPUT run once sets the digital pin as output The status bar at the bottom of main screen will display the compilation st
80. infrared reflector sensors value via analog input ports POP BOT programming use analogReadQ function of Arduino for reading analog sensor port POP BOT reads the black line and surface data with low value less than 400 and minimum is O and reads the white line and surface data with high value higher than 500 and maximum is 1023 The reference value for making the decision about line or surface is average value from summing of black and white surface as follows Reference value White surface value black surface value 2 The activity 5 shows the detail of the reference value for this line tracking activity POP BOT The Arduino Compatible Mobile Robot kit 65 Activity 5 Testing black and white area The POP BOT robot is attached with 2 of Infrared reflector modules at bottom of the robot base Thus this activity will only dwell on the programming Before developing the robot to track the line developers must program the robot to detect the difference between black and white surface A5 1 Open the Arduino IDE and create the sketch code from Listing A5 1 A5 2 Set the POP BOT into Program mode Upload the sketch to the robot A5 3 Disconnect the download cable S EE KK K k k k k k k khe kk ke k k k k ke ke ke k k ke kk ke e ke k k k k ke ke ke ke k k k k k k e k k k ke k k k k k k k k k k k k k k k k k k k k k k k ke ke k k k POP BOT V1 0 Filename AnalogRead pde Read analog signal from Infrared reflector se
81. ion distance For example Vout 0 5V is equal 26cm distance and Vout 2V is equal cm distance The table 9 1 shows the summary of GP2D120 s Vout and Distance relation L For interfacing with A D converter module within microcontroller the result is raw data from the A D conversion The user will need to use the software to convert the raw data to the exact distance You can calculate the approximate distance from the formula below R 2914 V 5 Thus R as Distance in Centimetre unit V as Digital data from A D conversion For example see the Table 9 1 The raw data from conversion is 307 It is equal 8cm distance Warning for the signal cable of the GP2D120 The GP2D120 module has a different pin arrangement then that of the POP BOT controller board even though it looks similar Therefore a special signal cable has already been connected to the GP2D120 module The user just needs to connect the other end of the cable to the connection points of the POP BOT controller board DO NOT remove the cable from the module and do not replace it with signal cables from other sensor modules 102 POP BOT The Arduino Compatible Mobile Robot kit GP2D120 10 bit Distance A D converter result cm c et et NININININININ RE RE Re ele ele ele e ojoj 5 OV UT DB UN Foo o Nl olu A U NF o UJAJ F ite D gt lt as Table 9 1 The relation of GP2D120 output voltage A D converter result and Measured dist
82. ki k kaki k k k k k k k ik kk k k k k kk kkk k kk Xi kkk ke ke kkk kkk int Ref 500 int Left Right void setup f pinMode 3 OUTPUT Motor Al pinMode 5 OUTPUT Motor A2 pinMode 6 OUTPUT Motor B2 pinMode 9 OUTPUT Motor B1 void loop Left analogRead 7 Read value from the left ZX 03 sensor Right analogRead 6 Read value from the right ZX 03 sensor if Left gt Ref amp amp Right gt Ref Both sensors detect the white surface Forward 150 else if Left Ref amp amp Right lt Ref Both sensors detect the black line Backward 150 delay 100 else if Left lt Ref Only left sensor detects the black line Backward 150 delay 300 Spin Right 150 delay 500 else if Right lt Ref Only right sensor detects the black line Backward 150 delay 300 Spin Left 150 delay 400 void Forward int speed analogWrite 3 speed digitalWrite 5 LOW analogwrite 6 speed digitalWrite 9 LOW j void Backward int speed analogwrite 5 speed digitalWrite 3 LOW analogWrite 9 speed digitalWrite 6 LOW void Spin Left int speed analogwrite 5 speed digitalWrite 3 LOW analogWrite 6 speed digitalWrite 9 LOW void Spin Right int speed analogWrite 3 speed digitalWrite 5 LOW analogwrite 9 speed digitalWrite 6 LOW Listing A6 1 BlackBorderMove pde file the Arduino sketch file for black border movement de
83. lWrite 14 LOW delayMicroseconds 150 void sound int freq int duration unsigned long us int xuratron i us 1000000 freq 2 duration duration us 2 for i 0 i lt duration i digitalWrite 14 HIGH delayMicroseconds us digitalWrite 14 LOW delayMicroseconds us void Forward int speed analogWrite 3 speed digitalWrite 5 LOW analogwrite 6 speed digitalWrite 9 LOW void Motor Stop digitalWrite 3 LOW digitalWrite 5 LOW digitalWrite 6 LOW digitalWrite 9 LOW void Spin Left int speed analogwrite 5 speed digitalWrite 3 LOW analogwrite 6 speed digitalWrite 9 LOW j void Spin Right int speed analogWrite 3 speed digitalWrite 5 LOW analogwrite 9 speed digitalWrite 6 LOW Listing A9 1 CrossingLineDetect pde file the Arduino sketch file for POP BOT moves along the black line and detects the crossing line 78 POP BOT The Arduino Compatible Mobile Robot kit A9 1 Improve the simple black line field from Activity 8 Add some cross lines Add as many junctions as you like However make sure that they are at least 2 robots width apart A9 2 Open the Arduino IDE and create the sketch code from Listing A9 1 A9 2 Set the POP BOT into Program mode Upload the sketch to the robot A9 3 Disconnect the download cable POP BOT The Arduino Compatible Mobile Robot kit e 79 A9 3 Place the robot on the field Tu
84. monstration of POP BOT POP BOT The Arduino Compatible Mobile Robot kit 69 A6 5 Place the POP BOT within the black border field Turn on the robot Observe the robot movement POP BOT moves forward on the white surface until any sensor detects the black border Ihis is robot behavior If both sensor detect the black line POP BOT move backward for a short while and then forward again If the left sensor defects the black line POP BOT move backward for a short while spin right and then forward again If the right sensor detects the black line POP BOT move backward for a short while spin leff and then forward again Finally POP BOT moves within the black border continually Va 70 POP BOT The Arduino Compatible Mobile Robot kit Activity 7 POP BOT with ping pong movement In thisactivity it shows how POP BOT move in a ZIG ZAG format The black line is the turning point The POP BOT moves forward until found the black line to change the direction Loop this operation always Thus robot will move within soace between both black lines A7 1 Open the Arduino IDE and create the sketch code from Listing A 1 A 2 Set the POP BOT into Program mode Upload the sketch to the robot A 3 Disconnect the download cable A7 4 Make the Ping pong field following the illustration below The white surface area is 90 x 60 cm and black line width is 1 inches 2 5 cm 50 cm POP BOT The Arduino Compatible Mobile
85. most important factor of this actiivty is Right90 function It is C C function for Arduino We can describe the function operation as follows 1 After robotis sensor detect the junction POP BOT must move forward 0 05 second for setting the robot s position at the centre of crossing line 2 Spin right and delay 0 1 second 3 Loop to read the right sensor value and return until detect the black line 4 Delay 0 05 second before back to main loop The source code of this function is shown below Turn right 90 degree function void Right90 Forward 150 delay 50 Spin Right 200 delay 100 while analogRead 6 gt Ref delay 50 A POP BOT The Arduino Compatible Mobile Robot kit 83 Activity 11 Multi crossing line mission This activity is taken from many popular line tracking mission in many robotic games Many crossing line are included the field The robot must move following the line and detect every crossing point or junction and make the decision to turn left or right or forward or backward With the example code in Activity 8 to 10 you can combine all to make the complete code for solving the multi crossing line mission The example field and movement path are shown below a 20 cm gt 20 cm 20 cm gt All 1 Open the Arduino IDE and create the sketch code from Listing Al 1 1 Al1 2 Set the POP BOT into Program mode Upload the sketch to the robot A1
86. motor Operating voltage is 4 8 to 7 2Vdc 9 Circle wheel and Threaded rubber wheel set with 2mm tapped screw 2 sets 10 80x60 cm and 80x80 cm Plastic Grid plate set 2 sets 11 Circle base with idle ball wheels 12 Plastic joiner and Strip joiner set 60 pieces of 3 type mix colored plastic joiner 4 pieces of each 3 5 12 holes of Strip joiner shaft 13 Right angled metal shaft set 4 pieces of each 1x2 2x2 2x5 Right angled metal 14 Nufs and Screws set 15 Line tracking demo paper sheet 16 UCON A USB to serial converter cable for downloading and communication 17 CD ROM contains software tools source code and documentation 6 POP BOT The Arduino Compatible Mobile Robot kit 1 2 Microcontroller components information 1 2 1 POP 168 microcontroller module The Arduino POP 168 is a flexible board with no hidden components which allows full development of its features with AVR Standard fools like the like IAR C C MikroElektronika Mikro BASIC MikroPascal for AVR and also the open source tool WINAVR AVRGCC for Windows etc Arduino POP 168 use the ATmegal 8 of AVR microcontroller from Atmel www atmel com Arduino POP 168 s oin assignment is similar BASIC Stamp module www parallax com It includes 35 232 serial port communication circuit for downloading and data communication with computer Arduino POP 168 module s hardware is compatibled with Arduino mini in Arduino project www arduino cc en The co
87. mplete schematic diagram of Arduino POP 168 module is shown in figure 1 1 The summarize features of POP 168 module is as follows e AImegal 8 on board with 10 bit ADC converter 16KB flash program memory 512 byte EEPROM 1KB RAM 16MHz clock e Built in 95 232 interface for Communication e Immediate code upload with the built in Bootloader e Reset Button for reset capability e Small Form Factor for compact size develooment e ISP port for programming with the PX 400 PX 4000 device e SMD Leds for indications e Fully compatible with the Ardruino Project e 161 O pin assignement compatible i Stamp i Stamp2P24 module e Supply voltage range 3 3 to 5V 50mA 1 2 2 RBX 168 Robot controller board for Arduino POP 168 The RBX 168Robot controller board is a complete low cost development platform designed for those interested in learning and using Arduino POP 168 module in robotic applications Ifs compact size convenient features and low price make it an ideal tool for the student and educator Figure 1 2 shows the layout of RBX 168 board and complete schematic diagram of its is shown in the figure 1 3 The summarized technical feature of the RBX 168 board is as follows POP BOT The Arduino Compatible Mobile Robot kit 7 5V 5V O LED1 LED2 5V 45V I I M E 2 z 8 a BA 8 8 8 88 O ix DL aaa A A A A R1 R2 R3 R4 4k7 10k 4k7 4k7 O CO OOOO OO O Qj PIN13 K1 PIN24 AVR R5 In System Programming Connector BL Bootload
88. n control many display operations of SLCD16x2 such as set the line display Clear screen select the display format etc by sending the control commands to SLCD 6x2 For the Standard command mode start byte must start with OxFE and following the command User can see the LCD command in SLCD information topic in this chapter A4 Open the Arduino IDE and create the sketch code from Listing A4 1 A4 2 Set the POP BOT into Program mode Upload the sketch to the robot A4 3 Reset the POP BOT and observe the SLCD16x2 operation Ihe SLCD16x2 show many message displaying following the specific by program kok k k kok k k k kk ke ke ke k kk k kk ke ke k k kk kk k ek ke ke k k k kk k k k k k k k k k k k k k k kk kk k k k ke kk k k k k POP BOT V1 0 Filename SLCDrunningText pde Show running text and number on Serial LCD kk kk ke kk khe ke kk khe ek ke ke ke ek ke ke ke kk ke ke ke kk ke hee kk ke ke kk RR I RII kk kk kc ke ke kk I ke ke ke ke ke ke ke e ke ke include SoftwareSerial h Hdefine rxPin 16 Hdefine txPin 16 SoftwareSerial MySerial SoftwareSerial rxPin txPin void setup digitalWrite txPin HIGH delay 1000 pinMode txPin OUTPUT MySerial begin 9600 delay 1000 j void LCD CMD int Command MySerial print OxFE BYTE Command MySerial print Command BYTE void loop int 1 LCD CMD 0x80 First Line MySerial print POP BOT LCD CMD 0xCO Second Line M
89. nsor to show on SLCD kk kk khe HR ek khe ke ke kk ke ke kk ke ke ke kk RII IR ke e kk I ke ck II kk heck kk RIKI III AR include lt SoftwareSerial h gt define rxPin 16 define txPin 16 SoftwareSerial MySerial SoftwareSerial rxPin txPin int LeftSensor int RightSensor void setup digitalWrite txPin HIGH pinMode txPin OUTPUT MySerial begin 9600 delay 1000 void LCD CMD int Command MySerial print OxFE BYTE Command MySerial print Command BYTE void loop LeftSensor analogRead 7 Read value from left sensor RightSensor analogRead 6 Read value from right sensor LCD CMD 0x80 Set display to first Line MySerial print L Sensor cs Show left sensor value on 1st line LCD CMD 0x8A MySerial print LeftSensor DEC LCD CMD 0xCO0 Set display to second Line MySerial print R Sensor Dr Show right sensor value on 2nd line LCD CMD 0xCA MySerial print RightSensor DEC delay 200 Listing A5 1 AnalogRead pde file the Arduino sketch file for reading the Infrared reflector sensor to display on Serial LCD of POP BOT robot 66 POP BOT The Arduino Compatible Mobile Robot kit A5 4 Make the black amp white testing sheet similar to the illustration as shown below Ihe white surface area is 30 x 30 cm and black surface is 30 x 30cm recommended A5 5 Place the POP BOT that is programmed already from step A5 3 above the white surface of
90. nt of the POP BOT robot After a collision is encountered the robot will move backward and change the its direction of movement A2 1 Open the Arduino IDE and create the sketch code from Listing A2 1 A2 2 Set the POP BOT into Program mode Upload the sketch to the robot A2 3 Turn off power and Remove the download cable A2 4 Prepare the demonstration area by placing and securing boxes or objects on the surface A2 5 Place the robot on the demonstration area Turn on the power and observe the robot The POP BOT will read both switch status from 15 A1 and 17 A3 port If any switch is pressed or touches some object the result is logic ii In a normal operation the robot will move forward continually If the Left Switch module touches any object the robot will move backward and change its moving direction fo its right To avoid the object If the Right Switch module touches any object the robot will move backward and change its moving direction to its left to avoid the object A a 8 B jp 4 z DB d 6 B E Gl 0 8 hp 2 Pg ex seed RET 3010 8385 BEN AE s o tpt lt Q EM NC Robot attacks the object in the left Robot attacks the object in the right POP BOT The Arduino Compatible Mobile Robot kit e 49 J EE KK K k k k k k k ee ke ke k k k k ke k k k k k k k e k k k ke k k k k k k k k k k k k k k k k k k k ke ke k k ke ke k k k POP BOT V1 0 Filename BumperRobot pde POP BOT with bum
91. of Straight joiners 24 POP BOT The Arduino Compatible Mobile Robot kit 10 Attach 2 of 33mm metal spacers with SLCD16x2 module by using 3x6mm screws Next fix the straight joiner at the end of spacer by using 3x10mm screw 11 Fix the SLCD16x2 structure from step 10 at the back of robot chasis following the picture below by using 3x10mm screws and 3mm nuts 12 Put the RBX 168 board into the Box holder Connect all cables Start with Leff motor cable to MOTOR A output Right motor cable to MOTOR B output Connect the left Infrared reflector cable to A7 pin the right Infrared reflector cable to A6 pin Next connect the the leftt switch module cable to 15 A1 pin the right switch cable to 17 A3 and connect SLCD16x2 to 16 A2 pin The POP BOT is just ready for programming now POP BOT POP BOT The Arduino Compatible Mobile Robot kit 25 3 Introduction to Arduino IDE Arduino is an open source electronics prototyping platform based on flexible easy to use hardware and software Itis intended for artists designers hobbyists and anyone interested in creating interactive objects or environments This chapter describe about introduction to Arduino Begin with Installation explain about Arduino IDE components and Menu bar details 3 1 Installation software 1 Insert the POP BOT CD ROM to CD drive of your computer 2 Enter the Software gt Arduino folder Find the ArduinoSetup exe and double
92. ons are e Operating voltage is vdc max e Speed 0 deg to 180 deg in 1 5 seconds on average e Weight 45 0 grams 1 590z e Torque 3 40 kg cm 4 oz in e Size mm L x W x H 40 5x20 0x38 0 POP BOT The Arduino Compatible Mobile Robot kit 11 1 3 3 SLCD16x2 16 characters 2 lines Serial LCD module The 16x2 Serial LCD module provides a simple way to display data from micro controller The module requires only one I O pin 5 V and ground to function Simple serial data out commands can be used in the Arduino POP 168 module to communicate with the module at 2400 and 9600 baud Features of the 16x2 Serial LCD Module e Serial Inout with Invert Non invert TIL logic level e 1 8 or 1 16 Duty can be selected by jumper e Scott Edwards s LCD Serial Backoack command compatible addition with Extended Command that make LCD control easier e Operation with 5 Vdc supply e SLCD16x2 provides a brightness adjustment with variable resistor at BRIGHTNESS position e Interfacing connector has 3 pins 5V Supply voltage Serial data input S and Ground G 12 POP BOT The Arduino Compatible Mobile Robot kit 1 4 Sensor module features 1 4 1 Switch module Touch sensor The switch input is used to detect collision at logic 10 Two sets along with the connecting cable are provided 1 4 2 ZX 03 Infrared reflector sensor The heart of this sensor is TCRTSO00 reflective object sensor It is designed for close p
93. operation of the LCD is determined by signals sent from the MCU These signals which include register selection signal RS read write signal R W and the data bus DBO to DB7 make up the LCD instructions Table 3 There are four categories of instructions that e Designate LCD functions such as display format data length etc e Set internal RAM addresses e Perform data transfer with internal RAM e Perform miscellaneous functions Although looking at the table you can make your own commands and test them Below is a brief list of useful commands which are used frequently while working on the LCD Instruction Hex Decimal Function Set 8 bit 1 Line 5x Dots Ox30 48 Function Set 8 bit 2 Line 5x Dots 0x38 56 Function Set 4 bit 1 Line 5x7 Dots 0x20 32 Function Set 4 bit 2 Line 5x7 Dots 0x28 40 Entry Mode Ox06 6 Display off Cursor off clearing display without clearing DDRAM content 0x08 8 Display on Cursor on OxOE 14 Display on Cursor off OxOC 12 Display on Cursor blinking OxOF 15 Shift entire display left Ox18 24 shiff entire display right OxIC 30 Move cursor left by one character 0x10 16 Move cursor right by one character 0x14 20 Clear Display also clear DDRAM content 0x01 set DDRAM address or coursor position on display Ox80 add 128 add oet CGRAM address or set pointer to CGRAM location Ox40 add 64 add DDRAM address given in LCD basics section CGRAM address from 0x00 to Ox3F 0x00 to 0x07 for c
94. ot kit A11 4 Place the POP BOT at the START point see the field illustration Turn on and observe the robot movement POP BOT moves along the line following The movement path that show in the field illustration POP BOT will do 3 scenarioes when a junction is detected Scenario 1 Move forward after detect the junction Scenario 2 Turn left after detect the junction Scenario 3 Turn right after detect the junction From the movement path it has Scenario 1 only one position at 8th junction Scenario 2 has 3 positions at 3rd 4th 10th junction POP BOT will do Scenario 3 for the rest junction After POP BOT moves pass the last junction 1 1th POP BOT will turn around 2 seconds and stop Va POP BOT The Arduino Compatible Mobile Robot kit 87 Activity 12 White line challanges This activity is taken from the mission in robotic games The difference from Activity 11 are line color and movement path This activity change the line color as white on thr black surface See the illustration of field below The mission is track the line from START to 3 ending lines or destinations You can place a balloon at each end of line Robot must pierce the ballon Competitor who can pierce all ballons fastest is the winner 35 cm 35 cm A12 1 Open the Arduino IDE and create the sketch code from Listing A12 1 Al12 2 Set the POP BOT into Program mode Upload the sketch to the robot A12 3 Disconnect the download cable 88
95. pacers with the Box holder by by 3x8mm flat screws at the position following the pictures below 3x8mm flat screws 3x8mm flat screws 3 Insert the wheel with tire to DC motor gearboxis shaft and fix with 2mm self tapping screws 4 Attach the gearbox structure as shown in step 3 with the circle base by using 3x6mm screws at the position following the pictures below See the weheelis position is the center of base gnuwvtinans A EEEE HEEE LE EEEE AERE EEEE TEELT FYLLE LR LRL OL guwv aans 5 Insert the 3x10mm screw via the Infrared reflectoris hole and 3mm plastic spacer Make 2 sets Infrared reflector sensor T 6 Fix both Infrared reflector structures from step 9 at the in front of robot base both side by using 3mm nut 3mm plastic spacer 3x10mm screw Infrared reflector sensors 3mm nut E Base Infrared reflector POP BOT The Arduino Compatible Mobile Robot kit 23 7 Now the POP BOT chasis with Infrared reflector sensors is ready 8 Attach the Right angle joiner with Switch module by using 3x10mm screw and 3mm nut following connect the obtuse joiner at the end of the right angle joiner Make 2 sets Switch module Obtuse joiner 3mm nut 3x10mm screw 9 Fix 2 pieces of Straight joiner at the front of robot chasis by using 3x6mm screws and 38mm nuts Next connect the Switch structures from step 9 at the end
96. per sensor kk RA kk hee ke khe ke ke kk k ke kk ke ke kaki ke ek kk ke ek ke ke III ke ek kk heck kc kk ke kk RII KI ke ke ke ke ke ke ke ke e void setup pinMode 3 OUTPUT Motor Al pinMode 5 OUTPUT Motor A2 pinMode 6 OUTPUT Motor B2 pinMode 9 OUTPUT Motor B1 pinMode 15 INPUT Left Switch pinMode 17 INPUT Right Switch void loop Forward 150 if digitalRead 15 0 Test Bumper Switch From Left Backward 150 delay 500 Spin Right 200 delay 400 if digitalRead 17 0 Test Bumper Switch From Right Backward 150 delay 400 Spin Left 200 delay 400 i ee ke ke ke ke kk ke kk che e ke ke ke kk ke kk ke kk check ck ee ee ke ke ke ke ke e ke ke e ke ke ek void Forward int speed analogWrite 3 speed digitalWrite 5 LOW analogwrite 6 speed digitalWrite 9 LOW j void Backward int speed analogwrite 5 speed digitalWrite 3 LOW analogwrite 9 speed digitalWrite 6 LOW void Spin Left int speed analogWrite 5 speed digitalWrite 3 LOW analogWrite 6 speed digitalWrite 9 LOW j void Spin Right int speed analogWrite 3 speed digitalWrite 5 LOW analogwrite 9 speed digitalWrite 6 LOW i ee ke kk ke ke khe kk check ck ek ck ck kk kk kc ee ee ke kk e ke ke e ke ke ek Listing A2 1 BumperRobot pde file the Arduino sketch file for POP BOT Bumper activity 50 POP BO
97. rn on power Observe the robot movement The Robot will move along the black line When the robot detects the junction If will brake and beep once When if finds the second junction the robot will drive beep twice and this will increase for the subsequent junctions Note In the motor brake operation the robot will stop and lock the motoris shaft immediately But sometimes this is not enough You must program the robot fo move backwards for a short time This will cause the robot to stop at its position O L 80 POP BOT The Arduino Compatible Mobile Robot kit Activity 10 POP BOT with 90 degree turning line tracking This activity features about 90 degree turning when robot detects the junction or crossing point This technique is very important in Robotic challenges Many line tracking challenges prepare many crossing lines or juntions Robot must detect and moves precisely enough to maintain its movement stability A10 1 Open the
98. roximity infrared IR detection There s an infrared diode behind its transparent blue window and an infrared transistor behind its black window When the infrared emitted by the diode reflects off a surface and returns to the black window if strikes the infrared transistor s base causing it to conduct current The more infrared incident on the transistor s base the more current it conducts When used as an analog sensor the ZX 03 can detect shades of gray on paper and distances over a short range if the light in the room remains constant The suitable distance from sensor to line or floor is during 3 to 8 mm The output signal connector V OUT GND Infrared Reflector voltage is during 0 1 to 4 8V and digital value from10 bit A D converter is 20 to 1 000 Thus ZX 03 will suitable to apply to line tracking sensor POP BOT The Arduino Compatible Mobile Robot kit 13 1 4 3 GP2D120 Infrared distance sensor One of the special sensors in robotics is the GP2D120 It is an Infrared Distance sensor Some people call it the IR Ranger With the GP2D120 module it adds the distance measuring and Obstacle detection using infrared light feature to your robot Your MicroCamp robot can avoid obstacles without having to make any physical contact Infrared LED transmitter Infrared Receiver GP2D120 Vout GND Vcc Features of the GP2D120 module e Uses Infrared light reflection fo measure range e Can measure a range from
99. sitive going pulse with length of 1 to 2 ms which is repeated about 50 to 60 times a second You can check the details in the figure 10 4 Start with generate pulse with period 20 millisecond and adjust the positive pulse width millsecond The servo motor move horn to last left position The pulse width 1 5 millisecond move the servo horn to center and pulse width 2 millsecond cause servo horn to last right position The important specification of servo motor are 2 points as Speed or Servo turn rate or transit time and Torque The servo turn rate or transit time is used for determining servo rotational velocity This is the amount of time it takes for The servo to move a set amount usually 60 degrees For example suppose you have a servo with a transit time of 0 17sec 60 degrees at no load This means it would take nearly half a second to rotate an entire 180 degrees More if the servo were under a load This information is very important if high servo response speed is a requirement of your robot application It is also useful for determining the maximum forward velocity of your robot if your servo is modified for full rotation Remember the worst case turning time is when the servo is at the minimum rotation angle and is then commanded to go to maximum rotation angle all while under load This can take several seconds on a very high torque servo Torque is the tendency of a force to rotate an object about an axis The torque unit is ounce in
100. t 37 4 2 1 2 Select the COM port Uploading the sketch from Arduino IDE to POP 168 module requires serial port communication It can work with virtual COM port that created from USB to Serial port converter select menu Tools gt Serial Port You can select the target COM port Bl Arduino 0011 Alpha File Edit Sketch Tools Help Auto Format Ctri T Copy for Forum Archive Sketch Board gt Serial Port b Burn Bootloader b Normally on board serial port will be COM or COMO For USB Serial port address will be COM3 or higher But Arduinoi can support COM port not higher COMO 4 2 2 Open the example sketch file select menu File gt Sletchbook gt Examples gt Digital gt Blink Bl Arduino 0011 Alpha File Edi Sketch Tools Help New Ctri N Sketchbook b Open Ctrl O Save Ctrl S sketch 510405a Save As Ctrl Shift S Examples gt Upload to WO Board Ctri U Analog Communication Page Setup Ctrl Shift P Digital Blink Print Ctrl P Library EEPROM ETER h Preferences Ctri Library Matrix Button Quit Ctrl Q Library Stepper Debounce Library V Vire Loop The example code Blink ode will appear on the text editor area Ell Arduino 0011 Alpha Io i P PNC Blink The basic Arduino example Turns on an LED on for one second then off for one second and so on We use pin 13 because depending on your Arduino board it has either a built in LED or a bu
101. the testing chart Turn on the robot See the reading value at SLCD screen and record it After that read value of black surface and record the value also giga III ligit igidlJl lg Ihe result is The white surface value is between 500 and 950 The black surface value is between 100 and 400 The example reference value for detecting the line is 6504 350 2 500 7a POP BOT The Arduino Compatible Mobile Robot kit 67 Activity 6 POP BOT border movement After knowing the values of the black and white surfaces the next activity touches on how to move POP BOT within the black border A6 1 Open the Arduino IDE and create the sketch code from Listing A 1 A 2 Set the POP BOT into Program mode Upload the sketch to the robot A6 3 Disconnect the download cable A6 4 Make the border field following the illustration below The white surface area is 90 x 60 cm and black line width is 1 inches 2 5 cm 50 cm 70 cm 68 POP BOT The Arduino Compatible Mobile Robot kit kok k k k kok k kok ee kk kk kk kok k kk kok k kk k kk k k k k k k kk kk k k k k k k k k k k POP BOT V1 0 Filename BlackBorderMove pde POP BOT moves in the black border line kk kk kk k k ke kikki ke ek ke kk k ka
102. tion testing 126 POP BOT The Arduino Compatible Mobile Robot kit A17 5 Tum on the POP BOT See its operation After turning on The power POP BOT will drive servo fo move the GP2D 120 fo last right position Position 0 Is O degree angle POP BOT controller reads data from GP2D 120 and show on the SLCD 16x2 screen as follows Dm ki value can change in any robot Next POP BOT drives fhe GP2D120 structure to Position 1 22 5 degree angle and reads sensor value and shows on the SLCD screen The robot will do same until Positions Position A
103. ts a menu of all the sketches in your sketchbook Save Saves your sketch Hf Upload to I O Board Uploads your code to the Arduino I O board POP 168 module Make sure to save or verify your sketch before uploading if Serial Monitor Displays serial data being sent from the Arduino board USB or serial board To send data to the board enter text and click on the send button or press enter Choose the baud rate from the drop down that matches the rate passed to Serial begin in your sketch Note that on Mac or Linux the Arduino board will reset rerun your sketch from the beginning when you connect with the serial monitor 3 5 Arduino programming reference notice This activity book will not describe about Arduino programming You can read and make the understanding about Arduino syntax and programming reference from Help menu or learn from Arduino website at www arduino cc Addition you can learn from 40 pages of Arduino Programming Notebook Also download rom Arduino website in Playground page POP BOT POP BOT The Arduino Compatible Mobile Robot kit e 31 4 POP BOT program development by Arduino The POP BOT program development can summarize as the diagram following the figure 4 1 Installtion software tools Create the sketch file Arduino IDE Make the C C code on Arduino IDE C C programming development tools Includes Text editor Compiler and Upload the code to microcontroller USB to RS 232 seri
104. uses a Modular plug RJ 11 6PAC 6 pins form and 4 contacts Its Length is 1 5 meters approximation The cable assignment is shown in the diagram below MCU TxD MCU DTR GND This cable requires 5V from USB port and support USB 1 0 2 0 User can set the baudrate up to 115 200 bit per second Requires the driver installation before using POP BOT The Arduino Compatible Mobile Robot kit 15 1 6 Mechnical prt features 1 6 1 Circle wheel and Tire set Includes 2 pairs of the suittable circle wheel for BO 2 DC motor gearbox and tread rubber tire Fix the wheel with gearbox shaft by 2mm self Tapping screws 1 6 2 Plastic grid plate set Includes each of the universal plastic grid palte 2 sizes 80x60mm and 80x80mm Each plate provides 3mm diameter holes with 5mm pitch 1 6 3 Circle base This base is injected from high quality ABS plastic Diameter is mm It has 2 free ball wheels at both side This base has many 3mm holes for fixing the controller board sensors and more mechanical parts 16 POP BOT The Arduino Compatible Mobile Robot kit 1 6 4 Plastic joiners 60 pieces of varied color joiners made from PVC plastic They can be connected together or by using screws and 3 mm nuts in installation There are 4 types Right angle Obtuse Straight joiner and Hole straight joiner d gt A V WA WA 1 6 5 Strip joiners They are made from plastic Each joiner has 3mm hole 5mm pitch
105. witch 2 2 4 Release the BL switch If Blue LED on POP 168 is turned on and not blink then POP 168 had entered Bootloader mode and ready to uploaded 3 At Arduino IDE select menu File gt Upload to I O Board Wait for uploading 4 When uploading complete the status bar at the bottom of main screen will display message Done Uploading Done uploading 5 After the uploading is finished press RESET switch again The sketch will run on ihe POP BOT The LED at Di13 Blue LED on the POP 168 module blinks 1 second rate The Arch ing compatioks FPOP BOT momie nop xit POP BOT The Arduino Compatible Mobile Robot kit e 4 5 POP BOT movement activities The POP BOT has 2 channels of DC motor drivers You can control the speed and direction of DC motor rotation with software Because DC motor is driven by PWM Pulse width modulation signal In this section describe how to drive DC motor with PWM and how to generate PWM signal of Arduino POP 168 microcontroller in C programming 5 Basic operation of driving DC motor with PWM By changing modulating the width of the pulse applied to the DC motor we can increase or decrease the amount of power provided to the motor thereby increasing or decreasing the motor speed Notice that although the voltage has a fixed amplitude it has a variable duty cycle That means the wider the pulse the higher the speed Refer Figure 5 1 the Vs supplies PWM signal to DC motor Ih
106. ySerial print Hello World delay 2000 LCD CMD 0x01 Clear Screen Command LCD CMD 0x85 ROW 1 COL 5 MySerial print From delay 500 LCD CMD 0x07 Iq SLEV E left text for 1 0 1 lt 9 i MySerial print delay 200 POP BOT The Arduino Compatible Mobile Robot kit e 6 LCD CMD 0x05 Shift right text for i 0 i lt 9 i 1 MySerial print delay 200 for 1 0 1 lt 9 i Blinking text LCD CMD 0x08 delay 200 LCD CMD 0x0C delay 200 LCD CMD 0x00 Show text MySerial print Innovative Line 1 LCD CMD 0xCO MySerial print Experiment Line 2 delay 5000 1 20 Show Number LCD CMD 0x01 Clear screen MySerial print Counter Line 1 while 1 i LCD CMD 0xC5 Line 2 MySerial print i DEC delay 100 Program description Part 1 Initial the communication module in microcontroller and SLCD16x2 Part 2 Select the target line to display The P line 0x80 is set to show FLEE message The bottom line 0xCO is set to show Fei iz lite ici message Part 3 Send the Clear screen command 0x01 and define the first letter at 5th digit on the top line of LCD 0x85 to show rar message Part 4 Send the shift left command 0x07 and loop to shift the iirz message to left direction Part 5 Send the shift right command 0x05 and loop to shift the rH message back To start Part 6 Loop for sendin
107. zv 9T OZAId eov ET V YOLOW O TdS pee o i P s 0 7o W LT EUY b 9 bY vTia 0uv be vt er AQT iy AS O ES vas vv 8T m Jnor oj SX i d e 5 0 3 12S Sv 61 WA AS OT _ ol 9X AStO O guy T LASAU 2 I l E ae 4 n AOS LASAN AS o FO zuy m CNS 1V8 MO1 Le AN Ez s i raa GND AV s T 1no ues PEOZVD pu s ai V0899SQJ M TOI E l M x ID TO T act 89T dOd saa ALY E TMS T A9T AZT 8 b l 0 S 0St TdON moot Livd MT AE 9 l n 7 c M000T m z 9 OY Q5 710 ano 6T8SNT o wd Ta 4e zo XL iu a A os NS cd G038ZVDI UA OFd9 TI Ca QVOINMOGQ AS TC Figure 1 3 The completely schematic diagram of RBX 168 controller board 10 POP BOT The Arduino Compatible Mobile Robot kit 1 3 Output device features 1 3 1 DC motor gearbox This robot kit provides 48 1 ratio DC motor gearbox model BO 2 with IDC connector cable This is features e Operating voltage is 3 to 9Vdc e Current consumption 130mA 6Vdc and no load e Average speed 170 to 250 round per minute RPM 6V and no load e Weight is 30 grams e Minimum torque is 0 5 kg cm e Attached with the plastic mounting with 5 of insert nuts e 42 x 45 x 22 7 mm WXxLxH dimension 1 3 2 Standard RC servo motor The standard servo is ideal for robotics and basic movement projects These servos will allow a movement range of 0 to 180 degrees The servo output gear shaft is a standard Futaba configuration Technical Specificati
Download Pdf Manuals
Related Search
Related Contents
User definable on-line co here - Itsineurope.com GX Developer Version8 Operating Manual グリーンハイツ メーカーカタログを見る(252KB) Philips Daily Collection Fryer HD6103/70 PC sync fuer Windows 3.0 DJ Lase Performance 150 RGY / 250 RVP / 200 GVC láser manual Copyright © All rights reserved.
Failed to retrieve file