Home

SBot v2.0 – Educational Robot for Clubs and Classrooms Introduction

image

Contents

1. Bluetooth device SBOT1 is attempting to connect to this A dd s 32 my Bluetooth Places Find Bluetooth Devices SB0T1 computer Click here to proceed with the connection Before a connection can be established this computer and the device i b t be paired To deny access ignore this prompt ide The Bluetooth pairing procedure creates a secret key that is used in all future connections between these two devices to establish identity and encrypt the data that these devices exchange 13 14 To create the paired relationship enter the PIN code and click OK Thursday Bluetooth PIN Code f Click the context help balloon to enter the PIN cs se Virtual serial port is established you can double E ter l 234 1 x My Bluetooth Places Find Bluetooth Devices SBOT1 File Edit View Bluetooth Favorites Tools Help Back Y BJ 4 Search KZ Folders p Address 2 My Bluetooth PlacesiFind Bluetooth Devices SBOT1 b Generic Serial on SBOT1 connected OM4 Connected In this case the port 1s COM4 always notice which port 1s assigned to your robot After connecting the robot we can verify the functionality of a robot with the standard firmware using the program SbotManager exe that you find on the CD Alternately you can use any terminal application that can connect to a serial port Robot States after Power Up If SBot has the standard firmware in its flash memory on p
2. the robot can be easily extended with a higher level system for example a small board with ARM9 processor Linux operating system and a camera to recognize image Such a robot could autonomously follow a ball search for light sources follow a line avoid obstacles or map its environment e Line following robot sensors on the bottom allow to send the robot to participate in the traditional line following robotics contests e Remotely controlled robot the robot with standard firmware can be controlled over the BlueTooth radio The BlueTooth connection creates a virtual serial port which can be connected from any terminal or user application e Play robot with a microcontroller 1s always a lot of fun your imagination 1s the key Getting Started Before using your robot make sure that it is working correctly Follow the following startup procedure 1 Make sure the robot 1s OFF the main switch 1s in the off position 2 Insert charged NiMH batteries note do not use non rechargeables as they have different voltage into the bottom battery holder The robot has a protection against incorrect polarity but 1t won t start if you insert batteries in a wrong direction When the batteries are properly inserted you can turn the main switch to the ON position 4 Robot will start a correct startup will be indicated by the four LED on the side of the board flashing in a sequence for a short period During the operation the bo
3. The sguare pad depicts 5 A a PINI of the specific connector 0 S S y gt 1s Power connector should 0 Bumpers connector S Serial line s be connected directly with the I2C bus battery module The polarity is important Even though the robot is protected from reversing the polarity it will work only when connected correctly the red wire is black wire The power follows through the main switch and 3A fuse that recovers automatically after few minutes The power is further connected to all the devices Note there is no power regulator it is assumed that the input power is at 5V The power level can be measured using the A D converter on channel 7 It is connected through a voltage divider For measuring the power the reference voltage of ADC should be switched to the internal 2 56V More information in the section on ADC below Pin layout 1 2 5V 3 4 GND Servomotor connectors Up to six independent servomotors can be connected to Motor Pin PORTB 5 OCIA the board The connectors are arranged in two groups of three each group as a whole can be programmatically disconnected from the power using MOSFETs with GATE stilo to PB4 peer 1 3 and PE2 ten 4 6 When the GATE 1s low motors are powered when the GATE 1s high power 1s disconnected from the motors The software framework has the macros servo 123 on servo 456 on andservo 123 off servo 456 off The PWM servo control signal is genera
4. X DM resistor of ca 20 kOhm can be enabled or isabled SPI bus for communication with advanced devices such as serial memories D A converters etc 1s also available Pin SPI CLOCK is shared with the programming interface i e its state is undefined during the microcontroller programming Two interrupt pins are available Interrupt A connected to the pin INT6 and Interrupt B connected to the pin INT7 It 1s possible to provide an interrupt routine that 1s invoked each time the raising or falling edge or level toggle of the signal is detected I2C bus that allows connecting to up to 127 devices is available Both pins have external pull up resistors of 5 6kOhm the recommended communication speed is 400kbps The serial port is available RxD pin transmits data to the microcontroller while TxD pin transmits data from the microcontroller These pins are used during the ISP programming Their state is undefined during the programming and nothing should be connected to these pins while programming All digital I O operates on standard TTL 0 5V level except the I2C bus that is an open collector The specialized pins such as SPI can be configured as regular digital pins too Analog sensors TOGO o Main Control Board Power IUI pa Electronics ISP programming The schematics of the main connector 3 control board is in appendix 1 lt 6 The placement of various 8 devices is shown at the figure on S the left
5. is decremented automatically in the timer interrupt occuring every 0 01 When it falls back to 0 the servomotors are turned off When this variable is equal to a special reserved value TIMER SERVO CONTINUOUS OPERATION the variable is not decremented and the robot will move in the current direction infinitely This variable should be set before we change the state of the motors Example ticks until stop 1000 set servo 1 SERVO FW set servo 4 SERVO FW servo 123 on servo 456 on The robot will be rotating right for 10 seconds ISR TIMERO COMP vect this interrupt occurs every 10 ms 0 01 of second It is possible to insert user code in this function as long as it is always executed fast The interrupt routine currently operates the bottom LEDs and timing of the servo motors Motor functions and macros servo c and servo h void set servo unsigned char which unsigned int value this function sets the control value for the PWM signal of the specified servo motor The first argument 1 6 specifies the motor a special value 0 indicates all motors The second argument can be a predefined value SERVO_FW for foward movement SERVO BW for backward movement and SERVO STOP to stop If the motor should stop it is recommended to use the servo xyz off macro so that it won t consume the power The left motor is usually connected to port 1 and the right motor is connected to port 4 Values close to SERVO STOP will c
6. signals of the microcontroller The central part is left for the user The connections are shown in the following layout 5V batteries 3 3V GND Universal Board 1 Analog input O The power sources available at the board are the o2 gear py 1 battery source 5V which may vary depending on the state on AES E a of the batteries and the actual power demand and the 95 Analog input 4 stabilized 3 3V that can supply up to 0 4A The 5V source o6 Analog input 5 cs h dev a as id tup to 1A provides current up D Analog input 6 98 Digital d 7 The analog inputs 0 6 are connected both to the no 99 Digital I O 6 ADC connector pins and holes of the universal board Thus A OS h of the input ly be used i f thet 911 Digital I O 4 2 each of the inputs can only be used in one of the two ee 12 Digital 1 0 3 2 locations The analog inputs recognize voltage from the s 5 pe j dem y a interval 0 to Vref of the A D converter i e either the 5V 00 W15 Digital I O O VCC or internal referential power source of 2 56V SSP LOGK The digital I O pins 0 7 represent the PORTC of the 017 SPI MOSI i NA Bis SPI Miso microcontroller Each of these pins can operate in both input 19 Interrupt B and output modes independent on the direction of the Mo sad AE om 4 Dt remaining digital pins Each pin can provide or sink up to 922 12C SDA z 20mA when operating as output When configured as input
7. 0 F eam U flasku projekty 0053 sbotsfwd sdefaultS bat hesi F Execute above Output avidude successfully opened stk500v1 device please use c stk500x1 Now the bootloader process can be run Start avrdude AVR device initialized and ready to accept instructions the Avrdude GUI application that 1S available Reading TEEEEEEEEEHEHEEEEEE EF FEE EHE HEEEEEE EE E FEE EE EHE EE EE EE H FEE EHE EE EE EE HEHEHE 100 0 222 on the CD avrdude Device signature 0000000 The figure on the left shows a program avrdude Yikes Invalid device signature h d h d d avidude Expected signature for ATMEGA128 is 1E 97 02 screenshot and the recommended settings Select ATMegal28 MCU and STK500 as programming protocol Select proper serial port COM7 on the figure in case the number is higher than 8 please specify MACOMxx in the command line instead of COMS Select the compiled hex file that contains the program to upload In case of EEPROM programming be aware that the memory location at address 0x0 contains the ASCII value of the robot number When ready press the Execute button Remove the bootloader jumper and reset the robot The program 1s started The Firmware Framework In order to make the robot programming more convenient and free the programmer from ardous setting of the flags registers and bits the firmware framework provides a set of macros that cover the usual needs of a robot program The basic framework supp
8. 0000 p Device Programmer P Port MCU memory The advantage is that it does ATmega128 y sem T feo M not require any additional hardware the Flash e write Read Verify Format JE projek 53 sbot hw defaults bat hex 3 Intel Hex ha EEPROM Write Read Verify Format CAD acuments and SettingssD avida tv Dacumentszserseeprom hex m Intel Hex bootloader communicates directly with the master device over the BlueTooth To program the robot all you need to do 1s to add the BlueTooth device on the PC and use the program AVRDude to upload the program AVRDude is installed together with Lock Fuse Extended Fuse Calibration WinAVR and iS provided on the CD write Write Write Write Read I Read I Read I Read Before downloading the robot must be ox fon ox o ox o0 ox foooo0000 0x foooo0n switched to the bootloader mode 1 Turn the robot OFF i E Exitmode D Disable auto erase for flash q Disable process bar output Reset Vec 2 Connect the pins of the Bootloader e Perform a chip erase t Terminal mode No reset No Vee e e F Verify the device signature Jumper v Enable verbose output n Don t write to the device Disable verify check Cycle counter 3 Turn the robot ON t ERA E 4 Connect the robot over BlueTooth as described in the getting started section Command line avrdude p m128 c stk50
9. 5 M M M J6 Le l i i p p E 1 i 4 2 2 2 100n SERVO Si4435 3 3V VCC R8 lt BAT MEASURMENT O O 10k U2 VIN VOUT C16 C5 C7 C6 100n 1000uF 6 3V D8 R9 100n 220uF 6 3V DIODE 4k7 LF33 DD_0 3 itle SBot zdroj a serva Size Document Number Date Tuesday July 08 2008 heet 7 of GP_BUTTONO SW2 GP Button 0 BUMPERO 20 a GP BUTTON1 1 vec SW3 O BUMPER 0 SW4 GP Button 1 BUMPER1 20 Pd R11 100k SW5 GP BUTTON JP1 BUMPER 1 O BUMPERO BUMPER2 Det SW7 Program Enable Pari 0 BUMPERI GP Button 2 A D 10 BUMPER RESET 50 7 2 AD2 48 BUMPER3 SW6 p sa AZ GF LEDO BUMPER 2 PA4 ADA za GP LEDI PAS ADS GP LED2 BUMPER3 Ba PAG AD6 44 GP LED3 n PA7 AD7 O C8 22p o SW8 RESET PB1 SCK MOSI SPI_CLOC D2 5 PB2 MOSI SPI MOSI Y1 MISO GP LEDO PB3 MISO SPI_MISO 14 745600MHz Le DKP POWERCA 000 jg SERVO SIGO S R12 560 PB5 OC1A SERVO SIG_0 c A SERVO SIG 1 D3 PB6 OC1B SERVO SIG 7 SERVO SIG 1 ab Gi PB7 OC2 OC1C IM SERVO SIG 2 2 GPIO DIGITAL 0 R13 560 C9 22p E s GPIO DIGITAL 1 Bo DA 37 GPIO DIGITAL2 5 POZ A10 GPIO DIGITAL 2 AR GP LED2 VCC r Be GPIO DIGITAL 3 os Q 3 A11 Fay GPIO DIGITAL 4 R14 560 PC4 A12 DIG 4 a ET GPIO DIGITAL 5 ae DS naa a E RA 3r GPIO DIGITAL 6 DICE GP LED3 C10100n amp 4 C6 A14 E GPIO DIGITAL 7 DiG 2 PC7 A15 E R15 560 PDO SCL INTO E a I2C SCL C12 100n EDDA ALL RXD BLUETO
10. OTH O PD2 RXD1 INT2 22 TXD BLUETOOTH 4 PD3 TXD1 INT3 22 BT TXD a RESET BLUETOOTH PDA ICP1 BT RESET EE 0 GP BUTTONO C13 100n aan GP BUTTON ISP programming interface ids GP BUTTON2 LED D I ODY A NARAZNIK ISP PROGRAMATOR PEO RXDO PDI Ld Ld EXTRA RXD DM A M NER PEZ XCK AINO SERVO SIG 8 9 PE3 OC3A AIN1 O sie SERVO SIG 3 83 PE4 OC3B INT4 SERVO SIG 5 SERVO SIG 4 c x lt G gt PES OCSC INTS INTERRUPT6 SERVO_SIG_5 PE6 T3 INT6 F INTERRUPT INTA PE7 ICP3 INT7 L9 INTERRUPT O intB PFO ADCO GPIO ANALOG 0 T ROD EEG GPIO ANALOG 1 ANI C14 100n is ae ga GPIO ANALOG 2 ane 2 ADC2 zg GPIO ANALOG 3 PF3 ADC3 AN3 GPIO ANALOG 4 PFA ADCA TCK ANA GPIO ANALOG 5 5 PF5 ADC5 TMS P AN5 GPIO ANALOG 6 PF6 ADC6 TDO GPIO ANALOG 7 ANG PF7 ADC7 TDI BAT_MEASURMENT Br i 4 DECO LEDS PG3 TOSC2 14 PGA TOSCI dne O ATMEGA64 Jumper special PROCEDUOR itle Sbot procesor Size Document Number Rev B lt Doc gt lt RevCode gt Date Tuesday July 08 2008 heet 3 of 4 ANO AN1 AN2 AN3 AN4 AN5 ANG dui Bojeuy dui Bojeuy dui Bojeuy eue JX3 0cLdodO eue e11x3 03103d9 eue e11x3 03103d9 J15 Univ board analog inputs 3 3V VCC BAT O O O DIG_0 DIG_1 DIG_2 DIG_3 DIG_4 DIG_5 DIG_6 DIG_7 Univ board digital inputs 12C_SDA 12C_SCL VCC O R17 5k6 EXTRA_RXD EXTRA_TXD UNIVERZALNA DOSKA J24 ea ETA dE I Univ board SPI itle
11. SBot v2 0 Educational Robot for Clubs and Classrooms Introduction SBot 1s a simple robotic system for people who would like to learn or perform microcontroller programming for robotics applications It is suitable for the beginners for simple applications as well as for advanced users as a platform for experiments in Artificial Intelligence The robot 1s communicating with the computer or another master device over the BlueTooth radio serial communication link A good quality base with multiple mounting holes allows easy extendability with additional components and the universal PCB is ready for extending the robot with custom electronics Specifications Overview Robot diameter including 150mm the bumper Robot dimensions without 130mm x 105mm bumper Power supply 4x 1 2V NiMH NiCD AA size rechargeable batteries power consumption with full motor load and active BlueTooth communication 330mA Weight without batteries BlueTooth range with 30m direct visibilit I O connections available 8x digital I O on the universal PCB 7x analog input Ix SPI Ix LC 1x serial line 2x interrupt Sensors in the basic 2x bottom line sensor IR bumper with collision detection from 4 different configuration directions Extensions that do not GP2Dxx distance IR sensors more bottom line sensors odometry encoders require any configuration changes 4x LED 3x button reset button Example Applications e Base for a more advanced system
12. Sbot univerzalna doska Size Document Number Rev B lt Doc gt lt RevCode gt Date Tuesday July 08 2008 heet 4 of 4 5 A BR Blokova schema robota Hlavna doska BlueTooth Seriova linka 1 ISP programovacie rozhranie PWM riadiace signaly 1 3 Zapnut napajanie 1 3 Serva Sig pre servo 1 Lave servo Sig pre servo 2 Prave servo PWM riadiace signaly 4 6 Zapnut napajanie 4 6 Procesor Analog 0 Pravy ciarovy Senzor senzory 0 7 Konektor na ser linku 0 Seriova linka 0 C Konektor na IZC zbernicu I2C Zdroje Baterie 5V 3 3V a GND Prerusenia 6 a 7 Tlacitka o Analog 1 Lavy ciarovy SEIUZOLZ a LED diody Naraznik Spinace narazniku Univerzalna doska A E I
13. The information can be obtained using the macro Bluetooth connection established which returns nonzero when the connection has been established More in the section on macros and firmware The module is sensitive and therefore it is not recommended to remove it from its socket It communicates with the MCU on its USARTI serial line i e pins PEO and PEI The reset pin of the BlueTooth module is also connected When logical 0 is supplied the module will reset to factory defaults Use only when you are sure you know what you are doing LED indicating connection is connected on a pin of the BlueTooth module It is ON when a master device is connected to the BlueTooth module and virtual serial line 1s established It is OFF when no device 1s connected Mounting holes The board is mounted in the robot chassis using four screws through four holes of diameter 3 5mm Instead of screws hex standoffs are mounted so that the robot is easily extensible with a higher system The distances are 96 5mm and 28mm in width and breadth dimensions Line Sensor For line following or surface pattern recognition the robot 1s equipped with the sensor CNY 70 It 1s suitable for perceiving objects in the proximity of 123 0 to 5mm Sensor 1s installed as a simple electronic board that 1s easy to mount using a single screw The board is powered with 5V and the analog output can m otol be directly connected to an ADC of the MCU The sensor works as a standard
14. ackets calculated value 1 bumperA 2 bumperB 4 bumperC 8 bumperD The state of the bumper is when there is no collision and 0 in case of collision The protocol has no timeouts 1 e the commands can be supplied at any time Robot Programming A user can upload a new program to the robot in two ways using the bootloader or through the ISP interface The standard ISP interface allows further options in addition to downloading a new program to the MCU flash memory one can setup the MCU fuses block further programming change the clock signal source and other settings The fuses and ISP programming is described in detail in the ATMegal28 datasheet ISP connector uses the standard pin layout see the section on main board above The following programmer devices can be used AVR Dragon JTAG ICE Mk2 AVR ONE and others A low cost solution can be built based on the manual in 6 Note The ISP interface is sharing some pins with the serial line 0 In consequence no device should be connected to serial line 0 during the programming An alternative way to program the robot is pM using the bootloader Bootloader is a small GreelO Driver Install Remove _ Remove Status program stored at the end of the MCU s flash memory Its purpose is to download programs over serial line from the master device to the avrdude EJ C Location of alternate configuration file 0
15. ause the motor to rotate slowly in one or the other direction Note The motors are automatically turned off by the timer To prevent this from happening the programmer may set the global variable ticks until stop to value TIMER SERVO CONTINUOUS OPERATION see above The variable ticks until stop can be read to determine whether the motor s have stopped Example ticks until stop TIMER SERVO CONTINUOUS OPERATION servo 123 on servo 456 on set servo 1 SERVO BW set servo 4 SERVO FW The robot will move backwards until it will receive a new command servo 123 on servo 456 on servo 123 off servo 456 off this macros connect or disconnect the groups of motors from the power The groups are arranged in tripples motors 1 2 3 and motors 4 5 6 Input and output functions and macros stdout is a standard output Usual printing functions such as printf can be used to send output here The standard output can be redirected to various ports as needed In the standard setup it is connected to the serial line 1 i e the BlueTooth virtual serial line To redirect to a different device use FDEV SETUP STREAM macro Example FILE usartl FDEV SETUP STREAM usart1 putchar NULL FDEV SETUP WRITE The above statement will create a file pointer that can be used as stdout The first argument is a function that can output a character The second argument could specify the function to read one character if we wer
16. e to use this SA for both input and output The third argument describes how the device is going to be used Read more at i __stdio html Now the lomas statement performs the redirection so that stdout will be redirected to the serial line 1 BT stdout usartl The files usartO and usartl are defined but the user is free to setup additional files int usartO putchar char c FILE stream for ser line 0 int usart1_putchar char c FILE stream for ser line 1 This function sends one character over the respective serial line The second argument can be ignored 0 Example usartO putchar a 0 This line sends the character a to the serial line 0 The function returns 0 unsigned char usart1 getchar void for ser line 0 unsigned char usartO getchar void for ser line 1 This function waits for a character from serial line 0 or 1 and returns it Example if usartl getchar a set leds OxOF This line reads a character If it is a the LEDs will be turned ON Source code Files The robot firmware is written in the language C and divided into parts each responsible for certain robot functionality The following is a list of files and their contents A D converter interrupt of the A D converter Usart1 c usart1 h gt imer interrupt with 10ms frequency a erial line 0 NN Protokol defs h ommunication protocol definitions ZIQ Makefile akefile automatically ge
17. escribed below Default number 1s 1 Command that is determined by this single character F Forward robot will start moving forward Example 11F000056 0 B Backward robot will start moving backward Example 1B000052 1 Left robot will start rotating left Example 1L00005C R Right robot will start rotating right Example 1R000042 Forward for robot will start moving forward and stop after the time specified in hundreths of second Example 1f01f425 robot will move forward for 5 seconds Backward for robot will start moving back and stop after the time specified in hundreths of second Example 1b00FA75 robot will move backward for 2 5 seconds Left for robot will start rotating left and stop after the time specified in hundreths of second Example 1103E8092 robot will rotate left for 10 seconds Right for robot will start rotating right and stop after the time specified in hundreths of second Example 11r003263 robot will rotate right for half a second Rename the robot The new name is specified using ASCII value of one character from A to Z ato z or U to 9 The robot will automatically disconnect from the BlueTooth and reset It has to be paired as a new device Example 11n004278 rename SBOTI to SBOTB mi Set state of the LEDs The parameter is a value 0 to 15 Example 1D000F22 will turn ON all the LEDs Reply packet 1000005F is a confirmation
18. f 2500mAh When the voltage on a single cell falls below 1 2V 1t should be recharged Mechanical Construction The robot body is a standard differential drive with two wheels and one support point The wheels are mounted directly on the axles of the motors A single aluminum chassis holds the motors main board and all the other parts The wheels wear a rubber layer to achieve a better grip of the surface Robot Control over BlueTooth The robot can be controlled using a supplied program SbotManager exe or using a terminal program using an arbitrary terminal program such as Hyperterminal or BrayTerminal When the commands are entered manually the following protocol 1s to abide the protocol can be also deactivated for direct console Input Output see wiki robotika sk for more information Protocol Description The robot can be controlled using a simple protocol All commands have the following form OpxxxxCC Where the meaning of the individual parts is as follows Exlamation mark indicates the start of a new packet the robot will erase its buffer and start receiving a packet Each packet must start with an exclamation mark Robot number this number has no special meaning and 1s used to distinguish between multiple robots The name of the robot is SBOTO SBOTI SBOTA SBOTZ where the last character is the robot number digit or letter The robot number can be changed using a service command d
19. h a checksum computed as Checksum 0x00 XOR 1 byte XOR 2 byte The single byte checksum is appended as two digit hexadecimal number at the end of the packet Example packet LbOOOF will have the following checksum Checksum 0x00 XOR XOR b XOR 0 XOR 0 XOR 0 XOR F Thus the resulting value is 4 and the complete packet is LbOOOFO4 Packet termination newline is not considered to be part of the packet Packets with incorrect checksum will not be accepted but a reply packet with a correct checksum will be sent back from the robot In this way you can determine the checksum when entering the command manually Example A reply packet BOOXXcc means that the correct checksum that was to be used was XX Example of conversation To SBOT 1b005055 move backward 80 time units 0 8 seconds From SBOT 1B007752 wrong checksum reported we should have used 0x77 To SBOT 116005077 resend the packet with the correct checksum From SBOT LOOOOOSF confirmation that the command was accepted Each packet is to be confirmed with a newline character either 0x0D CR or 0x0A LF This character is not considered part of the packet The robot replies to the command packets with reply packets They are sent only as a response to the packets sent down to the robot The reply packets have the form OpxxxxCC The meaning of the parts 1s as follows Same meaning as in command packet de
20. ltage 1s available in adc vals 7 and it is measured using the internal ADC REF 256V The real voltage of the battery can be computed using the formula Ubat adc vals 7 1023 2 56V 3 127 Serial line connector is dedicated to communication with external devices over a serial line It is connected to the MCU s USART 0 serial line When the ISP programming is used the RxD and TxD pins of this connector will contain undefined values Pin layout 1 5V can vary depending on batteries 2 RxD input data to MCU 3 TxD output from MCU 4 GND RC connector allows connection to one or more I2C compatible devices such as temperature sensors D A converters or various intelligent devices The connector provides the power supply for the devices and pull up resistors of 5 6kOhm Pin layout 1 5V 2 SDA serial data 3 SCL serial clock 4 GND ISP programming connector can be used to upload a new firmware program to MCU In order to use the ISP programming a programming cable or MISO MEE device 1s required See 6 with examples of ISP programming devices and SCK MOSI construction manuals Suitable programmers include AVR Dragon or JTAG ICE RESET GND MkII of Atmel Pin layout is shown on the figure right The programming is described in more detail below in the section on programming the robot Remaining Parts of Main Control Board The main board contains also a BlueTooth module RESET button
21. main switch bottom LEDs for flashing effects and applications LED that indicates BlueTooth connection and 4 mounting holes RESET button is connected directly to the RESET pin of the MCU When pressed the MCU will restart In case the bootloader jumper is applied the MCU will enter the bootloader mode that allows programming without the need to use the ISP interface More in the section on robot programming below Main power switch disconnects the power from all electronics on the main board The two bottom LEDs are controlled using the PGI pin and are ON when the pin contains logical 0 They can be operated with the macros set decoleds clear decoleds and toggle decoleds The macro set decoleds turns them ON clear decoleds turns them OFF and toggle decoleds negates the current state BlueTooth module is a module of type ESD200 with a built in antenna It has a range of approximately 30m It is powered from the 3 3V regulated supply on the board and its electronics operates at 3 3V logic thus the inputs are behind a resistor voltage divider The module supplies a transparent serial line 1 e all data sent to the serial port are transmitted over to the virtual serial port on the remote master device such as PC and vice versa When connecting the module sends status information This can be easily ignored by reading the connection status pin that is connected on the MCU s PBO Logical 0 indicates module 1s connected to a master
22. nerated by AVR Studio Sbot aps sbot aws VRStudio project files default sbot hex esulting hex file that is to be downloaded to the robot default everything else uxilliary files of compilation process gt gt Contents of the CD The robot package contains a CD with the following software tools and documentation AVRStudio 4 and service packs WinAVR Datasheets for individual parts Source code of the robot firmware and bootloader Compiled hex files SbotManager exe program for manual control of the robot This documentation in Slovak and English Useful Links 1 http www microstep mis com producer of the robot 2 http www robotika sk Slovak robotics portal 3 http gme sk Distributor of electronic parts in Slovakia 4 http atmel com Producer of the AVR MCUs 5 http winavr sourceforge net C compiler for AVR MCUs 6 http www lancos com prog html simple programmer for AVR MCUs BT_TXD BT_RXD BT_RESET BT_CONNECTION 3 3V O R5 560 STATUS D1 Connection AA 3 3V 3 3V BLUETOOTH R19 560 D6 D7 FRONTAL FRONTAL x DECO LEDS gt J7 5 O LEZ T swi 5 MAIN POWER 4 L 1 Battery power in POWER_B gt F1 BAT POLYSWITCH 2 5A O F2 C4 POLYSWITCH 2 5A C17 _ 100 1000uF 6 3 SERVO SIG 0 SERVO SIG 1 SERVO SIG 2 M M M R3 100k J3 E ZE p E EE o 2 2 2 100n SERVO Si4435 SERVO_SIG_3 SERVO SIG 4 SERVO SIG
23. of receipt Is Alive the robot replies with a packet with the firmware version Example 11A000051 Reply packet 11A000150 robot has firmware version 1 Number query return robot number This can be sent to all robots number Same response as to A packet Example 1 NO00045 all robots will reply with their number and firmware version Bumper status Returns 1 if no collision or O if there 1s a collision The reply packet contains the binary value 0 15 with the state of all four bumpers value 1 bumperA 2 bumperB 4 bumperC 8 bumperD The bumper layout is described in the section on bumper above Example 11 00007a This packet replies with the state of the bumpers i e 1 1b000F04 no collision this time Analog inputs Returns the state of the specified analog sensor Example 112000776 read the battery voltage level reply 1a724171 value is 0x0241 i e battery is 4 515V see the section on A D converter with the corresponding formula Command parameter applies to specific commands as described above Numbers are specified in hexadecimal number system For example 1000 time units is specified as O3E8 The number is always 4 digits long The capitalization of the letters can be arbitrary 1 e a and A are both OK When the parameter value is out of range the reply packet will inform about it 111000069 Checksum to verify the correctness of the packet each packet 1s appended wit
24. orts the A D converter robot sensors motors etc Some functions can be further extended by the programmer These locations are marked in the source code by a specific comment For instance the timer interrupt that occurs every 0 01 seconds The code in the interrupts should be as short fast as possible A D converter functions and macros adc c and adc h unsigned int adc vals 8 Array of 8 integers that contain the last sensor readings from the A D converter All contain the 5V battery supply as the reference voltage except of the last one which measures the battery voltage and uses the internal 2 56V Example if adc vals 7 500 set leds OxOF e 1s lower than the specified value all LEDs will be turned ON start adc this macro starts the ADC conversion The ADC conversion is started automatically from the interrupt and thus normally this macro should not be used adc select ref unsigned char x selects the reference voltage for the ADC conversion The allowed values are ADC REF 256V the reference voltage 2 56V or ADC REF AVCC the battery power supply ISR ADC vect this is a function that is called when the ADC conversion is complete and new value is available Users can insert their own code in this function Timer functions and macros timers c and timers h unsigned int ticks until stop this variable specifies the number of time units the robot is to continue moving in the specified direction It
25. os The bumpers are locates as shown in the figure on the right Bumper 0 is BlueTooth connected to PAO When the bumper is pressed the digital pin contains value 0 BUMPERO Buttons are connected to PD5 PD7 buttons 0 3 Button states are obtainable with macro button pressed BUTTON NUMBER where BUTTON NUMBER is GP BUTTON 0 GP BUTTON 1 or GP BUTTON 2 More information in the section on macros The internal pull up BUMPER2 resistors of MCU should be used BUMPER3 Analogue sensors connectors are connected to respective A D converter pin each The connector also contains the pins with battery power supply and ground Pin layout 1 ADC signal 2 GND 3 5V The sensors should have the input impedance maximum 10kOhm otherwise the measurement will be inaccurate In the software framework the firmware is continuouslyy scanning the ADC and the last raw sensor reading 0 1023 is always available in the global integer array adc_vals where 0 corresponds to OV on the respective channel and 1023 represents the power supply voltage The formula for the values in adc_vals array 1s adc_vals U UVcc 1023 where U is is the measured voltage and UVcc is the power supply voltage or another reference voltage The ADC can be configured for a stabilized reference power supply using the adc select ref REF macro where REF is ADC REF VCC to use the power supply voltage or ADC REF 256V to use the internal reference voltage 2 56V The battery vo
26. ower up it enters one of the following states Description LEDs on the board are Normal operation the robot is expecting remote commands over the BlueTooth The OFF and bottom LEDs LEDs on the board can be controlled using a special command flash occasionall LEDs on the board are Low power It 1s recommended that you turn off the robot immediately and let your flashing fast and bottom batteries get charged The robot will operate from about 3 8V but batteries could be LEDs flash occasionall harmed by extreme discharge LEDs on the board are Robot is in a bootloader mode ON ON OFF ON and bottom LEDs are ON Hardware Board Circuit Schematics All robot electronics is located on the main board All devices sensors user interfaces BlueTooth module are connected to the board using flat computer board connectors with standard 0 1 hole distance The sensors servo motors and bumpers also contain electronic circuits Main Control Board Kernel of the robot is formed by the main control board with ATMegal28 microcontroller Complete schematics 1s shown in appendix 1 this section explains the functionality and individual parts The board is divided into two parts control electronics and universal board The user can solder its own electronic circuits on the universal board special sensors LCD display etc The connecting holes on the shorter sides contain the power source the longer side is connected to the individual
27. reflecting light sensor it consists of a photo transistor and infrared LED The more light is reflected from the surface the more current flows through the emitter and causes voltage drop that can be read through the ADC The signal usually varies from 1V with white surface to 4 5V with black surface The board has a cable connection that can be plugged directly to the main board the red wire connects to the pin 1 Pin layout 1 Output signal green wire 2 GND black wire 3 5V power supply red wire Additional Electronics In addition to the main board and sensors the robot contains electronics circuits also inside of the servomotors and bumpers It also contains a battery module Servomotor contains a module that receives a digital signal that decides KL 0 5 2 5ms how to drive the motor The square digital pulse repeats with a fixed frequency The length of the positive pulse varies and determines the direction of the rotation The average value of about 1 5ms corresponds to a stopped engine The motor is connected using a three wire cable directly to the main board Usually the black wire is the GND signal followed by power supply 20ms J and signal Pin layout 1 Signal 2 5V 3 GND Bumper is mechanically connected with four switches so that the robot can determine in which direction a collision occurred In case of the collision the respective switch 1s pressed Batteries are NiMH rechargeable batteries with the capacity o
28. scribed above 0 Robot number same as above Type of reply one of the following characters Bad checksum the parameter is in the form 00xx where xx is the correct expected checksum Example 11B007257 the previous packet received had an incorrect checksum the correct checksum was 0x72 Unknown command Example To SBOT 11H000058 H is not a recognized command thus the SBOT replies 1 1U000045 Invalid parameter the parameter was out of range of allowed values for the specified command Example To SBOT 1n00237F change the name to which is not allowed reply packet 111000059 OK the command was accepted This reply is returned for the following commands F B L R f b r I S D n in case the command was accepted and had proper arguments obtained from the sensor in the form xyyy where x is the analog input number and yyy is a hexadecimal value read from the sensor 0x000 OV up to Ox3FF reference voltage or higher Example 1a202F 07 The channel 2 of ADC has the value 0x02F i e 0 11V if the reference i State of the analog sensor reply to the command to read from analog sensor contains the value Reply to ping Follows after the commands A and N the parameter xxxx is a hexadecimal number the firmware version XXXX Parameter of the reply depends on the reply packet type Checksum is calculated in the same way as in command packets described above Same meaning as in command p
29. ted using the 6 PORTES 0C3C MCU timer hardware features 1 e the MCU spends no cycles on motor control Direction can be controlled using the set servo SERVO NUMBER DIR macro where SERVO NUMBER is the motor number 1 6 and DIR is one of the predefined constants SERVO FW servo forward SERVO BW servo backward more information in the section on software framework below The table on the right shows the PWM servo signals MCU connections The square pad always pin 1 is the signal where the signal servo wire should be connected usually yellow or orange black wire is usually ground connected to the opposite end of the connector Pin layout 1 Signal 2 5V power 3 GND Bootloader Jumper Connector can be shortcut using a jumper After the robot is reset 1t will enter the bootloader mode programmable over the BlueTooth More information on this in section on programming the robot 4 LEDs are connected to upper 4 bits of PORTA Their state can be controlled using the macro set leds LED STATE where LED STATE is a bitwise sum of LED values For instance LED2 and LED3 will be ON and other LEDs OFF after the command set leds 0x02 0x04 Bumper connectors are connected to lower 4 bits of BUMPERI PORTA Internal pull up resistors are activated inside of the MCU The state of the bumper can be obtained with bumper stat BUMPER NUMBER where BUMPER NUMBER is in the interval 0 3 More information in the section on macr
30. ttom LEDs in the front flash shortly after a regular time interval 5 The robot is now ready to be connected from the computer Its flash memory contains standard firmware that was loaded when the robot was produced In the future use of your robot you may want to replace this firmware with your own control program or use this standard firmware for simple navigational remote control applications 6 Itis important that you do not hold all three switches pressed when powering the robot board In such a case the firmware will reset its BlueTooth module to the default configuration You should also take care of the jumper which should be open otherwise the bootloader will be started and the robot will expect a new firmware to be downloaded over the BlueTooth virtual serial port LJ To connect the robot over the BlueTooth from your computer make your operating system start searching for the BlueTooth devices The name of the robot will be SBOTx x is a number If the computer asks for the PIN code enter 1234 The following figure shows this process in Windows b My Device ind Bluetooth Devices cs view the services provided by Search for nearby Bluetooth d 3 Bluetooth Setup Wizard Configure dev ces connection Search for BlueTooth devices After the device is found click the right mouse button J Bluetooth PIN Code Required El Ou O Z p Search Folders gg d SA m M evice Name how

Download Pdf Manuals

image

Related Search

Related Contents

Lochinvar MFH-I&S-02 User's Manual  OBJET : Inspection du circuit du tuyau de carburant/remplacement  Holmes HCH4062B User's Manual  Manuale di istruzioni  Kenmore 580.53650 Dehumidifier User Manual  Honda GXV610 User's Manual  MDA-Win8086 MANUAL  Video User's Guide  取扱説明書/2.1MB  CAPÍTULO 2 MONTAGEM E ALINHAMENTO INTRODUÇÃO Este  

Copyright © All rights reserved.
Failed to retrieve file