AGH University of Science and Technology Faculty of Electrical Engineering, Automatics, Computer Science and Electronics Department of Electrical Mac
10 2Mbps. The third generation which we use nowadays operates on the same band as the second generation, 2,4GHz. The world first official standard I
100 var i,Size: Integer; begin Result:=0; Size:=Length(Value); for i:=0 to Size-1 do begin if Copy(Value,Size-i,1)='1' then
101 photo:=1; end; wait(2000); IdTelnet1.IOHandler.WriteLn('servo=1'); if (not checkbox1.Checked) then servo := 1 else se
102 else panel_login.Visible := true; end; procedure TForm1.Timer1Timer(Sender: TObject); begin if label56.Visible then label56.Visible := false
103 procedure TForm1.TrackBar4Change(Sender: TObject); begin label2.Caption := inttostr(trackbar4.Position); end; procedure TForm1.About1Click(Se
104 wait(200); IdTelnet1.IOHandler.WriteLn(''); IdTelnet1.IOHandler.WriteLn('servo=0'); end; procedure TForm1.Button13Clic
105 case PageControl1.ActivePageIndex of 0: begin IdTelnet1.IOHandler.Writeln('$$$'); IdTelnet1.IOHandler.Write
106 IdTelnet1.IOHandler.Writeln('set dns address '+edit15.Text); IdTelnet1.IOHandler.Writeln('set dns name &ap
107 INI.WriteString('Main','optpswd',Encrypt(edit21.Text)); end; finally INI.Free;
108 end else application.MessageBox('ERROR','password and its confirmation are not the same!'); end; en
109 Connected2.Enabled := true; end else application.MessageBox('ERROR','invalid login or password'); IdTel
11 Unit II Hardware/software 2.1. Open Source nice, simple and free Since the beginning of the computer history the intellectual property rights
110 end else begin if (servo = 1)and(checkbox3.Checked) then begin IdTelnet1.IOHandler.WriteLn('servo=0')
111 begin if not checkbox3.Checked then begin if (serv = 0)and(checkbox1.Checked) then begin IdTelnet1.IOHandler.WriteL
112 else begin edit20.Visible := false; edit3.Visible := true; end; end; procedure TForm1.ComboBox4Change(Sender: TObject); be
113 begin IdTelnet1.Connect; if ((pswd <> '') and (pswd <> '0')) then IdTelnet1.IOHandler.WriteLn(psw
114 wait(500); IdTelnet1.IOHandler.WriteLn('servo=0'); wait(500); IdTelnet1.Disconnect(); end; application.Te
115 serv := 0; rst := 0; command_ok := 0; // checking if file exists if not FileExists(ExtractFilePath(Application.ExeName) + 'setup.in
116 memo1.Lines.Add(Buffer); if ((pos('photo=',Buffer) <> 0)and(length(Buffer) < 12)) then begin trackbar3.Position
117 begin panele_false(); panel_login.Visible := true; end; procedure TForm1.menu_helpClick(Sender: TObject); begin if menu_help.Caption = &ap
118 Appendix E project on CD Attached CD contains: - three formats .doc, .docx and .pdf, - WCC (WirelessControlClient) appli
12 2.2. Arduino Uno Arduino is an open-source electronics prototyping platform cased on flexible, easy-to-use hardware and software. I
13 provided mostly in wiki-like and forum form which is bothersome when meeting problems during development process. Experience shared with othe
14 communication over USB (available on digital pins 0 RX and 1 TX). After connecting to the PC it appears as a virtual com port to software on the c
15 There are many reasons for choosing this solution as base for whole project. First of all I have assumed that in this case reinventing the wheel
16 2.3. WiFly Shield As Arduino Uno which plays role of the motherboard is very capable of talking and listening (controlling I/O), it i
17 - 8 - Two forums Arduino9 and SparkFun10 Overview - Fully Qualified and Wi-Fi Certified 2.4GHz IEEE 802.11
18 2.4 CodeGear Delphi Next decision I had to make was the way of communication from the side of the computer. As nowadays the programming lan
19 Unit III Conception of Control System 3.1. The idea Every project begins with the idea. In this case the main idea was to control servomotor v
2 STATEMENT OF ORIGINALITY Aware of criminal liability for making untrue statements I declare that the following thesis was written personally by
20 Figure 10. D-Link DSL-G684T ADSL2+ 54M Wireless Router w/ 4 Port 10/100 Switch [source: DSL-G684T Manual] Technical Specifications: Picture
21 Picture 12. Physical and Environmental Specification [source: DSL-G684T Manual] Picture 13. Wireless Specification [source: DSL-G684T Manual]
22 3. As a control system I have used Arduino Uno mainboard with additional WiFly SparkFun shield. Both are described with technical specificati
23 5. As all new inventions without the suggestion of application are rather meaningless,
24 3.2 Applications The main issue of new inventions are the applications. History of human kind is full of meaningless gadgets created without expl
25 subject, as well as capabilities of creating really complicated advanced projects that demands advanced knowledge for students familiar
26 Unit IV Implementation of Control System 4.1 Hardware Process of creation of the hardware aspect of the project was rather not c
27 two legs, connection pin to voltage, so that we read a HIGH. For the convenience of the user additional LED is placed into the circuit. When butto
28 the absence of light, its resistance increases dramatically. In this case due to the analog input photocell is connected to its range is betw
29 servomotor any other way will damage it. To place servomotor with blind on it I have used a stand based on three screws with spring bumpers. Whe
3 Sincere thanks to prof. dr hab. Inż Zygfryd Głowacz for a thematic approach and his help during the writin
30 Model : Portable Power Pack D.2200. Input : 5V Micro USB Output : 5-5.5V 700mA Battery Type : 3.7V 2200mAh Finished Control System After fin
31 4.2 Software The software prepared for the project consists of two parts. First one is the application written for control board. T
32 ARDUINO It all began with the installation of the Arduino board on my PC. As it is written in 11 guide all went smooth and
33 viod setup()the board. Third one is void loop()
34 At the beginning to control servomechanism it needs to be defined. To do this
35 At the end of the setup section we check if the SPI-to-UART bridge is initialized successfully (SPI_Uart_Init()) and afterwards if wireless
36 if ((get == 1)||(post == 1)) { Serial.println("\n\rConnection opened."); HTML_print("<html>");
37 In the earlier version of the project communication was based on the HTTP instead of the telnet protocol. That is why in this section an example
38 // Exit command mode if we haven't already SPI_Uart_println(""); SPI_Uart_println("exit"); delay(500);
39 Serial.print("Set security phrase to "); Serial.println(auth_phrase); // Set localport to <port_listen> SPI_Uart_
4 Table of Contents Unit I A Little bit of theory ... 6 1.1
40 itoa (myservo1.read(), val2, 10); SPI_Uart_print("servo1="); SPI_Uart_print(val2); delay(90); }
41 Above Have_Client(void) is presented. This is the first procedure that is called in the loop section to check whether client requests something
42 void Parse_Request(void) { int j = 0, k = 0; String temp = ""; inc_data_all = ""; post = 0; get = 0; while(j <
43 } else { j++; } } // if (post == 1) // check if incoming package is POST // { // inc_data_all.trim(); // //
44 // myservo_pos = 0; // //convertion ascii to integer // for (int i = 0; i < temp.length()-1; i++) // { // myservo_p
45 temp.charAt(i) - '0'; } Serial.println(myservo_pos); myservo.write(myservo_pos); SPI_Uart_print("OK"); F
46 if (inc_data_all.indexOf("photo") != -1) { if (inc_data_all.indexOf("photo=1") != -1){ photo = 1; } els
47 Parse_Request is a function that does not return any value. It is responsible for determining the syntax of incoming request/comman
48 - TELNET to communicate with control system telnet protocol is used. When command sent to Arduino is not one from above it
49 During designing process issue with saving data that will not disappear after cutting out the power appeared. To solve this problem I have cr
5 Introduction World runs faster and faster everyday. New inventions appear in every corner of the world. This is the fact. B
50 DELPHI (win32) In the second stage the time for pc application has come. Delphi is the object-oriented programming language base
51 4. Login As simple as it sounds to enter software we need to log in. This most basic protection prevents unwanted people or software
52 6. Settings This is the part of the program were four groups of settings can be found. Basic: SSID ssid of the network we want control syste
53 DNS Address DNS Name DNS Backup Connection Password additional security measure. When set up no one without it will be able to chang
54 4.3 Observations During many tests conducted in the process of projecting and creating Control System I have noticed series of pros
55 achievable. As always those are the values from perfect conditions. In real life range did not exceeded 100 meters outdoor in building area. Influ
56 Unfortunately prototype device I have prepared is not flawless. During tests I have noticed specific situations when WCS hangs up and needs reset.
57 Conclusion To sum up I believe that solution I have implemented to resolve the problem of the wireless control system of the servomotor h
58 Bibliography Literature 1. Reilly, First Edition, October 2008, 2. Tom Igoe, Making Thi
59 Census figures Figure 1. Construction of the servomotor ... 6 Figure 2
6 Unit I A Little bit of theory 1.1. Servo What and how To start solving the problem of wireless control system for servomotor we must be aware
60 Figure 31. WirelessControlClient Login screen ... 51 Figure 32. WirelessControlClie
61 Appendixes Appendix A Arduino Uno Schematics ... 62 Appendix B
62 Appendix A Arduino Uno Schematics Figure 34. Arduino Uno schematics [source: http://arduino.cc/en/uploads/Main/arduino-uno-schematic.pdf]
63 Appendix B WiFly SparkFun Schematics Figure 35. WiFly shield from SparkFun [source: http://arduino.cc/en/uploads/Main/arduino-uno-schematic.pdf]
64 Appendix C Arduino Source Code #include <string.h> #include <Servo.h> #include <EEPROM.h> // SC16IS750 Register Definitions
65 #define XON1 0x04 << 3 // Xon1 word[5] #define XON2 0x05 << 3 // Xon2 word #define XOFF1 0x06 << 3 // Xoff1 w
66 Servo myservo1; int myservo_pos = 0; int i = 0; int j = 0; int k = 0; int user = 0; char clr = 0; char polling = 0; int servo = 0; int photo = 0;
67 char auth_level[] = "4"; char auth_phrase[] = "dlink007"; char port_listen[] = "2000"; char channel[] = "6"
68 else{ Serial.println("Could not initialize bridge, locking up.\n\r"); while(1); } autoconnect(); } void loop() { //
69 HTML_print("</form>"); HTML_print("</br> "); HTML_print("this is example of use of the HT
7 designed to take position angle between 0 and 180 degrees. Most mechanisms have limiters that do not allow a greater swing of the shaft
70 current = digitalRead(inPin); if (current == HIGH && previous == LOW && millis()- firstTime > 200){ firstTime = millis(
71 // Set channel to <channel> SPI_Uart_print("set wlan channel "); SPI_Uart_println(channel); delay(500); Seri
72 if (current == LOW){ // reset the counter if the button is not pressed count = 0; } previous = current; // photocell value
73 myservo.write(myservo.read()-1); } } if(ph_val>val+5){ if((myservo.read()+1<=180)&&(
74 SPI_Uart_WriteByte(LCR, 0xBF); // access EFR register SPI_Uart_WriteByte(EFR, SPI_Uart_config.Flow); // enable enhanced registers SPI_Uart_
75 } long int SPI_Write(char* srcptr, long int length) // Write string to SC16IS750 { for(long int i = 0; i < length; i++) { spi_transfer
76 address = (address | 0x80); select(); spi_transfer(address); data = spi_transfer(0xFF); deselect(); return data; } char autoconne
77 Serial.println("'"); delay(100); Flush_RX(); delay(100); SPI_Uart_print("join "); SPI_Uart_println(ssid);
78 { int j = 0; while(j < 4000) { if((SPI_Uart_ReadByte(LSR) & 0x01)) { incoming_data = SPI_Uart_ReadByte(RHR); }
79 if ((inc_data_all.indexOf("GET") != -1)&&(k==0)) { post = 0; get = 1; k = 1; }
8 of the servos is a shaft of 1.5ms pulse length for the center position set. Deviate from this value causes the shift shaft move to the left or to t
80 // } // else // { // k = inc_data_all.indexOf("&", inc_data_all.indexOf("poh=")+4)+1; // Seri
81 if (inc_data_all.indexOf("pos=") != -1) // new position for servo from telnet { temp = ""; for (j = inc_data_all.i
82 } myservo_pos = 0; //convertion ascii to integer for (int i = 0; i < temp.length()-1; i++) { myservo_pos = (myse
83 else{ servo = 0; } inc_data_all = ""; SPI_Uart_print("command-OK"); } if (inc_data_all.indexOf(
84 } } void Save_To_EEPROM(String data) //saves settings to EPROM { int start = 0; byte c = 255; for (int i = 0; i < 1023; i++) {
85 { for (int i = 0; i < 1023 ; i++) { Serial.print(EEPROM.read(i), BYTE); } } char Wait_On_Response_Char(char num) // Wait on char num
86 void HTML_print(char *data) // Write <data> to THR of SC16IS750 followed by a delay { SPI_Uart_WriteArray(data,strlen(data)); delay(30)
87 Appendix D Delphi Source Code unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialo
88 Memo1: TMemo; Label1: TLabel; Panel_settings: TPanel; Button2: TButton; Button3: TButton; Label10: TLabel; Panel_about
89 ComboBox3: TComboBox; ComboBox2: TComboBox; Label22: TLabel; Label23: TLabel; Edit11: TEdit; Edit6: TEdit; Label7: TLa
9 1.2. Wireless Network 802.11 Since the beginning wires were the main restriction of every control mechanism. Due to this limitation human f
90 Edit21: TEdit; Label37: TLabel; TrackBar1: TTrackBar; Label50: TLabel; Label51: TLabel; TrackBar2: TTrackBar; TrackBar
91 CheckBox3: TCheckBox; Edit7: TEdit; Label9: TLabel; procedure Button1Click(Sender: TObject); procedure IdTelnet1DataAvailable(
92 procedure CheckBox2Click(Sender: TObject); procedure Button10Click(Sender: TObject); procedure Timer1Timer(Sender: TObject); proce
93 begin while command_ok = 0 do begin Application.ProcessMessages; end; wait(200); end; procedure TForm1.panele_false(); begin
94 edit13.Text := Decrypt(INI.ReadString('Main','login','')); edit14.Text := Decrypt(INI.ReadString(&ap
95 else if auth = 'AUTO' then ComboBox1.ItemIndex := 5; if ComboBox1.ItemHeight = 1 then begin edit20.Vis
96 Edit11.Text := copy(find_str('IP=', memo2.Lines.Text), 0 ,length(find_str('IP=', memo2.Lines.Text))-5); Edit5.Text := copy
97 label31.Caption := 'Conncected'; end; 2: begin label31.Font.Color := clRed;
98 begin label28.Font.Color := clWindowText; label28.Caption := 'Contracted'; end else be
99 wait(3000); application.MessageBox('Servo information turned off','OK', MB_OK); IdTelnet1.IOHandler.WriteLn(
Kommentare zu diesen Handbüchern