Monday, January 30, 2012

A robot for beginners



An aluminum, two wheels and of course a touch of electronics and the game is done!
A group of students electronics has put into practice the knowledge acquired on the benches of the school to make a simple robot whose "intelligence" in a small microcontroller is programmed properly.

Specifications:
- Power supply: 4 x sticks;
- Maximum current consumption 40 mA;
- Motion by two DC motors;
--Detectors with limit;
- Table edge detectors, infrared;
- Control microcontroller (16F84A).

Microrobotics is for students in Graduate Schools of electronics a multidisciplinary activity able to converge studies in various fields and increase their motivation, while helping them understand the potential and limitations of the technological world around us.

Our achievement
This paper presents a project that comes straight from the lab of one of these schools. For his achievement, many knowledge in the fields of IT and electronics and, of course, the latest progress of microcontrollers have been involved. The robot we will build our tower was developed as the final production by fifth graders. The starting point of the project was to design a small robot able to move independently on a table (and without falling down!).
The presence of two infrared sensors oriented toward the surface of the table allows the robot to detect the edge and using programmed maneuvers, stop, turn on itself and resume its progress without falling.
The limit switches located on its anterior detect potential obstacles and allow the robot to stop and avoid them. The first robotic work has been to keep it simple and use only components readily available and cheap: the mechanical part has been reduced to the essentials.

Description mechanics
To move the robot we chose two gearmotors Micro Motors L149.12.43 model whose characteristic is their very low inductive component and very low power consumption. It allowed us to connect the motors directly to the line of PIC, saving a power stage. The diodes present inside the microcontroller can mitigate small surges caused by inductive component engines during the commutations. Also in this goal, we have provided with the software adding a little break to avoid an instant reversing motors.
The reduced size of the latter can make a robot small, compact and easily usable on a table. Mechanics reduces to a simple metal plate shaped (aluminum) U
Inside the U and motors are fixed on the top plate was fixed on the main PCB.
For electrical connections were used for simple printed circuit connectors. On either side of the front infrared sensors are wired to two tiny plates and to detect the edges of the table, the limit switches are also mounted at the front but on the top shelf.
To enable very early detection of the obstacle, the lever end of the race was lengthened by a piece of wire. Since we want to use the robot on a table smooth, smooth, it was decided not to mount an extra wheel (usually an element pivoted) and let the robot build on one side of its metallic structure. Its dimensions are approximately 15 x 15 cm.
Power is constituted by a block of four sticks batteries (or rechargeable Ni-Cad): they are fixed by four Velcro inside the U, so as to maintain the center of gravity as low as possible and obtain a maximum stability during walking. The wheels are plastic and were machined specifically for this purpose and were streaked on the outer edge to increase the elasticity and hence increase the adhesion.



wiring diagram

 Figure 1: Diagram of the controller board.

The four rechargeable batteries provide a voltage of 4.8 V already stabilized feeding the circuit: no controller is thus required. At the time of testing, the robot was powered with batteries: we then arrive at the maximum voltage by the microcontroller, but the chip works perfectly. The PIC16F84A (U1) is the heart of the circuit and shall defer all operations: two motors are directly connected to him, and the two infrared sensors CNY70.
As shown in the wiring diagram in Figure 1, these sensors consist of an infrared emitting diode and a phototransistor, the two elements being included in the same case and shot the same side (see Figure 6).
The beam emitted by the phototransistor is reflected by the surface located opposite (in this case the surface of the table) and returns to strike the receiver, thus driving the phototransistor: this confirms the presence of the useful reflecting surface (the support on which the robot evolves) under the sensor, that is to say under the wheels of the robot.
When however it reached the edge of the table, the light beam "type" in a vacuum, it is not reflected and the receiver is not illuminated: the phototransistor is blocked, the microcontroller sees it and acts accordingly. Two trimmers are associated with sensors R1 and R2 can adjust its sensitivity.
The trimmers are adjusted to allow the micro sensors and thus determine if the surface of the table is present or not: thus, when the robot reaches the edge of the table, he stops and turns back.
This works best with table-colored, smooth, if possible, to reflect more intense.
With a table of dark and poorly reflecting surface, problems could arise about the detection (presence of "soil"). The recognition of potential obstacles on the line of march of the robot is assigned to two limit switches with mechanical contacts is in series with the signal from the infrared sensors and they make the robot perform the same functions.
The correct orientation of the binding engine is simply done by trial: when the robot is on the table and he does not encounter obstacles, the advance must be straight.
On the main board there are few components (see Figures 2a and 3) a crystal and an LED indicating power on the robot using the slide switch SW3, plus a few resistors and two trimmers with we treated. That's all and this leads us to the practical realization of the plates.

 Figure 2: Schematic implementation of the components of the controller board.

 Figure 2b: Drawing scale 1, the printed circuit board control.

