Home
User`s Manual
Contents
1. Z Axis g sensor value CED A Y Axis g sensor value EES In case several robots are used in different PCs it is necessary to assign a different channel for each one in order to avoid interferences between them These are the steps to follow 1 Ifthe communication with Scratch has been started press the Disconnect button Program RF channel Connect to channel 0 2 Assign a different channel to each robot in this case the channel 4 is selected Ga RF channel Program Connect to channel 4 Disconnect www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 167 of 175 3 Reprogram the robot by pressing the Program button 4 Once the robot has been programmed disconnect it from the PC and switch the robot on 5 Press the Connect to channel button 10 4 Commands and Sensors The actions available to run from the Scratch environment are displayed below as well as the variables for each action The command sending to mOway is done by using the control broadcast block broadcast rotate lett For example the message rotate left would make a left rotation Action Description Used variables mOway goes straight forward indefinitely with a speed of 50 mOway goes straight backward indefinitely with a back speed of 50 EA el E Fight mOwvay tums 90 degrees right turnaround mOway tuns road sop may stops
2. 2 Not sent The information has not been sent www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 114 of 175 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 Data sending routine Data sent and ACK received Data sent and ACK not received Data not sent l 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 O 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 t
3. Configure SPI modules of the PIC RF_CONFIG_SPIO Configure RF module channel and address if RF_CONFIG 0x40 0x01 0 Module not configured j Activate the RF module www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 116 of 175 if RF_ONQ 0 Module not initialised J 6 3 3 3 Flow diagram for sending and receiving data Ext interrupt Define RF_DIR gt RF_RECEIVE Define RF_DATA RF_SEND 1 0 0 lt n 2 T Process data Process data Send ok y AKC Send ok y AKC no No send y AKC received received received Diagram 5 Reception Diagram 4 Data send in C interruption in C www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 117 of 175 gt RF_RECEIVE Return 1 0 2 Process data Process data Out reception service Diagram 6 Reception in C www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 118 of 175 6 3 4 mOway Camera Board library in C18 6 3 4 1 Description This library allows controlling camera module 6 3 4 2 Functions This library includes functions to manage camera module A brief description of each one of these functions is given below Return Description void CAM_CONFIG void Configures microcontroller a SPI in
4. while iii Check Center Left Obstacle sensor if SEN OBS DIG OBS CENTER L LED FRONT OON else LED FRONT OFF Image 61 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 is 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 forward www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 93 of 175 ii ERASE NAAA Aa eae a ee ee A void mairi r 1 ff ReREEEASEASEN SOR CONFIGURATION t FERRERA SEN_CONFIG ESRRARRRARA AAA ENGINE CONFIGURATION e eaeeaae yf MOT CONFIG Green LED blink LED TOP GREEN ON OFF f traight on MOT STR 50 FWD TIME 0 while 1i Check Center Left Obstacle sensor if SEN OBS DIG OBS CENTER Lj LED FRONT ON Rotation MOT ROT 20 FWD CENTER LEFT ANGLE 50 while MOT END Straiqht on MOT STR 50 FWD TIME O h else LED FRONT OFF Image 62 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 Descript
5. 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 is 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 END_COMAND line Ja 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 v3 1 2 April 2013 Page 13 of 175 Speaker Microphone Accelerometer Battery level PIC 18f86j50 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 v3 1 2 April 2013 Page 14 of 175 3 3 1 Line sensors The line tracking sensors are two reflection optocouplers mounted on
6. Each sensor can perform one of the following conditions o black line detection o white line detection o detection inactive In addition it makes it possible to check the AND or OR boolean operation If AND option is checked all the conditions must be true to get a true output On the other hand if OR is checked just one of all the condition has to be true to get a true output Sensors Line Detection Configure mOways two line detection sensors and connect them with and or operator to set the condition for a true and false output Need help Commands for mOway Left Line Sensor Right Line Sensor Black Line i White Line an AND OR Output TRUE Ifa black line is detected on the right side FALSE Otherwise Y Save Cancel Image 91 Sensors Check Line configuration window e Noise This module has a true output if mOway detects a loud sound It has not any configuration window e Tap This module has a true output if mOway detects a tap or a high acceleration It has not any configuration window www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 136 of 175 7 3 3 Data This group of modules make it possible to read write and modify data that mOway robot can provide from sensors and internal memory Data is stored in user defined variables A variable is created by clicking on Variable on the toolbar a
7. Emitter data field simulates the data sending to the robot mOway data field shows the data sent by the simulated robot Simulation gt ib fz Communications Emitter data Emitter Address 2 Channel 0 o o o o o o o o Send Transmitter Data 7 Data0 e Registers it shows a list of the variables created in the program with its values at all times Simulation gt i Il a E Registers Name Value sensorValuel 0 sensorValuez2 13 www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 160 of 175 9 3 Simulation example The following example shows the simulation of a program in which the robot moves straight for 12cm and then lights the front LED Pressing the button Animate or Step In a yellow arrow indicates where the simulator is in the diagram Flowchart Simulation gt 1 5 z Movement Lights and Sound mOway movements Travelled Distance 0 0 cm While the simulator executes the block Straight it indicates the direction of the rotation of the wheels and the travelled distance 1s increased y E Simulation Simulation Gs ez gt Db I S Cz gt ib Movement Lights and Sound Movement Lights and Sound a Pees mOway movements a A a oe As LED zZ z a ee Travelled Distance 12 0cm Sound af www moway robot com
8. ga Communicate Start In this module you can configure communication parameters Commands for mOway Mowayld h 5 Communication Chanel Image 94 Communicate Start configuration window www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 142 of 175 e Communicate Stop This module stops the RF communication It has not any configuration window e Communicate Send This module makes it possible to transmit a frame to a specific address The address of the receptor and the data which can consists of constants or variables must be indicated in the frame If the sent data has been received by the receptor the output is true Otherwise the output is false Before using this conditional the RF communication must be configured using the Communicate Start module All the robots taking part in the RF communication must have the same channel and different addresses Communicate Send message In this module you can tell moway to send a message to another Moway Need help Moway receptor Direction h B 0 255 Constant Value 0 255 Varos E 0 255 Constant Val 0 255 ConstantValue F 0 l 0255 A p E oy Image 95 Communicate Send configuration window www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 143 of 175 e Communicate Receive This module makes it possible to receive a frame from a specific
9. 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 v3 1 2 April 2013 Page 9 of 175 3 Robot mOway This chapter describes each of the parts that constitute the mOway It is important to highlight that it is 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 or output others need an analog input or output and others instead are controlled by one of
10. www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 75 of 175 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 is 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 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 50 RF channels The address assigned 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
11. 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 O lt MOT _ VEL MOT _ RAD lt 100 www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 108 of 175 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 1 mm and with a value of O 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 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 RST_COM The parameter th
12. Line tracking sensors PIC connections Pin PIC Sensor PORTA Right line tracking sensor receiver Left line tracking receiver RDI O Left and right line tracking sensors transmitter www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 16 of 175 Image 10 Location of line sensors 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 1t 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 7Ous 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 1t by means of the ADC or as a digital input The digital distance range 1s close to 3cm and a bright environment 1s recommended to enhance infrared light reflection iE Fad a n 8 rr e i 1 Da i O as A a OU te Soo wees lt ss IE A a fi ia ioe eee Image 11 Obstacle detection sensor Table 4 Shock
13. MOT_FDBCK STATUS_T 0 0x7F gt 12 7 seconds elapsed since the last command MOT_FDBCK STATUS_T 1 OxFF gt Invalid data Request of distance traveled by the right motor from the last command e g Output mOway_km 0 0x08 mOway_km 1 0x01 0000 0001 0000 0100 Distance 264 1mm 6 3 3 BZI RF2GH4 library in CIS 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 60 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 www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 111 of 175 unsigned char RF_CONFIG unsigned CHANNEL 1 Correct Configures the inputs and char unsigned char ADDRESS configuration outputs of the d 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 ch
14. Movement by radio control Every time we press one of the arrows on the keyboard Scratch sends a movement command to mOway For example when the up arrow is pressed the command sent is forwards This makes the robot advance forwards If the down arrow is pressed the robot stops Similarly when the right and left arrows are pressed the robot turns 90 to the corresponding side In this case the Scratch robot will show the way the real robot turns To do this the turn 90 degrees blocks are used when Up arrow key pressed when down arrow key pressed broadcast go broadcast stop when right arrow key pressed when left arrow key pressed broadcast right broadcast left turn G 90 degrees STINE 90 EEEE www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 172 of 175 You will see that the Scratch robot copies the movements of the real robot 10 5 2 Radio control LEDs The programme consists of activating the LEDs every time the corresponding key is pressed The up and down arrows control the front and brake LEDs The left and right arrows control the green and red LEDs For example when the up key is pressed the first thing it does is to change the drawing of the robot in which the front LED is on Then the command to turn on the front LED is sent to the real robot Next the command to turn off the brake LED 1s sent N
15. Right 0 Left Bit 0 FWDBACK Forward or backwards 1 Forward 0 Backwards MOT_VEL www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 63 of 175 Desired command speed 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_COM 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 40 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 MOT_T_DIST COMOK straight line DWRONG MOT_CON FWDBACK COMTYPE MOT CHA VEL MOT_VEL MOT_STATUS A command to change the 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 a MOT_CENWHEEL COMOK robot MOT_T_ANG DWRONG www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 64 of 175 MOT_CON FWDBACK COMTYPE noon pease MOT CUR e MOT STATUS A command to execu
16. Title mOway User Manual Rev v3 1 2 April 2013 Page 161 of 175 Once the block Straight has finished the robot would travel 12cm the simulator executes the block Lights and the front LED lights This done the simulator ends Simulation gt I gt mM c p Travelled Distance www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 162 of 175 10 mOway Scratch 10 1 Introduction Now mOway 1s also compatible with Scratch The communication between Scratch and mOway is bidirectional Scratch receives the mOway detectors value and at the same time mOway receives Scratch commands This functionality uses Scratch sockets connection to obtain data from remote sensors and uses send to all commands for sending orders to mOway In this case mOway Scratch application works as data gateway between Scratch and mOway Ss Scratch MowayW orld Robot mOway The connection between mOway and Scratch is done by the mOway RF modules and the RFUSB module connected to the computer Therefore it is necessary having the RE module placed in the mOway expansion slot and the RFUSB module connected to a computer USB port 10 2 Functioning The mOway Scratch communication 1s activated by opening mOway Scratch application mOway Scratch eE xX Language Program RF channel Connect to channel O Disconnect MS Disconnected www moway robot c
17. address It must be indicated at least two variables one for collecting the transmitter address and the other for the data If the data sent by the transmitter has been received correctly the output 1s true Otherwise the output is false Before using this conditional the RF communication must be configured using the Communicate Start module All the robots taking part in the RF communication must have the same channel and different addresses G Communicate Receive a message In this module you can tell Moway to reveice a message from another Moway Need help Commands for mOway VarabTeer E Sender direction VarnRxed1 Data 0 WariRxed2 Data 1 No Variable Data 2 ariable Data 3 No Variable Data 4 No Variable Datad No Variable M Data 6 No Variable Data 7 Image 96 Communicate Receive configuration window www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 144 of 175 7 4 Variables For more flexible programs some modules make it possible to use variables Variables makes possible to save values into robot internal memory A variable contains a value that can change during the execution of the program This is useful to read the values of the mOway s internal sensors for example speed value pause time read analog obstacle sensor values etc Then the
18. pausing for a second in each block The block that is running the simulator at each time is indicated by a yellow arrow Pause Stops the simulation at the current block Reset Pressing the reset button the simulation returns to the initial state 1 e the beginning of the program Also resets the value of the variables Step In In this mode the simulator moves through the program step by step stopping at each block It also moves through the functions created by the user Step Over In this mode the simulator moves through the program step by step stopping at each block Unlike the previous mode the simulator does not advance into the user functions 9 2 Functioning In the simulator the user can vary the mOway sensors value and see how this affects the operation of the robot depending on the program it s being simulated The sections of the robot that can be viewed and controlled in the simulation are the following Movement lights and sound shows the state of the motors the state of the LEDs and the mOway speaker o The rotation of the wheels is indicated by red arrows It also reflects the distance travelled by the robot o The sound emitted by the robot is indicated by the speaker icon When it is green it simulates that mOway beeps When it is red it simulates that the sound has stopped www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 157 of 175 Simulation gt i to
19. AC characteristics Parameter Min Typical Max Units Frequency 11 2412 2484 mA Average output power gt 0 B Average power variation 0 5 05 dB____ www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 33 of 175 4 First Steps 4 1 mOway Pack installation In mOwayPack available in the webpage www moway robot com or in the installation CD you will find the software mOway s libraries test programs and documentation 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 e MowayWorld 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 C and MowayWorld o Example projects to start working with mOway easily e RFUSB Driver o Driver for RFUSB that establishes the communication between robots and PC e mOway Camera Board Driver o Driver for mOway Camera Board that makes it possible to grab images from mOway camera to display on PC If a security warning message appears during installation please click on install driver anyway MowayWorld software 1s safe 14 Module not available in all kits 15 Module not available in all kits www moway ro
20. B At first sight the last of these commands does not seem to be necessary but it is useful if we have pressed the down arrow beforehand and the brake LED was on In this way we ensure that every time we press the up and down arrows only one LED is left on when up arrow key pressed when down arrow key pressed switch to costume moway frontal switch to costume moway freno broadcast frontled on broadcast brakeled off when right arrow key pressed switch to costume moway verde broadcast areenled on broadcast redled off when space key pressed switch to costume moway broadcast leds off broadcast brakeled on broadcast frontled off when left arrow key pressed switch to costume moway rojo broadcast redied on broadcast greenled off www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 173 of 175 The part of the programme that controls the red and green LEDs is very similar to the one explained above Lastly when pressing the space key the robot drawing returns to what it was like initially and all the robot s LEDs turn off 10 5 3 Follow the line In this exercise we are going to practise the mOway followline left and followline right commands To do this we will need to use a track on which we will paint a black line on a white background A number of other tracks can be downloaded from the Club mOway section at http moway
21. CIS reset distance To reset the total distance counter motors mOway goes straight at a certain speed for the ae distance distance or time time If time and go straight ae A distance distance are same than zero mOway will move r indefinitely ams speed mOway goes back straight It s behaviour is identical to go straight but in the opposite way distance back straight time www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 168 of 175 mOway moves in a curve to the left of a certain BEER o left radius at a certain speed for the distance distance radius E or the time time If time and distance are distance same than zero mOway will move indefinitely une speed ethan mOway moves in a curve to the right Identical but radius BOs in the opposite direction of go left distance time speed mOway goes back in a curve to the left Identical radius back left to P i i go left but going backwards distance time speed eel ecard mOway goes back in a curve to the right Identical radius E but in the opposite direction back left distance time mOway rotates at a certain speed in a certain angle speed rotate left to the left on its axis or on a wheel If the angle rotation rotation is same than zero it rotates indefinitely o ania speed mOway rotates to the right Identical but in the opposite direction rotat
22. Image 2 Drive system electronic and mechanical The servo motor group includes different features _ 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 General speedometer counts distances traveled since the initial command 5 Angle control controls the angle when the mOway rotates 1a 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 surface www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 12 of 175 PIC16F687 A U
23. PORTB RBS 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 The output is directly connect to an analog input of the microcontroller so that it is 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 1s measuring changes in a capacitor Capacitors can work as sensors or as actuators In the case of mOway it is 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 RD7 www moway robot com Title mOway Use
24. The data is incorrect 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 www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 107 of 175 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 1s produced on one of the wheels more resolution is obtained On the other hand mechanical inertia must also be considered therefore to achieve greater precision it is advisable to reduce the speed Equation 4 MOT_T_ANG when rotating on its center MOT _T _ ANG round MELIA Example Rotation in relation to the center to the right at 80 speed for 10 seconds A00ms 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 iunsigned char RL junsigned char COMTYPE unsigned char MOT_T_DIST MOTVEL_________ Desiredsped______0 50 _ MOT_RAD Radius 00 MOT_T_DIST Time value 255 O PREPA PES Function Return The command has been sent correctly 1 Incorrect dispatch The command has not been sent Connection problem 2 Incorrect data The data is incorrect
25. This will be our source file Guardar como picos O pm h lib_mot_moway h h lib_sen_moway h Tipo All Source Files fc A asm asine 5 bas Jump to C Documents and Settings Julen Escritorio Encoding ANSI w Add File To Project Image 57 C creation www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 89 of 175 10 Finally the source file is 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 mOway_first_project MPLAB IDE v8 40 File Edit View Project Debugger Programmer Tools Configure Window Help Dae h tmeae SAGAN Checksum Oxfadb Debu Vics tae Ss E EN C main c E mOway_first_project mcp E Source Files main c E Header Files lib_mot_moway h lib_sen_moway h E object Files A Library Files 3 Linker Script B Moway_lkr lkr E Other Files Files Image 58 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 v3 1 2 April 2013 Page 90 of 175 finclude pl8f86350 h r Hovay microcont
26. a value from 1 to 4 BYTES COMMAND_CAM COM_WR ADDRESS_CAM IODIR_ADD DATA_CAM Channel 1 OxD8 Channel 2 0xD4 Channel 3 OxCC Channel 4 O0xDC www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 84 of 175 Camera activation example Camera configuration Channel 1 selection Camera activation CAM_SPI_WRITE This functions first sends one byte to SPI port of the microcontroller which sends it out Then it reads the SPI port in case it is needed This library only needs to send SPI commands Input variables BYTE_OUT Byte to send to SPI Output variables BYTE_IN Byte read from SPI www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 85 of 175 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 is larger than with assembly language To summarize Very interesting 1f you wish to start working with mOway quickly Very interesting to carry out eas
27. but in environments with a great deal of traffic collisions increase exponentially causing considerable increases in sending times Example RF_RECEIVE_INT Output variables RF _DIR_IN Address of the person who has sent the frame RF DATA IN _ 0 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 1t 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 transmitters to resend if the send flag is not activated Example Data reception routine with interruption Process data www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 79 of 175 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 Example Configuration with interruption and activation routine Enable interrupti
28. 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 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 Image 47 Command format MOT_CUR MOT_ROT Image 48 Command format MOT _STOP MOT_RST Image 49 Command format MOT_FDBCK www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 62 of 175 5 3 2 2 Variables MOT_STATUS A register that shows the command s status ca al elo sl el alo 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 AAA A ee eee eee eee Bit 7 3 Unused Bit 2 COMTYPE Type of command 1 Time 0 Distance or angle in MOT_ROT Bit 1 RL Right or Left 1
29. e Click on one of these marks e Click on one of the next module mark a al Image 74 Arrow drawing Connector tool makes easier to draw arrows It is located on Toolbar For selecting diagram elements it is necessary to change to the default Cursor tool Image 75 Cursor tool and Connector tool icons All the modules of the diagram must have at least one input arrow In addition they must have one output arrow two output arrows in case it is a conditional module The conditional modules oval shaped have two outputs depending on the condition If the condition is true the program will flow through true path arrow with a green mark If the condition is false the program will flow through false path arrow with a red cross www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 125 of 175 In order to describe a loop the procedure is similar but in this case the arrow starts on a module mark and finishes on another mark of the same block Image 76 Arrow drawing for a loop The arrow track can be modified dragging the marks that appear when the cursor is over the arrow Image 77 Modifying arrow track 7 1 7 Language change and updates The language of MowayWorld can be changed from toolbar Language tab It is also possible to check if MowayWorld needs to be updated in Help Check for updates www moway robot com Title mOway User Man
30. in watch mode in order to be able to receive data and or send data www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 113 of 175 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 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
31. m cS tz Movement Lights and Sound e Line and obstacles sensors simulates the change of the value of the line and obstacles sensors The value of the simulator sensors is defined by the analog value of the real sensors of the robot Therefore the value of the simulated sensor are the following Simulation gt 1 mM Ss E 0 to 20 Line and Obstacle Sensors Line Sensors Grey 21 to 229 _eft Sensor Right Sensor White 0 20 Grey 21 229 Black 230 255 Obstacle Sensors Central Sensor Central Sensor Ob 1 0 19 3ide Sensor Side Sensor stacle not to 127 127 E pf TON Obstacle 128 to 255 detected www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 158 of 175 e Environment it simulates the variation of the light and temperature sensors and the microphone CECI CS 0 100 A a e Accelerometer it simulates the variation of the accelerometer value in its 3 axis The value of the accelerometer in each axis varies between 2g and 2g being g the acceleration of gravity 9 81m s For example if we simulate that mOway is on an even surface the values are the following gt i i m E acceteromater Y www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 159 of 175 e Communications it simulates the transmitting of RF data to the mOway robot and also the receiving data sent by the robot
32. robot com oy In order to familiarise ourselves with the followline commands the proposed exercise 1s a simple radio control which gradually changes from a followline left command to a followline right command using the direction keys The space key stops the mOway and the back arrow sends a turnaround command www moway robot com when left arrow key pressed AT 70 ere 40 broadcast linefollow left when down arrow key pressed broadcast turnaround In this scenario the representation of mOway moves to the left side or right side of the line with the command change Title mOway User Manual Rev v3 1 2 April 2013 Page 174 of 175 when right arrow key pressed mee 70 Bie 40 broadcast linefollow right key pressed broadcast stop followline left followline right www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 175 of 175 www moway robot com
33. tablets or PCs The Wifi Module allows to develop applications such as a web server embedded into the mOway robot This server makes it possible to control the robot through user wifi devices as well as to receive mOway sensor status in these devices RF24WBOMA DER 104128 Hy MAC OOLECOD2ZTCAS PY ee Sa Fa S Image 25 Moway Wifi Module and adapter This module is based on MRF24WBOMB IC of Microchip This IC is a 2 4 GHz RF transceiver designed under IEEE 801 11b standard mOway Wifi Module includes all the necessary elements to use this IC so that the user does not have to design any additional circuitry 3 8 1 Connection to the robot In order to attach the Wifi Module to mOway robot is necessary to connect the adapter to the expansion connector of the robot Then the Wifi Module can be attached to one of the two ports of the adapter Image 26 mOway Wifi Module and adapter www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 30 of 175 3 8 2 Software The Wifi Module is managed by means of the TCP IP stack developed by Microchip It provides with all the required functions to implement a TCP IP communication for the Wifi Module as well as functions to control the module through SPI In order to understand how the TCP IP stack works an MPLAB project can be downloaded from mOway web page This example consists of a web server embedded into the robot The code is written in
34. that are configured as outputs WARNING Set Output values only can be assigned for pins configured as outputs leaving other lines with No change value If a value is assigned to an input this may damage the robot irreversibly 3 IO Module Set Output In this module you can set on off or toggle expansion output ports Settings a 1 a 2 y a 3 A PEE 4 E PE 5 Value mem 6 Image 93 Module IO Set Output configuration window www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 141 of 175 e Module IO Check Input This module checks the digital value of one of the 6 pins of the expansion connector It compares if the value of the selected pin is equal or different lt gt to on 1 or off 0 e Camera Play This module activates the mOway camera One of the four channels has to be selected This channel must be the same of the Moway Camera Board video receptor e Camera Stop This module turns the camera off e Communicate Start This module configures the robot in order to establish a radiofrequency RF communication An identification for the robot and a communication channel must be selected For establishing communication between two mOways they must be configured with the same channel and an unique address for each one If the configurations 1s correct the output is true Otherwise the output is false
35. 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 v3 1 2 April 2013 Page 103 of 175 6 3 2 mOway s motor library C18 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 Image 64 Command format MOT_ Image 65 Command format MOT_CUR MOT_ROT Image 66 Command format MOT _STOP MOT_RST image 67 Command format MOT_FDBCK www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 104 of 175 6 3 2 2 Functions A series of functions designed to control mOway s drive system are included in the lib_mot_moway library Table 57 Summary of functions in C for lib_mot_moway Name Input Return Description void MOT_CONFIG void Configuration to communicate with the motors unsigned char MOT_STR unsigned char unsigned ch
36. 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 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 v3 1 2 April 2013 Page 51 of 175 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 eac
37. 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 1s produced on one of the wheels more resolution is obtained On the other hand mechanical inertia has to be considered therefore it is advisable to reduce the speed to achieve greater precision Equation 1 MOT_T_ANG when rotating on its center MOT _T_ANG round PELEA 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 v3 1 2 April 2013 Page 68 of 175 MOT_CUR MOT_VEL Desiredspeed TO 100 MOT_RAD Radius JO to MOT_CON COMTYPE Type of command 1 TIME 0 DIST MOT_T_DIST Time value 253 Distance value 255 Output variables 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
38. 0 1 to 25 5 O finish time distance limit before continuing with the next action in flowchart Y Save Image 86 Movement Turn configuration window www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 132 of 175 e Movement Rotate With this command mOway will rotate either on its centre or on one of its two wheels Turning direction and rotation speed can be defined Movement Module Rotate in this Movement Module you can let mOway rotate around its own axis rotate center or around one wheel rotate wheel Need help Commands for mOway Rotate Speed Constant Speed 50 ox 100 Rotation Mode 9 Rotate about the center of Moway right CW O Rotate on a Moway wheel right wheel forward v Flowchart Control commands run 3 continiously until next movement module in flowchart for Constant Time gt 0 1 seconds 0 1 to 25 5 for Constant Angle A 3 6 degrees 3 6 to 360 O finish time angle limit before continuing with the next action in flowchart Image 87 Movement Rotate configuration window e Movement Stop This command stops mOway s motors e Sound Play This function makes mOway to emit tones from 244 Hz to 16 KHz It is possible to define the time that the speaker will be activated www moway robot com Title mOway
39. 000 goto IN IT Program memory org Oxid SA BA LIBRARY FERRERA RE RARA RAE RARA PPP Pa aa include lih sen movay inc RETRATAR AAA RARA RARA e RARA ARA AAA RARA AAA AAA ARA RARA NARRAN NANA INIT Microcontroller configuration to use the sensors call BEN CONFIG Green LED blink Call LED TOP GREEN ON OFF LSTA PTS a a a PA TA PROGRAM TTT TTT TTT TTT a as PLA TM Check central left obstacle sensor mov Liv OBS CENTER L mov rt SEN CHECK OBS call SEN OBS DIG 1f a obstacle is detected robot avoids it btisc SEN 055 0 call LED FRONT ON btfss SEN OBS3 D call LED FRONT OFF goto MAIN goto Mi TIM SOW Wooo eo a ot Image 42 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 1s 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 v3 1 2 April 2013 Page 46 of 175 list p 16F66750 PIC register definition include P18F86350 INC Reset vector ora ax1000 goto INIT Program memory ora Ox1021 ENEE AAA AAA MONA LIBRARY FERRERA RARE RARA RARA AAA AAA ARA ERA RARA AA AAA include lib sen moway inc include lib mot moway ino sow rW WWW WWW aa aa RRA RARA RARA RA RARA RARA RA ra RAR NANA RARA RARA RARA AAA RARA INIT Microcontroller configuration to use the Sensors ca
40. 1 MOT_RAD QO 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 O 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 curve Example Curve forward to the right at 50 with a radius of 10 during 10 seconds 100ms x 100 gt VEL_I 60 gt VEL_D 40 www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 69 of 175 movwt MOT RAD bsf MOT_CON FWDBACK bsf MOT_CON COMTYPE bsf MOT_CON RL call MOT_CUR Curve forward to the left at 80 with a radius 15 during 100mm 1mm x 100 VEL_I 95 VEL_D 65 movlw 80 movwt MOT_VEL movlw 100 movwt MOT_T_DIST_ANG movlw 15 movwt MOT RAD bcf MOT_ CON FWDBACK bcf MOT_CON COMTYPE bef MOT_CON RL call MOT_CUR MOT_CHECK_END Function that waits until the movement command finishes Example Wait the end of the command call MOT_CHECK_END MOT_STOP Output variables FLAGS MOT_STATUS COMOK A command to stop the robot Example Stop the mOway call MOT_STOP MOT_RST www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 70 of 175 MOT_RST_COM The parameter that needs to be reset RST_T RST_DIST RST_KM Output variables FLAGS MOT_STATUS
41. A RARA RARA ARANA RARA AAA AAA RARA Image 44 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 that one of them can relocate the code and the variables using the MPLAB IDE projects www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 48 of 175 It is 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 lA 4 2 2 f 7 3 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 sh
42. Both Camera Module and video receptor must have selected the same channel www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 27 of 175 Image 23 Channel selector Video receptor is connected to a USB port of the PC First time it is connected a message for installing drivers can appear In this case select the option of installing software automatically NOTE While video receptor is receiving images the casing heats up This is a normal functioning 3 7 1 Technical specifications Table 19 Maximum Ratings Parameter Oo ys o O TO A o Curent dS mA _ Powerdissipation 70 mw Table 20 mOway Camera Board specifications Minimum supply voltage Maximum supply voltage Current in Power Down mode Maximum frequency of the SPI bus 40 a 85 www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 28 of 175 Table 21 mOway Camera Board pinout AI A 4 Chip Select of the SPI SPI bus clock Data input to the RF module of the SPI bus MOSI Data output from the RF module of the SPI bus MOSJI Output interruption E i E i Sos H PES TN ar cal Image 24 Module layout www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 29 of 175 3 8 Wifi Module Moway Wifi Module allows the robot to create a wireless net So that the robot can communicate with other Wifi devices such as phones
43. C The mOway web server IP can be adapted in TCPIPConfig MRF24WB0M b file In addition the mOway Web Server can be programmed directly from the MowayWorld software 3 8 3 SPI communication Communication between mOway and Wifi Module is done through SPI 4 line SPI with interrupts The SPI clock frequency is up to 25 MHz The slave SPI interface works with the Interrupt line INT pin 8 When data 1s available for mOway during operation the INT line is asserted logic low by the MRF24WBOMB module The INT line is de asserted logic high by the MRF24WBOMB after the data is transferred to mOway Data is clocked in on the first rising edge of the clock after Chip Select CS pin 4 is asserted Data is placed on the bus with most significant bit MSb first The CS pin must be toggled with transfer blocks and cannot be held low permanently The falling edge of CS 1s used to indicate the start of a transfer The rising edge of CS is used to indicate the completion of a transfer Table 22 Wifi Module pinout Name Function RESET www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 31 of 175 3 8 4 Technical characteristics MRF24WBOMB IC is compatible with IEEE 802 11b g n It supports the 802 1x 802 11 security e WEP e WPA PSK e WPA 2 PSK It has the radio regulation certification United States FCC Canada IC Europe ETSD and Japan ARIB The transmission speed can be chos
44. COMOK 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 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_0 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 www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 71 of 175 Table 42 Parameter resolution Example Recall time elapsed since the last command AMAMTTTAQ mMm MAW vv A IS IOV VV Y fFAALUS 1 A C RARAS NT CTATTTO ALANNA mMIO
45. E 48 IA NE a E ree 48 www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 4 of 175 Ioko RAUNT ONS oia 51 5 3 2 mOway s motor library in assembly language ooooooncnnnncncnnnonononnnnnnnnnnos 60 Poedle Ds AAA nn A eee aeeadseeseanes 61 Dl VDE doc 62 A E A e E 63 5 3 3 BZI RF2GH4 library in assembly language occccccoononncccnnnncnonononinnnnnnnnnnnos 71 e os A UN In A 71 o WALA DCS A A o A A 12 o eMC CLOUDS eo 73 5 3 3 4 Flow diagram for sending and receiving data oooooonnnnnnnnncncnnnnnonnnnnnnnnoss 79 5 3 4 mOway Camera Board library in assembly language occccccconnnnnncnnnnnnonos 81 Ly IESO dioss 81 a NA crono 81 E O E sed doncesesttuntned cuaenattoneuelaeeesestaandredecussnenaanes 82 Programming mOway with C18 Compiler ooooonnnnnnnccnnnonnnonnnnnnnnnnonnnnnnnnnnnnnnnos 85 Ai PROJ EC IA 85 0 2 ESE RO Sa Wl CS pirado 89 A A 93 6 3 1 mOway s sensors library in C18 oocccccccnnnonnnnnnnnnnnnnnnnnononnnnnnnnnnnnnnnnonnnnnnnnnoss 93 dl DeeP aora ino 93 A A E o A eee eee 94 63 2 MO way s motor ibrary iS ascii site dario 103 A A E E E AEE 103 Co TOO a E E S 104 633 BAIR ZG i Orar mE lS ien 110 AM SS 110 o A A A e OE oi A 110 6 3 3 3 Flow diagram for sending and receiving data ooooonnncnnncncnonnninnnnnnnnnnnos 116 6 3 4 mOway Camera Board library in C18 oooonnnnnnnccncnnnnnocnnnnnnnnnnnnnnonnnnnnnnnoss 118 Oy ee mmm DEPO 0 suerte ll
46. L 9 A ANU MA 77 R E S USER MANUAL bi Title mOway User Manual Rev v3 1 2 April 2013 Page 2 of 175 Copyright c 2013 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 Title mOway User Manual Rev v3 1 2 April 2013 Page 3 of 175 Index NANO OPPPREOERA REP poco saa seen pee e PE Po E 3 A 0 1 0 2 00 Coser nrc ener nr nen enn COR CR In II A ere 6 De Wh ACIS TNO AA o Un ob gededeolnanes oceaeseess 8 3 PRODOG NO AY ui E 9 IA AMO CC PP 8 E EA 9 A TVS Sy SCC ii ahs saeco pan peso es ene E A 10 33 DEMSOr ANG MGICALOLS BEOU Dies Ea aa 12 Dice LAD C S CMS ONS EOAREPEe OCOU N05 ZII A 14 3 3 2 IS detection Sensors A 16 de MA SOUS O S 17 See Expansion CONS crol entorn arini Nii 17 Sad Topea O O ae E leiste 18 O a E E E E cosereasucnetons 19 Ide IV CTOPINONG essre EEE E E E 19 do AO E e E E 19 ra A E 20 3 3 10 A A OOO o II AA 20 3 3 11 Top wo color LED coo 20 3312 A A E o e E 21 3 3 13 Peo Pa PRE e OE O een yon cae anaceesese 2l IA EOWEL SOY gt ISI eaaa E 22 3 5 RF module and RFUSB sicssescsicacdecoestesaasncan
47. 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 v3 1 2 April 2013 Page 96 of 175 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 value 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 temp
48. LOG 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 7 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 56 SEN CHECK LINE allowed values void LED_BRAKE ON void 21 Due to tolerance two different sensors can differ from each other www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 102 of 175 Function to switches on the brake LED void LED FRONT ON void Function to switches on the front LED 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
49. O PC Lo 0110 0 S nee E A E S 162 O AA E E E coe a ecestanasebes 163 10 4 Commands a d SENSOLS session ostia 167 O O A 171 10 5 1 Movement By tado COMMON sia 171 10 5 2 Radio control LEDS oooccnccnnccnnccniocnnoconoconocnnocnnronoconoconoconccnaroniconoconos 172 10 5 3 Follow the line ocooccnocnnocnnccnnccnoconoconoconoconccnronoconoconoconocnnccnaroniconoconos 173 www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 6 of 175 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 1s needed to start this revolution People also need to be ready and prepared to identify in what fields microrobotics may
50. S_CENTER_L OBS_CENTER_R OBS_SIDE_R pc a icles LINE_L aa E LINE_L void LED_FRONT_ON oid pp gt Poboa S voidLED BRAKB ON void ________p gt Brkeifbon Z S void LED_TOP_RED_ON void TopredifDo gt S void LED_TOP_GREEN_ON void Toperenifbon void LED_FRONT _OFF void EED void LED_BRAKE_OFF oid pp gt Brake PED off TOP_ ee e void LED_FRONT_ON_OFF void Front LED lin void LED_BRAKE_ON_OFF void Brake LED in Z void LED_TOP_RED_ON_OFF void Tepe LED blink void LED_TOP_GREEN_ON_OFF void TOP green LED blink void LED_TOP_RED_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 v3 1 2 April 2013 Page 95 of 175 Table 49 PIC sensor connections PORTA RA3 I Side left infrared receiver Left line sensor receiver RAS PORTB RBI RB2 RB3 RB5 RB6 PORTC RC7 PORTD RDI O0 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 0 Brake LED PORTH RH5 RH RH7 PORTJ RJ6 RJ7 First interruption of the accelerometer Second interruption of the accelerometer Speaker Top red LED Top green
51. T and MAIN labels are added to create a loop Next the SEN CONFIG function is called to configure the microcontroller s inputs and outputs 6 Add winking to one of the LEDs 7 Test the program on mOway programming it in MowayWorld and verify that the green LED blinks oe www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 44 of 175 list p 15F56350 PTC register definition include P1isre6 750 INC Reset vector org ax1000 goto INIT zt Program memory org Oxlo2 a CERRAR RAR RRA RRA RRA AR TATA AAAA MOULY LIBRARY tate eat aaa eae eae aaa aa Finclude lib sen moway inc DORR RR Wor ear ee er eo INIT Microcontroller configuration to use the sensors call SEN CONFIG Green LED blink call LED TOP GREEN ON OFF A A PROGRAM TET a a MLIN goto MALIM i a a a a CC Cc CE ENT Image 41 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 v3 1 2 April 2013 Page 45 of 175 list p 16F86750 PIC register definition H include Pi5F56350 INC Reset vector org Ox 1
52. User Manual Rev v3 1 2 April 2013 Page 133 of 175 Sound Module In the Sound Module you can tell mOway to play a tone at a specific frequency Need help Commands for mOway Frequency Constant Frequency z 244 14 herzios 244 14 to 62499 84 Flowchart Control Commands run 3 continiously until next sound module in flowchart for Constant Time 0 1 seconds 0 1to 25 5 O finish time distance limit before continuing with the next action in flowchart Y Save Cancel Image 88 Sound Play configuration window e Sound Stop Stops the speaker sound e Lights This module makes 1t possible to operate on mOway s LED diodes Y ou can turn them on turn them off or make them blink Ed Light Module In the Light Module you can control mOway s four LED lights Switch them on off or let them blink Need help Commands for mOway Front Turn On Top green Let Blink Brake Turn Off Top red No Change Image 89 Lights configuration window www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 134 of 175 7 3 2 Sensors Check This group of modules makes it possible to get the mOway s sensors values These are conditional modules so that they have two different outputs if the condition configured in the module is true the output will be true green mark on the flowchart Other
53. VWA VIA p A N i A PIN OV W VILJ N A N A t JIVI LIIV Y VVI LVENY 3 J AMA N A MY Y J 11 A ALAM TOTANA TA SAY call MOT_FDBCK i rt Y Y Y y be Y vall IVINS 1 JD NK 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 10000 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 www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 72 of 175 In view of the fact that all the functions use the SPI protocol it 1s 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 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 wi
54. _VEL unsigned char FWDBACK unsigned char RL unsigned char COMTYPE unsigned char MOT_T_DIST Input MOT_VEL Desired speed O 100 FWDBACK BACK www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 106 of 175 RL Right or left RIGHT LEFT COMTYPE MOT_T_DIST Time value The command has been sent correctly 1 Incorrect dispatch The command has not been sent Connection problem 2 Incorrect data The data is incorrect 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 O 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 unsigned char MOT_T_ANG MOT_VEL Desiredspeed 100 MOT_T_ANG Time value 255 Angle value 100 Function Return 0 Correct dispatch The command has been sent correctly 1 Incorrect dispatch The command has not been sent Connection problem 2 Incorrect data
55. aken place and if 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 www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 115 of 175 When a frame is received the function output must be checked If the function returns a 1 the RF_RECEIVEQ 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 char data_in 8 char data_in_dir Reception routine with interruption pragma interrupt YourHighPriorityISRCode void Y ourHighPriorityISRCode RF _RECEIVE amp data_in_dir amp data_in 0 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 RE_INT_ENO
56. am access from MowayWorld Once the icon is pressed MowayCam lateral panel appears www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 149 of 175 Device Moway Video cap Mi t gt Play E Stop O Capture Location nee ic Browser Name Capture 1 jpg M Auto Inc Image 106 MowayCam panel This window displays camera images and allows the user to control the video receptor and to save a static image on PC e Click on Refresh button to see all the video devices connected to PC Depending on the driver version Moway video receptor may be named as Moway Videocap STK1160 Grabber or USB2 0 ATV e Click on Play button to start displaying camera images e Click on Stop button to deactivate video receptor Moway Camera Board e Click on Save button to save the current image in the path and name displayed on that fields IMPORTANT Video receptor Moway Camera Board MUST NOT be disconnected from USB port while MowayCam is showing camera images If it is disconnected while showing camera images some computers could restart Click on Stop button or close MowayCam panel before disconnecting it www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 150 of 175 8 3 MowayRC MowayRC is an application to control mOway as if it was a radio control device and to monitor all the robot s sensors This tool which uses RF BZI RF2GH4 modules
57. 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 107 Moway RC Diagram mOway World Edit Window Help Pu DSi nf gt R4 mOway RC Radio Control Settings Movements mOway Enviroment 100 402 402 en Brightness gt E Program mOway a ii TEE T 83 Angle 99C Temperature Batt Change channel 23 020 IN gs bo 2110 Noise Channel 0 mOway Control Speed 7 ights Lig Distance 0 0cm Obstacles O Front Light On O Top Green Light On Left Central Value Right Central Value O Brake Light On O Top Red Light On 0 0 Line Sensors Left Side Value Fa N Right Side Value 0 Hj 0 Left Sensor Value Right Sensor Value 248 A 252 Acceleration te Sound 244 14 Hz 244 14 to 62499 84 gt Start Beep Acceleration in X axis 0 453125G D mera Acceleration in Y axis 0 1875 G Channel 1 5 gt Start Acceleration in Z axis Activation time seconds 5 0 90625 G Image 108 Moway RC Center y www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 151 of 175 You can access the application in Window Moway RC Th
58. ar Toolbar makes it possible to manage the project edit the flowchart create variables program mOway robot change MowayWorld language and many other functions mOway World Edit View Project Functions Variables Simulation MowayRC Language Help Bwe amp 098 Nui O mOway Image 69 Toolbar 7 1 2 Flowchart Editor The Flowchart Editor window is where modules are placed and connected to develop the program When a new project is created this window is empty except for the starting point In flow diagrams there is always a starting point from which the program begins www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 122 of 175 Image 70 Flowchart Editor window 7 1 3 Tools On the left side of the workspace we can find the Tools section Here there are all the modules to control mOway such as movement actions checking sensors communication and so on Modules are grouped by their type of function Actions Sensors Data Flowchart Control and Expansion connector Image 71 Toolbox section A module is inserted by just dragging and dropping it in the flowchart editor This module function can be configured by making double click on it or in the Properties window see next chapter Some modules are grouped by a more specific type Movement Sound This is represented by a little black arrow in the toolbox module types www moway robot com Title mOway User Ma
59. ar 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 MOT_VEL FWDBACK COMTYPE MOT_T_DIST MOT_VEL FWDBACK RL COMTYPE MOT_T_DIST MOT_VEL FWDBACK MOT_CENWHEEL RL COMTYPE MOT_T_ANG MOT_VEL FWDBACK MOT_RAD RL COMTYPE MOT_T_DIST A command to move in a straight line 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 0 Correct dispatch A command to stop the robot 1 Incorrect dispatch unsigned char MOT_RST unsigned char unsigned char MOT_FDBCK void 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 communi
60. ar RF_OFF void 0 Correct Deactivates the radio 7 deactivation frequency module and leaves 1 Incorrect it in low consumption mode deactivation unsigned char RF_SEND unsigned RF_DIR_OUT 0 Sent correctly Sends a data frame 8 Bytes char unsigned char RF_DATA_OUT a to the address indicated unsigned char RF_DIR_IN 0 Single reception Checks whether a reception RF_RECEIVE unsigned char RE _ DATA IN 1 Multiple reception has occurred and if so i 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 61 SPI configuration PIC ports PIN RF PIN PIC SCK RC3 SDI RCS5 SDO RC4 Example Configure SPI modules of the PIC unsigned char RF_CONFIG unsigned char CHANNEL unsigned char ADDRESS 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 Ox7F 128 channels Function Return 1 Correct configuration The module has been configured correctly 0 Incorrect configuration The module is not configured Communications with the module impossible due to the absence of or incorrect electrical connection www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 112 of 175 This function configures the t
61. are is installed www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 37 of 175 Completing the Found New Hardware Wizard The wizard has finished installing the software for e Moway RF USB Click Finish to close the wizard Image 31 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 Connect the robot to the PC through the USB cable Open MowayWorld Open mOway_RF_send project included in the pack Click the Program bottom Discomnect and switch the robot on Configure RFUSB module using Communications window of MowayWorld with channel 0 and address 1 e Check receiving data in MowayWorld www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 38 of 175 Communications RFUSB Config Address 2 Channel 0 o P Start E Stop RFUSB gt Moway Moway Address 1 Oo7ao7yo0707 0707 OF 0 Transmitter Data7 Data0 g time 16h 5 4m 10s 3 8ms A 1 183 0 0 19 60 91 143 136 time 16h 54m 10s 88ms 1 182 0 0 16 60 27 0 0 time 16h 54m 9 310ms8 1 181 0 0 66 249 251 00 Image 32 Communications window 4 5 mOway Videocap drivers installation As with RFUSB device a driver that it s incl
62. at 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 www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 109 of 175 Example Reset elapsed time Reset distance traveled 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 59 Parameter resolution _V_L i Example www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 110 of 175 Recall elapsed time since the last command E g Output
63. 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 1s calculated Value is read Change the mode to tap detection Table 54 SEN_CHECK_ACCE allowed values Value ACCE_CHECK_X ACCE_CHECK_Y l ACCE_CHECK_Z 2 unsigned char SEN_ACCE_CHECK_TAP void Output 1 Tap 2 Tap tap 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 www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 101 of 175 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 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 55 SEN CHECK LINE allowed values unsigned char SEN_LINE_ANA
64. ble 14 PIC Brake LED connection Pin PIC Sensor PORTE RES O Brake LED Image 16 Brake LED location Switch on green LED 3 3 13 Free Pad mOway has implemented a free Pad 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 RJ7 Advanced users only www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 22 of 175 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 Image 17 Charging red and switched on green 3 5 RF mo
65. bot com Title mOway User Manual Rev v3 1 2 April 2013 Page 34 of 175 MENU CD Setup MOWAY CD MENU lO Open CD 44 Image 28 CD menu 4 2 Download a program to mOway Program download process is executed in MowayWorld This application can download to the robot MowayWorld projects assembler projects compiled with MPLAB or gputils and C C18 compiler projects Steps to download a program to mOway e Connect mOway to the PC through USB The robot doesnt need any driver e Open MowayWorld application e Open or create a project in MowayWorld or import a hex file from assembler or C project e Click on Program mOway icon If a hex file has been imported the download progress will start automatically e Disconnect the robot and turn it on mOwayPack provide several compiled projects to check sensors drive system RF communication and camera usage Project to check sensors e ASM_SEN 01 Assembler software to check sensors Obstacle sensors are checked and if an object is detected LEDs and speakers are switched on This project uses absolute lib_sen_moway inc library e 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 www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 35 of 175 e C_ SEN OI C18 soft
66. cate with the Drive System Table 58 Pic drive system connections Pin PIC I Indicates when the motor ends the command SCL of the I2C protocol SDA of the I2C protocol www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 105 of 175 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 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 Input MOT_VEL Desired speed 100 FWDBACK Movement direction BACK COMTYPE Type of command TIME DISTANCE MOT_T_DIST Time value Distance value 255 Function Return 0 Correct dispatch The command has been sent correctly 1 Incorrect dispatch The command has not been sent Connection problem 2 Incorrect data The data is incorrect 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 distance of 1 mm and with a value of 0 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
67. ccaneuseeawsiaesdeacevtasiacsaensesebesioamvinestianed 22 A ie Eo ee MUA E E EEO 24 30 MmOway Camera Module usipetcroo olle oceano 25 dle AMO Wai Camera Board s sestouaccnees c guasshancteecenduadsoracaneeceecouassuascste FETE 26 Se halle Technical specications an 27 Des WVU IVIO GUNG oo ccope sonseene te te cee tence ane ra eeoeecetoesserasnece ceaceosevecdeenecesausenentece ceaceess 29 Sao la COMMCCIION to he TODO essentiae sc ido ip cocamta 29 Iode e cos orcennaceten cay sviauhnatanedeunserauincnstoce 30 SP COMMUNICATION ooooccnnnnnnnnccnnnnnnnnnoconnnnnnnoroconononanoconnnss Error Marcador no definido Technical characteristics ici ets Error Marcador no definido A lod E tatiana 33 4l MOWway Pack 1st Ala con erroneo corola epoca 33 4 2 Download a program to MOWaY ooocccccccccnononocnnnnnnnnnnnnnnannnnnnnnnnnnnnonanonnccnnnnnnnnnnos 34 do A A Dd A EMO QUES carios iia E E 37 4 5 mOway Videocap drivers installatiOD coccccccnnononncnnnnnnnnonononianonncnnnnononnnnns 38 5 Programming MOway in assembler ooooooonnnnccnnncnnnnnnnocnnnnnnnnononnnnncnnnnnnnnnnnnnnos 39 dl CANIN OC e E EEE 39 5 2 First program in assembler ooooonncnncncccnononocnnncnnnnnonononnnnnnnnnnnnnnnnnonnncnnnnnnss 43 Io L a A E E A E E E E A E 47 5 3 1 mOway s sensors library in assembly language ooooonnnnnnncccnononocnnnnnnnnnnss 47 Deeded MCS CMON arse tire oss osteenntectce ose sese danncatceeayiasea E EE
68. ce In order to start RF communication choose an address and a RF channel for the RFUSB 2 and 0 in this example and push Start button Communications RFUSB Config Address 2 Channel O P Start E Stop RFUSB gt Moway Moway Address 1 F opojpojojofofojo E 0 Send Transmitter Data 7 Data0 E time 16h 54m 10s 378ms a 1 183 0 0 19 60 91 143 136 7 time 16h 54m 10s 66ms 1 182 0 0 16 60 22 0 0 time 16h 5 44m 9s 810ms 1 181 0 0 86 249 251 0 0 Image 104 Communications window www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 148 of 175 In order to send a message from PC to mOway select mOway robot address 1 in this example write the data to be sent from Data 7 to Data 0 and press Send button If a 0 1s selected for Moway Address the message will be received by all the robots near the PC When RFUSB receives a message from mOway the communication window displays the time when the message was received and the data The format of the data 1S e Address of transmitter mOway is displayed in brackets e Data arranged from Data 7 to Data 0 8 2 Moway Cam MowayCam application displays the camera images and lets the user to save a static image in a storage device connected to the computer This application can be launched from MowayWorld toolbar View gt mOway Cam or clicking this icon 0 DN x Image 105 MowayC
69. 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 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 0 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 called up once again after processing the data The transceptor has a 3 level stack and therefore if the receive function 1s not called before the stack 1s filled the device will be unable to receive more data www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 78 of 175 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
70. command finishes Table 50 Allowed values for SEN SPEAKER ON OFF Define Define Valor SPEAKER_OFF 0 JO A SPEAKER_ON 1 SPEAKER_TIME Table 51 SEN_SPEAKER_FREO vs PWM frequency PWM frequency SEN_SPEAKER_FREO Hz 0 0000000 5681 8181818 2976 1904762 1524 3902439 1225 4901961 2016 1290323 www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 98 of 175 1024 5901639 60 a 771 6049383 06868131868 o 516 5289256 516 5289256 477 0992366 310 9452736 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 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 output variables Deactivate the infrared diode Check for interfering signals www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 99 of 175 e If there is no signal interferences and the
71. compares one of the wheels speed value Values www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 138 of 175 goes from stopped to 100 maximum speed o Distance compares distance value covered by mOway to a variable Value goes from 0 to 255 centimetres o Angle compares the value of mOway turning angle Value goes from 0 0 degrees to 100 corresponding to 360 degrees o Brightness compares the light sensor value Value goes from O dark to 100 light o Line compares one of the line sensors value to a variable Value goes from 0 white colour detection to 100 black colour detection o Obstacle compares one of the obstacle sensors value to a variable Value goes from 0 no detection to 100 closest detection o Accelerometer compares one of accelerometer axis value Value goes from 2g negative acceleration limit to 2g positive acceleration limit When there is not acceleration the value is 0 NOTE g value is 9 81m s o Noise compares microphone value Value goes from 0 silence to 100 loud noise o Temperature compares the robot temperature value Value goes from 0 C to 255 C o Battery compares battery level Value goes from 0 to 100 www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 139 of 175 7 3 4 Flowchart Control e Pause This module makes it possible to insert a pause in the program with a
72. ctions Varables Window Moway RC e Moway Cam Communications Image 110 Access to Moway Web Server 22 Module not available in all kits www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 153 of 175 The lateral panel appears Web Server 1 Select IP and program 1692543 1 Program web server 2 Conect to the wifi net MowayNet 001 3 Launch web browser Moway web server Image 111 Moway Web Server panel In order to communicate with mOway Web Server it is necessary to follow these Steps 1 Select an IP only the last field can be modified and press Program web server button 2 The robot will establish an adhoc wifi net with the name MowayNet Qe is the selected number for IP in the previous step 3 If the web server will be accessed from PC press Moway web server button to launch web browser with the selected IP If another device is used launch web browser and introduce the selected IP Once this is done the mOway Web Server will be displayed It makes it possible to control mOway movements LEDs and read some sensor values www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 154 of 175 Moway Web Server e C fi 169 254 3 1 El extendd Mis enlaces Robots Mo viles Infr minirobots es Moway server LEDs control Light sensor 72 Motion control Top Red LED Obstacle sensors se da de Top Green LED l
73. ctive Detection inactive M Detection inactive Detection inactive Obstacle detected AND O OR Image 80 Check Obstacles configuration www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 128 of 175 7 Condition modules have a true output and false output When the obstacle is detected the condition is true green mark and the corresponding LED turns on If the obstacle is not detected the condition is false red mark and the corresponding LED turns off LED control is done with Lights modules 8 Test the program and check that the front LEDs light up when an obstacle is detected Image 81 First MowayWorld program obstacle detection 9 We add an straight forward movement 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 www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 129 of 175 i Movement Moc ae Movement Module Straight in this Movement Module you can let mOway rotate around its own axis rotate center or around In this Movement Module you can give mOway the command to move straight Need help one wheel rotate wheel Need help Commands for mOway seas Wheel Speed Rotate Speed Constant Speed x Constant Speed e Dir
74. d 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 33 Allowed values for SEN SPEAKER ON OFF Define SPEAKER_OFF o SPEAKER_TIME SPEAKER TIME 2 www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 55 of 175 Table 34 SEN_SPEAKER_ FREQ vs PWM frequency PWM frequency SEN_SPEAKER FREQ Hz 0 0000000 5681 8181818 2976 1904762 2016 1290323 PQ 1524 3902439 1225 4901961 PO 1024 5901639 880 2816901 ae 771 6049383 a 686 8131868 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 v3 1 2 April 2013 Page 56 of 175 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 inte
75. dule and RFUSB RF module establishes communication between other mOways or with PC using RFUSB 7 These LEDs can t be controlled by the user This LED can swap between on and off when the battery is fully charge because there is energy consumption when mOway 1s plugged Available in some packs 10 Available in some packs 11 Available in some packs www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 23 of 175 Image 18 RF module RF module is connected in expansion connector and it is very easy to use with MowayWorld 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 1s 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 1 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 th
76. dules share the microcontroller SPI port When CS pin is high the camera module receives SPI commands while RF module is disabled When CS pin is low the RF module receives SPI commands while camera module is disabled 5 3 4 2 Variables These variables are 1 byte length COMMAND_CAM This variable contains the type of the command reading or writing to send to the camera controller Functions included in this library only need writing commands ADDRESS_CAM This variable contains the direction of the register to read write DATA_CAM This variable contains data to send to the register defined by ADDRESS_CAM CAM_STAT This variable indicates the camera status If camera is activated the value is 1 Otherwise the value is 0 CAM_ CHANNEL This variable indicates the channel in which camera transmits the images www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 82 of 175 5 3 4 3 Functions This library includes functions to manage camera module A brief description of each one of these functions is given below Table 46 Assembler camera control functions Functions for the camera module CAM CONFIG Configures microcontroller SPI inputs outputs and configures camera board controller CAM_ON CAM_OFF CAM CHN SEL Selects the transmission channel from camera to camera capturer CAM SEND COM Sends a command to camera controller CAM_SPI WRITE Sends a byte thr
77. duration set in multiples of 0 05 seconds The pause parameter may be a constant or a variable e Call Function This module makes it possible to call a function or subroutine defined by user Subroutines will be explained on chapter Functions Subroutines e Finish This module sets the program end If the program consist of an infinite loop this module is not necessary 7 3 5 Expansion This group of functions makes it possible to control the expansion connector of mOway robot either to use radiofrequency RF communication mOway camera module or user expansion modules WARNING Only advanced users can use the pinout configuration Any incorrect connection of electronic elements to the expansion connector may damage the robot irreversibly or the user circuitry e Module IO Configuration This module configures the expansion connector pins as inputs or outputs and assigns a initial value for outputs www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 140 of 175 g IO Module Configuration In this module you can configure expansion ports as inputs or outputs Line 1 Line 2 Line 3 Line 4 Line 5 Line 6 Data Input Input Input Input Input Input Direction Output Output Output Output Output Output Init Value Image 92 Module IO Configuration configuration window e Module IO Set Output This module sets On resets Off or toggles expansion connector pins
78. e Check for interfering signals If there is no signal interferences and the process develops normally the SENOK flag 1s activated Table 36 SEN CHECK OBS allowed values OBS CENTERE J0 OBS_SIDE_L l JOBS CENTERR ________ 2 SEN_ACCE_XYZ_READ Input variable SEN_CHECK_ACCE Which axis must be read Output variable SEN_ACCE Output SEN_STATUS SENOK DWRONG SEN_ACCE_XYZ READ returns the acceleration of the robot in the 3 axes Resolution is 0 0156G bit Value 0 is 2G and 255 is 2G Image 45 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 1s calculated Value is read Change the mode to tap detection Table 37 SEN_CHECK_ACCE allowed values Define ACCE_CHECK_X 0 ACCE_CHECK_Y ACCE_CHECK_Z www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 58 of 175 SEN_ACCE CHECK TAP 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 Bit Unused al ee ee E Bit 7 2 Unused Bit 1 TAP_TAP shows 1f double tap is detected 1 Double Tap detected 0 Double Tap not detected Bit 0 TAP shows if tap is detected 1 Ta
79. e hardware required to implement the radio part of his application As interface the device has four pins available for the SPI bus two more pins for controlling the module and another two for the supply www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 24 of 175 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 MO O TEA Powerdissipation 60 Jow Table 17 Specifications BZI RF2GH4 Maximum power output Bm Currentin Power Down mode 900A Maximum frequency of the SPIbus 8 Mz Table 18 Pinout BZI RF2GH4 Pins N Deseription O Chip Select of the SPI SDI 6 Data input to the RF module of the SPI bus MOSI IRQ 8 Outputinterruption oS O www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 25 of 175 as Ji ts AIT 3 ER c4 6 i 2 O TAVHIZIY 1Z8 Image 20 RF Module layout 3 6 mOway Camera module Thanks to the camera module mOway Camera Module it is possible to display on the computer what mOway 1s watching Camera board sends images wirelessly to the video receptor mOway Camera Board Image 21 Camera module Camera Module is connected to expansion connector of mOway robot It is controlled by rob
80. e left rotate right rotaton rotation axis Ffrontled on Activates the front LED romeo Deactivates he from LED fontled btink Blinks the front LED brakeled on Activates the brake LED brakeledotf Deactivates the brake LED brakeled olink Blinks the brake LED greenled on Activates the green LED _ E Do a To Activates all the LEDs www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 169 of 175 leds off Deactivates all the LEDs Ls leds blink Blinks all the LEDs Ss Activates the buzzer with a sound in a certain buzzer on Tena frequency buzzer off To deactivate the buzzer melody charge Sounds a melody of charge melody fail Sounds a melody of failure Subprogram for enclosing mOway into a black enclosed circle It goes forward when it is on a white surface and it turns around when it reaches a black line ach Subprogram for pushing objects mOway searches d the objects and pushes them Subprogram for pushing objects out of a black defender circle It puts together the enclosed and push subprograms linefollow left Subprogram for following a line on the left side linefollow right Subprogram for following a line on the right side The following table shows the variables and the values can be taken for the correct execution of the commands Variable Description Range of values rota
81. e program mOway RC Client is downloaded in the robot and the application starts The fields of the RC Center will be explained on the next lines Functions Variables Window Help MowayR Moway Cam Communications mOwayserver St im Image 109 Access to Moway RC 8 3 1 RF configuration In this part the RFUSB module is configured with a 2 default address and 0 for the communications channel default mOway RC program channel Once connected the communications channel can be changed if WI FI Bluetooth Microwaves other mOways 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 0 The recommended procedure is as follows 1 Turn the robot on 2 Connect the RFUSB 3 Test the channel sending mOway commands 4 If the robot does not react well change the channel and try again In case the robot is not programmed with mOway RC Client it can be programmed pressing Program mOway button 3 3 2 Movements Once the RFUSB is connected mOway can be sent commands The robot s movements can be controlled by means of the panel buttons or keyboard W S 4 D keys There also are two bars to determine the speed and turning curvature The covered distance can be r
82. ection Rotation Mode go forward Rotate about the center of Moway go backward left CCW z Rotate on a Moway wheel right wheel forward Flowchart Control E commands run 3 continiously until next movement module in flowchart O for Constant Time gt 0 1 seconds 0 1 to 25 5 for Constant Distance 0 2 centimeters 0 1 to 25 5 commands run continiously until next movement module in flowchart for Constant Time 0 1 seconds 0 1 to 25 5 for Constant Angle 180 0 degrees 3 6 to 360 MW finish time anale limit before continuing with the next action in flowchart O finish time distance limit before continuing with the next action in flowchart Y Save Cancel Image 82 Movement and Rotation configuration Image 83 End of first program in MowayWorld www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 130 of 175 7 3 Modules The mOway programming consist of functions or actions that control the robot Modules are these functions or actions that mOway can carry out moving reading sensors transmission of radiofrequency messages etc These modules are grouped depending on their function Each of the modules included in MowayWorld are described below 7 3 1 Moway Actions This group of modules makes it possible to contro
83. en between Mbps or 2 Mbps The RF range is up to 400 meters The next image shows the radiation pattern of Wifi Module 0 TJ Dans Fa EC ae 4 f 4 A A ri Fi M ES EPA SY Pr LEVI A f A A f y NA F he Fi A f d va orn P a A j j A Lf Pi fj Pf oe oe A f j A AN Pai kw a ll o i f a A A N 4 Fd Ss P Dgo e 7 e e A Pi ZO Ne A fr ff sya PA A x ji f PLAY Y PEA Pot a f f f e f ri dl A r oe WIKIA X_N j fy j j Fa N ww NA E EA SL e N a Pi EKLE Y x a y y Pi Fd PA Pa e pz pe ore il ES LBS LS P 7 a pa Ly Sf we ee A fo MOG Pa we a a EL DIA ee E e ee aa ae eae jamii Y E e _ egg ae ai oe ze o a 90 _ S SN SIAN 5 NS A A ON i A ANS _ WARN DAN A Y i 7 1 y Sy ae f w e 180 Image 27 Wifi Module radiation pattern Table 23 Recommended operating conditions Parameter Min Typical NY Ed Units ee VDD OT 33 363 Volts www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 32 of 175 Table 24 Current consumption nominal conditions 25 C VDD 3 3V Parameter Min Typical Max Units C mA TXMode 14 mA SleepMode 50 A Hibernate Mode OFA Table 25 Receiver AC characteristics Parameter Min Typical Max Units 2412 2484 mA Input level sensitivity 1 Mbp 91 4 Bm Input level sensitivity 2 Mbps 88 4 dBm Table 26 Transmitter
84. er Top red LED Top green LED Line sensors transmitter RD4 SDO signal for the SPI communication accelerometer RDS Ol SDI sinal for the SPI communication accelerometer Clock sinal for the SPI communication accelerometer Chip Select for the SPI communication accelerometer PORTE RES O0 Brake LED PORTH RH a DU Tempreature sensor Battery measurer Infrared transmitter zo an Sm SEN_LIGHT 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 www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 53 of 175 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 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 variab
85. er is specified Example sStraight ahead at 100 speed during 10 seconds 100ms x 100 Straight backwards at 15 speed 100mm Imm x 100 MOT_CHA_VEL Input MOT_VEL Desired speed o 10 MOT_CON FWDBACK 1 FWD__ 0 BACK www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 66 of 175 MONT PST ESA FE Distance value 255 FLAGS MOT_STATUS 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 lmm x 100 MOT_ROT MOTVEL____ Desiredsped_________ JO 10 _ 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 233 Angle value 100 www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 67 of 175 Output variables FLAGS MOT_STATUS COMOK and DWRONG 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
86. erature 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 e Activate the ADC e Wait for the data acquisition process to end 100us e Read the analog value 12 The output value can differ from mOwayGUI 20 Sensor measures mOway s temperature which can be different from ambient temperature www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 97 of 175 e Returns amplified microphone value 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 unsigned 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
87. erruptlow YourLowPrioarityiIShRCode void YourLowPrioarityISRCodel ilow priority interrupt code EE REAL RAS AREA AEREA EAS MAIM aie ir ir ir e i aa a e a r r e e e e e e r e s EEE EEE EEE EEE EEE PEE EEE EEE ES void main Image 59 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 MowayWorld and verify that the green LED blinks www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 91 of 175 if Re ea ee Me AAA AN AA A ee ee OLLA TTT TT TTT r a a a a a a a a a a a a void mainii I L ff THATS SOR CONFIGURATION t sea eae aera yf SEN CONFIG Green LED blink LED TOP GREEN ON OFF while 1 i Image 60 First program configuration and LED 5 To detect obstacles call up the SEN_OBS_DIG 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 v3 1 2 April 2013 Page 92 of 175 EE a AI O A A A AA e ALA DI SEPTATE TTT TTT TTP RRA ARE AREA AA EA ARE AA AAA a a void maint i P TREE ATSPPY SOR CONFIGURATION eee eae eae SEN CONFIGI Green LED blink LED TOP GREEN ON OFF
88. es asm as inc s v Cancelar Jump to Encoding ANSI _ Add File To Project www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 43 of 175 Image 39 ASM creation 7 Finally the source file is added to the project accessing Project Add Files to Project E Moway_first_project MPLAB IDE v8 33 Moway_first_project mcw File Edit View Project Debugger Programmer Tools Configure Window Help Checksum 0x8358 E Moway_first_project mcw AE a Y Moway_first_project mcp a Source Files 5 Header Files lib_mot_moway inc E Object Files i Library Files Linker Script Other Files Files f Symbols PIC18F2550 0 novzdec Image 40 Project with ASM 5 2 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 0x102A and resetting 0x1000 vectors and to include the mOway libraries INI
89. eset with Reset distance button 9 3 3 LED In this section mOway s four LEDs are switched on and off www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 152 of 175 8 3 4 Speaker In this section is checked the switched on and off of the robot s speaker in a particular frequency He robot can also reproduce music notes 3 3 5 Sensor status This section describes the values returned by the sensors at all times updated every second e Line sensors the darker is the surface the higher is the value e mOway environment brightness temperature and noise detected by the robot e Obstacles the closer is the obstacle the higher is the value e Acceleration 3 axis acceleration values 3 3 6 Camera It activates mOway camera on the selected channel for a maximum of 15 seconds While the camera is on the communication between mOway and PC stops in order to avoid interferences Once the activation time finishes the communication automatically starts again In order to watch camera images it is necessary to launch Camera panel 9 4 MowayServer This application allows mOway to communicate with other devices such as phones tables and PCs through Wifi technology These devices can connect to the net established by mOway by means of Moway Wifi Module Once they are connected the robot can be controlled from device web browser The application 1s launched from toolbar un
90. gns the value of mOway turning angle to a variable Value goes from O 0 degrees to 100 corresponding to 360 degrees o Brightness assigns the light sensor value to a variable Value goes from O dark to 100 light o Line assigns one of the line sensors value to a variable Value goes from 0 white colour detection to 100 black colour detection o Obstacle assigns one of the obstacle sensors value to a variable Value goes from 0 no detection to 100 closest detection o Accelerometer assigns one of accelerometer axis value to a variable Value goes from O negative acceleration limit to 255 positive acceleration limit When there is not acceleration the value is 127 range mid point o Noise assigns the microphone value to a variable Value goes from O silence to 100 loud noise o Temperature assigns the robot temperature value to a variable Value goes from 0 C to 255 C o Battery assigns battery level to a variable Value goes from 0 to 100 e Compare This group of modules makes it possible to compare a variable or a sensor value with another value constant value or user variable The following are the comparison operators equal different lt gt greater gt greater or equal gt less lt less or equal lt o Data compares a variable with a constant value or a user variable o Time compares elapsed time Values goes from 0 1 to 23 5 seconds o Speed
91. h one of these function Table 31 ASM function summary Name Input variable Output variable Description pan a ee E Sensors SEN LIGHT SEN_LIGHT_P Reads light sensor values SEN BATTERY SEN_BATTERY_P Returns the battery level SENSTEMPERATURE Y Pen Cs SEN_MIC_ANALOG rc Nr il or not SEN SPEAKER SEN_SPEAKER_FREQ MO Emits tones in a E SEN_SPEAKER_ TIME frequency between 250 SEN_SPEAKER ON OFF Hz and 65 KHz 7 7 SEN_STATUS 7 7 SEN_STATUS obstacles 7 o 7 SEN_STATUS acceleration of mOway SEN ACCE CHECK TAP f gt Sencsratus tempat 7 7 7 SEN_STATUS been taped 7 7 SEN_STATUS lines SEN STAI B E SEN_STATUS LED_BRAKE_ON J o Bake LED oon LED FRONT ON Font Don LED TOPREDON __ __ So Topredifbon IED TOP GREEN ON e o o ToperenifDo LED_BRAKE_OFF Bae LED off LED FRONT ORE pp Front LEED off LED TOP REDO e A TopredigDoff LED_TOP_GREEN_OFF TopgrenifEDoff IO O CA USES E AAA AE AU AS SA SS ES LED BRAKE ON OFF LED FRONT ON OFF LED TOP RED ON OFF www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 52 of 175 LED_TOP_GREEN ON OFF TP teen LED blink SEN_CONFIG This function configures the inputs and outputs required to manage the sensors and initialize the variables Table 32 PIC sensor connections Light Central left infrared receiver Right line sensor receiver Side left infrared receiver Left line sensor receiver Speak
92. 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 Manual and not a comprehensive book on minirobotics This manual has been implemented to assist learning
93. 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 v3 1 2 April 2013 Page 7 of 175 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 v3 1 2 April 2013 Page 8 of 175 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 be connected to it as well as any other device considered interesting to perform a certain task mOway
94. ie Edit view Aa Debugger Programmer Tools Configure Window Help Oa fi Checksum New Open Close MM Untitled Y Set Active Project Quickbuild no asm file Package in zip Clean Build Configuration Build Options Add New File to Project Remove File From Project Select Language Toolsuite Set Language Tool Locations version Control PICISF2550 i novzdec Image 33 Project Wizard www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 40 of 175 1 First select the PIC installed in mOway PIC18F86J50 Project Wizard Step One Select a device Device Image 34 PIC selection 2 Then select the assembly tool MPASM Project Wizard Step Two Select a language toolsuite Active Toolsuite Microchip MPASM T oolsuite Toolsuite Contents MPASM Assembler mpasrawin exe v5 3 MPLINK 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 Isn t Listed Show all installed toolsuites Image 35 Tool selection www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 41 of 175 3 In step three enter the project s name and location Project Wizard Step Three E Create a new project or reconfigure the active projec
95. ion 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 v3 1 2 April 2013 Page 94 of 175 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 48 C function summary Name Input Description constants void SEN_CONFIGURAR oid Configured to use the sensors unsigned char SEN_LIGHT void Reads tight sensor values unsigned char SEN_BATTERY void Retums the battery level unsigned char SEN_TEMPERATURE void Detects the temperature im C unsigned char SEN_MIC_ANALOG void gt 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 SPEAKER_ON Hz and 65 KHz unsigned char unsigned char SPEAKER TIME 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 O rd 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 OB
96. l ento 118 oi FCO eee eee ere ee T ee 118 MowayWorld programm Ing ccscecsscccccccceeesseeeecceeeeeaeeeeseeeeeeeeeeaeaseeeeeeseeeeaas 121 Lala Moway World WOrkspaCE asesinada 121 FEL TOOD e e A 121 dlez NOW Ban EO e EEE EE 121 Ll TOOR eea E E E T ee ee 122 Tek AA E E E EEE E EE 123 To EOE e II S 123 LLO o o E 124 7 1 7 Language change and updates oooncccccccccnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnonnnnanncnnnnnnnnos 125 Did PST prosram in Moway Wo dssiconanaaiii iria 126 uo beenenuctecanecnneeeds 130 A PI MORT A 3 10101 AA OO O PRE SEO IIA 130 Lola EMS OO 134 A eo aatenen tease ose danesseseaean e areeoetecetes 136 TIA VOW CAI COO a establo 139 www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 5 of 175 ds EPA indi 139 DV AIAG scooter lease 144 7 5 Functions Subroutines ccoccnnccnocnnoconoconocnnccnoronoconoconocnnocnnronaronoconoconacnnicnncons 145 ds APDPpUcaiOAS tao 147 8 1 Communications Window oooccnccnnccnoconoconoconoconoconccnaronoronoconoconaconccnaronaroniconos 147 5 2 Mov CM T E pirate pasais 148 e SAA PP e OO UA 150 Sal SN PP R PEA 151 ls MO iio 151 O A 151 e E e A lt meatasestncansaneaacuaseeer 152 E DOA S E A 152 O C E AE EA ee a ee 152 SA MOND iy a E neaaeees ct eeeeaanes 152 D SIMI rE E E ER 155 Ze ic O a A E E so scieeeatsseansenevedesae eausece 155 Di PON OD e E E E E E E 156 93 E AAA aai d aiai 160 O e e E E E AA 162 IOT o O a E AEE A EO 162
97. l mOway s actuators motors speaker and LEDs Functions of these modules can be performed for a user defined period of time or distance 1f the finish time distance limit before continuing with the next action in flowchart option is selected If this option is not selected the function will be executed indefinitely until another module changes the current function e Movement Straight mOway robot has two motors one in each wheel These give it a great flexibility in its movements Movement straight command makes mOway to go forward or backward describing a straight line trajectory Speed value can be modified Movement Module Straight In this Movement Module you can give mOway the command to move straight Need help Commands for mOway Wheel Speed Constant Speed X Direction O go forward O go backward Flowchart Control commands run continiously until next movement module in flowchart for Constant Time 0 1 seconds 0 1to 25 5 for Constant Distance X 0 2 centimeters 0 1 to 25 5 O finish time distance limit before continuing with the next action in flowchart _W Seve Image 84 Movement Straight configuration window www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 131 of 175 e Movement Free Free movement is similar to straight movement but in this case the speed of each motor can be adjusted separately Moveme
98. le The higher the values the darker will the surfaces be Table 39 Allowed values for SEN CHECK _ LINE Define LED BRAKE ON This function switches on the brake LED LED FRONT ON This function switches on the front LED 18 Due to tolerance two different sensors can differ from each other www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 60 of 175 LED_TOP_RED_ON This function switches on the red LED LED_TOP_GREEN_ON This function 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 Soe mOway s motor library in assembly language www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 61 of 175 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 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
99. les 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_MIC_ANALOG Output variables SEN_MIC Sound Intensity 16 The output value can differ from mOwayGUI 17 Sensor measures mOway s temperature which can be different from ambient temperature www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 54 of 175 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 Sound frecuencia see table The SEN_SPEAKER function emits tones in a frequency between 250 Hz an
100. ll SEN CONFIG Microcontroller configuration to use the engines call MOT CONFIG Green LED blink call LED TOP GREEN ON OFF ERRADA AA AAA AA MALO PROGRAM a ERA A RARA AAA AAA RARA ARRE AA RARA Straight on SOs speed mov Li 60 mor MOT VEL mov liz Ol MOT T DIST ANG MOT CON FUDBACE MOT CON COMTYPE MOT STR Check central left obstacle sensor mov li OBS CENTER L Mow SEN CHECK OBS call SEN OBS DIG Image 43 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 v3 1 2 April 2013 Page 47 of 175 Check central left obstacle sensor mov Li OBS CENTER L morn SEN CHECK OBS call SEN OBS DIG If a obatacle is detected robot avoids it htisc SEN O8S 0 goto OBS DETECT htiss SEN O8S 0O call LED FRONT OFF goto Mall OBS DETECT call LED FRONT ON Eotate 160 at 0 speed mov Li 20 movi MOT VEL mov Li sS movwt MOT T DIST ANG mov Li OxOl MOT CENWHEEL MOT CON FUDBACE MOT CON COMTYPE MOT CON RL MOT ROT Wait until comand finishes call HOT CHECK END ratraight on 503 speed mov Li SO morn MOT VEL mov Li O HOT T DIST Ane MOT CON FUDBACK MOT CON COMTYPE MOT ATR goto MATO ORR CW Wh WoW Wow RARA RARA RARA RRA RARA RARA RARA RAR
101. ller as CONE 5 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 consumption mode RF_SEND Sends a data frame 8 Bytes to the address indicated RF RECEIVE o 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 function Table 44 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 45 RF pin configuration PIN RF PIN PIC
102. mputs outputs and configures camera board controller void CAM_SEND_COM unsigned COMMAND Sends a command to camera char unsigned char unsigned char ADDRESS controller DATA void CAM_ON void A LA PAR A void CAM_OFF void II AE A void CAM_CHN_SEL unsigned char CHANNEL Selects the transmission channel from camera to camera capturer char Table 63 C18 functions summary CAM_CONFIG This function configures the parameters of SPI communication and microcontroller SPI port It also configures input output port of camera controller PIN SPI PIN PIC SCK SDI RCS SDO RC4 Table 64 Microcontroller SPI port configuration CAM_SEND_COM www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 119 of 175 This function sends a command through SPI to the camera controller The format consists of 3 bytes command type read write register and data to write in that register COM_RD to read register ADDRESS_CAM IODIR_ADD to configure input output port of camera controller OLAT_ADD to change the level low high of camera controller port DATA_CAM Data to write on the register in ADDRESS_CAM CAM_ON This function sends a command to activate the camera It is a writing type command to the camera controller port The 3 bytes to send are BYTES COMMAND_CAM_ COM_WR ADDRESS_CAM OLAT_ADD DATA_CAM CAM_OFF This function sends a command to deactivate the camera It i
103. nd then clicking on New variable A name and an initial value have to be defined for this new variable see Variables chapter Some of the modules allow to create these variables directly from their configuration window This permits to configure the module with values that can be modified during the execution of the program NOTE Each variable is stored in one byte of mOway s internal memory which means that the value of the variable can be from 0 to 255 e Calculate This module adds or subtract two values First parameter is always a variable and it stores the operation result Second parameter can be a constant or a variable e Reset mOway Data j This module initializes time and distance counters stored in mOway s internal memory 3 a e Assign Variable This group of modules makes it possible to assign a value to a user defined variable This value can be constant or the analog value of mOway s sensors o Value assigns a constant value to a variable o Time assigns elapsed time to a variable Value goes from O to 255 tenths of a second o Speed assigns the speed value of one of the wheels to a variable Value goes from 0 stopped to 100 maximum speed o Distance assigns distance value covered by mOway to a www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 137 of 175 variable Value goes from O to 255 centimetres o Angle assi
104. nt Module Free In this Movement Module you can give mOway the command to move around freely by controlling its two wheels individually Need help Settings Left wheel Speed Right wheel Speed Constant Speed hd Constant Speed 5 50 sl 0 100 50 S 0 100 Left wheel Direction Right wheel Direction go forward go forward go backward go backward Flowchart Control commands run 3 continiously until next movement module in flowchart for Constant Time 7 0 1 seconds 0 1to 25 5 O for Constant Distance z 0 2 centimeters 0 1 to 25 5 O finish time distance limit before continuing with the next action in flowchart Image 85 Movement Free configuration window e Movement Turn In this function drive system will calculate the speed of the motors in order to be able to trace a curve indicating the speed and turning curvature Movement Module Turn In this Movement Moudle you can give mOway the command to make a turn Need Help Commands for mOway Wheel Speed Consta nt Speed 30 100 Direction go forward Turning radius Constant Radius wu centimeters 1 to 29 Turning direction turn right Flowchart Control Commands run 3 continiously until next movement module in flowchart O for Constant Time X lo 1 seconds 0 1 to 25 5 for Constant Distance X 0 2 centimeters
105. nual Rev v3 1 2 April 2013 Page 123 of 175 7 1 4 Properties When a module in Flowchart Editor is selected the Properties window will appear on the right side of the workspace This makes it easier and faster to change the modules configuration Movement Straight Wheel Speed Constant Speed 50 0 100 Direction 2 go forward O go backward Command run 2 continiously 2 for time limit Constant Time 0 1 0 1 25 5 s 3 for distance limit Constant Distance o2 01 255om LJ finish limit before continuing Image 72 Straight module properties 7 1 5 Error List Error List window shows the errors found in the diagram It includes a description of the error Description and the diagram in which the error has produced Diagram A diagram with errors will not be downloaded to the robot Error List Description X Error 410 Action element has to have one or more previous M Error 422 Action element has to have one next mm rr M Error 421 Start element has to have one next al Diagram E Main Main MyF unction oo A Image 73 Error List window www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 124 of 175 7 1 6 Arrows Modules execution order is established by means of arrows In order to connect the modules following steps must be taken e Place the cursor over a module until red and white marks appear
106. ogram and Program mOway button 6 In order to detect obstacles four Sensor Check Obstacle has to be added and configured one for each obstacle sensor Configure mOways four different obstacle sensors and connect them with the and or operator to set the Configure mOways four different obstacle sensors and connect them with the and or operator to set the condition for a true and false output Need help condition for a true and false output Need help Settings Settings Left Central Sensor Right Central Sensor Left Central Sensor A Right Central Sensor Detection inactive Obstacle detected Detection inactive Left Side Sensor Fa N Right Side Sensor Detection inactive F Detection inactive 7 Left Side Sensor A Right Side Sensor Obstacle detected y Detection inactive gt Detection inactive Configure mOways four different obstacle sensors and connect them with the and or operator to set the Configure mOways four different obstacle sensors and connect them with the and or operator to set the condition for a true and false output Need help condition for a true and false output Need help Settings Settings Left Central Sensor A Right Central Sensor Left Central Sensor A Right Central Sensor Detection inactive Z S Obstacle detected Detection inactive Z S Detection ina
107. om Title mOway User Manual Rev v3 1 2 April 2013 Page 163 of 175 The Program button programs the needed firmware in mOway for a right connection with Scratch In this case mOway robot should be connected to a USB port The firmware will be programmed to work in the selected channel in the RF channel box Once the firmware is programmed in a certain channel this channel should be selected when we get connected to Scratch To initiate communication the Connect to channel button is pressed mOway robot should have the Scratch firmware previously programmed the RFUSB module should be connected to PC and Scratch must be opened with a mOway sample program Once the connection from Scratch is started it is possible to obtain the value of any of the mOway sensors and also it is possible to send moving orders to mOway or switch on off the LEDs and buzzer To configure these actions we use variables in Scratch 10 3 Step by step 1 Connect RF module into the expansion connector of mOway robot 2 Connect the RFUSB to PC E 3 Connect mOway robot to PC 4 Open mOway Scratch application www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 164 of 175 5 Select the language in which the Scratch programs will be developed in this case English mOway Scratch Ls ae 6 Press the Program button on the lateral panel thi
108. ons call RF_INT_EN Configure SPI modules of the PIC call RF_CONFIG_SPI Configure RF module own channel and address movlw 0x01 Own address movwt RF DIR movlw 0x40 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 v3 1 2 April 2013 Page 80 of 175 Interrupci n ext dl Define RF_DIR Yo IRGI RF_RECEIVE gt RF_RECEIVE _INT Define RF_DATA IRQ 0 RF_SEND i process data e o y gt process data y E enn 1 4 0 Data sent and ACK received Out interruption service 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 v3 1 2 April 2013 Page 81 of 175 5 3 4 mOway Camera Board library in assembly language 5 3 4 1 Description This library allows to activate mOway s camera and to choose the channel to transmit the images to video capturer Camera is controlled through SPI commands The camera module has been designed to make possible to use it with other modules at a time like RF module BZI RF2GH4 Both mo
109. ot programming It has a connector on the back so that other circuitry can be attached RF module or user circuitry Camera control is performed by Microchip MCP23S808 device which is an input output port controlled by SPI The basic functions are the following 12 Available in some packs 13 Available in some packs www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 26 of 175 e Turn on When camera is on the LED of the module is on The camera sends images through RF to video receptor e Turn off When camera is off the LED of the module is off The camera RF transmission ends e Channel change When the camera channel changes the LED blinks As interface the device has four pins available for the SPI bus two more pins for controlling the module and another two for the supply Other wireless transmitters can affect the images quality If so change the channel of transmission both camera and video receptor NOTE Both camera transmission and mOway RF module transmission are in the same frequency band So that when camera is active mOway RF module reception distance decreases 3 7 mOway Camera Board mOway Camera Board is the video receptor It receives the images from the Camera Module through RF and sends them to PC through USB Image 22 mOway Camera Board video receptor It has a channel selector for choosing the RF communication channel with Camera Module channels 1 to 4
110. ough SPI CAM_CONFIG This function configures the parameters of SPI communication and microcontroller SPI port It also configures input output port of camera controller RC4 RF2 Table 47 Microcontroller SPI port configuration CAM_SEND_COM This function sends a command through SPI to the camera controller The format consists of 3 bytes command type read write register and data to write in that register COMANDOS COMMAND_CAM COM_WR to write in register COM_RD to read register ADDRESS_CAM IODIR_ADD to configure input output port of camera controller OLAT_ADD to change the level low high of camera controller port DATA_CAM Data to write on the register in ADDRESS_CAM www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 83 of 175 CAM_ON This function sends a command to activate the camera It is a writing type command to the camera controller port The 3 bytes to send are BYTES COMMAND_CAM_ COM_WR ADDRESS CAM OLAT ADD DATA_CAM CAM_OFF This function sends a command to deactivate the camera It is a writing type command to the camera controller port The 3 bytes to send are BYTES COMMAND_CAM_ COM_WR ADDRESS CAM OLAT ADD DATA_CAM CAM_CHN_SEL This function sends a command to set camera transmission channel It is a writing type command to the camera controller port Input variables CAM_CHANNEL Camera transition channel It must be
111. ows if SEN CHECK _ACCE_TAP function detects one or two taps a 21 IT 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 Title mOway User Manual Rev v3 1 2 April 2013 Page 49 of 175 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 27 Allowed values for SEN CHECK_ OBS Define OBS_CENTER_L 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 28 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 29 Allowed values for SEN CHECK LINE Define SEN_SPEAKER_ON_OFF This write only variable shows 1f speaker have to turn on turn off or play an amount of time www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 50 of 175 Table 30 Allowed values for SEN SPEAKER ON OFF SPEAKER OFF o 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
112. p 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 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 www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 59 of 175 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 38 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 e Read the sensor e Copy this value to the SEN_LINE variab
113. process develops normally returns value Table 52 Allowed values for SEN CHECK OBS OBS_CENTER L unsigned char SEN_OBS_ANALOG unsigned char SEN_CHECK_OBS Input variable SEN CHECK OBS Which sensor must be read Output Indicates if 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 Deactivate the infrared diode e Check for interfering signals If there is no signal interferences and the process develops normally value is returned Table 53 SEN CHECK OBS allowed values OBS_CENTER_L OBS SIDE L 1 OBS CENTER R 2 OBS SIDE R unsigned char SEN_ACCE_XYZ_ READ unsigned char SEN_CHECK_ACCE Input variable SEN_CHECK_ACCE Which axis must be read Output www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 100 of 175 Acceleration value 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 Image 63 mOway
114. proof sensor PIC connections Pin PIC Sensor PORTA Central right infrared receiver 2 Due to tolerance two different sensors can differ from each other www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 17 of 175 RA3 Side left infrared receiver PORTF Side right infrared receiver Central left infrared receiver PORTJ OR OQ Infrared transmitter _ Image 12 Location of Obstacle Sensor 3 3 3 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 RAO 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 wi
115. r Manual Rev v3 1 2 April 2013 Page 20 of 175 Pind RDS Pinl4 RDG 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 with a reading of the ADC battery level can be measured Table 11 PIC Battery level connection Pin PIC Sensor PORTH 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 PORTC o 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 PORTA o RA O Top red LED PORTB RB6 O Top green LED 5 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 v3 1 2 April 2013 Page 21 of 175 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 Ta
116. ram In order to create a new function click on icon and give it a name for example MyFunction A new tab called MyFunction will appear on the top of the flowchart editor lain Image 100 Creation of a new function The functionality described above can be developed in the MyFunction flowchart editor www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 146 of 175 Main MyFunction Image 101 MyFunction diagram In order to go back to the main diagram click on Main tab There the MyFunction function can be called Flowchart Control Call Function In the Call Function configuration window MyFunction 1s selected In this example 1t 1s called three times so that the front LED will blink three times once per second Main MyFunction Image 102 Calling MyFunction three times from main diagram www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 147 of 175 8 Applications 8 1 Communications Window The Communications Window makes it possible to send and receive RF messages using RFUSB device connected to PC In order to start RF communication push the Communications icon mOway World Edit Project Functions Variables Window Help D00 8000 o o Brx ole Image 103 Communications icon The Communications Window will appear on the right side of the workspa
117. ransceptor 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 62 RF module PIC ports configuration RF PIN PIC PIN RF2 RH4 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 is 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 68 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
118. rference 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 the SENOK flag is activated Table 35 Allowed values for SEN CHECK OBS OBS_CENTER_L OBS_SIDE_L 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 Output 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 Title mOway User Manual Rev v3 1 2 April 2013 Page 57 of 175
119. roller finclude lib sen moway h f fSensors library PRR EEEEEEEREREEEEEEEEEREEREEEREREEE AA AAA RARA RA RARA AAA AA RARA ARA EER EERE EERE RA AAA REE EERE RE EE EERE EE SS JUMPING THE BOOTLOADER PLEAS SETS Ee Ae REESE ee ee ee ee ee ee a ee ee i ee a a ee eR eR a ae ee ae a ee a a fdefine REMAPPED RESET VECTOR ADDRESS OxlOOO Reset adress for the correct bootloadea fdefine PEMAPPED HIGH INTERRUPT VECTOR ADDRESS Oxloos High priority interruption adress for fdefine REMAPPED LOW INTERRUPT VECTOR ADDRESS 0x1018 Low priority interruption adress for void YourHiqhPriorityiISkhCoaderi Function that executes the needed code in case of the high pr void YourLowPriorityiISRCode i Function that executes the needed code in case of the low prig PERA E ode ee eee ST HIGH AND LOD PRIORITY INTERRUPTION FPREMAPT Tre eee ee EEE EEE EEE EEE EEE extern void startup wold fpragma code REMAPPED RESET VECTOR REMAPPED RESET VECTOR ADDRESS void reset void _asm goto startup endasm fpraqma code fpragma code REMAPPED HIGH INTERRUFT VECTOR REMAPPED HIGH INTERRUPT VECTOR ADDRESS void Remapped High ISE roid _asm goto YourHighPrioritylsttode endasm fpragma code REMAPPED LOW INTERRUPT VECTOR REMAPPED LOW INTERRUPT VECTOR ADDRESS void Pemapped Low ISR woid asm goto YourLowPriorityIihCode endasm fpraqma code fpraqma interrupt YourHighPriorityISPCode void YourHighPriorityIlISBCodel high priority interrupt code fpradqma int
120. s Image 53 Tool selection 3 In the next step user has to specify location www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 87 of 175 Project Wizard Step Three ES Create a new project or reconfigure the active project Los 2 Create New Project File AmO prop C1 aml way first project mU way fret project Image 54 Location 4 Add mOway libraries It is highly recommended to copy those libraries to the folder Project Wizard Step Four Add existing files to your project 3423 C MOT_01 lib_sen_moway h C Wulern M Ow 4 cll Bio lib_mot_moway h C WulenM Ow E _Mot_01 cof E Mot_07 Fhex E Mot_O1 map E M0T_01 mcp E M0T_01 mc E MOT_07 rc delays h lb_mot_moway h main c main o Il Image 55 Add libraries www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 88 of 175 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 createconfigure the project with these parameters Project Parameters Device PICTSFS6J50 Toolsulte Microchip C18 Toolsuite File CA mU wap first project mep A new workspace will be created and the new project added to that workspace Image 56 Wizard ends 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
121. s a writing type command to the camera controller port The 3 bytes to send are BYTES COMMAND_CAM_ COM_WR ADDRESS CAM OLAT ADD DATA_CAM CAM_CHN_SEL This function sends a command to set camera transmission channel It is a writing type command to the camera controller port Input variables CAM CHANNEL Camera transmission channel It must be a value from to 4 www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 120 of 175 BYTES COMMAND _CAM_ COM _WR ADDRESS_CAM IODIR_ADD DATA_CAM Channel 1 OxD8 Channel 2 0xD4 Channel 3 OxCC Channel 4 O0xDC Camera activation example Camera configuration Channel 1 selection Camera activation CAM_SPI_WRITE This function sends a byte from microcontroller through SPI Input variables DATA Byte to send through SPI www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 121 of 175 7 MowayWorld programming MowayWorld application makes it possible to design programs by means of flowchart diagrams so that mOway robot can be programmed very easily Different modules represent functions that control robot s sensors and actuators These modules are joined by means of arrows to define the program flow Previous programming knowledge is not essential to use flowchart programming 7 1 Moway World workspace The following lines describe the different parts of MowayWorld workspace 7 1 1 Toolb
122. s is not necessary if the robot has been previously programmed in this way RF channel Connect to channel 0 Disconnect 7 Once the robot has been programmed disconnect it from the PC and switch the robot on 8 Open one of the Scratch projects for mOway You can open them form Start gt All programs gt mOway Pack v3 gt mOway Scratch projects For example open the moway RC sb project Je mOway Pack de mOway Pack v2 de mOway Pack v3 Je mOway Datasheets di miwa groer t F po 1 crati OIE 1 J Ah miwa ve 5 mOwayWorld 2 Uninstall de mOway Smart City 4 P www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 165 of 175 9 Press OK Remote sensor connections enabled DE 10 Once the Scratch project is open press the Start button on the lateral panel of MowayWorld The panel status is the following l 0 g RF channel Disconnect 11 On the Scratch window you will see the sensor values When the arrow keys of the keyboard are pressed the robot will move www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 166 of 175 Light R sensor value Ea Distance sensor value Microphone sensor value Line Right sensor value o 36 Line Laft sensor valua arm
123. se values can be compared transmitted through RF to check sensor status etc Variables can be created from some modules They can also be defined from the toolbar by clicking on Variables and then clicking on New variable A name and an initial value have to be declared The name must not have more than 14 letters Moway Subroutines Variables Help Mew Variable Varnables Image 97 Creation of a new variable from toolbar g Compare Variable In this Module you can compare a constant variable with the value of another variable Need Help Comparison i B Constant Val Create Variable o El 010255 Output True If is equal to 0 False Otherwise Image 98 Creation of a new variable from a module www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 145 of 175 E Variables Variables store any information From here you can create modify or delete them but remember to always have a unique name Variables Name Init Value ObstacDetect 0 SpeedVal 50 Image 99 Variables window 7 5 Functions Subroutines A function or subroutine is a piece of program that can be used in another program For example a user can develop a diagram that turns on the front LED waits one second then turns off the LED and finally waits one more second If this program is defined as a Function it can be called from the main diag
124. ssages Bit 0 SNDOK This shows whether data was sent the last time 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 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 www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 74 of 175 Table 43 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 microcontro
125. t Lo 2 Create New Project File AmOpro 4SkMmtmO way first project ASM mOwap first project Image 36 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 EJ 45m_S5EM_01 lib_mot_moway ine ASM_SEN_O1 mep ib sen_moway inc ASM SEN_O1 mes ASM SEN _O1 meu lIb_sen_mowar ine Main asm Main cor Main err Main HEr Hair let Main map Man 0 www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 42 of 175 Imagen 37 Select mOway libraries 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 WW a 4 4 Click Finish to create configure the project with these 4 parameters Project Parameters Od ez Device PIC18F85J50 Toolsuite Microchip MPASM Toolsuite File C Moway_first_project mep A new workspace will be created and the new project added to that workspace Image 38 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 y Moway_first_project E lib_mot_moway inc E lib_sen_moway inc Nombre Main asm Guardar Tipo Assembly Source Fil
126. t a ae Battery level 69 2011 Bizintek Innova S L Image 112 A Moway Web Server NOTE Connecting to MowayNet or web server displaying can take a while depending on the wifi connection and on the web browser www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 155 of 175 9 Simulation 9 1 Introduction MowayWorld simulator allows testing the working of a program before programming it in mOway robot In this way you can detect any errors you could have in the program and fix them quickly The simulator is opened from the toolbar NOTE When you activate the simulator the side panels remain inactive Deactivate FS F6 Ctrl F5 Run Simulation Animate Pause Simulation Reset Simulation Step In F10 F11 Step Over Image 113 Simulator access By activating the simulator it will appear in the side panel Simulation gt ts 2 Movement Lights and Sound mOway movements Travelled Distance 0 0 cm Properties Simulation Image 114 Simulator side panel www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 156 of 175 The modes available in the simulator are the following a Run In Run mode the simulator executes the program in real time 1 e the speed at which the program would execute in the real robot Animate In Animate mode the simulator executes the program step by step
127. te a COMOK curve MOT_T DIST DWRONG MOT _ CON FWDBACK COMTYPE RL MOT STOP MOT_STATUS A command to stop the robot 7 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 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 System Table 41 Pic drive system connections Pin PIC 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 RE7 I Indicates when the motor ends the command REO O 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 v3 1 2 April 2013 Page 65 of 175 MOT _CHECK_END function also can be used MOT_STR MOT_VEL Desiredspeed 100 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 ord
128. th other robots and with a PC via the RFUSB With this module it is 3 Top two color LED has to be switched off to have a valid measure www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 18 of 175 possible to create complex collaboration applications without having to worry about complicated wireless communications Table 6 Expansion connector connections PIC Pink JOU Veda o Ping OU GND ane C2INC 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 RH5 Temperature measured by the sensor can be 5 C higher than external temperature www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 19 of 175 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
129. th 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 There are no pending messages Bit 2 RCVOK Reports that data has been received correctly and 1s accessible for processing 1 Correct reception 0 No data has been received or the information received 1s corrupt www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 73 of 175 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 me
130. the I2C SPI communication buses The table below describes how the microcontroller pins are distributed www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 10 of 175 Table 1 PIC sensors connections PORTA RA3 I Side left infrared receiver Left line sensor receiver RAS PORTB RBI RB2 RB3 RB5 RB6 PORTC RC7 PORTD RDI O0 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 0 Brake LED PORTF Side right infrared receiver Central right infrared receiver Tempreature sensor First interruption of the accelerometer Second interruption of the accelerometer Speaker Top red LED Top green LED Front LED TZ 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 v3 1 2 April 2013 Page 11 of 175 Engrane Encoder PIC16F687 Encoder Engrane
131. the module the ONOK RF_STATUS bit will remain at 0 Example Configuration without interruption and activation routine Configure SPI modules of the PIC www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 76 of 175 Configure RF module own channel and address Own address Channel Module not configured 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 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 www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 77 of 175 ACK it receives therefore we cannot be
132. 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 v3 1 2 April 2013 Page 15 of 175 Es Es E Image Line tracking sensor on a colored surface 1 Dark surface A dark surface reflects very little light obtaining a high voltage reading at the sensor s output Image 9 Line tracking sensor on a dark surface Table 3
133. tion ax1s Rotation axis Wheel over a wheel Any value over the center Movement speed 30 100 time Movement time in tenths of a 0 255 0 25 5 seconds second www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 170 of 175 The following table shows the mOway variables we can read in Scratch using the sensor value block Line Lett sensor value For example the previous block indicates the remaining battery level of mOway WETHEL Ce Description Range of values Y Axis g Acceleration in g in the axis Y 2 0 to 2 0 g Z AXIS g Acceleration in g in the axis Z 2 0 to 2 0 g Motor End Activated sensor when the last 0 1 command sent to the motor has finished X AXIS g Acceleration in g in the axis X 2 0 to 2 0 g www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 171 of 175 10 5 Exercises For a better understanding of the mOway integration within the MowayWorld installer we include five sample exercises By default they are located in this the Scratch projects folder My Projects gt mOway Robot gt English You can find them also in Start gt All programs gt mOway Pack v3 gt mOway Scratch projects Open Project Computer co mOway Robot bizintek Casta Protects um 3 ee y AS y O a gt MUWay Fack Vo mOway Datasheets O Desktop l Examples amp 2 Uninstall 10 5 1
134. ts 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 RFUSB installation e This is a device that allows to communicate the PC and mOway A driver that it s included in mOwayPack is required www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 36 of 175 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 If your hardware came with an installation CD lt 6 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 Advanced Click Next to continue Image 29 Driver installation Wizard e Now the installation process will begin Found New Hardware Wizard Please wait while the wizard installs the software e Moway RF USB O libusb0 dil ACAWINDOWS system32 Image 30 Windows XP driver installation e Assistant will then indicate that the hardw
135. ual Rev v3 1 2 April 2013 Page 126 of 175 7 2 First program in Moway World This first basic program will make mOway avoid obstacles Once MowayWorld is launched save this project as first program 1 Once the project is saved the program starts with a 2 second delay Just drag and drop a Pause module and configure it with a constant value of 2 seconds 2 The command to make green LED blink is added with the Lights module Configuration of both modules are shown below Light Module In the Light Module you can control mOway s four LED lights Switch them on off or let them blink Need help Commands for mOway Here the application programmer have to write a little description of Front No Change Ni Top green LetBlink 7 the window No Change i Top red No Change 7 Settings Pause time Constant Time 2 gt seconds 0 05 to 12 E F jail A Tel KN Image 78 Pause and LED configuration 3 The end of the program is added Finish module so that the application can be compiled 4 The program is compiled and recorded into the robot clicking on Program mOway button in the toolbox shown in the next image 5 Test the program and check that after waiting 2 second the green LED blinks www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 127 of 175 Image 79 Flowchart of the pr
136. uded in mOwayPack is required to use video capturer e The first time the mOway Videocap is connected the PC will detect it as a new device Driver installation runs automatically If it doesnt 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 e Now the installation process will begin e Assistant will then indicate that the hardware is installed e Check if mOway s software has detected the mOway Videocap www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 39 of 175 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 5 1 Creating a project Use the MPLAB IDE Project Wizard to create the first project quickly M MPLAB IDE v8 33 mB F
137. ware to check sensors Obstacle sensors are checked and if an object is detected LEDs and speakers are switched on Project to check drive system e ASM_MOT_0l Assembler software to check drive system Different movements of mOway are executed This project uses absolute lib_mot_moway inc library e ASM_MOT_02 Assembler software to check drive system Different movements of mOway are executed This project uses relocatable lib_re_mot_moway inc library e C_MOT_0l C18 software to check drive system Different movements of mOway are executed Projects to check RF module ASM_RF_O1 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 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 interruption This project uses absolute lib_rf2gh4 inc 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 projec
138. wise if the condition 1s false the output will be false red cross on the flowchart e Obstacle This module checks the digital value of the four obstacle sensors Each sensor can perform one of the following conditions o obstacle detected o no obstacle detected o detection inactive In addition it makes it possible to check the AND or OR boolean operation If AND option is checked all the conditions must be true to get a true output On the other hand if OR is checked just one of all the condition has to be true to get a true output E Sensors Obstacle Detection Configure mOways four different obstacle sensors and connect them with the and or operator to set the condition for a true and false output Need help Settings Left Central Sensor Right Central Sensor Obstacle detected v Obstacle detected N Left Side Sensor E z DN Right Side Sensor No Obstacle Detection inactive AND O OR Output TRUE If obstacle detected on upper right corner AND no obstacle detected on right corner FALSE Otherwise Y Save x Cancel Image 90 Sensors Check Obstacles configuration window www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 135 of 175 e Line This module checks the digital value of line sensors This module is very useful for making mOway follow a line black or white on the floor detect boundaries etc
139. y 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 MPLAB IDE v8 33 Sele File Edit View Ac Debugger Programmer Tools Configure Window Help Dob Checksum New Open Close E Untitled Set Active Project Quickbuild no asm File Package in zip caf Build Configuration Build Options save Project save Project As Add Files to Project Add New File to Project Remove File From Project gt Select Language Toolsuite Set Language Tool Locations Version Control PIC1SF2550 H novzdcc bank 0 Image 51 Project Wizard 1 First select the PIC installed in mOway PIC18F86J50 www moway robot com Title mOway User Manual Rev v3 1 2 April 2013 Page 86 of 175 Project Wizard Step One Select a device Image 52 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 MPLAB C18 C Compiler mccl8 exe v3 35 MPLIB Librarian mplib exe Location Browse Store tool locations in project Help My Suite lant Listed Show all installed toolsuite
Download Pdf Manuals
Related Search
Related Contents
SERVICE MANUAL - Shark Pressure Washers Samsung DVD-HR720 MP3 Player User Manual GDB 1600 WE GDB 1600 DE PROFESSIONAL Lenovo ThinkCentre M82 Cellules moyenne tension Cellule isolée au gaz jusqu`à - Link Masters, LLC Timex 229-095000 Heart Rate Monitor User Manual MANUAL DEL USUARIO lux Le 16 mars 2015 Citycable passe au tout numérique ! VIRTUAL CAPITOL Manual de usuario Copyright © All rights reserved.
Failed to retrieve file