Home

mOway User Manual

image

Contents

1. Encoder PIC16F687 Encoder Engrane Image 2 Drive system electronic and mechanical The servo motor group includes different features p lt Speed control controls the speed of each motor Time control controls the time for each command with a 100 ms precision 3 Traveled distance control Controls the distance traveled by each command with a precision of 1 mm aprox 4 General speedometer counts distances traveled since the initial command 5 Angle control controls the angle when the mOway rotates D The microcontroller sends the I2C command to the drive system that controls the motors and therefore releasing the main microcontroller so it can carry out other tasks Speed control is carried out by means of proportional control with negative feedback from the encoders signal The illustration displays the controlling system The microcontroller feeds the motors through an H bridge controlled by pulse width modulation PWM signals Wheel rotation is monitored by an encoding sticker and an infrared sensor When the sticker shows its black segment the logical output shall be 1 and when it shows the white sector the output shall be 0 The microcontroller analyzes these signals it can determine the exact wheel speed by measuring the pulse width and acts on the motors This way the mOway will be able to keep the speed constant on any surfa
2. Configuration Configuration Operandi Operandi Vanablel Vanablel aye S i Operands Operand eea 5 I a PA att constant v 10 constant v eo E constarit Variable Variable Image 110 Choose the second operand and the comparative www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 133 of 137 7 3 3 Start and End Any program must have a Start element but it does not need to have an End element an infinite loop can be created Properties Configuration Select 4 property type lnitiahzation ome me r J E PLPA m Image 111 Choose the option initialization The Start element can initialize the variables Properties Configuration Properties Configuration Select a property type see ene iis Intisization Initialization Initialization C Variable variable C Variable C ariable2 C arnable3 i _ atiable i Image 112 Choose the variable and the value for the initialization 7 3 4 Arrow Arrows are used to join Modules and Conditionals in order to r create the program flow diagram The same program indicates the user if the arrow is correctly positioned to ensure that the application Ao operates correctly www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 134 of 137 7 3 5 Erase Arrow Thi
3. 0 0 Out receive service Data sent and ACK received Out interruption Diagram 1 Sent data in Diagram 2 Receive interruption Diagram 3 Reception in assembler in assembler assembler www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 71 of 137 6 Programming Moway with C18 Compiler C18 is a compiler that can be acquired in the market and which supports the PIC18F86J50 microcontroller In the Moway Website the libraries required to manage sensors motors and RF modules written for the compiler Its greatest advantage is that it compiles in C language Managing numerical variables char int etc and flow controlling structures if for etc is very simple and it includes many pre compiled functions which greatly assist programming I2C SPI However the size of the generated programs 1s larger than with assembly language To summarize Very interesting if you wish to start working with Moway quickly Very interesting to carry out easy or average difficulty tasks Inadequate for programs with large coding Inadequate for critical response timeframes 6 1 Creating a project Use the MPLAB IDE Project Wizard to create the first project quickly C18 compiler has to be installed These example is made by MPlab v8 3 amp MPLAB IDE v8 33 File Edit View Mamad Debugger Programmer Tools Configure Window Help Dak Mies Checksum AA N Open Cl
4. e mOwayGUI software o This software controls all aspects of the robot program download battery charge control radio control RFUsb management and C or assembler programs download e Reference projects in assembler and C o Example projects to start working with mOway easily e RFUsb Driver o Driver for RFUsb that allows the communication between robots and PC MENU CD Setup MOWAY ED MENU Image 21 CD 11 Module not available in all kits 12 Module not available in all kits www moway robot com 4 2 Title mOway User Manual Rev v2 1 0 June 2010 Page 25 of 137 Download a program to mOway Download process is always executed in mOwayGUI This application can download to the robot mOwayGUI assembler compiled with Mplab o gputils and C C18 compiler projects Steps to download a program to mOway e Connect mOway to the PC through USB The robot doesn t need any driver e Open mOwayGUI application e Open or create a project in mOwayGUI or import a HEX file from assembler or C project e Click download bottom If a HEX file has been imported the download progress will start automatically e Disconnect the robot and check the project mOwayPack provide 8 compiled projects 3 to check sensors 3 to check the drive system and 2 programs that are explained in the next section Project to check sensors ASM_SEN_O1 Assembler software to check sensors Obstacle sensors are chec
5. June 2010 Page 13 of 137 3 3 1 Line sensors The line tracking sensors are two reflection optocouplers mounted on the top front part of the robot They use infrared light reflection to detect the color of the terrain at the point where the robot is These two sensors are connected to two microcontroller analog ports so strong terrain contrasts like white lines on black backgrounds can be detected They are also capable of distinguishing different tones The Vishay CNY70 sensor has a compact construction where the emitting light source and the detector are arranged in the same direction to be able to detect by using the reflective IR beam the light reflected in the terrain In the images below the three possible cases can be observed 1 Clear surface A white surface reflects all the infrared light and therefore we obtain a low voltage reading at the transistor s output when in regular mode Image 7 Line tracking sensor on a clear surface e Colored surface A colored surface reflects part of the emitted light obtaining an intermediate voltage at the microcontroller s analog channel input This way colors are easily identified Due to CNY70 tolerance two different sensor can differ www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 14 of 137 Image 8 Line tracking sensor on a colored surface 1 Dark surface A dark surface reflects very little light obtaining a high voltage
6. RF_RECEIVE Define RF_DATA l Return RF_SENDQ 1 0 2 0 gt Process data Process data 1 Send ok y AKC Send ok y AKC no No send y AKC Out interruption received received received Diagram 5 Reception Diagram 4 Data send in C interruption in C gt RF_RECEIVE Return 1 0 2 Process data Process data eres Out reception service Diagram 6 Reception in C www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 103 of 137 7 mMOwayGUI programming 7 1 Creating a Project The only thing you have to do 1s to click on the new project icon WorkBox Image 62 mOwayGUI screen FZ First programme in mOwayGUI In order to develop your first programme first you must create a project previous chapter This first basic programme will make mOway avoid obstacles www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 104 of 137 1 Next step is to add a 1 second delay delay_ms 1000 Just add a module and double click in order to configure it The Pause option is selected and configured as may be seen in the following image 2 The command to make one of the LEDs blink is added This is another module with the following configuration Properties Configuration Select a property type Properties Configuration o LED diodes Configuration LED diodes Configuration x Top green Wi ait ti
7. 0 Correct dispatch A command to stop the robot 1 Incorrect dispatch unsigned char MOT_RST unsigned char unsigned char MOT _FDBCK void RST_COM A command to reset the temporary variables for time and distance 0 Correct dispatch 1 Incorrect dispatch A command to determine the motor s status 0 Correct dispatch 1 Incorrect dispatch void MOT_CONFIG void This function configures the inputs and outputs so the microcontroller can communicate with the Drive System Table 48 Pic drive system connections Pin PIC I Indicates when the motor ends the command SCL of the I2C protocol SDA of the I2C protocol Port RE7 indicates the end of a command This port is labeled as MOT_END in the library Example Straight forward at 100 speed for 10 seconds 100ms x 100 www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 91 of 137 No action is taken until the command ends unsigned char MOT_STR unsigned char MOT_VEL unsigned char FWDBACK unsigned char COMTYPE unsigned char MOT_T_DIST MOT_VEL Desiredspeed 100 COMTYPE __ Typeofcommand s MOT_T_DIST Time value 255 Distance value 255 The command has been sent correctly The command has not been sent Connection problem Command to move in a straight line It is necessary to specify speed direction type of command and the time or the distance to cover The time has a resolution of 100ms and the
8. June 2010 Page 137 of 137 8 1 2 Radio control Once the RFUsb is connected mOway can be sent commands The robot s movements can be controlled by means of the buttons and the keyboard There also are two bars to determine the speed and turning radius When mOway captures the transmitted data a small green indicator will light on the lower left side On the contrary when no data is captured its color changes to red 8 1 3 LED In this section Moway s four LEDs are switched on and off 8 1 4 Speaker In this section is checked the switched on and off of the robot s speaker in a particular frecuency 8 1 5 Info Displays information about Moway RC Center 8 1 6 Sensor status This section describes the values returned by the sensors at all times updated every second 1 Analog value from obstacle sensors higher when the object is closer 2 Percentage of inciding light 3 Values from line tracking sensors higher when the terrain is dark 4 Distance covered by the robot after being switched on or the distance 1s reset 5 Accelerometer values 6 Battery meter 7 Temperature of mOway 8 1 7 Keyboard control The keyboard controls W Forward A Left S Back D Right www moway robot com
9. RST_COM The parameter that to be reset RST_T RST_DIST RST_KM Function Return 0 Correct dispatch The command has been sent correctly 1 Incorrect dispatch The command has not been sent Connection problem Resets the motor s internal time distance and speedometer temporary variables Example Reset elapsed time Reset distance traveled www moway robot com m Title mOway User Manual TEET ae Rev v2 1 0 June 2010 Page 95 of 137 unsigned char MOT_FDBCK unsigned char STATUS_COM STATUS COM The parameter to be recalled STATUS_T STATUS_A STATUS_V_R STATUS_V_L STATUS_D_R STATUS_D_L STATUS_KM Output A command to recall different drive system parameters elapsed time the angle only through the MOT_ROT command the speed of each motor distance traveled by each motor and the speedometer This function returns a pointer to 2 chars All the petitions except STATUS_KM return one byte MOT_FDBCK STATUS_x 0 maintaining MOT_FDBCK STATUS_x 1 at a OxFF value These two variables are updated every time a new command is sent e g recall the time elapsed since the last command Whenever using STATUS_KM the two bytes must be considered This command is very useful to calculate the length of a line while the robot follows it Table 49 Parameter resolution Example Recall elapsed time since the last command E g Output MOT_FDBCK STATUS_T O 0x7F gt 12 7 seconds elapsed since the last
10. a constant or variable to a previously created variable This variable can be used to configure different aspects of the robot Properties Configuration Properties Configuration Select a property type Select a property type Select 4 property type Assignment Configuration l Configuration i Configuration Value to asion Value to asign Yale to asign Warabled Variable Variable Vanablee Value to asign Value to aston Vanable3 j L constant constant w 2 0 Ee Image 85 Choose the variable and the value to assign www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 120 of 137 e Mathematical This is used to carry out arithmetic operations to add or subtract to or from a variable The first parameter must be a variable in each case and this will be used to store the result of the operation The second operand may be a constant or a variable Properties Configuration Properties Configuration Select a property type select a property type Mathematical Mathematical Configuration Configuration Operand Operandi laa Veiablet OO O valable Varnable Varnables Operand Operan constant v fi D A constant a Ascent Image 86 Choose the operand and the operation Properties Configuration Properties Configuration Select a property tupe Select a property type 1 athematic RA Configuration Configuration Operandi
11. dir 02 16 42 14 625 data 00 00 0000 00 00 00 dir 02 16 42 12 625 data C w o on 00 w fn on a Se so Image 25 RF window www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 29 of 137 5 Programming mOway in assembler Microchip s MPLAB IDE is the most widely used PIC microcontroller programming environment as Microchip also manufactures these microcontrollers It basically uses assembly language but other languages can also be added Thanks to it source code can be compiled and hexadecimal files HEX generated This compiler can be downloaded free of charge from Microchip s Website mOwayPack offers sensor motor and RF module managing libraries written for MPLAB Summary e Very interesting to learn assembly language programming low level language e Ideal for large code size programs Indispensable for critical response timeframes 35 Creating a project Use the MPLAB IDE Project Wizard to create the first project quickly MPLAB IDE v8 33 File Edit View Buijiaa Debugger Programmer Tools Configure Window Help Deu Mmm New Checksum ret Close Set Active Project EE Untitled Quickbuild no asm file Package in zip 1 tlean Build Configuration Build Options save Project 33 Add Files to Project Add New File to Project Remove File From Project Select Language Toolsulte Set Language Tool Locat
12. 1s obtained On the other hand mechanical inertia has to be considered therefore it 1s advisable to reduce the speed to achieve greater precision Equation 1 MOT_T_ANG when rotating on its center ee MOT _T_ ANG rouna z Example Rotate in relation to the center to the right at 80 speed for 10 seconds 100ms x 100 Rotate on the left wheel forward at 20 speed 180 www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 58 of 137 MOT_CUR MOT_VEL Desiredspeed 100 MOT_RAD Radius ___ JO _ 0 _ a a E Distance value 255 FLAGS MOT_STATUS COMOK and DWRONG Command to describe a curve It is necessary to specify speed direction radius course type of command and the time or the distance to cover The radius is the speed which shall be subtracted or added to the robot s global speed This means that if the specified speed is 50 and the radius 10 one of the motors shall work at 60 speed and the other one 40 Therefore the radius has to adhere to the following restrictions Equation 2 Condition 1 MOT_RAD 0 lt MOT _VEL MOT _RAD lt 100 Equation 3 Condition 2 MOT_RAD 0 lt MOT _VEL MOT _ RAD lt 100 The time has a resolution of 100ms and the distance 1 7mm and with a value of 0 returned by MOT_T_ANG the command shall be maintained until another order is specified The speedometer counts the distance traveled by the motor located on the external side of the cur
13. Speed a i x 0 156256 y 02343756 z 10312356 la Connected Image 114 Moway RC Center www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 136 of 137 You can access the application in Window Radio Control or using the button shown in the next image MowayGUl Proyecto Image 115 Access from mOwayGUI 8 1 Description of the mOway RC Center The different parts of the program are described below 8 1 1 RF configuration In this part the RFUsb module is configured with a 0x02 default address and 0x00 for the communications channel default mOway RC program channel The Radio Control s indicator dispatch status on the left lower part will glow red when configuring the module with the robot switched off Once connected the communications channel can be changed if WI FI Bluetooth Microwaves etc interferences are detected in this first channel Click on the change channel button to select up to 16 channels To change the channel the robot has to be switched on and be in communication with the RFUsb Every time the RFUsb is disconnected the default channel shall be 0x00 The recommended procedure is as follows 1 Turn the robot on 2 Connect the RF Usb 3 Test the channel sending mOway commands 4 If the robot does not react well change the channel and try again www moway robot com m Title mOway User Manual TEET MANAN Rev v2 1 0
14. TOP GREEN ON OFF PEAHA KATA ATA AAA AAT TTT AAT TT MAIN PROGRAM tet ee ee area eee eae MAIN Check central left obstacle sensor mov Li OBS CENTER L morr SEN CHECK OBS call SEM OBS DIG If a Obstacle is detected robot avoids it btfsc SEM OBS O call LED FRONT Of bhtfiss JEN OBS O call LED FRONT OFF goto MAIN goto MALIN oo a a e e ea a e aa cc ce Image 35 First program detecting obstacles 11 We then add movement to the robot unrestricted straight command until it encounters an obstacle 12 lib_mot_asm inc is added to the project 13 MOT_CONFIG is called to be able to use Diver system 14 Go straight on the first time www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 36 of 137 list p 16F56750 PIC register definition Hinclude P1SFs64750 INc keset Vector org OxLlOoo0 goto IN IT Program memory org Oxide amp SO eR ar ae eee aN Oe Kee a me ON a ee ae eT A LIBRARY TRTATTT TTT TATA TPT TTT PP aa inc lude lib_sen moway ine Hinclude lib mot moway inc ee cc Cc cc cc cc INIT Microcontroller configuration to use the sensors call SEN CONFIG Microcontroller configuration to use the engines call NOT CONFIG Green LED blink call LED TOP GREEN ON OFF Sa a ee ee eee ee ee ae ee ee PL TY PROGRAM SETTER ETE EEE EEE ETE EPP a a a a Peatraight on 50 speed mov 50 mow MOT VEL mov Li 0 MOT T DIST ANG MOT CON FWUDBACK HOT COM CONTYPE MOT STR Check cent
15. a A Fa ee ee eT e e RT TTT TTT TTT TTP TTP PPP PPP aaa a void mainii if TRARA AAAA SPP SOR CONFIGURATION E A ttt ttt SEN CONFIG Green LED blink LED TOP GREEN ON OFF while 1 i Image 53 First program configuration and LED 5 To detect obstacles call up the SEN OBS_DIGQ with OBS_CENTER_L as input value If it detects an obstacle the front LEDs light up 7 Test the program on mOway and verify that the LEDs switch on when an object is placed close to the front part of the mOway a www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 78 of 137 ff Ee ee ee a ey eee ae ee ee ee a ee ee ee EE TETRA a a EEE PPP a a a void main i fad THT ATAT AT SPP SOR CONFIGURATION A 4s eae aaa fs SEN CONFIG Green LED blink LED TOP GREEN ON OFF while 1i i Check Center Left Ohstacle sensor if SEN OBS DIG OBS CENTER _L LED FRONT ON else LED FRONT OFF Image 54 First program detecting obstacles 8 We then add movement to the robot unrestricted straight command until it encounters an obstacle 9 lib_mot_asm inc is added to the project 10 MOT_CONFIG 1s called to be able to use Diver system 11 Go straight on the first time 12 When it encounters an obstacle a command is sent to rotate 180 and the top red LED lights up the front LEDs will not operate The robot will wait until this command has ended and will then continue moving straight fo
16. acceleration of the robot in the 3 axes Resolution is 0 0156G bit Value 0 is 2G and 255 is 2G Image 38 Accelerometer axes Communication between microcontroller and accelerometer is SPI Command is sent to change the mode of the accelerometer to measure Function waits until the value is calculated Value is read Change the mode to tap detection Table 29 SEN CHECK ACCE allowed values Define ACCE_CHECK X 0 ACCE_CHECK_Y ACCE_CHECK Z SEN_ACCE CHECK TAP www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 48 of 137 Output variable SEN_ACCE_TAP Output SEN_STATUS SENOK DWRONG Accelerometer detects taps e Communication between microcontroller and accelerometer is SPI e Checks if tap interrupt has been detected e SEN_ACCE_TAP value is changed a ee ee ee ee ee eee eee Bit 7 2 Unused Bit 1 TAP_TAP shows if double tap is detected 1 Double Tap detected 0 Double Tap not detected Bit 0 TAP shows if tap is detected 1 Tap detected 0 Tap not detected SEN_LINE_DIG Input variable SEN_CHECK_LINE Which sensor must be read Output variable SEN_LINE Digital value of the sensor Output SEN_STATUS SENOK DWRONG The SEN LINE DIG function indicates whether the sensors are or are not on a dark surface To achieve this follow the steps indicated below e Emit the infrared light pulse to detect the line This light beam will be ref
17. command MOT_FDBCK STATUS_T 1 OxFF gt Invalid data www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 96 of 137 Request of distance traveled by the right motor from the last command le g Output mOway_km 0 0x08 mOway_km 1 0x01 0000 0001 0000 0100 264 Distance 264 1mm 264mm 6 3 3 BZI RF2GH4 library in C18 6 3 3 1 Description With this library it is easy for mOway to communicate with the BZI RF2GH4 6 3 3 2 Functions To manage the sending of parameters and the return of values external values are used These must be modified beforehand or verified after each call What these are and how they act will be explained in each function Table 50 Summary of functions in C18 Description void RF_CONFIG_SPI void Configures the inputs and outputs of the microcontroller as well as the parameters necessary to use the SPI bus void RF_INT_EN void This routine enables the external interruption for the radio module in the microcontroller unsigned char RF_CONFI1G unsigned CHANNEL 1 Correct Configures the inputs and char unsigned char ADDRESS configuration outputs of the 0 Not configured microcontroller as well as the radio module parameters unsigned char RF_ON void 0 Correct activation Activates the radio 1 Incorrect activation frequency module in watch mode unsigned char RF_OFF void 0 Correct Deactivates the radio deactivati
18. directly connect to an analog input of the microcontroller so that it 1s capable to detect not only if there is sound or not digital mode but also the intensity of the sound with a simple reading of the ADC analog mode Table 9 PIC Microphone connection Pin PIC PORTH 3 3 8 Accelerometer An accelerometer is a device that measures acceleration and the gravity induced forces the movement and rotation There are many types of accelerometers most of them based on piezoelectric crystals but their size is too big Because of that it was tried to design a small device in the field of microelectronics which might improve the applicability Then the MEMS Microelectromechanical Systems accelerometers were created An easy way to create an accelerometer is measuring changes in a capacitor Capacitors can work as sensors or as actuators In the case of mOway it 1s a capacitive accelerometer which consists of two capacitors displaced in differential mode whose electrical capacity changes as the acceleration varies By measuring X Y Z axes of the MMA7455L accelerometer from FREESCALE Semiconductor it is possible to know if mOway is correctly positioned inverted or tilted Table 10 PIC Accelerometer connection RD4 O O 3 3 9 Battery level The robot has a LiPo cell battery rechargeable For proper operation of the microcontroller the battery is connected to one of its analog inputs through a splitter Thus
19. eoce eee sene 134 Eae ROCONI eea E E E 134 MoS R C A e E E E EEE E E 135 8 1 Description of the mOway RC Center cc eccccccccccccessseeeeeeceeeeeaaeesseeeeees 136 Sikes RPCO EO anr EE EE 136 Skea FRACUIO COMO bee E E E 137 oloa EED ee eee ee ee ee ee ee ee eee er ere 137 ela CE acer thaa ses teeereecadee ces aeseescohessa Mataancs Abeta estanesec hence edtenesenabelceeestacess 137 Sla R eee een EA ee ee ee 137 GAl PERO S Sune ean ener ee eee 137 Sales IRC YOOAPG CON O een E E E 137 www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 5 of 137 1 Prologue The dawning of a new era the era of the minirobots Increasingly more mobile robotics applications enter our daily life We can currently find robots which help us with simple tasks like cleaning household floors mowing the lawn or keeping the swimming pool clean As technology keeps improving these small devices which blend mechanics electronics and software are performing more and more complex tasks They are slowly introducing themselves into our lives in a useful manner and reducing the burden of unpleasant jobs It s not too far fetched to think that the revolution which took place in the IT or telecommunications fields will be repeated with robotics in the next decade Enough technology is currently available to manufacture these devices and society is also ready to receive them in the market Yet a specific catalyst is needed to start
20. mes ASM SEN OT mew ib ser mowar inc Man asm Main cot Main err Main HES Mair st Main map Wlan 0 Imagen 30 Select mOway libraries www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 32 of 137 5 With the steps above the project will now be created the next step is to create a ASM file for the source code Project Wizard Summary Click Finish to create configure the project with these parameters Project Parameters Device PICISFS6 50 Toolsuite Microchip MPASM Toolsuite File CAMoway first projectmep A new workspace will be created and the new project added to that workspace Image 31 Wizard ends 6 The next step is to open the project and create a new file New File saving it in the same folder of the project as Main asm This will be our source file Guardar como Guardar en O Mowap_first_project Z lib mot moway inc jE ib_sen mowaw ine Nombre Main asm Guardar FE T E Tipo Assembly Source Files asm as ine 3 w Cancelar Jump to J Encoding ANSI A Add File To Project Image 32 ASM creation www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 33 of 137 7 Finally the source file is added to the project accessing Project Add Files to Project A Moway_first_project MPLAB IDE v8 33 Moway_first
21. or output others need an analog input or output and others instead are controlled by one of the I2C SPI communication buses The table below describes how the microcontroller pins are distributed www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 9 of 137 Table 1 PIC sensors connections PORTA RA3 Side left infrared receiver RAS Left line sensor receiver PORTB RBI RB2 RB3 RB5 RB6 PORTC RC7 PORTD RDI Ol Line sensors transmitter RD4 SDO signal for the SPI communication accelerometer RDS Ol SDI sinal for the SPI communication accelerometer RD6 Ol Clock sinal for the SPI communication accelerometer Chip Select for the SPI communication accelerometer PORTE RE5 O Brake LED PORTF Side right infrared receiver Central right infrared receiver Tempreature sensor Battery measurer Infrared transmitter First interruption of the accelerometer Second interruption of the accelerometer Speaker Top red LED Top green LED Front LED J2 Drive system To be able to move the mOway uses a double servo motor group It includes both an electronic part and a mechanical one The electronic part is mainly in charge of controlling the motor s speed and the mechanical part allow the mOway to move unhindered over different terrains with adequate power www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 10 of 137 Engrane
22. reading at the sensor s output Image 9 Line tracking sensor on a dark surface Table 3 Line tracking sensors PIC connections Pin PIC Sensor PORTA Right line tracking sensor receiver Left line tracking receiver PORTD RDI O Left and right line tracking sensors transmitter Image 10 Location of line sensors www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 15 of 137 3 3 2 Obstacle detection sensors Similar to line tracking sensors obstacle detection sensors also use infrared light to detect objects located in front of the mOway The sensor includes two infrared light emitting source Kingbright KPA3010 F3C and four receivers placed on both sides of mOway The output of the Sharp PTIOOFOMP receivers are connected to the microcontroller s analog inputs so it can detect the presence of any object digital mode and also measure how far away it is analog mode The sensor functions similarly to the line tracking sensor The light emitter generates a 70us pulse which allows the receiver to capture any obstacle using a filtering and amplifying stage Once the signal is processed electronically the PIC can measure it by means of the ADC or as a digital input The digital distance range is close to 3cm and a bright environment is recommended to enhance infrared light reflection Image 11 Obstacle detection sensor Table 4 Shock proof sensor PIC connection
23. the sensors unsigned char SEN_LIGHT void Reads light sensor values unsigned char SEN_BATTERY void Retums the battery level unsigned char SEN_TEMPERATURE void Detects the temperature in C unsigned char SEN_MIC_ANALOG void Detects sound intensity unsigned char SEN_MIC_DIG void Detects if there is sound or not unsigned char SEN_SPEAKER unsigned char SPEAKER_OFF Emits tones in a frequency between 250 unsigned char unsigned char opal ae Hz and 65 KHz unsigned char SEN_ACCE_XYZ_READ unsigned char ACCE_CHECK X Calculates the X Y Z axes acceleration of ACCE_CHECK_Y mOway ACCE_CHECK Z unsigned char SEN_ACCE_CHECK_TAP void Detects if mOway has been taped unsigned char SEN_OBS_DIG unsigned char OBS_SIDE_L Detects obstacles OBS_CENTER_L OBS_CENTER_R OBS_SIDE_R unsigned char SEN_OBS_ANALOG unsigned char OBS_SIDE_L Detects the distance to obstacles OBS_CENTER_L OBS_CENTER_R OBS_SIDE_R aiala a cea rnin tac i iain tania LINE_L Brake LED off void LED_FRONT _OFF void void LED_BRAKE_OFF void Po void LED_TOP_RED_OFF void Se e void LED_TOP_GREEN_OFF void void SEN_CONFIG void This function configures the inputs and outputs required to manage the sensors and initialize the variables www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 81 of 137 Table 39 PIC sensor connections PORTA RA3 Side left infrared receiver RAS Left line se
24. these steps e Ensure that there is no noise source interference before sending the infrared light pulse e Emit the infrared light pulse to detect obstacles This light beam will be reflected back if there is any existing obstacle and this signal will be perceived by the infrared receiver Check for any eventual signals from the four IR receivers Copy the digital receiver s value to the output variables Deactivate the infrared diode Check for interfering signals If there is no signal interferences and the process develops normally returns value www moway robot com m Title mOway User Manual san peavey nOweN Rev v2 1 0 June 2010 Page 85 of 137 Table 42 Allowed values for SEN CHECK_ OBS OBS_CENTER L O unsigned char SEN_OBS_ANALOG unsigned char SEN_CHECK_OBS Input variable SEN CHECK OBS Which sensor must be read Output Indicates 1f there is obstacle or not This function indicates if the obstacle is on the right front side or on the left front side and its distance from the robot To achieve this follow the steps indicated below e Ensure that there is no noise source interferences before you send the infrared light pulse Emit the infrared light pulse to detect obstacles Activate the ADC Check for any possible signals from the four IR receivers Copy the analog receiver s value to the output variables The higher the value the shorter the distance will be
25. this revolution People also need to be ready and prepared to identify in what fields microrobotics may have an opportunity and which new applications may be interesting to implement Up till now processors weren t able to move But today things have changed Software is one of the fundamental elements in the world of mobile robotics The main difference between developing a program for these robots and running it with a personal computer is interaction with the environment The environment isn t changing randomly in PC applications so decision making and programming are simplified On the other hand when running commands for a minirobot application usually the result is unknown therefore algorithms have to consider situations with a wider range of possibilities some of them unexpected The mOway robots are tools specifically designed for teaching and research Their purpose is to bring the world of autonomous robots closer to the teaching centers mOway s main purpose is to be a useful tool for those who are being introduced for the first time to the world of the minirobots as well as for those who are already experienced and wish to perform complex collaborative robotic applications mOway aims to stimulate enthusiasm for this new and exciting branch of engineering in a prompt and enjoyable way through the practical exercises included in this manual An easy and entertaining way to learn This book s purpose to be mOway s M
26. to allow expert users to connect their electronics It is accessible opening the robot and it s located near brake LED Table 15 PIC free Pad connection Pin PIC PORTJ 3 4 Power Supply System mOway s battery is located inside and accessible only by disassembling the product It is a small rechargeable LiPo cell The battery can be charged via a computer s USB port through the mOway s MINI USB B port There is no need to wait for the battery to be completely discharged as it can be plugged in any time since these batteries do not have memory effect also known as lazy battery effect These batteries are a perfect power source for mOway due to their small size lightness and flexibility Battery duration depends to a great extent on the active sensors and the amount of time the motors are used Charging lasts about 2h Power supply system controls two LED located in the back part of the robot Green LED indicates that mOway is switched on and red LED indicates that the battery is charging When the battery is full red LED will switch off Advanced users only These LEDs can t be controlled by the user www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 21 of 137 Image 17 Charging red and switched on green 3 5 RF module and RFUsb RF module allows communicate with other mOways or with PC using RFUsb Image 18 RF module RF module is connected in ex
27. to which it is required to send the data 1 byte RF_DATA_OUT_0 Variables to be transmitted 8 bytes RF_ DATA OUT_7 Output variables FLAGS SNDOK and ACK This function sends 8 bytes of data to the indicated address and reports the correct reception to the recipient Following this the device will return to watch mode If a message is sent to the address 0x00 this will be received by all the modules on the same channel It must be taken into account that the module accepts the first ACK it receives therefore we cannot be certain that the data has arrived at all the devices Example Data sending routine Preparation of the receiver address and of the data Receiver address www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 67 of 137 Data to be sent Send frame Not sent No ACK RF_RECEIVE Output variables RF _DIR_IN Address of the person who has sent the frame RF DATA _IN 0O Frame received from the address indicated RF DATA _IN_7 RCVOK and RCVNW This routine is responsible for checking whether a reception has taken place and if so it returns the data received Likewise it reports whether there is any data that has not been read in the reception FIFO of the module When a frame is received the RCVNW bit of the RF_STATUS variable must be checked and if this is active the RF_RECEIVE function must be c
28. value of line sensors This module is very useful for making mOway follow a line black or white on the floor www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 123 of 137 detect boundaries etc User has to check the AND or OR boolean operation With AND option both conditions must be true and on the other hand with OR one of the two condition has to be true Properties Configuration Properties Configuration Properties Configuration Select a property type select a property type Select a property type Check line Check line Check line Configuration Configuration Configuration Left line sensor Lett line sensor Left line sensor Right line sensor Right line sensor AND oR elle AND OF oa check Image 92 Choose the left and the right line sensors both have to be white e Check obstacles It checks the digital value of obstacle sensors It is used to determine whether there is an obstacle or not in front to the left or right User has to check the AND or OR boolean operation With AND both conditions must be true and on the other hand with OR one of the two condition has to be true Properties Configuration Select a property type Check obstacles Configuration Left central obstacle Right central obstacle es Obstacle we Yes Obstacle e Left side obstacle Fo Right side obstacle Ives Obstacle we ves Obstacte OAND OR gt Cancel Image 93 I
29. with which the module is configured 5 3 3 3 Functions The library consists of nine functions that will make the task of developing a communications application with BZI RF2GH4 modules considerably easier A brief description of each one of these functions is given below Table 35 Assembler RF functions Functions for the BZI RF2GH4 module RF CONFIG Configures the inputs and outputs of the microcontroller as well as the radio module parameters Configures the inputs and outputs of the microcontroller as A COSMO well as the parameters required to use the SPI bus RF_ON Activates the radio frequency module in receive mode RF_OFF Deactivates the radio frequency module and leaves it in low www moway robot com Title mOway User Manual TEET i Rev v2 1 0 June 2010 Page 64 of 137 consumption mode RF_ SEND Sends a data frame 8 Bytes to the address indicated RF RECEIVE ne whether a reception has occurred and if so collects the RF RECEIVE INT Carries out the same function as RF_RECEIVE but in this case checks whether there has been an interruption RF INT EN This routine enables the external interruption for the radio module in the microcontroller RF_CONFIG_SPI The speed of the SPI must not exceed 8 Mhz and therefore the use of this function is limited to PIC microcontrollers with a frequency of less than 32Mhz The different parameters of the SPI module and the pins of the PIC are configured in the f
30. 18io lib_mot_moway h Culen Dw CMot_O1 cof CMot_O01 hex CL Mot_O1 map C MOT _O1 mep C MOT_O1 mcs C MOT _O1 mew delays h lib_mot_momay h main c main o Image 48 Add libraries www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 74 of 137 8 With the steps above the project will now be created the next step is to create a C file for the source code Project Wizard Summary Click Finish to createycontigure the project with these parameters Project Parameters Device PICTSFS6J50 Toolsuite Microchip C18 Toolsuite File CAmOway first project mep A new workspace will be created and the new project added to that workspace Image 49 Wizard ends 9 The next step is to open the project and create a new file New File saving it in the same folder of the project as Main c This will be our source file Guardar como ua O fem h lib_mot_moway h h lib_sen_moway h Tipo All Source Files c h asm as ine s bas Jump to C Documents and Settings Julen Escrtonoa Encoding ANSI w Add File To Project Image 50 C creation www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 75 of 137 10 Finally the source file 1s added to the project accessing Project Add Files to Project After that user has to add Linker Script to the project This can find y mOwayPack o in another example project s mOway_fir
31. A MEZE D o El 0 1 sec 1 Ost Fem Wait until the end of the command Image 76 Choose the speed the way and the time or the distance e Curve The curve module is a specific case of the movement module In this command drive system will calculate the speed of the motors in order to be able to trace a curve indicating the speed and turning radius We can also use here the time restrictions and distance and the Wait until end of command option www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 115 of 137 Select a property tune Configuration Global velocity Radius constant ka constant p i oo 8 ao g Direction Way Forward F Lett Enable end checking time Enable end checking distance constant constat i O11 sec DAF em Wat Gal the end ofthe command Image 77 Choose the speed the curvature radio the direction the way and the time or the distance e Rotation The rotation module is another specific case of the movement module With this command mOway will rotate either on its centre or on one of its two wheels We can configure the turning direction and the rotation speed www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 116 of 137 Configuration Global Velocity Rotate mode constant ka Center Tum oo Wt ey Way a Porvard Richt l Ena
32. CKTAP Sencorarus bomen 7 E 7 SEN_STATUS been taped SEN STAI fae ns Ol a a SEN_STATUS lines eee a SEN_STATUS PLED_BRAKE ON Brake LEDon O LED_FRONT_ON Front LED on WED TOPLREDZON SS LED_TOP_GREEN_ON Top gteen LED on LED_BRAKE_OFF Brake LED off LED_FRONT_OFF Front LED off TED TOP RED OF 0 a e E LED_TOP_GREEN_OFF Soo Top green LED Off a a a ee ee ee 2 rr rs E D ae ee ee ee re ee ee eee E LED_BRAKE _ON_OFF LED_FRONT_ON_OFF LED TOP RED ON OFF LED TOP GREEN ON OFF www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 42 of 137 SEN_CONFIG This function configures the inputs and outputs required to manage the sensors and initialize the variables Table 24 PIC sensor connections PORTA RA3 Side left infrared receiver RAS Left line sensor receiver PORTB RBI RB2 RB3 RB5 RB6 PORTC RC7 PORTD RDI Ol Line sensors transmitter RD4 SDO signal for the SPI communication accelerometer R Ol SDI sinal for the SPI communication accelerometer RDO Ol Clock sinal for the SPI communication accelerometer Chip Select for the SPI communication accelerometer PORTE RE5 FO Brake LED PORTH RH5 RH6 RH7 PORTJ RJ6 RJ7 First interruption of the accelerometer Second interruption of the accelerometer Speaker Top red LED Top green LED Front LED Tempreature sensor Battery measurer Infrared transmitter I SEN_LI
33. Deactivate the infrared diode e Check for interfering signals If there is no signal interferences and the process develops normally value is returned Table 43 SEN CHECK_ OBS allowed values OBS_CENTER_L o unsigned char SEN_ACCE_XYZ_READ unsigned char SEN_CHECK_ACCE Input variable SEN CHECK ACCE Which axis must be read Output SEN ACCE XYZ READ returns the acceleration of the robot in the 3 axes Resolution is 0 0156G bit Value O is 2G and 255 is 2G www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 86 of 137 Image 56 mOway axes Communication between microcontroller and accelerometer is SPI Command is sent to change the mode of the accelerometer to measure Function waits until the value is calculated Value is read Change the mode to tap detection Table 44 SEN CHECK ACCE allowed values ACCE_CHECK_X 0 unsigned char SEN_ ACCE_CHECK_TAP void Accelerometer detects taps e Communication between microcontroller and accelerometer is SPI e Checks if tap interrupt has been detected e SEN_ACCE_TAP value is changed unsigned char SEN_LINE_DIG unsigned char SEN_CHECK_LINE Input variable SEN CHECK LINE Which sensor must be read Output Digital value of the sensor The SEN LINE DIG function indicates whether the sensors are or are not on a dark surface To achieve this function follows the steps indicated below www moway robot c
34. GHT Output variables SEN_LIGHT_P Percentage of ambient light The SEN_LIGHT function captures the analog value generated by the inciding light on the photo transistor To achieve this follow these steps e Activate the ADC e Wait for the data acquisition process to end 100Qus www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 43 of 137 e Read the analog value e Calculate the inciding light percentage based on the analog voltage measurement e This information is then copied to the SEN_LIGHT_P variable SEN_BATTERY Output variables SEN_BATTERY_P Percentage of battery level The SEN_BATTERY function captures the analog value of the battery To achieve this function follows these steps Activate the ADC Wait for the data acquisition process to end 100us Read the analog value Calculate the battery level percentage based on the analog voltage measurement This information is then copied to the SEN_ BATTERY_P variable SEN_TEMPERATURE Output variables SEN_TEMPERATURE_C The SEN_TEMPERATURE function captures the analog value that depends on the temperature captured by the thermistor To achieve this function follows these Steps Activate the ADC Wait for the data acquisition process to end 100us Read the analog value Calculate temperature based on the analog voltage measurement This information is then copied to the SEN_ TEMPERATURE_C variable SEN_M
35. IC_ANALOG Output variables SEN_MIC Sound Intensity S The output value can differ from mOwayGUL Sensor measures mOway s temperature which can be different from ambient temperature www moway robot com m Title mOway User Manual TEET MANAN Rev v2 1 0 June 2010 Page 44 of 137 The SEN_MIC_ANALOG function captures the analog value that depends on the sound intensity from the microphone To achieve this function follows these steps Activate the ADC Wait for the data acquisition process to end 100us Read the analog value This information is then copied to the SEN_MIC variable SEN_MIC_DIG Output variables SEN_MIC Indicates if there is sound or not The SEN_MIC_DIG function indicates if there is sound or not To achieve this function follows these steps e Check if there is sound in the microphone e This information is then copied to the SEN_MIC variable SEN_SPEAKER Input variables SEN_SPEAKER_ FREQ Sound frecuencia see table SEN_SPEAKER_TIME SEN_SPEAKER_ON_OFF The SEN_SPEAKER function emits tones in a frequency between 250 Hz and 65 KHz SEN_SPEAKER_ON_OFF is going to say if we want to switch on switch off or activate the speaker an amount of time 100ms intervals To achieve this function follows these steps e PWM on with frequency SEN_SPEAKER_FREQ and 50 of duty e If SEN SPEAKER ON_OFF is SPEAKER TIME 2 function waits until command finishes Table 25 Allowed values for SE
36. It compares the analogue value of obstacle line battery temperature accelerometer or microphone sensors All mOway sensors return an analogue value For example the light sensor gives a value of O to 100 according to the intensity of the incident light and obstacle sensors give a value of 0 255 Properties Configuration Properties Configuration select a property type Senzor comparative yt Sensor comparative Configuration Configuration Sensor Sensor es Light Left Line Aight Line Lett central obstacle Aight central obstacle Lett side obstacle Right side obstacle Image 97 Choose the sensor and the comparative www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 126 of 137 Properties Configuration Cc a eno Comparative Configuration Configuration Sensor Censor Light yl Light v Operand Operand constant ae constant vl constant Varablel Vanablez Secor a Image 98 Choose the variable to be compared ENGINES Properties Configuration Select a property tpe Sensor comparative Engines Movement info comparative Radio Frequency RF Transmision RF Reception Operations Comparative Image 99 Choose the type of conditional Engines www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 127 of 137 e Movement info comparative A comparison is made with the
37. MOWAY S USER MANUAL Title mOway User Manual Rev v2 1 0 June 2010 Page 2 of 137 Copyright c 2010 Bizintek Innova S L Permission is granted to copy distribute and or modify this document under the terms of the GNU Free Documentation License Version 2 0 or any later version published by the Free Software Foundation with no Invariant Sections no Front Cover Texts and no Back Cover Texts A copy of the license is included in the section entitled GNU Free Documentation License www moway robot com NADAS E EAE EET AEE T EE 3 POO U ee E E E ae tanceme ie heceatdecemicsn conces 5 VY HAUS TO WAY or sect net ceide legacecn O Metetenass 7 FOO OW AY ee E tenn wtacaianenianbosswaes A 8 I cs E SOE e ee ne ee ee ee ee 8 Dele NDTIS SY a E E E E E E E E E 9 3 3 Sensor andindicators CROW D9 sanetecccasen ste sae totes see eesaantatesasensdesassecteetipnddsane tendon 11 Dt MENISCUS OIG a T E EEA E E E ssc eaeeee 13 3 3 2 Obstacle detection Sensors eeeeesssessssssssseeeeeerereressssssssssssseeeeererreeeessssssssss 15 Foo LES O a E E E 16 3 3 4 Expansion Connector ssesissssrserererisiiesetediriesr kinini ariede inania 16 Joa Tempere Se SOM enaa E E AA deeeeeapemntes 17 Po PP a eea a a e eeee e e 17 Io M ODO ea E E E E S 17 To ATTO E a E E 18 ID BAET a E E E E 18 3 3 10 Poat D e E E EE 19 3 3 11 Toa oe ONO CED ir E E 19 3 3 12 Doke CED eee E E 19 3 3 13 aA e EE E E TE E E E E T 20 DA Powersupply SyS l
38. N SPEAKER ON OFF Define Define Vale SPEAKER_OFF J0 SPEAKER_ON SPEAKER_TIME www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 45 of 137 Table 26 SEN_SPEAKER_ FREQ vs PWM frequency PWM frequency SEN_SPEAKER FREQ Hz 0 0000000 56818181818 2976 1904762 2016 1290323 PQ 1524 3902439 1225 4901961 a 1024 5901639 880 2316901 ae 771 6049383 P90 686 3131868 618 8118812 563 0630631 516 5289256 477 0992366 443 2624113 413 9072848 388 1987578 365 4970760 345 3038674 327 2251309 310 9452736 296 2085308 282 8054299 270 5627706 259 3360996 249 0039841 244 1406250 SEN_OBS_DIG Input variable SEN CHECK OBS Which sensor must be read Output variable SEN_OBS Indicates if there is obstacle or not Output SEN_STATUS SENOK DWRONG www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 46 of 137 This function indicates if the obstacle is situated on the right front side or on the left front side To achieve this function follows these steps e Ensure that there is no noise source interference before sending the infrared light pulse e Emit the infrared light pulse to detect obstacles This light beam will be reflected back if there is any existing obstacle and this signal will be perceived by the infrared receiver Check for any eventual signals from the four IR receivers Copy the digital receiver s value to the outpu
39. OM Type of motor data to be read MOT_STATUS_DATA_0 1 These two variables store the value required by the MOT_FDBCK function 5 3 2 3 Functions A series of functions designed to control mOway s drive system are included in the lib_mot_moway and lib_re_mot_moway libraries Table 32 Summary of assembly languague functions for lib_mot_moway Name Description MOT_CONFIG Configuration to communicate with the motors MOT STR MOT_VEL MOT _STATUS A command to move ina 7 MOT_T_DIST COMOK straight line DWRONG MOT_CON FWDBACK COMTYPE MOT CHA VEL MOT_VEL MOT_STATUS A command to change the gt E MOT_T_DIT COMOK speed of a motor DWRONG MOT_CON FWDBACK COMTYPE RL MOT ROT MOT_VEL MOT_STATUS A command to rotate the 7 MOT_CENWHEEL COMOK robot MOT_T_ANG DWRONG MOT_CON FWDBACK COMTYPE RL www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 54 of 137 MOT CUR MOT_VEL MOT_STATUS A command to execute a MOT_RAD COMOK curve MOT_T_DIST DWRONG MOT_CON FWDBACK COMTYPE RL MOT STOP MOT_STATUS A command to stop the robot COMOK DWRONG MOT_RST_COM MOT_STATUS A command to reset the MOT_RST COMOK temporary variables for time DWRONG and distance MOT FDBCK STATUS_COM MOT_STATUS _ A command to determine the 7 DATA_0 motor s status MOT_STATUS_ DATA_1 MOT_STATUS COMOK DWRONG MOT_CONFIG This function configures the inputs and outputs so the microcontroller can communicate with the Drive Syste
40. Selecta property type f Speaker Configuration Freq Time constant ha constant ka 15 3906 Hz ose A E Image 74 Choose the frequency and the time of the tone ENGINES Properties Configuration Movement Curve Rotate Consult movement info Reset Move Info Radio Frequency RF Control Image 75 Choose the type of module Engines www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 114 of 137 e Movement mOway has two motors in each wheel These give it a great flexibility in its movements The movement commands allow the speeds of each motor to be controlled individually and to restrict movements in certain time or distance Another important option when configuring motors is the Wait until end of command This option allows you to block the movement command the program stops running until the movement module finishes according to time or distance This option is only accessible if we select the options Enable end according to time or Enable end according to distance Properties Configuration Select a property type Movement we Configuration Lett Speed Right speed constant z constant po sl i Wian I ET e Forward Forward LPEE _ Enable end checking time i Enable end checking distance constant we Sa ag DETET
41. TUS COMOK and DWRONG A command to change the speed of any of the two motors You will have to specify speed direction motor type of command and the time or distance to cover The time has a resolution of 100 ms and the distance 1 mm and with a value of O returned by MOT_T_DIST the command shall be maintained until another order 1s specified Example Change speed 80 forward of the right motor for 10 seconds 100ms x 100 Change speed 20 backwards of the left motor and cover a distance of 100 mm 1mm x 100 MOT_ROT MOT_VEL si Desiredspeed 00 MOT_CON FWDBACK I FWD__ 0 BACK MOT CENWHEEL On the center or on the wheel 0x01 CE 0x00 WH MOT_CON RL Right or left 1 RIGHT 0 LEFT MOT_CON COMTYPE Type of command 1 TIME 0 ANG MOT_T_ANG Time value 239 Angle value 100 Output variables FLAGS MOT_STATUS COMOK and DWRONG www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 57 of 137 Command to make the mOway rotate It is necessary to specify speed direction type of rotation the motor type of command and the time or the rotation angle The time has a resolution of 100ms and with a value of O returned by MOT_T_ANG the command shall be maintained until another order is specified Regarding the angle the following equations show how to calculate the value of MOT_T_ANG taking into account the desired rotation angle If the rotation is produced on one of the wheels more resolution
42. _project mcw File Edit View Project Debugger Programmer Tools Configure Window Help Checksum 0x8358 E Moway_first_project mcw MEK 5 Moway_first_project mcp 3 a Source Files i S 4 Main asm 0 Header Files o E fib_mot_moway inc C Object Files Ga Library Files 9 Linker Script i Other Files Files iy Symbols PIC18F2550 w 0 novedec Image 33 Project with ASM D2 First program in assembler To generate the first program a project has to be created first previous chapter This first basic program will enable the mOway to avoid obstacles Absolute code 1 First the list p 18F86J50 PIC installed in mOway has to be added to the Main ASM file 2 It is also necessary to include into the project folder the library for this microcontroller which can be found at the MPLAB installation directory or in mOway s pack testing programs Once this library is copied to the folder enter include P18F86J50 INC in the Main ASM file 3 The next step is to add the starting Ox102A and resetting Ox1000 vectors and to include the mOway libraries 4 INIT and MAIN labels are added to create a loop 5 Next the SEN CONFIG function is called to configure the microcontroller s inputs and outputs Add winking to one of the LEDs 7 Test the program on mOway programming it in mMOWwayGUI and verify that the green LED blinks www moway robot com Title mOway User Manual Rev v2 1 0 Jun
43. address Transmitter address Variable Variable Dato to assign Dato5 to assign Datol to assign Dato to assign aes PSE ii i Saser x Variable2 v Variable2 Dato to assign Dato6 to assign Dato to assign Dato6 to assign a pacino Variable3 Variable Dato to assign Dato3 to assign Dato to assign Variable2 i Vanable3 Dato4 to assign Dato to assign Dato4 to assign Dato to assign z Image 107 Choose the second data to transmit OPERATIONS Properties Contiguration Select a property type Sensor comparative Engines Movement info comparative Radio Frequency RF Transmision RF Reception Operations Comparative Image 108 Choose the type of conditional Operations www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 132 of 137 e Comparative It makes a comparison on a variable The variable can be compared with a constant or with another variable This is very useful when comparing a variable used to carry out a mathematical operation Properties Configuration Properties Configuration Select a property type Comparative Configuration Configuration Operandi perand E arable AF Variable Vanable Vanables Operand wr a Lomparative E omparative
44. alled up once again after processing the data The transceptor has a 3 level stack and therefore if the receive function is not called before the stack is filled the device will be unable to receive more data As interruptions are not used the probability of losing packages with high traffic levels is moderate It is advisable to use this only in environments in which there are just a few devices and or little data traffic This problem can also resolved by causing the images to resend the same frame until the communication is correct but in environments with a great deal of traffic collisions increase exponentially causing considerable increases in sending times Example www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 68 of 137 Procces data RF_RECEIVE_INT Output variables RF _DIR_IN Address of the person who has sent the frame RF DATA _IN 0O Frame received from the address indicated RF_DATA_IN_7 RCVOK RCVNW This is the optimum reception routine This routine is virtually the same as RF_RECEIVE the difference being that this one operates by interruption For this reason it must be placed within the interaction code and the interruptions must be configured beforehand RF_INTER_EN It is responsible for checking that an external interruption has occurred RBO and if so it clears the interruption flag The probability of losing packages is minimal Even so it is advisable for tr
45. alue Calculate the battery level percentage based on the analog voltage measurement Returns battery level unsigned char SEN_TEMPERATURE void Output Temperature in C The SEN_TEMPERATURE function captures the analog value that depends on the temperature captured by the thermistor To achieve this function follows these Steps Activate the ADC Wait for the data acquisition process to end 100us Read the analog value Calculate the temperature based on the analog voltage measurement Returns temperature in unsigned char SEN_MIC_ANALOG void Output Sound intensity The SEN_MIC_ANALOG function captures the analog value that depends on the sound intensity from the microphone To achieve this function follows these steps Activate the ADC Wait for the data acquisition process to end 100us Read the analog value Returns amplified microphone value The output value can differ from mOwayGUI 7 Sensor measures mOway s temperature which can be different from ambient temperature www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 83 of 137 unsigned char SEN_MIC_DIG void Output Indicates if a sound has been detected The SEN_MIC_DIG function indicates if there is sound or not To achieve this function follows these steps e Returns the digital value of microphone input void SEN SPEAKER unsigned char SEN_SPEAKER_FREQ unsigned char SEN_SPEAKER_TIME unsigne
46. ansmitters to resend if the send flag is not activated Example Data reception routine with interruption Process data RF_INT_EN This routine is responsible for enabling the external interruption of the microcontroller RBO that uses the RF module in data reception For this reason the RBO pin is configured as input Although the module can be managed without interruptions the minimum response time is not guaranteed www moway robot com Title mOway User Manual TEETE MOWAY Rev v2 1 0 June 2010 Page 69 of 137 Example Configuration with interruption and activation routine Enable interruptions call RF_INT_EN Configure SPI modules of the PIC call RF_CONFIG_SPI Configure RF module own channel and address movlw Ox01 gt Own address movwt RF_DIR movlw Ox40 Channel movwt RF _CHN call RF CONFIG btfss RF_STATUS CONFIGOK nop Module not configured Activate RF module call RF_ON btfss RF_STATUS ONOK nop Module not initialized 5 3 3 4 Flow diagram for sending and receiving data www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 70 of 137 Interrupci n ext lt 0 ACK no recived Define i RF_DIR 7 1 l RF_RECEIVE gt RF_RECEIVE mol _INT Define RF_DATA e RF_SEND a 1 1 1 H 0 process data 0 Q No sent process data
47. anual and not a comprehensive book on minirobotics This manual has been implemented to assist learning how to use mOway It provides some basic notions on using mOway and its functions in a quick and clear manner www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 6 of 137 This manual is divided in two parts The first part includes a description of the elements which form part of the robot and their functioning The second part of the manual includes a series of practical exercises that can be executed with mOway www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 7 of 137 2 What is mOway mOway is an autonomous programmable small robot designed mainly to perform practical minirobotics applications It provides a perfect hardware platform for those wishing to take their first steps within the world of mobile robots as well as for those who have already worked with minirobots and want to develop more complex applications The mOway robot is equipped with a series of sensors which aid it to move in a real environment It also includes a drive unit which allows it to move over smooth terrain commanded by a I2C communications bus All these peripherals are connected to a microcontroller responsible for governing the robot This small robot incorporates I2C SPI expansion bus options As an example a wireless communications module a video camera or a prototype card can b
48. ata 2 C Data 6 constant o a constant Data 3 C Data c nstant constant Data C Data 8 constant constant Image 105 First and second data ready to be transmitted e RF Reception It receives a frame from a specific address It must be indicated at least two variables one for collecting the transmitter address and the other for the data It must be remembered that before this conditional the module must be configured using the RF Control module Remember that all robots taking part in the RF communication must have the same channel and different addresses Properties Configuration Properties Configuration Select a property type Select a property type z RF Reception E F Reception Configuration Configuration Transmitter address Transmitter address Variable1 Dato5 to assign Datol to assign Dato5 to assign AeA E L ESR Dato6 to assign Variable Dato6 to assign Varnable2 Variable3 Dato3 to assign Dato to assign Dato4 to assign Dato8 to assign Dato2 to assign Dato3 to assign n Dato to assign Dato4 to assign Dato8 to assign re lt ae L Image 106 Choose the address of the transmitter and the first data to transmit www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 131 of 137 Properties Configuration Configuration Configuration Transmitter
49. be common to all the modules that are going to take part in the communication Users can choose any channel from among the 128 available www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 98 of 137 Nevertheless if there 1s more than one communication in the environment between modules in different channels a spacing of 2 must be left between the channels to be used in order to avoid interferences thus leaving 32 channels usable Another question to be taken into account is the existence of other technologies that use the ISM 2 4GHz band Wifi Bluetooth etc and that might also cause interference in one of the channels Canal Canal 0x01 0x04 2 4Ghz 2 401Ghz 2 402Ghz 2 403Ghz 2 404Ghz 2 405Ghz 2 525Ghz Image 61 RF channels Before calling up this function the SPI module must be configured Example Configure RF module channel and address Module not configured unsigned char RF_ON void Function Return 1 Correct activation The module has been turned on correctly 0 Incorrect activation The module is not active Communications with the module impossible or on the other hand absence of or incorrect electrical connection This routine activates the radio module in watch mode in order to be able to receive
50. been sent This function sends 8 bytes of data to the indicated address and reports the correct reception to the recipient Following this the device will return to the watch mode If a message is sent to the address 0x00 this will be received by all the modules on the same channel It must be taken into account that the module accepts the first ACK it receives therefore we cannot be certain that the data has arrived at all the devices Example www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 100 of 137 Data sent and ACK received Data sent and ACK not received Data not sent unsigned char RF_RECEIVE unsigned char RF_DIR_IN unsigned char RF_DATA_IN Output variables RF_DATA_IN This is an 8 bytes variable It presents the information received RF_DATA_IN 0 7 RF DIR _IN This is a byte variable It indicates the transmitter address Function Return Single reception There is no more data in the reception stack 1 Multiple receptions There is more data in the reception stack This occurs when the transmitter sends more than one frame before the receiver collects this No data have been received This routine is responsible for checking whether a reception has taken place and 1f so it returns the data received Likewise it reports whether there is data that has not been read in the reception FIFO of the module When a frame is received the function output mus
51. ble erid checking time earisharit Z Enable end checking angle constant i 01 ser i 368 et E m Wait urti the end ofthe corimand Image 78 Choose the speed the rotate mode the way and the time or the distance We can also use here the time restrictions and turning angle as well as the Wait until end of command option e Stop The Stop module is another specific case of the movement module With this command mOway will stop moving Properties Configuration Select a property type Configuration Stop the robot Image 79 Stop mOway www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 117 of 137 e Consult movement info mOway keeps a record of the data of the movements it makes This module enables you to consult this record Current speed Distance covered Angle of turn etc Properties Contiguration Properties Configuration Properties Configuration Select 4 property type Consult movement into M Configuration Configuration Configuration Wariable to asigni Variable to asigr Yariable to azigri Variable1 Variable ka Vanable Variable F ag Ausiliar variable Auumillar variable Move information Move information Move information es EO esssaa Il Time Time Left Estante Time Left Speed Right Distance Angle Total Distance Image 80 Choose the variable and the move information e Reset movement data This modu
52. can consists of constants or variables must be indicated in the frame It must be remembered that before inserting this conditional the module must be configured using the RE Control module Remember that all the robots taking part in the RF communication must have the same channel and different addresses www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 129 of 137 Properties Configuration Selecta property type AF Transmision Configuration Recenvers address ot el Data 1 C Data constant se Ox 0 E l constant Vanable Vearablez lA Variable E CO Data 3 consart Dx a constant C Data 4 C Data g 7 rs constant Os iu constant Accept Cancel Image 103 Choose the first data to be transmitted Properties Configuration Select a property type RAF Transmision Configuration Receivers address 0x1 i Data 1 C Data 5 Wariablel s s fg aa EN Data 2 constant constant Varablel Varnable Vanables C Data G constant C Data m nF constant C Data 4 C Data 8 Seoanskant iL constant Cancel Image 104 Choose the second data to be transmitted www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 130 of 137 Properties Configuration Select a property tupe AF Tranemsior Configuration Receivers address whi i eee Data 1 C DataS Variablel we i za constant D
53. ce www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 11 of 137 PIC16F687 es f Mecanic Diver system Image 3 Motor control To send a movement command to the robot via the main microcontroller all we need to do is send the movement command parameters To this end some libraries were designed in assembly and C language to simplify communications through some functions which are responsible for I2C communications The format for these frames 1s explained in the motors and drive system library section The table below describes connections between the main PCB and the servo motor unit Table 2 Processor motor connections Pin PIC PORTE 12C clock 12C data R7 E END_COMAND line 3 3 Sensor and indicators group This group consists of different luminous sensors and indicators connected to the mOway microprocessor through which the robot interacts with the external world Two line tracking sensors Four obstacle detection sensors A light sensor An expansion connector Four LED diodes Temperature sensor www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 12 of 137 Speaker Microphone Accelerometer Battery level PIC18f86j50 SPEAKER Image 4 Sensors and indicators group Image 5 Top view of mOway s PCB Image 6 Down view of mOway s PCB www moway robot com Title mOway User Manual Rev v2 1 0
54. ced Click Next to continue Image 22 Driver installation Wizard www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 27 of 137 e Now the installation process will begin Found New Hardware Wizard Please wait while the wizard installs the software Moway RF USB libusbO dil A C AWINDOWS system32 Image 23 Windows xp driver installation e Assistant will then indicate that the hardware is installed Found New Hardware Wizard Completing the Found New Hardware Wizard The wizard has finished installing the software for Moway RF USB Click Finish to close the wizard Image 24 Driver installed in Windows xp e Check if Moway s software has detected the RFUsb 4 4 RF modules RF modules are very useful tool to introduce RF concept These are the steps to start working with them e Connect RF modules into the expansion connector Check that the module is fully connected e Connect the robot to the PC through the USB cable www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 28 of 137 Open mOwayGUI Open mOway_RF_send project included in the pack Click the Program bottom Disconnect and switch the robot on Configure RFUsb module using RF window of mOwayGUI with cannel 0x00 and address 0x01 Check receiving data in mOwayGUI RF 1 Ad Channel E Con dir 02 16 42 16 625 data 00 00 00 00 00 00 00 E
55. com void LED_TOP_RED ON void Function to switches on red LED void LED_TOP_GREEN_ON void Function to switches on green LED void LED_BRAKE OFF void Function to switches off the brake LED void LED_FRONT_OFF void Function to switches off the front LED void LED_TOP_RED OFF void Function to switches off the red LED void LED_TOP_GREEN_ OFF void Function to switches off the green LED void LED_BRAKE ON _ OFF void Blink the brake LED void LED_FRONT_ON_OFF void Blink the front LED void LED_TOP_RED_ ON _ OFF void Blink the red LED void LED_TOP_GREEN_ON_OFF void Blink the green LED www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 89 of 137 6 3 2 1 Description The library includes a series of functions in charge of sending I2C commands to the Drive System which will be responsible for controlling the motors and therefore releasing the main microcontroller so it can carry out other tasks Communications with the motor module are conducted via the I2C protocol Any microcontroller with this kind of communications can control the motors use the libraries in assembly The format for the Driving System I2C frame can be observed in the following illustrations Each of these frames lasts approximately 350 us nice 57 Command format MOT_STR MOT_CHA_VEL Image 58 Command format MOT_CUR MOT_ROT iiae 59 Command format MOT_STOP MOT_RST Image 60 Command forma
56. d char MOT_T_ANG Input Imp O MOT_VEL Dessiredspeed L100 MOT_T_ANG Time value 255 oe o Function Return Command to make the Moway rotate It is necessary to specify speed direction type of rotation motor type of command and the time or the angle to rotate The time has a resolution of 100 ms and with a value of O returned by MOT_T_ANG the command shall be maintained until another order is specified For the angle the equations below illustrate how to calculate the value of MOT_T_ANG taking into account the desired rotation angle If the rotation is produced on one of the wheels more resolution 1s obtained On the other hand mechanical inertia must also be considered therefore to achieve greater precision it 1s advisable to reduce the speed www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 93 of 137 Equation 4 MOT_T_ANG when rotating on its center x3 MOT _T_ANG round 27E 12 Example Rotation in relation to the center to the right at 80 speed for 10 seconds 100ms x 100 Rotation in relation to the left wheel forward at 20 speed 180 unsigned char MOT _CUR unsigned char MOT_VEL unsigned char FWDBACK unsigned char MOT_RAD unsigned char RL unsigned char COMTYPE unsigned char MOT_T_DIST MOT_VEL Desiredspeed 100 MOT_RAD Radius 100 MOTD pstievane fd 55s Distance value 255 1 Incorrect dispatch The command has not been sent Connection problem 2 Incorrec
57. d char SEN_SPEAKER_ON_OFF Input variables SEN_SPEAKER_FREQ Sound frequency see table SEN_SPEAKER_TIME SEN_SPEAKER_ON_OFF The SEN_SPEAKER function emits tones in a frequency between 250 Hz and 65 KHz SEN_SPEAKER_ON_OFF is going to say if we want to switch on switch off or activate the speaker an amount of time 100ms intervals To achieve this function follows these steps e PWM on with frequency SEN_SPEAKER_FREQ and 50 of duty e If SEN SPEAKER ON_OFF is SPEAKER TIME 2 function waits until command finishes Table 40 Allowed values for SEN SPEAKER ON_ OFF SPEAKER_OFF ooo SPEAKER_ON SPEAKER_TIME Table 41 SEN_SPEAKER_FREQ vs PWM frequency PWM frequency SEN_SPEAKER_FREQ Hz 0 0000000 5681 8181818 2976 1904762 p40 1524 3902439 801024 5901639 www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 84 of 137 771 6049383 80 Y 686 8131868 618 8118812 110 563 0630631 516 5289256 477 0992366 443 2624113 413 9072848 388 1987578 365 4970760 310 9452736 296 2085308 282 8054299 270 5627706 259 3360996 250 255 250 249 0039841 p55 244 1406250 unsigned char SEN_OBS_DIG unsigned char SEN_CHECK_OBS Input variables SEN CHECK OBS Which sensor must be read Output Indicates if there is obstacle or not This function indicates 1f the obstacle is situated on the right front side or on the left front side To achieve this function follows
58. data and or send data It is important to take into consideration that following the call to this routine the module requires 2 5 ms to be ready Example Configuration and activation routine without interruption Configure SPI modules of the PIC Configure RF module channel and address Module not configured www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 99 of 137 Activate the RF module Module not initialised unsigned char RF_OFF void Function Return 1 Correct deactivation The module has been deactivated correctly 0 Incorrect deactivation The module has not been deactivated correctly Communications with the module impossible due to the absence of or incorrect electrical connection This routine deactivates the radio module leaving this in low consumption mode It does not clear the established configuration unsigned char RF_SEND unsigned char RF_DIR_OUT unsigned char RF_DATA_OUTT Input variables RF DATA OUT This is an 8 bytes variable RF_DATA_OUT 0 7 RF_DIR_OUT Ouput address Function Return 0 Sent correctly ACK OK The data has been sent and the ACK has been received from the receiver 1 Incorrect reception of ACK The information has been sent but the ACK has not been NO ACK received incorrectly configured receiver different channel in receiver incorrect address 2 Not sent The information has not
59. derscencuessvesshoustheseuteeeeucdnsiecuacnbasdesdbensdesavebsateachaessees 63 5 3 3 4 Flow diagram for sending and receiving data ccceccccssseeeeeeeeeeeeeeaes 69 Programming Moway with C18 Compiler ssessssseeessssssssseeressssssssserrrsssssseseerres 71 pds CCAS OIC Claas ceca seea tare coreaeseraseceanesteusoeu E O N E 71 o PPO E ON a A AOA 75 Oo LO A E E E esse 79 6 3 1 mOway s sensors library in C18 oo ecccccccccccccessssesecceeeeeseaeeeseeeeeeeeeaaas 79 Coe BDE T a A E A EE 79 CoL UCU OID e E S 80 6 3 2 mOway s motor library C18 seeeccvetsocccresntiin sats oceatecanecuseeemanenniie eiea caret 89 Oy SON e E 89 2 FUO e E T R 89 6 3 3 BZ RF2GH4 library in C 8 a reise cece ene cba eweesmecesenestdecentoccssencoaswensmecasonestdesenss 96 Conk DEO e S E es fre mre eames tomer erro ner 96 oa RUIN CHONG e E acastasaenaecsececenae 96 6 3 3 3 Flow diagram for sending and receiving data ccccccssseeeeeeeeeeeeeeees 102 mOwayGUI programmMIing cccccccssessssecccccceeeesseeccceeeeeeaeaesseeeceeeeeseaeaseeeeeeseeeeaas 103 PN CCAS AP LON CL E E E A E naeesibes 103 7 2 First programme in MOWaYGUL oi eeecceccccccceeeeeeesseececeecesseeeeseeeseeeeeeaaas 103 Toe TNS eee ac ccrcetsere co nent E geen E E E E E 110 Mecha Mod chcdaesseateecnneecetcaaceeseetoc E S 110 do COn O a E A E E 121 Dee E rR E T A 133 Toe O a E E N E cose ewe ateeee ene 133 Toos Ea OA o E E E E 134 Po OUO a a cece cee egos E E R E
60. distance of 1 mm and with a value of O returned by MOT_T_DIST the command will be maintained until another order is given Example Straight forward at 100 speed during 10 seconds 100 ms x 100 MOT_STR 100 FWD TIME 100 Straight backwards at 15 speed 100mm 1mm x 100 unsigned char MOT_CHA_VEL unsigned char MOT_VEL unsigned char FWDBACK unsigned char RLvunsigned char COMTYPE unsigned char MOT_T_DIST MOT_VEL Desiredspeed LO 100 a a Distance value 255 I Incorrect dispatch The command has not been sent Connection problem 2 Incorrect data The data is incorrect www moway robot com m Title mOway User Manual TEET MANAN Rev v2 1 0 June 2010 Page 92 of 137 A command to change the speed of any of the two motors It is necessary to specify speed direction motor type of command and the time or distance to be traveled The time has a resolution of 100 ms and the distance 1mm and with a value of 0 returned by MOT_T_DIST the command shall be maintained until another order is specified Example Change speed 80 forward of the right motor during 10 seconds 100 ms x 100 MOT_CHA_VEL 80 FWD RIGHT TIME 100 Change speed 20 backwards of the left motor and travels a distance of 100 mm 1 mm x 100 MOT_CHA_VEL 20 BACK LEFT DISTANCE 100 unsigned char MOT_ROT unsigned char MOT_VEL unsigned char FWDBACK unsigned char MOT_CENWHEEL unsigned char RL unsigned char COMTYPE unsigne
61. e 2010 Page 34 of 137 list p 168F66750 PTC register definition f include P1is8Frea6750 IMC keset Vector org Ox 1LO0O0 goto INIT Program memory org Oxloed PUAHAA ATTA TATA ETT TTT AAT TTT MOWAY LIBRARY eee eee e eee ee aR H include lib sen moway inc Pere eee eee eA aaa a A oo a a a a a a INIT Microcontroller configuration to use the sensors call SEN CONFIG Green LED blink call LED TOP GREEN ON OFF Bee Re a BN Ot es ae a ea a ee ee ee me e DT E NT PROGRAM TTT TTT Pa ow ao MLIN goto MALIM a a a a a a a e e a e e a END Image 34 First program configuration and LED 8 To detect obstacles call up the SEN_OBS_DIG function with OBS_CENTER_L parameter in infinite loop which will inform of the presence of an obstacle through the SEN_OBS variable 9 If it detects an obstacle the front LEDs light up 10 Test the program on mOway and verify that the LEDs switch on when an object is placed close to the front part of the mOway www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 35 of 137 list p 15F669750 PIC register definition Hinclude P1isF86 750 INC Reset vector DEG Ox 1LOO00 gota INIT Program memory org Ox1l0e amp ae ae ea ie ae eo ae ee ea ease eee ee ee Pe ae LIBRARY TET PPP Pa Pa aoa oa inc lude lib sen moway inc ee a a e e a e ce ec cc ec ee INIT Microcontroller configuration to use the sensors call BEN CONFIG Green LED blink call LED
62. e connected to it as well as any other device considered interesting to perform a certain task mOway s external design is very compact intended to move with grace and style avoiding standstills due to obstacles or corners This small mobile device has been fittingly called a pocket robot mOway is a perfect tool for those who want to both learn and teach minirobotics The user will be pleasantly surprised by the speed in achieving results even if this is the first time he she comes into contact with mobile robots www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 8 of 137 3 Robot mOway This chapter describes each of the parts that constitute the mOway It is important to highlight that it 1s not necessary to know the total functioning of the robot to be able to program it at least not at the level of detail explained here The following elements are to be found inside mOway Processor Drive system Sensors and indicators group Power supply system An expansion connector Encoder PIC18f86j50 PIC16F687 SPEAKER Encoder Image 1 Diagram of mOway s parts 3 1 Processor mOways are governed by a 4 Mhz PIC18F87J50 microcontroller manufactured by Microchip Technologies All the peripherals distributed throughout the whole robot are connected to its input output ports Some of them need a digital input
63. elies a S EE EE 20 Dee RE e RS De E E N 21 LL WECMMICAI SCC HC AION S sena E AA 22 P E E E E E E A E set eeteae ac asarorseatececces 24 4 1 mOway Pack installation ccccccssseesseececcceceaeesseecccceeeeseeeeseeeeeeeeeeaeeeenees 24 4 2 Download a program to MOWAY c ccsessccceccecessessseeecceeeeeeaaeeseeeeeeeeeeaaaeesees 25 Be BRE CISD instalation csse nees E a E 26 k RETO e E E E N 2 Programming MOway 1n assembler cc ceeessseccccccceeaeeeseeecceeeeeeeaeeeseeeeeeeeeeeeas 29 I CEA TO CU e E ET 29 5 2 Firstprogtam in assembler tiie ccaesicdsadiuncrcesseraioaeatacecesewioseodiecmeescorcdennsPacareneniess 33 o LOO E r A E E ee ee eee ee 37 5 3 1 mOway s sensors library in assembly language ccccccsessseeeeeeeeeeeeees 37 IL DE 0 i eran were TermereT O 38 FL NAR VAD LO a E E E E A 38 JoL Tan ON eee A E A R 4 5 3 2 mOway s motor library in assembly language ccceecccssssseeseeeeeeeeeeees 50 Io TICS CRO HOM astro es ceres outa cece S E E 51 K NAVA Srcrtgeee crete A oa etessaaiaaceos ese A E A E EE 51 Dees TO ONG strep sassacetsaen E E deuce sen suases la usbateratecgscteicasees 53 5 3 3 BZI RF2GH4 library in assembly language ee eccccccecssseeeeeeeeeeeeeeaes 61 Deb CSOT IN aes peer ecetetes cence cate ad gee E E cece chosen ceneenew ics ed seateee a 61 Dis NAICS er E E peteieenctace edie E E 6l www moway robot com 5 3 3 3 PUNCH ONS soccecicccarcodccacsscesnc
64. f one of the sensors detects an obstacle true output www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 124 of 137 e Accelerometer With the accelerometer you can check if the mOway has been beaten once tap or twice Double tap Properties Configuration Properties Configuration Selecta property type Accelerometer poccelerometer Configuration Configuration Interrupt Type Interrupt Type we een rT ap iT ap Tap Image 94 Choose the interrupt type e Sound This sensor checks 1f there is a loud sound or not Properties Configuration Select a property type Sound H Configuration When mUwary heards a loud sound this if activated Image 95 Choose to check if there is a sound e Check expansion card This checks the digital value of the expansion connector pin www moway robot com Configuration Fin ensor Pint ae Ping Pins Title mOway User Manual Rev v2 1 0 June 2010 Page 125 of 137 Properties Configuration Check expansion card Configuration Pin Sengor a Ty aos Pind Pind Ping H constant Luminosity ora Temperature Image 96 Choose to expansion connector pin WARNING Only advanced users can use the pinout configuration Any incorrect connection of electronic elements to the expansion connector may damage the robot irreversibly e Sensor comparative
65. here are no pending messages Bit 2 RCVOK Reports that data has been received correctly and is accessible for processing 1 Correct reception 0 No data has been received or the information received is corrupt Bit 1 ACK Shows whether the ACK confirmation has been received from the receiver following a transmission 1 The receiver has confirmed that the data has been received correctly 0 Confirmation from the receiver has not been received This may be due to the fact that the signal has not been received or that the stack is full and cannot store more messages Bit 0 SNDOK This shows whether data was sent the last time www moway robot com 1 Radio module has sent the data This bit does not indicate that someone has heard it 0 It has not been possible to send the data This may be due to a failure in the communication with the radio module RF_DATA_OUT_0 RF_DATA_OUT _1 RF_DATA_OUT 7 This group of variables consists of 8 bytes In each transmission the contents of the 8 bytes is sent RF_DATA_IN_0 RF_DATA_IN _1 RF_DATA_IN 7 This group of variables consists of 8 bytes In each reception these 8 bytes are updated RF_DIR_OUT This variable is of one byte only This indicates the direction of the device that wants to send the data RF_DIR_IN This variable is of one byte only It indicates the address of the data received RF_DIR This variable is of one byte only It indicates the address
66. information from the drive system The drive system provides information about the total distance covered partial distance etc Properties Configuration Properties Configuration select a property tupe E Selecta property type fh ovement info comparativ A ovement amparati Configuration Configuration Movement information Movernent intorratiar Time Lett Speed Right speed Lett Distance Aight Distance Angle Total Distance Surlan operand gorstanie Image 100 Choose the movement information and the comparative Properties Configuration Properties Configuration Select a property type Selecta property type vement info comparati MMovernient into comparatiy Mio Configuration Configuration Movement informations Movement infarmatiare Time y Time a Operand Operand constant a constant Auxillary operand monshante Image 101 Choose the variable to be compared www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 128 of 137 RADIO FREQUENCY Properties Configuration Select a property type Senor comparative Engines Movement info comparative R adio Frequency RF Tranemsion AF Reception OU perabons Comparative Image 102 Choose the type of conditional Radio Frequency e RF transmission It transmits a frame to a specific address The address of the recipient and the data which
67. ions Version Control PICL8F2550 OW inovzdcc Image 26 Project Wizard www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 30 of 137 1 First select the PIC installed in mOway PIC18F86J50 Project Wizard Step ne Select a device Device Image 27 PIC selection 2 Then select the assembly tool MPASM Project Wizard Step Two Select 4 language toolsuite Active Toolsuite Microchip MPASM Toolsuite Tooleuite Contents MPASM Assembler in Srv Ene v53 MPLIBE Object Linker mplink exe v4 31 MPLIB Librarian mplib exe Location C Mchivos de programa Microchip MPASM Suite MPASMWIN exe Store tool locations in project Help My Suite lent Listed Show all installed toolsuites Image 28 Tool selection www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 31 of 137 3 In step three enter the project s name and location Project Wizard Step Three Create a new project or reconfigure the active project Create New Project File Arn proha SMi wap first project ASM Ami way first project Image 29 Select name and folder 4 In the next step the mOway libraries which control different features of the robot are added to the project Project Wizard Step Four Add existing files to pour project a ASM_SEN_O1 i lib_mot_moway Inc ASM_SEN_D1 mcep Ib_Sen_ moway inc ASM SEN_O1
68. ked and if an object is detected LEDs and speakers are switched on This project uses absolute lib_sen_moway inc library ASM_SEN_02 Assembler software to check sensors Obstacle sensors are checked and if an object is detected LEDs and speakers are switched on This project uses relocatable lib_re_sen_moway inc library C_SEN_0O1 C18 software to check sensors Obstacle sensors are checked and if an object is detected LEDs and speakers are switched on Project to check drive system ASM _MOT_O1 Assembler software to movements of mOway are executed lib_mot_moway inc library ASM _MOT_02 Assembler software to movements of mOway are executed lib_re_mot_moway inc library C MOT _O1 C18 software to check drive mOway are executed Projects to check RF module check drive system Different This project uses absolute check drive system Different This project uses relocatable system Different movements of e ASM_RF Ol Assembler software to check RF module Sends data to channel 0x40 and address 0x02 every 2 sec This project uses absolute lib_rf2gh4 inc library www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 26 of 137 ASM_RF_02 Assembler software to check RF module Sends data to channel 0x40 and address 0x02 every 2 sec This project uses relocatable lib_re_rf2gh4 inc library ASM_RF_03 Assembler software to check RF module Makes robot work as a repeater Reception without in
69. le resets stored movement counters You can select the specific pieces of data you wish to reset Properties Configuration Gontiquration Reset Time Reset Partial Distance Reset Krm Image 81 Choose the options to be reset www moway robot com me E EL Dist Left T ie ee a Cancel Title mOway User Manual Rev v2 1 0 June 2010 Page 118 of 137 RADIO FREQUENCY Properties Configuration Select a property type Reset Move Info Radio Frequency RF Control Operations Assignment Mathematical Pause Call a subrutine Image 82 Choose the type of module Radio Frequency e RF Control This activates or deactivates the RF module When you activate this control you must select which address the robot will use and in which channel you wish to operate So that two mOways can communicate between each other they must operate on the same channel Properties Configuration Configuration O Deactivate AF Activate AF Channel ceda aal e Image 83 Choose the channel and the address www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 119 of 137 OPERATIONS Properties Configuration Selecta property type Reset Move Info Radio Frequency RF Control OU peratons Assigment Mathematical Pause Call a subrutine Image 84 Choose the type of module Operations e Assignment This function is to assign a value
70. lected back if the line is detected and this signal will be perceived by the infrared receiver e Wait for the data acquisition process to end 900 us e Read the sensor www moway robot com m Title mOway User Manual TEET nOweN Rev v2 1 0 June 2010 Page 49 of 137 e Copy the value to the SEN_LINE variable If the surface is dark no light is reflected the variable will return a 1 value Table 30 SEN CHECK _ LINE allowed value SEN_LINE_ANALOG Input variable SEN CHECK LINE Which sensor must be read Output variable SEN_LINE Analog value of the sensor Output SEN_STATUS SENOK DWRONG The SEN_LINE_ANALOG function indicates the light reflected in the optocouplers To do this follow the steps indicated below e Emit the infrared light pulse to detect the line This light beam will be reflected back if the line is detected and this signal will be perceived by the infrared receiver e Wait for the data acquisition process to end 900us Read the sensor Copy this value to the SEN_LINE variable The higher the values the darker will the surfaces be Table 31 Allowed values for SEN CHECK LINE LED_BRAKE_ ON This function switches on the brake LED LED_FRONT_ON This function switches on the front LED LED_TOP_RED_ON S Due to tolerance two different sensors can differ from each other www moway robot com This function switches on the red LED LED_TOP_GREEN_ON This function
71. m Table 33 Pic drive system connections Pin PIC RE7 I Indicates when the motor ends the command REO OJ SCL of the I2C protocol O SDA of the I2C protocol Port RE7 indicates the end of a command This port is labeled as MOT_END in the library Example sStraight forward at 100 speed for 10 seconds 100ms x 100 Nothing is done until the command has ended www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 55 of 137 MOT _CHECK_END function also can be used MOT_STR MOT_VEL Desiredspeed L100 MOT_T_DIST Time value 255 Distance value 255 Output variables FLAGS MOT_STATUS COMOK and DWRONG Command to move in a straight line You will have to specify speed direction type of command and the time or the distance to travel The time has a resolution of 100 ms and the distance of Imm and with a value of O returned by MOT_T_DIST the command shall be maintained until another order is specified Example Straight ahead at 100 speed during 10 seconds 100ms x 100 Straight backwards at 15 speed 100mm 1mm x 100 MOT_CHA_VEL MOT_VEL Desired speed 0 100 MOT_CON FWDBACK 1 FWD__ 0 BACK MOT_CON RL Left or right 1 RIGHT 0 LEFT MOT_CON COMTYPE Type of command 1 TIME 0 DIST MOT T_ DIST Time value 255 Distance value 255 www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 56 of 137 Output variables FLAGS MOT_STA
72. motor distance traveled by each motor and the speedometer This function updates two variables where the required information will be saved All the petitions except STATUS_KM return one byte MOT_STATUS_DATA_0O maintaining MOT _STATUS_DATA_1 at a OxFF value These two variables are updated every time a new command is sent e g recall the time elapsed since the last command Whenever using STATUS_KM the two bytes must be considered This command is very useful to calculate the length of a line while the robot is following it Table 34 Parameter resolution Resolution 100ms bit STATUS_A 3 6 bit www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 61 of 137 Example Recall time elapsed since the last command HIO V VV WY It FA U VY i movwi MOT STATUS COM call MOT _FDBCK E g Output SMOT_STATUS_DATA_0 0x7F gt 12 7 seconds elapsed since the last command MOT_STATUS_DATA_1 0xFF gt Invalid data Recall distance traveled by the right motor since the last command 0000 0001 0000 0100 264 Distance 264 1mm 264mm 5 3 3 BZI RF2GH4 library in assembly language 5 3 3 1 Description With this library it is possible to communicate easily between mOway and the BZI RF2GH4 module In turn it is important to take into account that in order to call any library function three free stack levels are necessary and the watchdog must be deactivated In vie
73. ne OBS_CENTER_L a OBS_SIDE_L OBS_CENTER_R OBS_SIDE_R SEN_CHECK_ACCE This write only variable shows which axis must be read by SEN ACCE XYZ _ READ function Table 20 Allowed values for SEN CHECK ACCE Define ACCE_CHECK_X ACCE_CHECK_Y ACCE_CHECK_Z SEN_CHECK_LINE This write only variable shows which sensor must be read by line functions Table 21 Allowed values for SEN CHECK LINE Define SEN_SPEAKER_ON_OFF This write only variable shows if speaker have to turn on turn off or play an amount of time www moway robot com Table 22 Allowed values for SEN SPEAKER ON OFF Define SPEAKER_OFF OO SPEAKER_ON SPEAKER_TIME SEN_LIGHT_P This variable records the percentage of light reaching the light sensor It is updated every time the SEN_LIGHT function is called SEN_BATTERY_P This variable records the percentage of the battery level It is updated every time the SEN BATTERY function is called SEN_TEMPERATURE_C This variable records the value of the temperature in C It is updated every time the SEN TEMPERATURE C function is called SEN_MIC This variable records the value of the microphone The data will be digital or analog depending on the updating function SEN_MIC_DIG and SEN_MIC_ANALOG SEN_SPEAKER_FREQ This variable records the value of the frecuency between 250 Hz and 65 KHz to create the tone SEN_SPEAKER_ TIME These variable records the time the speaker must send the
74. ne re Actors Image 63 Pause and LEDs configuration 3 The end of the program is added so that the application can be compiled 4 The program is compiled and recorded into the robot by means of the record button in the menu 5 Test the program and check that after waiting 1 second the green LED lights up www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 105 of 137 T aa op Green Blink Image 64 First mOwayGUI program Pause and blinking www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 106 of 137 6 In order to detect obstacles the Condition modules are configured to check both sensors individually Properties Configuration Select a property type StS cl e eck obstacles Configuration Left central obstacle Right central obstacle No Obstacle v No Obstacle v Left side obstacle Right side obstacle Yes Obstacle X No Obstacle Properties Configuration Select a property type Check obstacles r Configuration Left central obstacle Right central obstacle No Obstacle v Yes Obstacle v Left side obstacle Right side obstacle No Obstacle v No Obstacle Properties Configuration Select a property pe Chec k obstacles Configuration Left central obstacle Right central obstacle Yes Obstacle v No Obstacle v Left side obstacle Right side obstacle No Obstacle
75. nsor receiver PORTB RBI RB2 RB3 RB5 RB6 PORTC RC7 PORTD RDI Ol Line sensors transmitter RD4 SDO signal for the SPI communication accelerometer RDS Ol SDI sinal for the SPI communication accelerometer RD6 Ol Clock sinal for the SPI communication accelerometer Chip Select for the SPI communication accelerometer PORTE RE5 O Brake LED PORTH RH5 RH6 RH7 PORTJ RJ6 RJ7 First interruption of the accelerometer Second interruption of the accelerometer Speaker Top red LED Top green LED Front LED Tempreature sensor Battery measurer Microphone Infrared transmitter Free pad unsigned char SEN_LIGHT void Output Percentage of ambient light The SEN_LIGHT function captures the analog value generated by the inciding light on the photo transistor To achieve this follow these steps Activate the ADC Wait for the data acquisition process to end 100us Read the analog value Calculate the inciding light percentage based on the analog voltage measurement e Returns the percentage of ambient light www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 82 of 137 unsigned char SEN_BATTERY void Output Percentage of battery level The SEN_BATTERY function captures the analog value of the battery To achieve this function follows these steps Activate the ADC Wait for the data acquisition process to end 100us Read the analog v
76. om Title mOway User Manual Rev v2 1 0 June 2010 Page 87 of 137 e Emit the infrared light pulse to detect the line This light beam will be reflected back if the line is detected and this signal will be perceived by the infrared receiver e Wait for the data acquisition process to end 900 us e Read the sensor e Copy the value to the SEN_LINE variable If the surface is dark no light is reflected the variable will return a 1 value Table 45 SEN CHECK LINE allowed values LINE_L LINE_R l unsigned char SEN_LINE_ANALOG unsigned char SEN_CHECK_LINE Input variables SEN CHECK LINE Which sensor must be read Output Analog value of the sensor The SEN_LINE_ANALOG function indicates the light reflected in the optocouplers 18 To do this function follows the steps indicated below e Emit the infrared light pulse to detect the line This light beam will be reflected back if the line is detected and this signal will be perceived by the infrared receiver e Wait for the data acquisition process to end 900us e Read the sensor e Copy this value to the SEN_LINE variable The higher the values the darker will the surfaces be Table 46 SEN CHECK LINE allowed values po y y OUNL 0 void LED_BRAKE_ON void Function to switches on the brake LED void LED_FRONT_ON void Function to switches on the front LED 18 Due to tolerance two different sensors can differ from each other www moway robot
77. on frequency module and leaves 1 Incorrect it in low consumption mode deactivation www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 97 of 137 unsigned char RF_SEND unsigned RF_DIR_OUT 0 Sent correctly Sends a data frame 8 Bytes char unsigned char RF_DATA_OUT saa to the address indicated unsigned char RF_DIR_IN 0 Single reception Checks whether a reception RF_RECE IVE nsi gne dcha r RF _DATA_IN 1 Multiple reception has occurred and if so 3 2 No reception collects the frame unsigned char void RF CONFIG_SPI void The speed of the SPI must not exceed 8 Mhz In the function the different parameters of the SPI module and the PIC pins are configured Table 51 SPI configuration PIC ports Example Configure SPI modules of the PIC unsigned char RF_CONFIG unsigned char CHANNEL unsigned char ADDRESS RF_DIR RF _CHN Channel to be used in the communication Must be a value 0 Incorrect configuration The module is not configured Communications with the module impossible due to the absence of or incorrect electrical connection This function configures the transceptor enabling its own watch address and the broadcast address In turn it configures other parameters such as PIC pins transmission speed emission power address length the length of the CRC code etc Table 52 RF module PIC ports configuration RF PIN PIC PIN RF2 The channel must
78. or value Configuration Configuration Configuration Variable to asigr Variable bo asige Variable to asigni a l Yariable i variable w Marable Gensor Sensor Vanables F Erp ariable3 Light E x Hi i Left central obstacle Lett side obstacle E i Aight side obstacle Battery Image 72 Choose the variable to assign and the sensor e Expansion control Control of the expansion connector of the mOway robot It can be used with the mOway expansion module www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 112 of 137 Properties Configuration Select 4 property type Expansion Control Configuration Pinout configuration v Manual Config Esp Sensor Piri Pind Out QIN OUT 0 4 Variable to aaign Pine Ping Out OW ouT O1 Pind Pins Out On outr 8 01 Pir Pind Out On our F O1 Ping PinS Out On oar 2 01 Ping Ping Out Om oaut OF O1 Image 73 Choose pinout configuration of the expansion connector WARNING Only advanced users can use the pinout configuration Any incorrect connection of electronic elements to the expansion connector may damage the robot irreversibly e Speaker This function enables mOway to emit tones from 250 Hz to 65 KHz in pair sequences of 100 ms This is possible because of the speaker installed on the robot www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 113 of 137 Properties Configuration
79. ose E Untitled Set Active Project Quickbuild no asm file Package in zip Build Configuration Build Options Remove File From Project Select Language Toolsulte Set Language Tool Locations Version Control PICL8F2550 wo novedcc Image 44 Project Wizard www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 72 of 137 1 First select the PIC installed in mOway PICI8F86J50 Project Wizard Step ne Select a device Device Image 45 PIC selection 2 Choose C18 C compiler Project Wizard Step Two Select a language toolsuite Active Toolsuite Microchip C18 T oolsuite Ww Toolsuite Contents MPLINE Object Linker mplink exe v4 35 Store tool locations in project Help My Suite lant Listed Show all installed toolsuites Image 46 Tool selection www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 73 of 137 3 In the next step user has to specify location Project Wizard Step Three B Create a new project or reconfigure the active project L Create New Project File hma proti ov mUway first projectsmU wap first propect ee T Image 47 Location 4 Add mOway libraries It 1s highly recommended to copy those libraries to the folder Project Wizard Step Four Add existing files to your project 30 C_LMOT_O lib_sen_moway h Culen Dw 1 cO
80. otors use the libraries in assembly The format for the Driving System I2C frame can be observed in the following illustrations Each of these frames lasts approximately 350 us Image 39 Command format MOT_STR MOT_CHA_VEL Image 40 Command format MOT_CUR MOT_ROT Image 41 Command format MOT_STOP MOT_RST Image 42 Command format MOT_FDBCK 5 3 2 2 Variables www moway robot com MOT_STATUS A register that shows the command s status a eee ee eee eee Bit 7 2 Unused Bit 1 DWRONG Appears if data is incorrect 1 Incorrect data 0 Correct Data Bit 0 COMOK Appears if the command has been sent correctly by I2C 1 Correct dispatch 0 Incorrect dispatch MOT_CON Control register This register defines command parameters es ee ee ee ee eee eee eee Bit 7 3 Unused Bit 2 COMTYPE Type of command 1 Time 0 Distance or angle n MOT_ROT Bit 1 RL Right or Left 1 Right 0 Left Bit Q FWDBACK Forward or backwards 1 Forward 0 Backwards MOT_VEL Desired command speed www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 53 of 137 MOT_T_DIST_ANG According to the COMTYPE and command values the variable will be the time the distance or the angle MOT_CENWHEEL Rotate on the robot s center or on one of the wheels MOT_RAD Radius for the MOT_CUR command MOT_RST_COM Type of reset desired MOT_STATUS_C
81. p perandi Variable Variable es Ra Operand2 Operancde ig cons constant ja o g constant consta sit Variable vee z Image 87 Choose the operand2 www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 121 of 137 e Pause This allows you to insert a pause in the programme with a duration set in multiples of 0 05 seconds The pause parameter may be a constant or a variable Properties Configuration Configuration Wait time I constant a i A 40 2 00 sec Image 88 Choose the time e Subroutine call Subroutine call which can be reused in other mOway projects Properties Configuration Select a property type Calla subrutine Configuration Configuration SUB ute Fi uti i Subruatirie F ii i ne Image 89 Choose the subroutine 7 3 2 Conditionals Conditionals are actions in which the output is important in order to operate with them comparisons sensor verification etc The following actions can be carried out with modules www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 122 of 137 Image 90 Set of mOwayGUI conditionals SENSORS Properties Configuration Check line Check obstacles Accelerometer Sound Check expansion card Sensor comparative Engines Image 91 Choose the type of conditional Sensors e Check line It checks the digital
82. pansion connector and it is very easy to use with mOwayGUI The best way to start working with the module is using an example project provided in mOwayPack 8 This LED can swap between on and off when the battery is fully charge because there is energy consumption when mOway is plugged Available in some packs 10 Available in some packs www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 22 of 137 Image 19 RFUsb The BZI RF2GH4 radio frequency communications module is based on the nRF24L01 transceptor manufactured by Nordic Semiconductors This integrated circuit has been fitted with all the logic required to establish wireless bidirectional communications with acknowledgement of receipt Communications with the microcontroller is made via an SPI bus The main characteristics of the BZI RF2GH4 module are as follows Low consumption Working frequency 2 4GHz Transmitting power between 18 and 0 dBm Transmission speed between and 2 Mbps 128 in transmission channels selectable by the SPI bus In addition to the CI nRF24L01 the BZI RF2GH4 is also fitted with all the associated electronics for its correct operation plus a microstrip antenna on the same board with the impedance adaptation network In this way the user can forget completely about the hardware required to implement the radio part of his application As interface the device has four pins available for the SPI bus two mo
83. r Manual Rev v2 1 0 June 2010 Page 109 of 137 Image 68 End of first program in mOwayGUI www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 110 of 137 7 3 mOwayGUI 7 3 1 Modules Modules are actions in which the output is unconditional turn on a LED send a movement command etc With modules the following actions can be carried out WEL 100 Center Left Image 69 First program detecting obstacles moving SENSORS Properties Configuration Select a property type LED diodes Assign Sensor value Expansion Control Speaker Engines Movement Curve Image 70 Choose the type of module Sensors www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 111 of 137 e LED Diodes This module enables you to operate on mOway s LED diodes You can turn them on turn them off or make them blink Properties Configuration Properties Configuration Select a property type E D diodes LEC diodes Contiguratiory j Configuration i Configuration LED diodes LED diodes LED diodes Front Front w Action OF Cancel Image 71 Choose the LED diode and its action e Assign sensor value This function is to assign a variable to one sensor This variable can be used to configure different aspects of the robot Properties Configuration Properties Configuration Selecta property type 1 x m Assign Sens
84. ral left obstacle sensor mov Liv OBS CENTER L movwe SEN CHECK OBS call SEN OBS DIG Image 36 Configuration and first movement 15 When it encounters an obstacle a command is sent to rotate 180 and the top red LED lights up the front LEDs will not operate The robot will wait until this command has ended and will then continue moving straight forward www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 37 of 137 Check central left obstacle sensor mov Li OBS CENTER L morn SEN CHECE OBS call JEN OBS DIG If a obstacle is detected robot avoids it bhtfisc SEN OBS 0O goto OBS DETECT htiss JEN O8S 0 call LED FRONT OFF goto MLIN OBS DETECT call LED FRONT ON Rotate 160 at 205 speed mov Li 20 morn MOT VEL mov Li 50 morn HOT T DIST ANG mov Li OxOl HOT CENWHEEL HOT CON FUDBACK HOT CON CONTYPE HOT CON RL HOT ROT Vait until comand finishes call HOT CHECK END patraight on 505 speed mov Li 50 morn HOT VEL mov Li 0 HOT T DIST Ane HOT CON FWDBACE HOT CON CONTYPE HOT ATR goto MALIN p o a Wor a ra WoW irr ro or ror Wo WW Image 37 First program detecting obstacles moving This project is included in the mOway pack 5 3 Libraries 5 3 1 mOway s sensors library in assembly language There are two libraries in assembly language which can be included in any mOway project and allow the user to control the sensors with ease Both are identical except
85. re pins for controlling the module and another two for the supply In order to facilitate the handling of the module a number of libraries have been developed to simplify and shorten the development time of wireless applications with these modules 3 5 1 Technical specifications Table 16 Maximum Ratings Parameter o ys S S O Data input voltage www moway robot com m Title mOway User Manual TEET MEAN AN Rev v2 1 0 June 2010 Page 23 of 137 Power dissipation mW Table 17 Specifications BZI RF2GH4 Maximum poweroutpupt i S Bm Current in Power Down mode nA _ Maximum frequency of the SPIbus CT Mhz Table 18 Pinout BZI RF2GH4 Pins N SD scription CSN 4 Chip Select of the SPI SDI 6 __ Data input to the RF module of the SPI bus MOSD IRQ 8 Outputinterruption ooo O RT o y 1H JH H O TAtYH ZJ3Y 1IZE Image 20 Module layout www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 24 of 137 4 First Steps 4 1 mOway Pack installation In mOwayPack available in the webpage or in the installation CD you will find the software mOway s libraries test programs and documentations Following setup steps you will have all the resources e Beginner s and User manual o Beginner s manual includes all you need to start working with mOway o User manual contains detailed description of the robot
86. rward www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 79 of 137 if Ae Len ae may ae ee Ae em A Ae eee A ae UY ee Oe eae ey eee we Oda C a a r a a a a a a a a a a a r a a a r a a a a r a a a a a a a s a r r void mairi ff ReeEEEAESASEN SOR CONFIGURATION eeae eae eS SEN CONFIGI ff Ree ETESIREGINE CONFIGURATION eae eae yf NOT CONFIG iGreen LED blink LED TOP GREEN ON OFF Straight on NOT STR SO FWD TIME 0j while 1 f Check Center Left Obstacle sensor if SEN OBS DIG OBS CENTER Lj i LED FRONT ON Rotation MOT ROT 2O0 FWD CENTER LEFT ANGLE 50 while NOT END i Straight on MOT STR SO FWD TIME O 1 else LED FRONT OFF Image 55 First program detecting obstacles moving This project is included in the mOway pack 6 3 Libraries 6 3 1 mOway s sensors library in C18 6 3 1 1 Description The library includes a series of functions in charge of reading the data provided by the robot s sensors They configure the input and output ports the microcontroller s ADC and the luminous indicators www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 80 of 137 6 3 1 2 Functions A series of functions to control mOway s sensors and LED diodes are included in the lib_sen_moway library Table 38 C function summary Name Input Description constants void SEN_CONFIGURARWoid Configured to use
87. s PORTA PORTF PORTJ RIT Of Ifrared transmitter _ Image 12 Location of Obstacle Sensor Due to tolerance two different sensors can differ from each other www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 16 of 137 J Light sensor This sensor allows mOway to recognize the light intensity that enters through a small half moon shaped opening on the top part of the chassis Since it is facing forward it enables it to detect where the light source is located and to act accordingly The output of the AVAGO APDS 9002 sensor is connected to the analog port of the microcontroller so that with a simple reading of the ADC we can register the light intensity level and any change in intensity levels based on the last reading Table 5 PIC light sensor connection Pin PIC RAQ Luz Image 13 Location of Light Sensor 3 3 4 Expansion connector This connector allows the mOway to connect with any commercial modules or electronic circuits the user may choose As shown in the above table it is possible to connect commercial SPI devices On the other hand the RF BZI RF2GH4 module available in the market is totally compatible with mOway and with specific libraries This module enables the mOway to communicate with other robots and with a PC via the RFUsb With this module it is possible to create complex collaboration applications without having to worry about complicated wireless communica
88. s tool is very useful to create the diagram Erase Arrow is used to delete the link between the element and the next one It can be pee done clicking on the element 7 3 6 Subroutines In order to simplify the diagrams and optimise the use of programme memory reusable subroutines can be generated In other words if a part of the programme is repeated with great frequency a subroutine can be created with this task and replacing it in the main diagram with a subroutine module 7 3 7 Recording mOwayGUI can be used to record the diagram in the robot directly The status of the recording process will be indicated at the top www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 135 of 137 8 Moway RC Center Moway RC Center is an application included in Moway s Pack to control Moway as if it was a radio control device and to monitor all the robot s sensors This tool which uses RF BZJ RF2GH4 modules and RFUsb mOway Base is compatible is very useful for all those users wishing to explore the field where the microbot will perform Its functioning concept is as follows the application transmits commands by means of the USB to the RFUsb which transmits them to Moway where a recorded program interprets those commands Moway_RC_Client included in Moway Pack Image 113 Moway RC Diagram Moway RC Center File RF Help RF Configuration Sensor Status Channel a Radio Control A
89. st_project MPLAB IDE v8 40 File Edit View Project Debugger Programmer Tools Configure Window Help Cae tee Shw ee e Checksum Oxfadb Debeu VeGa Lg a mOway_first_project mcp a 2 Source Files main c 5 Header Files lib_mot_moway h lib_sen_moway h 5 object Files fs Library Files Linker Script E Moway_Ikr Ikr E other Files Image 51 Project with C 6 2 First program in C18 To generate the first program a project has to be created first previous chapter This first basic program will enable the mOway to avoid obstacles 1 Add code to redefinition of the reset and interrupt codes This code is required Also lib_sen_moway h is added www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 76 of 137 finclude pleftee7s50_ h Howay microcontroller finclude lib sen moway h fSensors library PgR REEEEEEEREREEREEEE REE Ett REE EERE EERE E EERE REE EE EERE REE EEE ERE RE EERE REERERE EERE EEE EERE EERE REESE S JUMPING THE BOOTLOADER pg ER EEEEEEEEREEE ERE EEE REE REESE REE EERE EEEREERERERE EEE EERE EERE EEE RE RE EERE ERERE EERE EEE REE R EERE REESE fdefine REMAPPED RESET VECTOR ADDRESS OxloooO Reset adress for the correct bootloadg define REMAPPED HIGH INTERRUPT VECTOR ADDRESS Ox1008 High priority interruption adress for fdefine REMAPPED LOW INTERRUPT VECTOR ADDRESS OxlOls fLow priority interruption adress far void YourHighPrioritylSRCode i Fune
90. switches on the green LED LED_BRAKE OFF This function switches off the brake LED LED_FRONT_OFF This function switches off the front LED LED_TOP_RED_OFF This function switches off the red LED LED_TOP_GREEN_OFF This function switches off the green LED LED_BRAKE_ON_OFF Blink brake LED LED_FRONT_ON_OFF Blink front LED LED_TOP_RED_ON_OFF Blink red LED LED_TOP_GREEN_ON_OFF Blink green LED s mOway s motor library in assembly language There are two libraries in assembly language which can be included in any mOway project and which allow the user to easily control the drive system Both are www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 51 of 137 identical except that one of them can relocate the code and the variables by means of MPLAB IDE projects It 1s essential to understand that every time a function library is called up it uses three additional call stack levels This means that at least four call stack levels must be free before calling one of these functions to avoid return errors 5 3 2 1 Description The library includes a series of functions in charge of sending I2C commands to the Drive System which will be responsible for controlling the motors and therefore releasing the main microcontroller so it can carry out other tasks Communications with the motor module are conducted via the I2C protocol Any microcontroller with this kind of communications can control the m
91. t MOT_FDBCK 6 3 2 2 Functions A series of functions designed to control mOway s drive system are included in the lib_mot_moway library www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 90 of 137 Table 47 Summary of functions in C for lib_mot_moway Name void MOT_CONFIG void unsigned char MOT_STR unsigned char unsigned char unsigned char unsigned char unsigned char MOT_CHA_VEL unsigned char unsigned char unsigned char unsigned char unsigned char unsigned char MOT_ROT unsigned char unsigned char unsigned char unsigned char unsigned char unsigned char unsigned char MOT_CUR unsigned char unsigned char unsigned char unsigned char unsigned char unsigned char Input MOT_VEL FWDBACK COMTYPE MOT_T_DIST MOT_VEL FWDBACK RL COMTY PE MOT_T_DIST MOT_VEL FWDBACK MOT_CENWHEEL RL COMTY PE MOT_T_ANG MOT_VEL FWDBACK MOT_RAD RL COMTYPE MOT_T_DIST Return Description Configuration communicate motors A command to move in a straight line with 0 Correct dispatch 1 Incorrect dispatch 2 Incorrect data 0 Correct dispatch 1 Incorrect dispatch 2 Incorrect data A command to change the speed of a motor A command to rotate the robot 0 Correct dispatch 1 Incorrect dispatch 2 Incorrect data A command to execute a curve 0 Correct dispatch 1 Incorrect dispatch 2 Incorrect data unsigned char MOT_STOP void
92. t be checked If the function returns a 1 the RF_RECEIVE function must be called up again but before doing so it is necessary to process the data or this will be lost The transceptor has a 3 level stack and therefore if the RF_RECEIVE function is not called up before the stack is filled the device will not be able to receive more data Example www moway robot com while 1 while RF_RECEIVE amp data_in_dir amp data_in O 2 Replace with code required for processing data void RF_INT_EN void This routine is responsible for enabling the external interruption of the microcontroller that uses the RF module in data reception For this reason the RBO pin is configured as input Although the module can be managed without interruptions the minimum response time is not guaranteed Example Configuration and activation routine with interruption Enable interruptions RF_INT_EN Configure SPI modules of the PIC RF_CONFIG_SPIQ Configure RF module channel and address if RF_CONFIG 0x40 0x01 0 Module not configured Activate the RF module if RF_ON Q 0 Module not initialised www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 102 of 137 6 3 3 3 Flow diagram for sending and receiving data Ext interrupt Define RF_DIR gt
93. t data The data is incorrect Command to describe a curve It is necessary to specify speed direction radius course type of command and the time or the distance to be traveled The radius is the speed that will be subtracted or added to the robot s global speed This means that if the specified speed is 50 and the radius 10 one of the motors shall work at 60 speed and the other one 40 Therefore the radius has to adhere to the following restrictions Equation 5 Condition 1 MOT_RAD 0 lt MOT _ VEL MOT _ RAD lt 100 Equation 6 Condition 2 MOT_RAD 0 lt MOT _VEL MOT _ RAD lt 100 The time has a resolution of 100 ms and the distance mm and with a value of 0 returned by MOT_T_ANG the command shall be maintained until another order is specified The motor measures the distance traveled by the motor located on the external side of the curve www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 94 of 137 Example Curve to the right at 50 with a radius of 10 for 10 seconds 100ms x 100 VEL_I 60 VEL_D 40 Curve to the left at 80 with a radius 15 for 100mm 1mm x 100 VEL_I 95 VEL_D 65 unsigned char MOT_STOP void Function Return 0 Correct dispatch The command has been sent correctly 1 Incorrect dispatch The command has not been sent Connection problem Command to stop the robot Example Moway stop unsigned char MOT_RST unsigned char RST_COM
94. t variables Deactivate the infrared diode Check for interfering signals If there is no signal interferences and the process develops normally the SENOK flag is activated Table 27 Allowed values for SEN CHECK OBS OBS_CENTER_L OBS_CENTER_R 2 OBS_SIDE_R SEN_OBS_ANALOG Input variable SEN CHECK OBS Which sensor must be read Output variable SEN_OBS Indicates if there is obstacle or not SEN_STATUS SENOK DWRONG This function indicates if the obstacle is on the right front side or on the left front side and its distance from the robot To achieve this follow the steps indicated below e Ensure that there is no noise source interferences before you send the infrared light pulse Emit the infrared light pulse to detect obstacles Activate the ADC Check for any possible signals from the four IR receivers Copy the analog receiver s value to the output variables The higher the value the shorter the distance will be e Deactivate the infrared diode www moway robot com m Title mOway User Manual TEET MOWAY Rev v2 1 0 June 2010 Page 47 of 137 e Check for interfering signals If there is no signal interferences and the process develops normally the SENOK flag is activated Table 28 SEN CHECK_ OBS allowed values OBS_CENTER LO SEN_ACCE_XYZ_READ Input variable SEN CHECK ACCE Which axis must be read Output variable SEN_ACCE SEN_STATUS SENOK DWRONG SEN ACCE XYZ READ returns the
95. terruption This project uses absolute lib_rf2gh4 ince library ASM_RF_04 Assembler software to check RF module Makes robot work as a repeater Reception without interruption This project uses relocatable lib_re_rf2gh4 inc library C_RF 01 C18 software to check RF module Sends data to channel 0x40 and address 0x02 every 2 sec C_RF 02 C18 software to check RF module Makes robot work as a repeater Reception without interruption First projects e mOway_first_project_ASM Assembler project explained in this manual mOway avoids obstacles rotating 180 e mOway_first_project_C18 C18 project explained in this manual mOway avoids obstacles rotating 180 4 3 RF Usb instalation e This is a device that allows to communicate the PC and mOway A driver that it s included in mOwayPack is required e The first time the RFUsb is connected the PC will detect it as a new device and an Assistant for new hardware found message will be displayed Select the No not this time option e In the following window select the recommended option Install software automatically Found New Hardware Wizard Welcome to the Found New Hardware Wizard This wizard helps you install software for Moway RF USB Ce If your hardware came with an installation CD 4 or floppy disk insert it now What do you want the wizard to do Install the software automatically Recommended Install from a list or specific location Advan
96. that one of them can relocate the code and the variables using the MPLAB IDE projects www moway robot com It 1s essential to understand that every time a function library is called up it uses an additional call stack level This means that at least two call stack levels must be free before calling one of these functions to avoid errors 5 3 1 1 Description The library includes a series of functions in charge of reading the data provided by the robot s sensors They configure the input and output ports the microcontroller s ADC and the luminous indicators 5 3 1 2 Variables SEN_STATUS This read only variable checks the validity of the data returned by the sensors Bit 7 2 Unused Bit 1 DWRONG shows if input data is correct 1 Incorrect data 0 Correct data Bit 0 SENOK shows if the sensor has been read correctly 1 Correct reading Valid output data 0 Incorrect reading Invalid output data SEN_ACCE_ TAP Read only variable that shows if SEN CHECK _ACCE_ TAP function detects one or two taps Bit Unused a ee a ee ee ee ee Bit 7 2 Unused Bit 1 TAP_TAP shows if double tap is detected 1 Double Tap detected 0 Double Tap not detected www moway robot com Bit 0 TAP shows if tap is detected 1 Tap detected 0 Tap not detected SEN_CHECK_ OBS This write only variable shows which sensor must be read by obstacle functions Table 19 Allowed values for SEN CHECK OBS Defi
97. tion that executes the needed code in case of the high pr void YourLowPriocrityiISRBCode j Funetion that executes the needed code in case of the low prig Fe RE ea a ce eee ee ee re ESRD HIGH AND LO PERETORITY THTERRBUPTION PELE PFE SEES REESE EE EEE EEE EE extern void startup oid fpragma code REMAPPED RESET VECTOR REMAPPED RESET VECTOR ADDRESS wold reset woid _asm goto startup endasm fpraqma code fpragma code REMAPPED HICH INTERRUPT VECTOR REMAPPED HICH INTERRUPT VECTOR ADDRESS void Remapped High ISR woid asm goto YourHighPrioritylshCode endasm fpragma code REMAPPED LOW INTERRUPT VECTOR REMAPPED LOW INTERRUPT VECTOR ADDRESS void Remapped Low ISR woid asm goto YourLowPrioritylISPCode endasm fpraqma code fpraqma interrupt YourHiqhPriorityIShCode void YourHiqhPriorityisShCoder high priority interrupt code pragma interruptlow YourLowPriorityishCode void YourLowPriorityiIShCodel ilow priority interrupt code if he ee ee eR ee ee ee a ee ee HATH J iaar r ir a ir i ee ee ae ee ea void mair Image 52 First program vector redefinition 2 Next the SEN_CONFIG function is called to configure the microcontroller s inputs and outputs 3 Add winking to one of the LEDs 4 Test the program on mOway programming it in mOwayGUIlI and verify that the green LED blinks www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 77 of 137 ra ae Seay a aN ee aa ML
98. tions Table 6 Expansion connector connections O Pint OU Vee BV O n PRjJ o GND C2INC I O INT Top two color LED has to be switched off to have a valid measure www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 17 of 137 A A r Image 14 RF modules into expansion connector 3 3 5 Temperature sensor mOway has installed as a temperature measurer an NTC thermistor from Murata a semiconductor whose electrical variable resistance decreases as temperature increases The sensor is located in the front part of the robot very close to obstacle sensor The thermistor is connected to the analog port of the microcontroller so that with a simple reading of the ADC it is possible to get the temperature value in that moment and notice any change in it since the last reading Table 7 PIC Temperature sensor connection Pin PIC Sensor PORTH 3 3 6 Speaker The CMT 1102 speaker from CUI INC directly connected to the microcontroller is capable to play tones from 250 Hz to 65 KHz Table 8 PIC Speaker connection Pin PIC PORTB RB3 Of Speaker S 3 3 7 Microphone The CMC 5042PF AC microphone from CUI INC enables the robot to detect sounds from 100 Hz to 20 KHz Temperature measured by the sensor can be 5 C higher than external temperature www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 18 of 137 The output is
99. to each device must be one way within each channel If the SPI communication of the PIC is configured incorrectly the connection has been made incorrectly or in the absence of the module the CONFIGOK RF_STATUS bit of will remain at 0 RF_ON Output variables FLAGS ONOK This routine activates the radio module in watch mode in order to be able to receive data and or send data It is important to take into consideration that following the call to this routine the module requires 2 5 ms to be ready If the SPI communication of the PIC is configured incorrectly the connection has been made incorrectly or in the absence of the module the ONOK RF_STATUS bit will remain at Q Example Configuration without interruption and activation routine Configure SPI modules of the PIC Configure RF module own channel and address gt Own address Channel www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 66 of 137 Module not configured gt Activate RF module Module not initialised RF_OFF Output variables FLAGS OFFOK This routine deactivates the radio module leaving this in low consumption mode It does not clear the established configuration If the SPI communication of the PIC is configured incorrectly the connection has been made incorrectly or in the absence of the module the OFFOK RF_STATUS bit will remain at 0 RF_SEND Input variables RF_DIR_OUT Direction
100. tone SEN_OBS This variable stores the value of the obstacle sensor SEN CHECK OBS This value is updated when SEN_OBS_DIG or SEN_OBS_ANALOG functions are called SEN_ACCE This variable stores the value of the acceleration The axis is selected by SEN_CHECK_ACCE This value is updated when SEN ACCE XYZ__ functions is called www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 41 of 137 SEN_ACCE_TAP This variable records if mOway has been taped It is updated every time the SEN_ACCE_CHECK_TAP function is called up SEN_LINE This variable stores the value of the line sensor SEN CHECK LINE This value is updated when SEN_LINE_DIG or SEN_LINE_ANALOG functions are called 5 3 1 3 Functions A series of functions to control mOway s sensors and LED diodes are included in the lib_sen_moway and lib_re_sen_moway libraries Below is a brief description of each one of these function Table 23 ASM function summary Name Input variable Output variable Description B sensors SEN_LIGHT a SEN_LIGHT_P Reads light sensor values SEN _ BATTERY SEN_BATTERY_P Returns the battery level Je SENSTEMPERATURE SE ee SEN_MIC_ANALOG Detects sound intensity eG SS Le E E or not SEN_SPEAKER SEN_SPEAKER_FREQ Emits tones in a 7 SEN_SPEAKER_ TIME frequency between 250 SEN_SPEAKER_ ON_OFF Hz and 65 KHz Te SEN_STATUS 7 7 SEN_STATUS obstacles 7 E 7 SEN_STATUS acceleration of mOway SEN ACCE CHE
101. unction Table 36 SPI configuration PIN RF PIN PIC RF_CONFIG Input variables RF DIR Device address Must be a value of between 0x01 and OxFE RF CHN Channel to be used in the communication Must be a value of between 0x00 and 0x7F 128 channels Output variables FLAGS CONFIGOK This function configures the transceptor enabling its own watch address and the broadcast address In trun it configures other parameters such as the PIC pins the channel the transmission speed the emitting power the address length the CRC code length etc Table 37 RF pin configuration PIN RF PIN PIC RF2 The channel must be common to all the modules that are going to take part in the communication Users can choose any channel from among the 128 available Nevertheless if there 1s more than one communication in the environment between modules in different channels a spacing of 2 must be left between the channels to be used in order to avoid interferences thus leaving 32 channels usable Another question www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 65 of 137 to be taken into account is the existence of other technologies that use the ISM 2 4GHz band Wi Fi Bluetooth etc and that might also cause interference in one of the channels Channel Channel 0x01 0x04 2 4Ghz 2 401Ghz 2 402Ghz 2 403Ghz 2 404Ghz 2 405Ghz 2 525Ghz Image 43 RF channels The address assigned
102. v No Obstacle v Properties Configuration Select 4 property type Chec k obstacles i Configuration Left central obstacle Right central obstacle No Obstacle v No Obstacle v Left side obstacle Right side obstacle No Obstacle I Yes Obstacle v Image 65 Check obstacles configuration 7 Condition modules have a true output and false output If the condition is true obstacle detected the corresponding LED lights up otherwise it remains off 8 Test the program and check that the front LEDs light up when an obstacle is detected www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 107 of 137 Image 66 First mOwayGUI program obstacle detection www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 108 of 137 9 We add movement to the robot straight on indefinitely until an obstacle is found 10 When an obstacle is found a command is sent to the robot to rotate 180 The robot will continue to move in a straight line when the rotation is completed Properts Lh Progeertioe st ond igur ation Rotate mode Center Torry Waa Fomei 4 Lett ki C Erbie and chacking ditarse I Enable end checking time F Ensbis ond checking angle p i rei ed agreia t ka DaF an fl laa fie so Ai aon y A Wek uri the erd ol the command Ce Image 67 Movement and Rotation configuration www moway robot com Title mOway Use
103. ve Example Curve forward to the right at 50 with a radius of 10 during 10 seconds 100ms x 100 VEL_I 60 gt VEL_D 40 www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 59 of 137 Curve forward to the left at 80 with a radius 15 during 100mm 1mm x 100 sVEL_I 95 gt VEL_D 65 MOT CHECK END Function that waits until the movement command finishes Example Wait the end of the command MOT_STOP Output variables FLAGS MOT_STATUS COMOK _ S O FLAGS MOT_STATUS COMOK A command to stop the robot Example Stop the mOway MOT_RST MOT_RST_COM The parameter that needs to be reset RST_T RST_DIST RST_KM Output variables FLAGS MOT_STATUS COMOK www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 60 of 137 Resets the motor s internal time distance and speedometer temporary variables Example Reset elapsed time Reset distance traveled MOT_FDBCK STATUS_COM The parameter we want to look up STATUS_T STATUS_A STATUS_V_R STATUS_V_L STATUS_D_R STATUS_D_L STATUS_KM Output variables MOT_STATUS_DATA_0 First response byte time angle speed distance and first speedometer byte MOT_STATUS_DATA_1 Second response byte second speedometer byte FLAGS MOT_STATUS COMOK and DWRONG Command to recall different drive system parameters We can look up elapsed time angle only through the MOT_ROT command speed of each
104. w of the fact that all the functions use the SPI protocol it is necessary to enable the microcontroller hardware for this purpose To do this just add a few lines of code in the initial configuration of programme 5 3 3 2 Variables www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 62 of 137 RF_STATUS This read only variable reports on the communications situation via the radio module CONFI OFFOK ONOK RCVNW RCVOK SNDOK GOK Bit 7 Unused Bit 6 CONFIGOK Shows whether the module has been configured correctly 1 The module has been configured correctly 0 Module has been de configured Communications with the module impossible due to the absence of or incorrect electrical connection Bit 5 OFFOK Shows whether the module has been switched off correctly 1 The module has been switched off correctly 0 The module has not been switched off correctly Communications with the module impossible due to the absence of or incorrect electrical connection Bit 4 ONOK Shows whether the module has been switched on correctly 1 The module has been switched on correctly 0 The module is not active Communications with the module impossible due to the absence of or incorrect electrical connection Bit 3 RCVNW Shows whether there is still data to be read 1 There are data frames to be read in the radio module stack 0 After the last reading the module data stack was empty T
105. with a reading of the ADC battery level can be measured Table 11 PIC Battery level connection Pin PIC www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 19 of 137 Battery level 3 3 10 Front LED The front LED is a white LED placed on the front side of mOway The output of the OSRAM LW A6SG LED is connected to a digital output of the microcontroller Table 12 PIC front LED connections Pin PIC Sensor PORTC R7 O Front LED 3 3 11 Top two color LED This double indicator and the light sensor share the same opening on the top part of the robot They are connected to two microcontroller digital outputs Table 13 PIC Top LED connection Pin PIC Sensor PORTA R4 O Top red LED PORTB RB6 O Top green LED Image 15 Robot with Front LED and red LED switched on 3 3 12 Brake LED The brake LED is double indicator placed on the back side of mOway The output is connected to one digital outputs of the microcontroller gt Please note that since they share the same opening as the light sensor it is fundamental to switch them off when wanting to perform a light intensity reading www moway robot com Title mOway User Manual Rev v2 1 0 June 2010 Page 20 of 137 Table 14 PIC Brake LED connection Pin PIC PORTE PRES Of Brake LED Image 16 Brake LED location Switch on green LED 3 3 13 Free Pad mOway has implemented a free Pad

Download Pdf Manuals

image

Related Search

Related Contents

Amana Deepfreeze Upright Freezers User's Manual  CCP 380 - Protool  Avolites Ltd ART2000 Power Cube  i-TECH CUT40 User Manual  AMPLIFICADOR DE PODER DE 2 CANALES MB-2150  Bedienungsanleitung User manual - eQ-3  

Copyright © All rights reserved.
Failed to retrieve file