Iist ET659
R1 ..... trimmer 47 kilohm
R2 ..... trimmer 47 kilohm
R3 ..... 220Ω 1%
R4 ..... 10 kW 1%
R5 ..... 10 kW 1%
R6 ..... 1 kΩ
R7 ..... 1 kΩ
C1 ..... 22 pF ceramic
C2 ..... 22 pF ceramic
C3 ..... 100 nF 63 V polyester
LD1 .... LED 3 mm green
T1 ..... CNY70
T2 ..... CNY70
Q1 ..... 4 MHz quartz
SW1 .... Limit switch
SW2 .... Limit switch
SW3 .... Vertical Slide Switch
U1 ...... PIC16F84A-EF659 already programmed in the factory
M1 ..... Gearmotors Micro-Motors L149.12.43
M2 ..... Gearmotors Micro-Motors L149.12.43

Miscellaneous:
2 x 9 1 support
January 1 battery holder 4 x 1.5 V
2 strips 4 males pitcher hes
5 bars male 2 pin Unless otherwise specified, all resistors are 1 / 4 W 5%.

 Figure 3: Photograph of a prototype of the controller board.

All functions are controlled by a PIC16F84 microcontroller which analyzes information from both CNY70 optical sensors and controls DC motors directly.
Both sensors are mounted on two small plates (for details see Figure 5) and are able to detect when and which side the edge of the table on which the robot moves.




