diff --git a/.gitignore b/.gitignore index 28f0b97..c38af0f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.DS_Store # Ignore list for Eagle, a PCB layout tool # Backup files diff --git a/EAGLE/VISCAShield.brd b/EAGLE/VISCAShield.brd index ec2def1..eee2049 100644 --- a/EAGLE/VISCAShield.brd +++ b/EAGLE/VISCAShield.brd @@ -6,7 +6,7 @@ - + @@ -150,9 +150,9 @@ - - - + + + VISCA Shield for Cisco TelePresence @@ -164,7 +164,7 @@ PrecisionHD - ~ + - ~ + - ~ + -- + +- + - + SDA SCL @@ -515,6 +515,136 @@ type 0204, grid 2.5 mm + +<h3>SparkFun Communication ICs</h3> +This is the communications library, which contains things that exist on wired busses. This includes USB to serial conversion ICs, like the FTDI line, plus high speed line drivers, level shifters, bus drivers, CAN transceivers and ethernet PHYs. +<br> +<br> +We've spent an enormous amount of time creating and checking these footprints and parts, but it is <b> the end user's responsibility</b> to ensure correctness and suitablity for a given componet or application. +<br> +<br>If you enjoy using this library, please buy one of our products at <a href=" www.sparkfun.com">SparkFun.com</a>. +<br> +<br> +<b>Licensing:</b> Creative Commons ShareAlike 4.0 International - https://creativecommons.org/licenses/by-sa/4.0/ +<br> +<br> +You are welcome to use this library for commercial purposes. For attribution, we ask that when you begin to sell your device using our footprint, you email us with a link to the product being sold. We want bragging rights that we helped (in a very small part) to create your 8th world wonder. We would like the opportunity to feature your device on our homepage. + + +<h3>SOIC-16</h3> +<p>Specifications: +<ul><li>Pin count: 16</li> +<li>Width:0.15"</li> +</ul></p> +<p>Example device(s): +<ul><li>HEX_CONVERTER</li> +</ul></p> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + +SOIC-16 +Specifications: +Pin count: 16 +Width:0.15" + +Example device(s): +HEX_CONVERTER + + + + + + + + +<h3>SparkFun Capacitors</h3> +This library contains capacitors. +<br> +<br> +We've spent an enormous amount of time creating and checking these footprints and parts, but it is <b> the end user's responsibility</b> to ensure correctness and suitablity for a given componet or application. +<br> +<br>If you enjoy using this library, please buy one of our products at <a href=" www.sparkfun.com">SparkFun.com</a>. +<br> +<br> +<b>Licensing:</b> Creative Commons ShareAlike 4.0 International - https://creativecommons.org/licenses/by-sa/4.0/ +<br> +<br> +You are welcome to use this library for commercial purposes. For attribution, we ask that when you begin to sell your device using our footprint, you email us with a link to the product being sold. We want bragging rights that we helped (in a very small part) to create your 8th world wonder. We would like the opportunity to feature your device on our homepage. + + +<p><b>Generic 2012 (0805) package</b></p> +<p>0.2mm courtyard excess rounded to nearest 0.05mm.</p> + + +>NAME +>VALUE + + + + + + + + +Generic 2012 (0805) package +0.2mm courtyard excess rounded to nearest 0.05mm. + + + + + + @@ -702,14 +832,14 @@ Note, that not all DRC settings must be set by the manufacturer. Several can be - - - - - - - - + + + + + + + + @@ -719,15 +849,15 @@ Note, that not all DRC settings must be set by the manufacturer. Several can be - - - - - - - - - + + + + + + + + + @@ -943,6 +1073,36 @@ Note, that not all DRC settings must be set by the manufacturer. Several can be + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -965,25 +1125,32 @@ Note, that not all DRC settings must be set by the manufacturer. Several can be - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + @@ -1044,6 +1211,16 @@ Note, that not all DRC settings must be set by the manufacturer. Several can be + + + + + + + + + + @@ -1078,34 +1255,33 @@ Note, that not all DRC settings must be set by the manufacturer. Several can be - - - - - + + + + + + + + - - - - - - - - - - + + + + + + + - - - - - - - + + + + + + @@ -1289,6 +1465,72 @@ Note, that not all DRC settings must be set by the manufacturer. Several can be + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/EAGLE/VISCAShield.sch b/EAGLE/VISCAShield.sch index 0d14017..cb5d8bf 100644 --- a/EAGLE/VISCAShield.sch +++ b/EAGLE/VISCAShield.sch @@ -4061,6 +4061,567 @@ type V526-0, grid 2.5 mm + +<h3>SparkFun Communication ICs</h3> +This is the communications library, which contains things that exist on wired busses. This includes USB to serial conversion ICs, like the FTDI line, plus high speed line drivers, level shifters, bus drivers, CAN transceivers and ethernet PHYs. +<br> +<br> +We've spent an enormous amount of time creating and checking these footprints and parts, but it is <b> the end user's responsibility</b> to ensure correctness and suitablity for a given componet or application. +<br> +<br>If you enjoy using this library, please buy one of our products at <a href=" www.sparkfun.com">SparkFun.com</a>. +<br> +<br> +<b>Licensing:</b> Creative Commons ShareAlike 4.0 International - https://creativecommons.org/licenses/by-sa/4.0/ +<br> +<br> +You are welcome to use this library for commercial purposes. For attribution, we ask that when you begin to sell your device using our footprint, you email us with a link to the product being sold. We want bragging rights that we helped (in a very small part) to create your 8th world wonder. We would like the opportunity to feature your device on our homepage. + + +<h3>SOIC-16</h3> +<p>Specifications: +<ul><li>Pin count: 16</li> +<li>Width:0.15"</li> +</ul></p> +<p>Example device(s): +<ul><li>HEX_CONVERTER</li> +</ul></p> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + +<h3>Dual In Line Package - 16</h3> +<p>Specifications: +<ul><li>Pin count:16</li> +</ul></p> +<p>Example device(s): +<ul><li>MAX2323</li> +</ul></p> + + + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + +<b>TSOP16</b><p> +thin small outline package + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + +SOIC-16 +Specifications: +Pin count: 16 +Width:0.15" + +Example device(s): +HEX_CONVERTER + + + + + + +Dual In Line Package - 16 +Specifications: +Pin count:16 + +Example device(s): +MAX2323 + + + + + + +TSOP16 +thin small outline package + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + + + + + + + + + +<h3>RS232 Transceiver</h3> +<p>This part covers 232 drivers that are compatible with the MAX3232.</p> +<p><a href="http://cdn.sparkfun.com/datasheets/Components/General%20IC/SP3232EBCA-L.pdf">Sipex SP3232EB Datasheet</a></p> +<h4>SparkFun Products</h4> +<ul> +<li><a href="https://www.sparkfun.com/products/589">SOIC component</a> (COM-00589 / IC-08171)</li> +<li><b>Retired</b> DIP component (COM-00316 / IC-08446)</li> +<li><a href="https://www.sparkfun.com/products/11189">SparkFun Transceiver Breakout - MAX3232</a> (BOB-11189)</li> +<li><a href="https://www.sparkfun.com/products/13225">SparkFun XBee Explorer Serial</a> (WRL-13225)</li> +</ul> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<h3>SparkFun Capacitors</h3> +This library contains capacitors. +<br> +<br> +We've spent an enormous amount of time creating and checking these footprints and parts, but it is <b> the end user's responsibility</b> to ensure correctness and suitablity for a given componet or application. +<br> +<br>If you enjoy using this library, please buy one of our products at <a href=" www.sparkfun.com">SparkFun.com</a>. +<br> +<br> +<b>Licensing:</b> Creative Commons ShareAlike 4.0 International - https://creativecommons.org/licenses/by-sa/4.0/ +<br> +<br> +You are welcome to use this library for commercial purposes. For attribution, we ask that when you begin to sell your device using our footprint, you email us with a link to the product being sold. We want bragging rights that we helped (in a very small part) to create your 8th world wonder. We would like the opportunity to feature your device on our homepage. + + +<p><b>Generic 1608 (0603) package</b></p> +<p>0.2mm courtyard excess rounded to nearest 0.05mm.</p> + + + + + + + + +>NAME +>VALUE + + + + + +<p><b>Generic 1005 (0402) package</b></p> +<p>0.2mm courtyard excess rounded to nearest 0.05mm.</p> + + + + + + + + +>NAME +>VALUE + + + + + +<p><b>Generic 2012 (0805) package</b></p> +<p>0.2mm courtyard excess rounded to nearest 0.05mm.</p> + + +>NAME +>VALUE + + + + + + +<p><b>Generic 3216 (1206) package</b></p> +<p>0.2mm courtyard excess rounded to nearest 0.05mm.</p> + + + + + + + + +>NAME +>VALUE + + + + + + + +Generic 1608 (0603) package +0.2mm courtyard excess rounded to nearest 0.05mm. + + + + + +Generic 1005 (0402) package +0.2mm courtyard excess rounded to nearest 0.05mm. + + + + + +Generic 2012 (0805) package +0.2mm courtyard excess rounded to nearest 0.05mm. + + + + + +Generic 3216 (1206) package +0.2mm courtyard excess rounded to nearest 0.05mm. + + + + + + + + + +>NAME +>VALUE + + + + + + + + +<h3>1µF ceramic capacitors</h3> +<p>A capacitor is a passive two-terminal electrical component used to store electrical energy temporarily in an electric field.</p> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -4106,6 +4667,12 @@ type V526-0, grid 2.5 mm + + + + + + @@ -4335,6 +4902,30 @@ type V526-0, grid 2.5 mm + + + + + + + + + + + + + + + + + + + + + + + + @@ -4459,6 +5050,36 @@ type V526-0, grid 2.5 mm diff --git a/visca-controller/visca-controller.h b/visca-controller/visca-controller.h index 3fd122d..dde9c77 100644 --- a/visca-controller/visca-controller.h +++ b/visca-controller/visca-controller.h @@ -32,4 +32,56 @@ #define BTN9 12 #define BTN10 13 +const byte numChars = 16; +byte viscaMessage[numChars]; + +// Pan/Tilt +byte panTilt[9] = { 0x81, 0x01, 0x06, 0x01, 0x00, 0x00, 0x03, 0x03, 0xFF }; +byte panUp[9] = { 0x81, 0x01, 0x06, 0x01, 0x00, 0x00, 0x03, 0x01, 0xFF }; // 8x 01 06 01 0p 0t 03 01 ff +byte panDown[9] = { 0x81, 0x01, 0x06, 0x01, 0x00, 0x00, 0x03, 0x02, 0xFF }; // 8x 01 06 01 0p 0t 03 02 ff +byte panLeft[9] = { 0x81, 0x01, 0x06, 0x01, 0x00, 0x00, 0x01, 0x03, 0xFF }; // 8x 01 06 01 0p 0t 01 03 ff +byte panRight[9] = { 0x81, 0x01, 0x06, 0x01, 0x00, 0x00, 0x02, 0x03, 0xFF }; // 8x 01 06 01 0p 0t 02 03 ff +byte panUpLeft[9] = { 0x81, 0x01, 0x06, 0x01, 0x00, 0x00, 0x01, 0x01, 0xFF }; // 8x 01 06 01 0p 0t 01 01 ff +byte panUpRight[9] = { 0x81, 0x01, 0x06, 0x01, 0x00, 0x00, 0x02, 0x01, 0xFF }; // 8x 01 06 01 0p 0t 02 01 ff +byte panDownLeft[9] = { 0x81, 0x01, 0x06, 0x01, 0x00, 0x00, 0x01, 0x02, 0xFF }; // 8x 01 06 01 0p 0t 01 02 ff +byte panDownRight[9] = { 0x81, 0x01, 0x06, 0x01, 0x00, 0x00, 0x02, 0x02, 0xFF }; // 8x 01 06 01 0p 0t 02 02 ff + +byte panStop[9] = { 0x81, 0x01, 0x06, 0x01, 0x09, 0x09, 0x03, 0x03, 0xFF }; // Camera Stop +byte panTiltPosReq[5] = { 0x81, 0x09, 0x06, 0x12, 0xff }; // Resp: y0 50 0p 0q 0r 0s 0t 0u 0v 0w ff ; pqrs: pan position ; tuvw: tilt position + +// Zoom +byte zoomTele[6] = { 0x81, 0x01, 0x04, 0x07, 0x2E, 0xff }; // 8x 01 04 07 2p ff +byte zoomWide[6] = { 0x81, 0x01, 0x04, 0x07, 0x3E, 0xff }; // 8x 01 04 07 3p ff +byte zoomStop[6] = { 0x81, 0x01, 0x04, 0x07, 0x00, 0xff }; +byte zoomDirect[9] = { 0x81, 0x01, 0x04, 0x47, 0x00, 0x00, 0x00, 0x00, 0xff }; // 8x 01 04 47 0p 0q 0r 0s ff +byte zoomPosReq[5] = { 0x81, 0x09, 0x04, 0x47, 0xff }; // Resp: y0 50 0p 0q 0r 0s ff + +// Focus +byte focusAuto[6] = { 0x81, 0x01, 0x04, 0x38, 0x02, 0xff }; +byte focusManual[6] = { 0x81, 0x01, 0x04, 0x38, 0x03, 0xff }; +byte focusDirect[9] = { 0x81, 0x01, 0x04, 0x48, 0x00, 0x00, 0x00, 0x00, 0xff }; // 8x 01 04 48 0p 0q 0r 0s ff pqrs: focus position +byte focusModeInq[5] = { 0x81, 0x09, 0x04, 0x38, 0xff }; // Resp: y0 50 0p ff ; p=2: Auto, p=3: Manual + +// Iris / Gain +byte aeAuto[6] = { 0x81, 0x01, 0x04, 0x39, 0x00, 0xff }; +byte aeManual[6] = { 0x81, 0x01, 0x04, 0x39, 0x03, 0xff }; +byte irisDirect[9] = { 0x81, 0x01, 0x04, 0x4B, 0x00, 0x00, 0x00, 0x00, 0xff }; // 8x 01 04 4B 0p 0q 0r 0s ff pqrs: Iris position, range 0..50 +byte gainDirect[9] = { 0x81, 0x01, 0x04, 0x4C, 0x00, 0x00, 0x00, 0x00, 0xff }; // 8x 01 04 4c 0p 0q 0r 0s ff pqrs: Gain position, values: 12-21dB. +byte aeModeInq[5] = { 0x81, 0x09, 0x04, 0x39, 0xff }; // Resp: y0 50 0p ff ; p=0: Auto, p=3: Manual + +// White Balance +byte wbAuto[6] = { 0x81, 0x01, 0x04, 0x35, 0x00, 0xff }; +byte wbTableManual[6] = { 0x81, 0x01, 0x04, 0x35, 0x06, 0xff }; +byte wbTableDirect[9] = { 0x81, 0x01, 0x04, 0x75, 0x00, 0x00, 0x0, 0x00, 0xff }; // 8x 01 04 75 0p 0q 0r 0s ff pqrs = wb table. + +// Config +byte address_command[4] = { 0x88, 0x30, 0x01, 0xFF }; // Sets camera address (Needed for Daisy Chaining) +byte if_clear[5] = { 0x88, 0x01, 0x00, 0x01, 0xFF }; // Checks to see if communication line is clear +byte ir_off[6] = { 0x81, 0x01, 0x06, 0x09, 0x03, 0xff }; // Turn off IR control (required for speed control of Pan/Tilt) +byte callLedOn[6] = { 0x81, 0x01, 0x33, 0x01, 0x01, 0xff}; +byte callLedOff[6] = { 0x81, 0x01, 0x33, 0x01, 0x00, 0xff}; +byte callLedBlink[6] = { 0x81, 0x01, 0x33, 0x01, 0x02, 0xff}; + +int delayTime = 500; //Time between commands + #endif diff --git a/visca-controller/visca-controller.ino b/visca-controller/visca-controller.ino index 040cd9a..7c3bb43 100644 --- a/visca-controller/visca-controller.ino +++ b/visca-controller/visca-controller.ino @@ -1,20 +1,138 @@ #include "visca-controller.h" -LiquidCrystal_I2C lcd(0x27,16,2); +LiquidCrystal_I2C lcd(0x27,20,4); SoftwareSerial visca(VISCARX, VISCATX); void setup() { - Serial.begin(9600); + Serial.begin(115200); while (!Serial) { ; // wait for serial port to connect. Needed for native USB port only } - for (uint8_t i = 2; i <= 12; i++) { + for (uint8_t i = 4; i <= 12; i++) { pinMode(i,INPUT); } + visca.begin(9600); + + initCameras(); + Serial.println("Started"); } void loop() { + readSerial(); + receiveData(); + readButtons(); + // int talentDimmer = map(analogRead(TALENT_DIMMER_PIN), 0, 1023, 0, 255); +} + +void receiveData() { + static byte ndx = 0; + byte rc; + while (visca.available() > 0) { + rc = visca.read(); + + if (rc != 0xFF) { + viscaMessage[ndx] = rc; + ndx++; + if (ndx >= numChars) { + ndx = numChars - 1; + } + } + else { + for (uint8_t i = 0; i < ndx; i++) { + Serial.print("0x"); + Serial.print(viscaMessage[i], HEX); + Serial.print(" "); + } + Serial.println("0xFF"); + ndx = 0; + byte packet[3] = { 0x10, 0x41, 0xFF }; + visca.write(packet, 3); + } + } +} + + +void readSerial() { + if (Serial.available() > 0) + { + char inChar = Serial.read(); // read incoming serial data: + + switch(inChar) { + case '1': + initCameras(); + break; + case 'w': + sendViscaPacket(panUp, sizeof(panUp)); + break; + case 'a': + sendViscaPacket(panLeft, sizeof(panLeft)); + break; + case 's': + sendViscaPacket(panDown, sizeof(panDown)); + break; + case 'd': + sendViscaPacket(panRight, sizeof(panRight)); + break; + case 'q': + sendViscaPacket(panStop, sizeof(panStop)); + break; + case 'z': + sendViscaPacket(callLedBlink, sizeof(callLedBlink)); + break; + case 'r': + sendViscaPacket(zoomTele, sizeof(zoomTele)); + break; + case 'f': + sendViscaPacket(zoomStop, sizeof(zoomStop)); + break; + case 'v': + sendViscaPacket(zoomWide, sizeof(zoomWide)); + break; + } + } +} + +unsigned long time_now = 0; +void readButtons() { + if(millis() > time_now + 100) { + time_now = millis(); + + bool button1 = digitalRead(8); + if(button1 == true) { + sendViscaPacket(panTiltPosReq, sizeof(panTiltPosReq)); + } + } +} + +void sendViscaPacket(byte* packet, int byteSize) { + Serial.print("Sending:"); + for (int i = 0; i < byteSize; i++) + { + Serial.print(" 0x"); + Serial.print(packet[i], HEX); + visca.write(packet[i]); + } + Serial.println(); +} + +void initCameras() { + //Send Address command + Serial.println("Setting addresses..."); + sendViscaPacket(address_command, sizeof(address_command)); + delay(delayTime); //delay to allow camera time for next command + receiveData(); + // Turn off IR control + Serial.println("Disabling IR control..."); + sendViscaPacket(ir_off, sizeof(ir_off)); + delay(delayTime); //delay to allow camera time for next command + receiveData(); + + //Send IF_clear command + Serial.println("Sending IF_Clear..."); + sendViscaPacket(if_clear, sizeof(if_clear)); + delay(delayTime); //delay to allow camera time for next command + receiveData(); }