200 likes | 219 Views
SSN – Simple Sensor Network. R. Stelzer, K. Jafarmadar, A. Dabrowski. Agenda. InnoC.at – Who are we? Motivation for SSN What is SSN? SSN Protocol SSN Hardware How to Use SSN - Light Following Robot Discussion. InnoC.at. Non-profit organisation
E N D
SSN – Simple Sensor Network R. Stelzer, K. Jafarmadar, A. Dabrowski Austrian Association for Innovative Computer Science
Agenda • InnoC.at – Who are we? • Motivation for SSN • What is SSN? • SSN Protocol • SSN Hardware • How to Use SSN - Light Following Robot • Discussion Austrian Association for Innovative Computer Science
InnoC.at • Non-profit organisation • Support & motivation of comers in innovative computing Austrian Association for Innovative Computer Science
Main Projects Simple Sensor Network MariaTheresia Wiki http://wiki.atrox.at RobotChallenge http://www.robotchallenge.at Austrian Association for Innovative Computer Science
Motivation • Similar sensors use totally different interfaces • Reimplementation and testing of interfaces wastes a lot of time • Make it easier to get into robotics & hardware • Concentrate on logic & algorithms instead of debugging hardware Austrian Association for Innovative Computer Science
What is SSN? • SSN stands for „Simple Sensor Network“ • SSN is a protocol, which provides a uniform and simple "language" to communicate to a large number of different sensor and actuator devices. • A few functions (getdata, setdata, ...) can be used to retreive values from sensors respectively to set values of an actuator. Austrian Association for Innovative Computer Science
Why SSN? • Simple commands (GetData, SetData) • ASCII mode for immediate use & testing • Based on standards (RS232, USB cables) • Modular, Plug and Play • Easy to implement • Scaleable • Open specification • Cheap Austrian Association for Innovative Computer Science
SSN Topology • Direct connect: One sensor/actuator directly connected to the master (PC) • Connected via SSN switch / Cascaded via Port 0xF I----I I-------------I I-------------I I PC I---I Switch 1 I-F-I Switch 2 I I----I I-------------I I-------------I | | | | | | I---I I---I I---I I A I I B I I C I I---I I---I I---I Austrian Association for Innovative Computer Science
SSN Reply Request Cycle • Master sends request to SSN switch • SSN switch extracts address* • SSN switch forwards complete packet to appropriate port • SSN switch waits for reply I----I I----------I I PC I---I Switch I I----I I----------I | | 3 8 | | I---I I---I I A I I B I I---I I---I *) Address 0xF indicates cascaded SSN switches; this exception is not considered in this listing. Austrian Association for Innovative Computer Science
Address halfbyte 0x0 .. 0xE (port number of SSN switch) 0xF .. cascading indicator Command halfbyte GetInfo GetData* SetData* *) 4 variations (1 byte, 2 bytes, 4 bytes, \0-terminated string) Data dependent on variation of SetData SSN Request Packet • Cascading headers are additional header bytes (1 per hop): • First halfbyte: 0xF .. cascading indicator instead of address • Second halfbyte: port, where the next SSN switch is connected. • discarded, when passing on the packet Austrian Association for Innovative Computer Science
SSN Commands • Get general Information about Device • 0x0 ... getinfo short • 0x1 ... getinfo long • Get sensor value / actuator status • 0x2 ... getdata string (\0-terminated) • 0x3 ... getdata byte • 0x4 ... getdata 2 bytes • 0x5 ... getdata 4 bytes • Set actuator value / change sensor settings • 0x6 ... setdata string (\0-terminated) • 0x7 ... setdata byte • 0x8 ... setdata 2 bytes • 0x9 ... setdata 4 bytes Austrian Association for Innovative Computer Science
I----I I----------I I PC I---I Switch I I----I I----------I | | 3 8 | | I---I I---I I A I I B I I---I I---I Request: PC -> Switch -> Device B 1st byte - 0x87 // sensor is attached to port 8, setbyte() 2nd byte - 0x09 // value is 9 Reply: Device B -> Switch -> PC 1st byte – 0x87 // request header SSN Request Example We want to set the value of device B to 9 Austrian Association for Innovative Computer Science
I----I I----------I I----------I I PC I---I Switch 1 I-F-I Switch 2 I I----I I----------I I----------I | | | 3 8 4 | | | I---I I---I I---I I A I I B I I C I I---I I---I I---I PC -> Switch 1 1st byte – 0xFF // cascade via port F to next switch 2nd byte – 0x43 // sensor is attached to port 4, getbyte() Switch 1 -> Switch 2 -> Device C 2nd byte – 0x43 // sensor is attached to port 4, getbyte() SSN Request Example - Cascading We want to read the sensor value of device C Austrian Association for Innovative Computer Science
SSN Reply Packet • 1st byte usually identical to header of request (address, command)* • Additional data bytes dependent on request data type *) Exception: in case of timeout (recongnised by SSN switch), the 2nd halfbyte contains 0xF instead of the command Austrian Association for Innovative Computer Science
SSN Hardware • SSN switch • Microchip PIC16F877 • USB type A sockets • Sensor/actuator Modules • Microchip PIC12F675/683 if sufficient • Communication • RS232 9600 baud 8-N-1 (to Master) • TTL 0/+5 V (between SSN switch and Device) Austrian Association for Innovative Computer Science
Modules Master device (notebook) SSN switch 2-channel LDR module 2 motor driver modules Topology Switch I---I-0--[2-Channel-LDR] Master I I I----I I I-1--[Motor-Driver] I PC I----I I I----I I I-2--[Motor-Driver] I I I---I-3-- Light Following Robot Austrian Association for Innovative Computer Science
Master Software setbyte(0,1) // activate channel 1 (left) on port 0 left=getbyte(0) // read value on port 0 setbyte(0,2) // activate channel 2 (right) on port 0 right=getbyte(0) // read value on port 0 if ( left < right ) // light is left -> go to left setbyte(1,100) // speed 100 on port 1 (left motor) setbyte(2,200) // speed 200 on port 2 (right motor) else // light is right -> go to right setbyte(1,200) // left motor fast setbyte(2,100) // right motor slow Austrian Association for Innovative Computer Science
Sensors 2-channel ADC Distance (Infrared, Sharp) Angle (potentiometer) Brightness (LDR) 2-axis-accelleration (ADXL202) Distance (ultrasonic) Infrared (RC5-Signals) Compass (CMP03) Temperature (DS1820) GPS (NMEA-1083) Pushbutton/switch Dimmer ... Actuators Motorbridge (TC4424) Servo Stepper LCD-Display (I2C) Infrared (RC5-Signals) Switch (relais) ... Planned SSN Modules Austrian Association for Innovative Computer Science
Sources & Information • SSN specification & FAQ on the webwiki.atrox.at/index.php/SSN_Protokoll • Kits for SSN switch and modules available soonwww.innoc.atwiki.atrox.at/index.php/SSN_Module • Don’t hesitate to ask for help with implementing new SSN modulescontact@innoc.at Austrian Association for Innovative Computer Science
Thank You for Your Attention! supported by www.distrelec.com Austrian Association for Innovative Computer Science