The practical realization
There is no particular difficulty and a beginner, it is a bit careful, it will come out very well.
First prepare the single-sided printed circuit 2b which gives you the 1:1 scale drawing or get it. First, mount the support of the CIP, the two bars and five peripheral connectors, then check out these first welds (or short-circuit between tracks or pads or cold solder joints).
Then, exactly as shown in Figure 2a (and the list of components) and Figure 3, climb all the components starting with those with the lowest profile (such as resistors, LED, ceramic and polyester capacitors and ending with the bulkier as quartz (up to lying down), slide switch and two trimmers. Pay close attention to the orientation of active components (LED and PIC repèredétrompeur U outward from the plate for the latter, but do not insert at the end).
Next perform the two small plates of optocouplers whose 4b gives you the drawing to scale 1: 1 or get the. Mount to the optocouplers, as shown in Figures 4 and 5.
Attach the large plate on top of aluminum profile, as shown in the photos section. Fit the two small plates at the front, inside of the U. Also at the front, but on top of the section, attach the two limit switches (which you extended levers with stiff wire and shrink tubing). Attach the two motors on the frame (see the journal's website).
Attach the rechargeable battery pack inside the U before the Velcro and attach it to the plate.
Connect, through netting connectors, two small plates to large and the latter two switches and motors. The robot is supplied ready for use.
Like setting, just adjust the orientation engines for walk straight and sensitivity of sensors with the trimmers according to the reflectivity of the medium (table top).


 Figure 4a: Schematic implementation of the components of the two plates supporting the sensors.

 Figure 4b: Drawing scale 1, the circuit board of one of the two plates supporting the sensors.

 Figure 5: Photos of a prototype of the two plates supporting the sensors and sensor.

 Figure 6: The reflection of the infrared beam generated and detected by CNY70 can determine when, under the robot, the surface the table on which he ceases to be changing this.


resident program the PIC
This "listing", written in Assembler, configured as input lines and RB1 RB0 as outputs and RA0-RA3. It is expected that the robot avoids obstacles the same way and the edge of the table: the signals to manage are those that refer to Table 1.

TABLE 1


The four outputs, as shown in Table 2, control the motors.

TABLE 2


The robot avoids obstacles and table edge because every time the sensors are activated immediately reacts by running the appropriate operation.
First he comes back slightly, then turns on itself in the opposite direction to the presence of the obstacle and continues its march. To better understand how, look at the chart in Figure 7 and the "listing" of assembler in Figure 8.
We see that the first block named "setup" and configure the PIC interrupt predisposes the "timer" which will be used to obtain the dwell time of the engines. The main block ("Ripetta) constantly monitors the status of sensors: when it detects the alarm signal, it jumps to subroutines" FCDX "or" FCSX "which make the robot execute the avoidance maneuver .
The delay is reported in the subroutine "delay" which receives the value contained in the Working register, the delay value.

 Figure 7: Flowchart.
LIST P = 16F84A 
INCLUDE  

EQU 0CH told 
org 0 

goto setup 
org 4 

Interrupts 
DECF told, each counter counting 0065 sec 
movlw 0H 
movwf TMR0; is "timer" to zero 
bcf Intcons, T0IF; detects the interruption 
RETF; the program returns to point 
And before interrupts 

setup 
CRLC told, is counter to zero 
bsf STATUS, RP0; selects pupitre1 
movlw 0FFh 
movwf TRISB; Port B output 
movlw 00H 
movwf TRISA; Port A input 

movlw B'11010111 '; prescaler (256) on TMR0 
movwf OPTION_REG 

bcf STATUS, RP0; selects pupitre0 
tso Intcons, T0IE; empowers the timer interrupts 
tso Intcons, GIE; enables interrupts 
CLRF PORTA; resets all outputs 

Ripetta 
movlw 0AH; advance 
movwf PORTA 
btfsc PORTB, 0; collision FCDX 
goto FCDX 
btfsc PORTB, 1; collision FCSX 
goto FCSX 
goto Ripetta 

;************************************************* ******** 
, The robot has hit an object on its DX 

FCDX 
;************************************************* ******** 
; Engine stopped 
CLRF PORTA; engine stops 
movlw 0BH; delay parameter 
call delay 

;************************************************* ******** 
; Active rear control 
movlw 05H; astern 
movwf PORTA 
movlw 19H; delay parameter 
call delay 

;************************************************* ********* 
; Engine stopped 
CLRF PORTA 
movlw 0BH; delay parameter 
call delay 

;************************************************* ******** 
; Turns SX 
movlw 06H 
movwf PORTA; turns SX 
movlw 19H; delay parameter 
call delay 

;************************************************* ********* 
; Shutdown 
CLRF PORTA 
movlw 0BH; delay parameter 
call delay 
goto Ripetta 

;************************************************* ******** 
, The robot has hit an object on its SX 

FCSX 
;************************************************* ******** 
; Engine stopped 
CLRF PORTA; engine stops 
movlw 0BH; delay parameter 
call delay 

;************************************************* ******** 
; Active rear control 
movlw 05H; astern 
movwf PORTA 
movlw 19H; delay parameter 
call delay 

;************************************************* ********* 
; Engine stopped 
CLRF PORTA 
movlw 0BH; delay parameter 
call delay 

;************************************************* ******** 
; Turns DX 
movlw 09H 
movwf PORTA; turns DX 
movlw 19H; delay parameter 
call delay 

;************************************************* ********* 
; Shutdown 
CLRF PORTA 
movlw 0BH; delay parameter 
call delay 
goto Ripetta 

;************************************************* ********* 
; Subroutine delay (the delay is spent with W) 
, Each count = 0.065 sec (1sec delay for W = 15) 

delay 
movwf told, puts the value of W on counter 
atd 
movf contaminated, 0, puts the counter value of W 
btfss STATUS, 2; control if count = 0 
goto atd 
return 
end 
Figure 8: "Listing" in Assembler.

Conclusion
The targets they had set were achieved by students and it has many rewards for their investment of time and effort. During the implementation, new directions have emerged for future development.
Interest in this project has been useful not only for teaching but also as an experience of group work (that is to say, mutual respect and cooperation necessary).

No comments:

Post a Comment

Most visited posts this week