Home
electronic locking for high voltage grounding system
Contents
1. void gir2 void This is our usual include F 16Mhz The delay functions routines 39 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 Second stepper move int x 1 1 PORTB 8 delay ms x PORTB 12 delay ms x PORTB 4 delay ms x PORTB 6 _delay_ms x PORTB 2 delay ms x PORTB 3 delay ms x PORTB 1 delay ms x PORTB 9 delay ms x 40 6 1 4 menu c 1 include lt avr io h gt 2 include lt util delay h gt 3 include lt util twi h gt 4 include lt avr interrupt h gt 5 include lt stdbool h gt 6 include lt inttypes h gt 7 Hinclude serial h 8lHinclude display h 9 include E2PROM h 10 include lt avr sleep h gt 11 12 char x 13 char y 14 15 16 17 18 x 19 void adorm ard void 20 set sleep mode SLEEP MODE PWRDOWN 21 sleep enable 22 sleep cpu 23 24 x 25 26 void init_princ void 27 init 28 serial init 29 setup tw 30 e2prom init 31 display init 2 0 32 display on 33 display cursor on 34 display clear 35 36 37 38 void write eprom void 39 40 e2prom write OXEA 0x02 E2prom write 41 e2prom_write2 0xEA 0x02 42 43 44 45 void comparacio void 46 Authentication comparsion 47 x e2prom read 0xEA 48 y e2prom_read2 0xEA 49 y 0202 50 51 if
2. 6 1 6 display c 1iHfinclude lt stdbool h gt 2 include lt inttypes h gt 3 include lt util delay h gt 4 include display h 5l include twi h 6 7 uint8 t addr cols 8 uint8_t display basic 9 uint8_t display extended 10 uint8_t displaycontrol 11 uint8_t displaymode 12 13 static bool send address display t void 14 static bool send address display r void 15 static void instruction uint8 t value 16 static void write uint8 t value 17 18 19 20 static bool send address display t void 21 Funcio de base 22 Catch channel and send display address 23 in write mode x 24 25 catch channel 26 return send_address_mt 62 27 28 29 30 static void instruction uint8 t value 31 32 send address display t 33 _delay_us 5 34 send data 0x00 RS clear 35 delay us 5 36 send data value 37 delay us 5 38 release channel 39 delay us 30 40 41 42 static void write uint8_t value 43 x Escrivim el valor a la pantallax 44 send address display t 45 delay us 5 46 send_data 0x40 Rs Set 47 _delay_us 5 48 send data value 49 _delay_us 5 50 release_channel 51 _delay_us 30 52 53 x 54 Usage functions 55 kx 56 void display init uint8_t rows uint8_t height 57 58 addr 62 59 cols 8 60 61 display basic LCDINSTRUCTION SET B
3. This display was choosen because it communicates easily using the i2c bus technology which is the one we use in our system As you will see in the display module we programmed a specific library to write in the display easily Also you will see now the connection diagram for the display as well as the dimensions The display pins increase from left to right By this we mean that the first on the left is number one and the last one on the left is eight Figure 2 10 Display connections and dimensions In the following table you will see a basic description of the connections Bascially we connect to voltage inputs and a ground Also we connect the SCL and the SDA inputs to the bus system The reset is connected to the ground also in the case you want to reset the display you have to trigger up the system to 5V The CAPIN and the CAPIP pins remain unused Display pin Description 1 Vout pin voltage input con nection 2 Cap1N pin 3 Cap1P pin 4 Vdd connection voltage input connection Vss ground connection SDA connection SCL connection CO NI Od Or RST reset connection Figure 2 11 Display connection table 18 2 3 Clamp hardware Inside each one of the pair of clamps we have a small board that contains the hardware necessary to control the stepper and to identify the clamp pair as a single one This is basically done using the following hardware whoose operation
4. gec CPPFLAGS DF CPU 16000000UL CFLAGS Wall std c99 Os mmcu atmega328p fshort enums LDFLAGS mmcu atmega328p queue o gueue h serial o serial h gueue h twi o twi h serial h display h gueue h display o display h twi h serial h E2PROM o E2PROM h i2c h display h twi o menu o E2PROM h menu h i2c h display h serial h twi h i2c o i2c h motor o serial h motor h queue h sleep o polsadors h serial h queue h polsadors o serial h polsadors h prova display o twi h display h serial h prova_display twi o display o serial o queue o main2 o serial h display h i2c h E2PROM h twi h menu h motor h polsadors h sleep h main2 serial o queue o display o i2c 0 F2PROM o twi o menu o motor o polsadors o sleep o main3 0 twi h display h serial h queue h main3 twi o display o serial o queue o driver_pressure o twi h hex avr objcopy Oihex lt Hc hex avrdude c arduino p atmega328p P dev ttyACMO U lt rm 0 Gel hex avrdude c arduino p atmega328p P dev ttyACM1 U lt rm 0 _isp hex avrdude c avrisp b19200 p atmega328p P dev ttyACMO U lt IM 0 PHONY clean veryclean clean rm f 7 x o x s hex MAKE C libpbn clean veryclean clean rm f master MAKE C libpbn veryclean 49
5. referring to achieveing the project expectations and specifications During this meetings I showed physically how the device was working and evolving since the last meeting and also I explained what was the next step we will be developing After my explanations it was the turn for the tutor and the company to tell me what improvements could be made and also what modifications they wanted me to do in the system It must be said that usually the meetings with the company were not made directly meaning that the tutor had a meeting with the company and afterwards it was only me and the tutor doing a project evolution meeting 11 2 Hardware description 2 1 Introduction Certainly one of the most important parts in any project is the hardware As we already explained our system consists of a very few hardware parts as it is a very basic electronic system The basic idea consists of an external device that will be connected to any clamp and that will make it work We will later on explain what this external device consists on The way we will connect the external device to the clamps will be using a pair of Db9 connectors one for each of the pairs of the clamp The external device will be the one containing the processor and all the user interface parts This includes the display and a pair of buttons This external device contains the most of the hardware parts our project will have The hardware inside the clamp won t be acessible to any
6. x y 52 display clear 53 display_write Authentication 54 display setcursor 0 1 55 display write OK 56 delay ms 2000 57 58 else 59 display clear 60 display write Authentication 61 display setcursor 0 1 62 display_write failure 63 _delay_ms 2000 64 41 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 void benvinguda void Welcome init_princ display_write 7 Welcome _delay_ms 2000 display_clear display_write Initializing the display_setcursor 0 1 display write system delay ms 2000 void authentication void System authentication display clear display_write System display_setcursor 0 1 display_write authentication _delay_ms 2000 comparacio void adeu void Goodbye display_clear display_write Autentificacio display_setcursor 0 1 display_write acabada delay_ms 2000 display clear display setcursor 0 0 display write Desbloquejant _delay_ms 2000 display_clear display write 7 Enclavament display_setcursor 0 1 display write obert delay_ms 2000 display clear display write Fins aviat
7. 19 Eagle interface picture The design of the board has been performed using Eagle a very specific program for board designing The user interface of the program is very easy going and we got used to it very easily The designing of the board has two basic parts e Schematic design e Board layout design To design the schematic the first step is choosing all the components that we need in our board and connecting them to one another using the eagle software It is of vital importance not forgetting any component nor any interconnection as later on we will link this schematic file to the board layout and if there isn t a single component we will have lots of troubles 23 When finished our schematics from the main board and clamp board looked like this JP db pS 2 ABCDEF GH JKLMNOP IABCDEF GHIJKLMNOP DSP1 Figure 2 20 Main board schematic design FH21 6S 1DSA Figure 2 21 Clamp board schematic design 24 Once we finish our schematic it is time for the layout designing Unlike the schematic this the closer you can be to hell if you have never designed a board layout In our case both boards are quite simple yet we had lots of problems until we finished them successfully The main problem is that not a single track of the board can ran over any other as we would get a short circuit This may seem
8. an Bs aS eee BN ee ee Bw eH SR Py ee al 32 4 Conclusions 33 da Ee me ane eos se es ens Sm ee e ee see ee Setena es eee a 33 5 Bibliography 34 6 Annexes 35 Bl Cod ls kn Boe edt Be Ra RE Ne na De a en be Oe aus dite LUE 35 OLEC EC et ee feber be Pena A eee SD PE ee h 35 dod oo Oh tse Hh a mh Ep oe he ee Ge a eae a Ge Sey eh eee ha de a la 38 6 1 MOLOore e e do do hee a daa eg ue Sas r Kees ba 39 OLEA Menuda sa Se eS Sek eks ea FG OER Ra dl 41 6 1 5 2B 2PROMEG des sri a bm be Leena ge es a EES RAS tah SR s 43 Sh nan EE ees aes gee es ee MO de NE van an A 44 GLT AANG se ra Se aa SEA Re SSE Se SG RE Se ma Hd 48 6 1 8 Makefile The present document includes all the documentation and information regarding this final degree project This project is basically designed with the idea to improve the security and make it easier for the people who have to deal with high voltage lines to do their work Such information includes all the possible topics going through the very first ideas and reaching the conclusions in the end Also it explains all the hardware and software that it includes and how they are related one another Also it explains the desiging procedure that has been followed It is of crucial importance to mention that this project has been designed and created under the request of the company Sofamel SL to fulfill it s needs and ambitions They firstly presented a need of improving a system that had always been
9. delay_ms 2000 display clear 42 CC NI IP WN 29 36 55 56 57 58 59 60 61 62 63 64 6 1 5 E2PROM c include lt stdint h gt include E2PROM h include twi h include display h void e2prom init void Init setup tw static void e2prom addressing uinti6 t address First eeprom direction x catch channel send data E2PROM SLA_W send data int address gt gt 8 MSB send data int address amp 0xFF LSB static void e2prom addressing2 uinti6 t address Second Eeprom directionx catch channel send data E2PROM SLA W2 send data int address amp 0xFF LSB void e2prom write uint16 t address char data First eeprom writex e2prom_addressing address send_data data release channel void e2prom write2 uint16 t address char data x Second eeprom writex e2prom addressing2 address send data data release channel char e2prom read uinti6 t address First eeprom readx e2prom_addressing address release_channel rep catch channel send data E2PROM SLA R char data receive data release channel return data char e2prom read2 uint16 t address x Second eeprom readx e2prom addressing2 address release channel rep catch channel send data E2PROM SLA R2 char data receive data release channel return data 43
10. designed for our project This board is responsible for all the system configuration and operation as the rest of the system is pasive and only waits for orders from the main board 13 2 2 1 Microcontroller The microcontroller we will be using is the Atmega 328p as it is the one that best fits ours project needs To use our microcontroller we added to it when designing the board schematic the necessary components to adapt it to something similar to the Arduino board which is the one we used for our prototype So as to do this we added a pair of push up buttons some resistances as well as capacitors and a 16Mhz Oscillator Crystal AYR Pragrammer Figure 2 3 Atmega Original Schematic In the picture above we can see a picture of the the Atmega328p schematic in the picture below you can see the physical aperance of the microcontroller welded to the board Figure 2 4 Atmega 328p The utilities that we will be using from our processor are the one s that follow e Eight digital outputs PD4 PD7 and PBO PB3 e SDA and SCL bus outputs e Sleep Mode Voltage and Ground outputs e PC6 Reset as Reset Button PD3 INT1 as a Digital input 14 The eight digital outputs will be used to control the two steppers one in each of the pair of clamps What we do is just setting the voltage high 5V or low 0V The SDA and SCL i2c bus outputs are used for the communication with the E2proms and the display also it is our crucial i
11. encen el displayx displaycontrol LCD DISPLAYON instruction LCD DISPLAYCONTROL displaycontrol delay us 30 void display _off atura el displayx displaycontrol amp LCD DISPLAYON instruction LCD DISPLAYCONTROL displaycontrol delay us 30 void display_cursor_on void displaycontrol LCD CURSORON instruction LCD DISPLAYCONTROL displaycontrol delay us 30 void display cursor off void displaycontrol amp LCD CURSORON instruction LCD DISPLAYCONTROL displaycontrol delay us 30 void display_blink_on void Activem el blink del cursorx displaycontrol LCD BLINRON instruction LCD DISPLAYCONTROL displaycontrol delay us 30 void display_blink_off void displaycontrol amp LCD_BLINKON instruction LCD DISPLAYCONTROL displaycontrol delay us 30 46 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 void display_left void shifta el display cap a l esquerrax instruction LCD FUNCTIONSET display_basic delay us 30 instruction LCD CURSORSHIFT LCD_DISPLAYMOVE LCDMOVELEFT delay us 30 void display right void shifta el display ca
12. inttypes h gt Hinclude serial h include display h include E2PROM h include menu h include motor h include lt avr sleep h gt include lt util delay h gt include lt avr io h gt include lt stdbool h gt CC I IP WN Le mel enti bm rwWNYNr 15 include polsadors h 16 include sleep h 17 18 19 void loop void 20 Main loop of the system 21 desperta 22 benvinguda 23 urite eprom 24 comparaci 25 authentication 26 adeu 27 set up2 28 degree 29 display clear 30 adorm 31 32 33 34 35 int main void 36 system init 37 benvinguda 38 init pols 39 sei 40 degree a loop 42 int a 43 while true 44 loop 451 gt 46 return 0 471 48 49 Interrupt atention routine 50 ISR INT1 vect 51 delay ms 20 52 loop 53 if valor_alt 54 display clear 55 loop 56 If it gets here is because there is an interrupt 57 58 desactiva flag 59 48 CC NI oO IP WN 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 6 1 8 Makefile C avr gcc CPPFLAGS DF CPU 16000000UL CFLAGS Wall std c99 Os mmcu atmega328p fshort enums Ilibpbn LDFLAGS mmcu at mega328p HOC avr
13. person and it will be only for identificating any pair of clamps as something unique Furthermore using the Db9 connector it will be the clamp board the one moving the stepper motor inside the clamp to enable the worker to externally open the clamp It is very important to understand that first we will design a prototype for testing our hardware and software and afterwards we will design the final board that will be inside the device using Eagle Db9 connector Driver Stepper External device Internal Device Figure 2 1 State diagram for our system 12 2 2 External device This external device consists on a system that has as objective to control the whole clamp Meaning this we understand interacting with the user and sending the orders to the clamp Firstly we designed a prototype to make all the tests and configure all the hardware properly Afterwards we designed the board layout with all the components together so as to be integrated in a single device The board contains the following hardware whoose operation will be explained lately One Atmega 328p processor Two Capacitors of 22pF and one of 100pF One 100KOhms Resistor one 2kOhms Resistor and two 4 8KOhms resistor Two Push up buttons One 16Mhz Crystal oscillator One MCCOG21605B6W Display Two Db9 Output connectors One Double Input pin One ISP Input connector Figure 2 2 External device board In the figure above we can see the main board we
14. pins location It is of crucial importance to connect both lines using a pull up to 5V This is very important when using i2c as the system wouldn t work without the pull up s the value of the resistors is 48KOhms each In the following picture you will see a diagram of how the pullup should be connected as well as some aleatory devices Figure 3 2 i2c connection diagram with pull up After all this previous matter regarding the setup we program our Processor to initialize the system and communicate to the slaves that we want When this is done it is time to connect the slaves to the line It must be said that it is crucial when defining the code that we compile in our Processor that the slave adresses are defined properly both physically and in our software They must be the same Usually most of the systems have 6 7 bit adress that are fixed and there are 1 2 bits that can be choosen by hardware externally This allows us to define the address of our slaves in the case of connecting two slaves of the same kind 28 3 3 Modules As we already explained our system is structured in modules because it is the best way the define a clear structure To make an approach to this structure we will begin listing all the modules that are included in our system and we will later on explain the communication and dependencies between them using a jerarchy and dependency diagram In later chapters we will include all the code in our project so
15. that we can take even a closer look to our system Also we will explain what each module is responsible of This is the list of the modules included in our system e twi c e display c e E2PROM c e motor c e menu c e main c e sleep c e polsadors c Also we have a Makefile which is the responsible of structuring the dependencies between modules and compiling it into a single file Our system is very simple and easy to understand as we have very few lines of code In the next page we will illustrate you with a module diagram so that you can better understand which modules is used for who and what are the dependencies between them 29 In the following diagram we want to show how our modules interact with one another The arrow indicates how the information flows in our system By this we mean that the main c is the module using information from the four below and the menu is using the other two and so on Also it must be said that all the modules include some packages that are not self explained in this diagram but that are included in the annex so that you can check them polsadors c Figure 3 3 Software modules digaram 30 3 3 1 twi c The twi module is the one responsible for the most basic communication with the i2c bus This module is responsible for first of all configurating the speed the address the master and the salves Also it physically sends the instructions for reading writting the registers in a certain slave
16. the memories and the authentication we thought it was a good idea to use a display to show the user in which state was the device Concerning this matter we used a very simple display that we already used in some projects during our degree The usage of this display will be very simple it will only show the user what is the system doing at that exact moment For example when the user connects the device to the clamp and presses the button the device wakes up and starts with the indentification of the clamp While doing it it prints on the screen of the display whether the authentication has been a failure or not When the authentication is over we bump into the serious part of the project that is the physical operation of the clamp We needed something that in the case of a failure in the authentication would not allow the person working with the clamp to open it The idea we had is to move an interlocking 90 degrees so as to enable the clamp to be opened manually In the case of a failure during the authentication the interlocking would remain closed and the clamp won t be opened After having a clear idea of how our design would work we started thinking what could we be using to move the interlocking The best idea of which we could think was a bipolar stepper motor with which we would be able to excacly move a certain interlocking 90 degrees It must be said that this will be done two times like with the EEPROM s because we have a pair of
17. 8 TW_MR SLA_ACK JA bool catch_channel void start wait twint return check start bool rep_catch_channel void start wait twint return check rep start bool send_address_mt uint8_t a data ac xl wait twint return check mt address bool send_address_mr uint8_t a data a lt lt 1 0b00000001 wait twint return check mr address bool send_data uint8_t d data d wait twint return check mt data int8_t receive_data void uint8 t d TWDR TWCR 1 lt lt TWINT 1 lt lt IWEN 1 lt lt TWEA wait twint int8_t d TWDR return d int8_t receive_data_last void uint8 t d TWDR TWCR 1 lt lt TWINT 1 lt lt TWEN wait twint int8_t d TWDR return d void release_channel void stop wait stop x Innit void setup_tw void 36 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 DDRC OxFF Ports de sortida TWSR amp 0b11111100 Prescaler 1 TWBR 72 Freq 100kHz sei uint8_t regRead const uint8_t slave_addr const uint8_t reg register read uint8 t data catch channel send address mt slave addr send data reg display write OK1 rep catch chann
18. ASIC LCD8BITMODE LCD_1ILINE LCD_5x8DOTS 62 display extended LCD INSTRUCTION SET EXTENDED LCD8BITMODE LCD ILINE LCD 5x8DOTS 63 displaycontrol LCD DISPLAYON 44 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 uint8_t contrast Ox0A if rows gt 1 display_basic LCD_2LINE display_extended LCD_2LINE if height 1 rows 2 display basic LCD_5x16DOTS display extended LCD_5x16DOTS delay_ms 40 instruction LCD FUNCTIONSET display basic delay us 30 instruction LCD FUNCTIONSET display extended delay us 30 instruction LCD_BIAS_OSC_CONTROL LCD_BIAS1 5 LCD_OSC_192 delay us 30 contrast low nible instruction LCD CONTRAST LOW BYTE contrast LCD CONTRAST LOW BYTE MASK delay us 30 contrast high nible icon power instruction LCDICON CONTRAST HIGH BYTE LCDICON ON LCD BOOSTER ON contrast gt gt 4 amp LCD CONTRAST HIGH BYTE MASK delay us 30 follower control instruction LCD FOLLOWER CONTROL LCD FOLLOWER ON LCD Rab 2 00 _delay_ms 200 Junction set basic instruction LCD FUNCTIONSET display basic delay us 30 display on un
19. ELECTRONIC LOCKING FOR HIGH VOLTAGE GROUNDING SYSTEM Eduard Boja Josep Font Teixid 10 June 2014 Contents 5 Se ee oes Doe SE E aos Se oe ee Se 7 Lo EO ee Se ee SEE eee i 8 By RAE Tela de nn ae EEE EE cee Gey ee Gea sa en tes Sees 8 oy Gy fe re Eee ates acer Seas NAS ee cy D et eee ae ay ate Maan ages eres 8 SAA oe ge Sees Ste Bee Sy es ee ee es ee ee es Gin 10 1 3 Meetings with the tutor and the Companyl 0 000052 ee eee 11 12 EE Dah ee eu tae ve aa oe Ge a ee ae ee ee E 12 2 2 external device resi sed ee eed ke SG de Saw ae Sh ee Ed 13 2 2 1 Microcontroll rl ss dok betes Avge STG Fre wid ae ee eh s see Nos eu 14 2 22 POWER sak kva ke ea a ce a ie o 16 2 23 ES ee ee ee dk Gan deh 17 Yew ees a ee ee a a a ea Ed 19 2 0 1 B2PrOMy 2 ob 4 ve dass Se RRA d 21 Be ck eee D dr Se ee eee Ba tgn pl 22 Soe en ye El Seed A Rae Oe EN A 23 27 Bote es oe ES eee ee 27 32 BPO BUSI o ss ke ke bee els e Ce VE Oe R a 27 3 3 Mo d les o eh 4 ao Sk su se he e a ee ee a DE Gee ae a a 29 391 GWEC 5 oe sr oe Oke bea Owe ae Pea ba hae eee Dee ae ewe Bo a 31 as Sys Ge eee ee ara 31 333 IED ROME ee dde da ld Eee e eG 31 3 34 Motord concisa ica BIN A GE er a a di 31 A Se eee es 31 AE Cl E ua hf Uh Sm doe Ate E Gnd dow ee A A Stee EE es Bi a A 31 3 3 Mente sos Pod Lea RUE as OS ee Ga ee ob 32 3 38 MAIN Clea sat sa Ge Ge ee AN ENS ny eee MN Se Oe de eh ee PG 32 33 09 Maket ed occ amp rv Gop
20. clamps so each one needs it s own interlocking The next thing we thought of is the battery needed to make the arduino work The arduino needs 5V to be working and will only need the power to work himself as the only thing that will be doing is eventually moving the stepper motor 90 degrees We will later on do some calculations to know how long would a battery last and what kind of it do we need The last thing we thought we needed was a pair of buttons to operate the whole device and that will have a function that we will explain later on 1 2 Project Explanation 1 2 1 Introduction During this chapter we will be explaining the basis of both our project and the original one that is the one we will be using as example From the original one we will be keeping the physical design as we just want to use it to install an electronic system Furthermore we will be using the same concept of key to open the system but instead of using a physical one we will be using an electronic one Also the design of our project is structured in two basic phases The first one is designing a prototype for our system and as soon as it works we will start designing all the physical electronics and board layout for our final system 1 2 2 Existing system At this point you may have a more or less clear idea of how our project works but how did the existing systems work And also what are their basic parts and what needs to be improved from them The previou
21. d by the main c 3 3 8 main c This is our princpial module as it name indicates It s objective is to use directly or indirectly all the modules in our system Our main is based in a routine that attends the interruption when the button to wake up the system is pushed After this the system does the authentication of the two E2PROM s in the clamp and if the authentica tion is alright the system opens the locking of the sytem allowing the user to open the clamp manually After this it send the processor back to sleep If the authentication is a failure the system goes back to sleep again It must be said that the system while processing all this actions it mantains the user informed of the actuation using the display sending the system status at all time 3 3 9 Makefile c The makefile is not a module at all but we thought we had to include it as it is a very important piece of our design The makefile is used for compiling the main and sending it to the processor successfully If you want to further see what is it based on you can take a look at it on the annex chapter 32 4 Conclusions The conclusion of our project is that we successfully designed a device to improve system that had worked mechanically for so long This was our objective from the very begining as all the mechanical systems have huge limitations Our design apart from beeing very compact is suitable to lots of changes in the case of beeing necessary In thi
22. de up content uploads 2011 05 V6 manual en pdf 34 Co TD TENUN 6 Annexes 6 1 Code 6 1 1 twi c include lt avr io h gt include util twi h include lt avr interrupt h gt include lt stdbool h gt include lt inttypes h gt include twi h include display h Envia static void start void TWCR 1 lt lt TWINT 1 lt lt TWSTA 1 lt lt TWEN static void data uint8 t d TWDR d TWCR 1 lt lt TWINT 1 lt lt TWEN static void stop void TWCR 1 lt lt TWINT 1 lt lt TWSIO 1 lt lt TWEN Espera static void wait twint void while TWCR amp 1 lt lt IWINT static void wait_stop void while TWCR amp 1 lt lt TWSIO Verifica x static bool check start void return TWSR amp OxF8 TWSTART static bool check_rep start void return TWSR amp OxF8 TW_REP START static bool check_mt_address void return TWSR amp OxF8 TWMTSLAACK static bool check_mt_data void return TWSR amp OxF8 TWMT DATA ACR static bool check mr address void 35 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 TT 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 return TWSR amp OxF
23. disable 26 27 EIMSK 1 lt lt INTI 28 EIMSK 1 lt lt INTO 29 30 31 bool valor _alt void 32 xRise up interruption checking 33 34 return PIND 1 lt lt PD3 0 35 36 37 void desactiva flag void 38 flag disable 39 40 EIFR 1 lt lt INTF1 411 38 6 1 3 motor c include motor h include lt stdlib h gt CNI IE WN PEE BPP BWWWWWWWWWWNNNYNNNYNNYNNNYNYP RP RP PRP RP RP pl pl bn OO ND PC DO NN GG IE ND HP CD NI GG ND OC COI GG ND HC COLO 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 include include include include include lt avr interrupt h gt lt avr sfr_defs h gt queue h lt util delay h gt lt avr io h gt define FCPU 16000000UL include lt util delay h gt void set up2 void DDRD DDRD DDRD DDRD DDRB DDRB DDRB DDRB 1 lt lt PD7 4 1 lt lt PD4 1 lt lt PB3 1 lt lt PB2 1 lt lt PBO void degree void 45 degrees rotation int t 0 while t 130 girl gir2 t 1 void girl void f First stepper move int x 1 1 PORTD 128 _delay_ms x PORTD 192 delay ms x PORTD 64 delay ms x PORTD 96 delay ms x PORTD 32 delay_ms x PORTD 48 delay ms x PORTD 16 delay ms x PORTD 144 delay ms x
24. e it is awakened then it falls asleep again If we get into the real case the Atmega is awake for no longer than 30 seconds and then it goes to sleep again Knowing this and getting an average that for every time the arduino stays awake it has been 20 min asleep we can make the following calculations Asuming the proportionality we already stated between the time it is asleep and the time it is awake we can calculate the average current consumption of our system 0 1 x 1073 x 20 15 x 0 5 2 Current 3 751mA 2 1 Figure 2 7 Average current calculation in mA With this calculations we now can calculate how long will our batteries last if we know that their capacity is 2400mAh 2400m Ah Ti 2 2 ime 3 bm 660hours 2 2 Figure 2 8 Battery duration calculation Now we have calculated how long would our batteries last Of course this is an aproximation and the duration of the batteries will depend on how the person working uses the system 16 2 2 3 Display The display that we will be using is MCCOG21605B6W from Midas It is a very simple display and we used it because the information we need to share with the user is very small In fact the only thing that we will be telling the user via display is whether the authentication has been a success or not and if the locking has been opened or not Here you can see a picture of our simple display attached to the board Figure 2 9 Display connections
25. e operated when the key was put inside the rabbet The fact is that the normal way to operate is the one that follows First we put the key into the rabbet of the clamp that is going to be connected to the ground Once we did this we are able to manually open the clamp and connect it to the ground After this we can remove the key from the first clamp and put it into the rabbet of the clamp that we will connect to the high voltage Once this is done we can manually open the second clamp and connect it to the voltage Look out that when we do this the first clamp can t be operated at all so when we have both clamps connected respectively the key can t be removed from the second clamp The only way to remove the key is dissconecting the clamp from the high voltage line This is the security system that we want to improve electronically What we will develop is an external system that will identify every pair of clamps as something unique This way we will be able to use this key in any pair of clamps that we have and will always work taking into account that we connect the system properly Later on we will explain how we will do this To communicate our external system with the pair of clamps we will use a bidirectional communication bus The one we have choosen is the I2C system which enables us to do exactly what we want This system basically consists in one master controlling a certain number of devices connected to the bus In our ca
26. el display write OK2 send address mr slave addr display write OK3 data receive_data_last display_write OK4 release channel return data void regWrite const uint8 t slave addr uint8 t reg uint8_t data register write catch channel send address mt slave addr send data reg send data data release channel void regWriteS const uint8_t slave addr uint8 t data catch channel send address mt slave addr send data data release channel 37 6 1 2 polsadors c interns EIMSK INT1 INTO Per activar desactivar les interrupcions EIFR INTF1 INTFO Per comprovar si hi ha interrupcions EICRA 1 lt lt ISC10 1 lt lt ISC11 S activa interrupcio per qualsevol canvi 1 lt lt INTO Interrupcions habilitades 1 include lt inttypes h gt 2 include lt util delay h gt 3 include lt avr io h gt 4 include lt stdbool h gt 5l include polsadors h 6 7 void init pols void 8 External interrupts enable registers to modificate 9 PORTD Per activar pull ups 10 EICRA ISC11 ISC10 Per seleccionar el mode 11 12 13 14 15 16 DDRD amp 1 lt lt DDD3 17 PORTD 1 lt lt PORTD2 Activem pull up 18 19 EIMSK 1 lt lt INTI 20 EIMSK 211 22 23 24 void desactiva int void 25 x Interrupt
27. ented by the Philips semiconductor division today NXP Semicon ductors and used for attaching low speed peripherals to a motherboard embedded system cellphone or other digital electronic devices Several competitors such as Siemens AG later Infineon Technolo gies AG now Intel mobile communications NEC Texas Instruments STMicroelectronics formerly SGS Thomson Motorola later Freescale and Intersil have introduced compatible I2C products to the market since the mid 1990s The i2c is a very usefull bus to communicate a master with several slaves as it s protocol it s simple to implement and to understand In our case we use the i2c to communicate with the Display and the E2prom memories We use the 300Khz mode so we could still be using a faster mode in the case of needing it The basis of this system consists in two lines one is the serial clock SCL and the other one is the serial data SDA Every slave or master has to be connected to both lines to have communication with the system The beginning of our system will be the Arduino to which we connect the SDA and SCL to the analogic pins A4 and A5 respectively In the following picture you can see where physically are the SDA and SCL connections for the At mega328p 27 x gt ho se PWM Ds SC 9 O PWM D6 D1 TX D7 gt DO RX Bo 8C12 33 RESET PWM Bi 9013 18 C5 SCL B2 amp C4 SDA PWM MOSI 88 MISO B4 yos Sa EPO LI Md 6 Figure 3 1 i2c
28. hysical layer of the system It basic operation is fullfilling a complete loop to make the stepper move one step and do a certain number of steps to move 45 degrees 3 3 5 polsadors c The polsadors c module is the module in charge of controlling the push up buttons in our system Basically it controls the button that wakes up the processor when it is asleep This is done by using an atention interrupt routine that wakes up the atmega once the button is pushed This module works by its own self and it is only used by the main 3 3 6 sleep c The sleep c module is a very simple module This module the only thing that does is awaking and sending the arduino to sleep This is done using the javr sleep hj library that is specifically designed for this This module works by its own and does not need any other module to work furthermore it is only used by the main 31 3 3 7 menu c The menu c module is the second most important module in our sytem This module uses some of the most basic modules to send information to the main c His objective is reducing the amount of code inside the main and making easier to understand This module uses the E2PROM c and the display c module and inderectly uses also the twi c module The idea of this module is to aglutinate in further implementations also the sleep c motor c and the polsadors c modules This way the main will be only using the menu c module and will be this one mentioned the one that is use
29. icament posem en marra el display el cursos i el blink estan en off instruction LCD DISPLAYCONTROL LCD DISPLAYON LCD CURSOROFF LCD_BLINKOFF delay us 30 entry mode set increment d esquerra a dreta i sense autoscroll displaymode LCD_ENTRYLEFT LCD ENTRYSHIFTDECREMENT instruction LCD ENTRYMODESET displaymode delay us 30 clear display nateja el display i apunta a la posicio 0 instruction LCD CLEARDISPLAY delay_ms 2 return home apunta a la posicio 0 instruction LCD RETURNHOME _delay_ms 2 void display write char data xPrintem cadenes llargues de caractersx for int i 0 data i 0 i write uint8 t datafil 45 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 void display_setcursor uint8_t col uint8_t row oe ow gt 1 ow 1 if row 1 instruction LCDSETDDRAMADDR col 0x40 else instruction LCDSETDDRAMADDR col delay us 30 void display_clear void It clears the screenx instruction LCD CLEARDISPLAY delay ms 2 void display home void instruction LCD RETURNHOME delay_ms 2 void display_on
30. mechanical and our objective was to present a solution Our idea was introducing to this basic system a few electronic components that combined achieve the objective of replacing the mechanical system Afterwards we presented our solution to them and they valorated it and idicated what could be improved in the case of the need to continue with this project later on 1 Introduction The main objective of this project is designing a security system for those people who work at high voltage lines Basically we found out that the system that was used to connect the three phase line to the ground was way too rudimentary Basically a key was used to enable the worker to connect every line to the ground This lead to situations like loosing the key and having to just throw away the whole equipment In the technological world like the one we live in we decided that probably we could design some kind of electronical system to perform that activity and improve the actual system The basic operation we must perform is authentication as it is the main issue when we are talking about security In the previous system this was done by using a simple key but as we said this was quite of a problem Our idea is to create an universal system to be able to access to any system we have The basic idea is that we have system with two way clamp that will be connected respectively to the ground and to the high voltage line Previously any of the two clamp could only b
31. mportance that we connect the Voltage output and the Ground The way to operate is the following we connect the power supply and the ground to the processor and then it is the processor the one that powers up the rest of the system The reset is a very important matter for a system like this so we connected a push up button to the reset pin in the processor so as to reset the system as soon as the push up button triggers up Also we have connected to the PD3 pin another push up button This pin and his twin PD2 are the only ones that can tell the Atmega to completely wake up when it is asleep so it is a very important part of our project also In the following table we can see a brief explanation of the ports that we are using from the processor and what are we using them for For a bigger detail you can check the schematic attached at the annex Microcontroller Pin Name Description PC6 Reset Atmega reset pin used for general reset AREF AVCC Voltage input General processor power GND Ground General connection to the ground GND Ground General connection to the ground PB6 PB7 XTALI TOSC1 XTAL2 TOSC2 External crystal oscillator connection PC4 PC5 SDA SCL i2c bus connectors PD4 PD5 PD6 PD7 TO T1 AINO AIN1 First four outputs used as stepper motor controllers PBO PB1 PB2 PB3 ICP 0C1A 0C1B MOSI Second four outputs used as stepper motor controllers PBO PB1 PB2 PB3 ICP 0C1A 0C1B MOSI Second four
32. onnection 8 VCC 5 Volt input 9 GND Ground connection Figure 2 14 Db 9 connection table 20 2 3 1 E2prom The memory we will be using in our clamp is BR24L08 W from Rohm It has 8Kbit of memory that can be used for storage but this is very far from what we need for our authentication In our case we will only be using 1 register for storing a byte that will be the same in the two E2proms of the clamp and that will later on be used for authenticating the system BR24LO1A W BR24L02 W BR24L04 W BR24L08 W BR24L16 W BR24L32 W BR24L64 W Figure 2 15 BR24L08 W e2prom memory It is important to mention that we are using this E2prom not only because it s specifications fit perfectly with our project needs but also because it is specifically designed for working with i2c system which is the core of our project design In the table below you will find a brief explanation of the connections in the memory It is important to mention that this memories have already set all the bits for adressing them but one which is A2 So to distinguish both memories we connected this pin to GND and Vcc respectively in each memory so that we can address them properly AO and Al remain unconnected in this memories Also the write protect terminal is used for enabling or disabling the write in the memory when is set to 0 and 1 respectively In our design we set it to 0 as we believe that is inteligent to leave the write available beca
33. oprocessor and the user interface Also we need one small board inside each pair of the clamp to which we will connect the big board and that we will be using for authenticating the system and moving the stepper By moving the stepper we understand tranismitting the microprocessor orders to the stepper as the small board has no active component able to transmitt anything In the following picture we can see the interface of the eagle program that we are using for our system designing File View Options Window Help Name v Description Libraries Libraries dl Design Rules Design Rules User Language Programs User Language Programs Scripts Script Files CAM Jobs CAM Processor Jobs Projects agle bre Projecte G Projecte G Projecte G Projecte G Projecte G Projecte GTL Projecte G Projecte G Projecte G Projecte TXT Projecte brd Projecte dri Projecte gpi E Projecte pro Projecte sch E Projecte2 Projecte2 Projecte2 Projecte2 Projecte2 Projecte2 Projecte2 Projecte2 Projecte2 Projecte2 Projecte2 Projecte2 El Projecte2 El Projecte2 El Projecte2 4 gl arduino Arduino Mega 2560 Reference Board y elektro Examples Folder for Electrical Schematics Es hexapod gt Hexapod Example Project Gg inclinometre sl Gi Itspice o dil singlesided Example Project for Singlesided Autorouti sl E tutorial Example Files for the Tutorial Projects Figure 2
34. outputs used as stepper motor controllers PD3 INTI Input pin used for waking up the processor PB4 PB5 MISO SCK Input pins used for program ming the processor Figure 2 5 Atmega 328p connections 15 2 2 2 Power To power up our system we will be using four 1 2V AA NiMH Batteries PRT00335 able to supply 2500mAh They will be connected right into the external device and consequently to it s board Our system is almost all the time asleep and it only wakes up for eventually authenticating the system and moving the steppers and right after this it falls asleep again The boards on the clamps have no power supply connected to them so once they have been programmed they remain unpowered until the external device is plugged in This is the reason why we used e2prom memories This way the memories can remain unpowered for a long time and still be able to keep stored it s authentication values In the following image we can see an example of one of our batteries GI SS Figure 2 6 System Battery The Atmega current consumption is of the order of mA when it is awake and 0 14 A when it is asleep Knowing this we can make an apoximation of how long would our battery last If we get in worst possible case the Atmega can reach peaks of 15mA consumption when working at full speed with the oscillator In this case we would get a life of 160 hours which is quite a lot because our Processor works only for 30 seconds every tim
35. p a la dretax instruction LCD FUNCTIONSET display basic _delay_us 30 instruction LCD CURSORSHIFT LCD DISPLAYMOVE LCD MOVERIGHT _delay_us 30 void display_left_to_right void canvia la direccio d increment del cursor escrivim d esquerra a dreta displaymode LCD ENTRYLEFT instruction LCDENTRYMODESET displaymode delay us 30 void display_right_to_left void canvia la direccio d increment del cursor escrivim de dreta a esquerra x displaymode amp LCD_ENTRYLEFT instruction LCD ENTRYMODESET displaymode delay us 30 void display_autoscroll void Quan escrius desplasa tots els registres en direccio contraria a la d escriptura displaymode LCD ENTRYSHIFTINCREMENT instruction LCD ENTRYMODESET displaymode delay us 30 void display_autoscroll_off void displaymode amp LCD ENTRYSHIFTINCREMENT instruction LCDENTRYMODESET displaymode delay us 30 void display_setcontrast uint8_t contrast instruction LCD FUNCTIONSET display extended delay us 30 instruction LCD ICON CONTRAST HIGH BYTE LCDICON_ON LCDBOOSTER ON contrast gt gt 4 amp LCD CONTRAST HIGH BYTE MASK delay us 30 instruction LCD CONTRAST LOW BYTE contrast LCD CONTRASTLOW BYTE MASK delay us 30 47 6 1 7 main c include lt util twi h gt include lt avr interrupt h gt include lt stdbool h gt include lt
36. quite of a basic clue but in fact it isn t The reality is that there are quite a few dozens of tracks going from one side of the board to the other and is quite a hard job achieving to optimize the space as well as getting a good looking board To make it easier for such a newbie like I am with board design we will use double side designing so we can drive tracks through both sides of the board Also we can connect one another using drills that will shortcircuit both sides of the board we could say it is more or less like making a tunnel In the following pictures you can see how our board layout final design looks like Figure 2 22 Main board layout design 25 Figure 2 23 Clamp board layout design In the layout design you can see connections from two colors blue and red Red colors are the one s that are in the TOP of our board while the blue one s are in the bottom As we already explained we use this to avoid making shortcircuits between the different connections The same happens with the devices attached to the board blue ones will be attached at the bottom while red ones at the TOP The rest of the board will be connected to the ground The green button look like things you see are the drills that we already mentioned This drills are what we use to communicate both sides of the board without making any disgrace This drills are very useful to jump over a line 26 3 Software description 3 1 Introduction Ha
37. rnal system that when plugged into the clamp would work as a key The difference between the mechanical system and the one that was about to be designed was that the digital one would work for any clamp while the key worked only for a certain one This idea needed the design of an external device able to be connected to the clamp and afterwards interact with some kind of internal device that would authenticate the clamp as an unique pair After this we would open the clamp locking using the external device Having fulfilled the company Sofamel SL objectives it is clear that we designed a device that could be used in real live The fact is that this device is suitable to huge changes as we knew it wasn t the final device but just the beginning The idea is that this project can be further developed in the case of the Company beeing realy interested in developing it for real life usage 33 5 Bibliography E2prom Brl24L Pdf http rohmfs rohm com en products databook datasheet ic memory eeprom br241 e pdf Stepper 28BYJ 48 Pdf hittp robocraft ru files datashest 28BYI 48 pat Driver Umn2003 Pat http w EA con Tit asaya ink aIa2003a pa Processor Atmega328p Pdf http www atmel com Images doc8161 pdf Display MCCOG21605B6W Pdf http www farnell com datasheets 1663636 pdf i ie user manual Pat ERP sp con documents user manual MOI pal Eagle Eagle manual Pdf http www cadsoft
38. s first design we used a single byte for the system authentication this is something we can easily modify reserving more bits for the authentication Also the code we programmed to our processor can easily be used for much more bigger stepers The only need in the case of needing bigger stepers to move a bigger lock would be using a driver or a power bridge able to provide the stepper with the necessary current In general de project has been a success as we achieved the objectives stated in the beginning During the project design we achieved the first objective of making the prototype work and once we knew that our project was factible we begun the design of the board with the final device This last steps of designing the final device were much more complicated than the prototype design as we weren t used to the usage of Eagle and to designing board layouts Anyway once we knew that our project was factible and worked properly we can say that our project has been a success 4 1 Improvements As we said from the very beginning this project has been designed for a company Sofamel SL an so on the objectives were stated by them and the tutor of the project The first objective was to think of the suitable design that could substitute the existing mechanical system for a more modern one All together we thought that we could use some kind of digital key instead of the physical key that was used until then The idea we had was to design an exte
39. s it has already been explained the basic idea of our system is to transform a purely mechanical system into an electronic one This will be made using an external device that will control the pair of clamps using an Atmega328p processor The idea is to use an external device as if it was a key and it fact it will be one but not a physical one but an electronic one Our key will be an electronic external device with a display a microprossesor and a connector that once it is plugged to the clamp it operates as a key The idea is that the external device checks the value of a certain register in each of the pair of clamps and in the case of beeing the same value proceed with the authentication After this the operator will have the oportunity to open the first locking and connect the clamp to the ground after this the second clamp will be available to be opened and connected to the ground also As we already explained how our project worked we will explain it now using a diagram so that you can get a clearear glance of how the system interacts with the user and with the clamp Null Button Failure Lock opening Connected Success Authentication Figure 1 3 State diagram for our system 10 1 3 Meetings with the tutor and the Company While develoving the project we performed several meetings with both the tutor responsible of the project Josep Font and the Company This has been done to know at which point we are when
40. s systems were much more basic and mechanic but the problem is that they did not have any external security at all The system was completely mechanic and that s what we wanted to change The basic idea of the existing system is the one that follows We have a pair of clamps one of which can be opened manually to ground it meaning connecting it into the ground While you don t have the first clamp closed you are unable to open the second one Once you grounded the first one you can open the second one and connect it to the high voltage line When you have both of them connected and you want to unplug the system you have to do it backwards By this we mean that you can t unplug the ground clamp before desconnecting the second one that is connected to the high voltage First you have to unplug the second clamp and secondly the ground clamp In the following picture we can apreciate one of the pairs of the clamp that will be connected to the ground Figure 1 1 One pair of the clamp This is something made completely mechanically and we want to perform this same operation but using our electronic system Basically the physical part and apearence of the clamp needs no change at all what we want to do is changing the security system that is operated with a key by an electronic authentication In the following image we will see how the security system works in the Existing system Figure 1 2 Key of the clamp 1 2 3 Our system A
41. se the AVR will be the master controlling all the slaves connected to the bus The idea is basically to connect the AVR to the pair of clamps detect wheter the identification has been a success of a failure and afterwards releasing an interlocking that will enable us to manually open the clamp The idea is trying to reduce to the minimum the energy that will be needed to this operation so as to reduce the number of necessary batteries This project has four basic phases e Investigation Information resarch regarding the project realization This includes material soft ware etc e Development Hardware integration and software development to include all the parts in a single one e Presentation to the company As it is a project designed for a company we will show them our design to exchange points of view e Improvements After having exchanged points of view with the people in the company we will do the necessary changes in the application to fit their expectations I must be said that the Development phase has two different parts the first one is to design a prototype to fulfill the project expectations Secondly there is the need of developing a group of boards to achieve the final objective of implanting the project in the final device 1 1 Investigation The first step in every well designed project is the investigation The basic idea is gathering all the needed specifications and start looking for suitable solutions Basicall
42. se the current ideally this driver can transform a current of 1 5mA to 150mA reaching a maximum output current of 500mA In our case it increases the current that the microprocessor sends that has a value of 2mA to reach the necessary input current for our stepper aproximately 100mA Figure 2 18 ULN2003 stepper driver Apart from increasing the current the driver does another very important job In the last part of the driver there is a diode included so as to not allowing the current to drive the other direction This is very important because if it wasn t for this the current could be driven in inverse which is something that we don t want If you want to read further technical information about this two components you can find them in the annex section Furthermore the code that is used to program the stepper will be explained in the software chapter 22 2 4 Board design At the very beginning we used a protoboard to design our project and also to check the behavior of all the components and as soon as we advanced with the project we kept integrating the components into a single system Once the system worked we decided it was about time to create a board that could fullfil the necessities of our project More certainly we needed three boards two of which would be practically identical As we already explained we would have a central device that will control the whole system and that will have the big board containing the Micr
43. use if we set it to 1 once the board is welded and in the case of having any problem which required rewritting the memory we would have to buy a whole board Display pin Name Description 1 AO First bit for i2c memory ad dressing 2 Al Second bit for i2c memory ad dressing 3 A2 Third bit for i2c memory ad dressing 4 GND Ground connection 5 SDA i2c serial data connection 6 SCL i2c serial clock connection 7 WP Write protect terminal 8 VCC 5 Volt input Figure 2 16 E2prom connection table 21 2 3 2 Stepper and driver Connected right into our special designed clamp board we have the stepper and it s driver whoose main puropuse is to open and close the locking for the clamp The stepper motor that we will be using is the 28BYJ 48 and we having it working with the ULN2003 driver Later on we will further explain it s technical characteristics In the following picture you can see the stepper Figure 2 17 283BYJ 48 stepper motor The stepper is commanded by our microprocessor in the main board and it is basically done by sending him small pulses of 5V steps to it s four inputs The problem we had is that altough the stepper is quite small our microprocessor hadn t enough power to move it properly Because of this and after beeing unable to move any stepper just with the system we had we decided to add a driver The basic operation of the driver is to increa
44. ving explained the hardware that is used in our project it is now about time to explain the most important matter the software that makes this hardware work properly The software is certainly the most important part in our project as it is by far to what we dedicated more time developing Our project has been programmed using C and it is jerarquically structured by modules and based on the i2c system as a communication tool This is the basis of the system later on we will explain how this structure works in the Module section In general we haven t written a big amount of code but a very specific one The idea was to be very concrete and specific rather than writting huge modules full of unusefull lines During this introduction we will explain the basis of our project software By this we mean explaning both the code and the communication tool we will be using First of all we will explain the specifications and usage of the i2c bus protocol and how we will use it in our system Later on we will make an introduction of how ous software system works and how the modules interact with one another In the end to finish the chapter we will be explaining briefly what each module is responsible of as later on we will include the code in the annex and it is not necessary to do a huge explanation 3 2 12C Bus We will explain now the basis of our project intercomunication the i2c bus The i2c is basically a mul timaster serial single ended bus inv
45. will be explained lately e One BR24L08 W E2PROM Memory e One Db9 connector e One six output Pin One Stepper Driver e One Stepper Motor In the following image we can see how the board inside the clamp is Figure 2 12 Clamp board In the board we can clearly see the three important elements The first one is the EZPROM memory that is used to authenticate the system secondly the DB 9 input connector that powers up the board and also controls the stepper and third but not least important the 6 outputs that control the stepper 19 In the following image and it s self explaning table we will see the pinout connection of the DB 9 connector Regarding the 6 pin out output for the driver stepper we will explain them in the driver and stepper section Figure 2 13 Db 9 connection In this table we can see the connections of the Db 9 In some cases there are two connections the boards are symetrical meaning that both do the same but the ports that control the stepper are different in each board thats why there are two connections in ports 5 to 2 Display pin Name Description 1 None Not connected 2 PB4 and PD7 Fourth and last port of the stepper controller 3 PB2 and PD6 Third port of the stepper con troller 4 PB1 and PD5 Second port of the stepper controller 5 PBO and PB4 First port of the stepper con troller 6 SCL i2c serial clock connection 7 SDA i2c serial data c
46. within the i2c connection The i2c module doesn t need to use any other module to work but it is used for the display and the E2PROM c modules to help them work 3 3 2 display c The display c module is the one responsible for interacting with the display It uses the twi module to send orders to the display slave so that we can write anything The module is programmed so that we can send what we want to write and the module itself uses twi c to write it 3 3 3 E2PROM c The E2PROM is a ver specific module that is used to adress two different kinds of E2PROM memories This module is used to access the different registers in the memory and writting or reading them With this module we can write to any memory of the same family of the one designed for our project This module uses the twi c module to physically communicate with the memory and send to it orders such as what he wants to read etcetera The way we programmed the module we can access any register we want and reading it or writting to it 3 3 4 motor c This module is the one that interacts with the stepper motor and does not need any other module to work it just interacts with the main c to receive orders of when to move the stepper It main task is to move the lock 45 degrees in one direction or another depending if you want to open or to close the lock This module interacts directily with the output pins of the processor to set them high or low so interacts with the most p
47. y the idea is to strip the project into small parts and start trying to find solution to each of this parts and as soon as we solve them start to gather them into bigger ideas and at the same time problems We knew that we wanted to interact with many possible slaves at the same time beeing commanded by a master so we needed a system that could be used this way What came into our mind was using Arduino and the i2c bus protocol to communicate with different slaves In fact this is what we chosed and to do this we used the i2c c library to get some extra time So to begin we first thought in what we wanted to do and in consequence what we needed to do it The first thing that we were asked was to perform an authentication system that replaced the key that was used since the begining and that also did not need any power supply The first idea we had was the EEPROM memory able to store data for a long time without needing any power supply So the first thing that we did was search for a pair of suitable EEPROM memories for our project Soon after this be begun developing a library for the interaction with the memories and for making it easier to deal with them The way to use the memory is easy we will only use a small part of the memory 1 byte and we will compare if the value stored at both memories is the same In the case of getting a good authentication we can proceed with the operation of the clamp else we won t When we finished with
Download Pdf Manuals
Related Search
Related Contents
Instructions for use Epson AP-60 Installation Guide Copyright © All rights reserved.
Failed to retrieve file