===============Curve_Tracer_Arduino_Code_Below=================== int tri = 5; // TriAngle Wave at D5 int vg = 3; // Voltage step port at D3 int j = 0; // Tri value int k = 0; // Step Value int slope = 4; int incomingByte; // read incoming serial data into void setup() { Serial.begin( 9600); // initialize serial communication: pinMode( tri, OUTPUT); pinMode( vg, OUTPUT); } // setup void loop() { if (Serial.available() > 0) // see if incoming serial data: { incomingByte = Serial.read(); // read oldest byte in serial buffer: } // if (Serial.available() > 0) if (incomingByte == 'H') // if H (ASCII 72), printoutput { delay( 10); j = j+slope; analogWrite( tri, j); // will be PWM 488 Hz analogWrite( vg, k); // will be PWM 488 Hz Serial.print( analogRead(0)); // read current at A0 Serial.print( " "); Serial.println( analogRead(1)); // read tri voltage at A1 delay( 10); // to stabilize adc: if (j > 251) slope = -4 ; if (j < 1) { slope = 4 ; k = k + int(255/5); } // if (j > 251) slope = -4 ; if (k > 255 ) k = 0 ; } // if (incomingByte == 'H') } // loop() ================Curve_Tracer_Processing_Code====================== import processing.serial.*; PrintWriter output; // output file Serial myPort; // The serial port int xPos = 1; // hor position graph void setup () { size( 300, 300); // set the window size: println( Serial.list()); // List serial ports myPort = new Serial(this, Serial.list()[0], 9600 ); // initialize to 9600 baud myPort.bufferUntil('\n'); // serialEvent() @ \n: background( 0); // set inital background: println( "Click on image and hit s to start"); // will start serial data println( "Hit w to write to file"); // dump to file ad stop String file = String.valueOf(year()); file = file +"."+String.valueOf(month()); file = file +"."+String.valueOf(day()); file = file +"."+String.valueOf(hour()); file = file +"."+String.valueOf(minute()); file = file +"."+String.valueOf(second())+".mat"; println( file); output = createWriter(file); // Sketch->Show_Sketch_fie } // setup void draw () { if( keyPressed) { if (key == 's' || key == 'S') { myPort.write( "H"); } //if (key == 's' || key == 'S') if (key == 'w' || key == 'W') { output.flush(); // Writes the remaining data to the file output.close(); // Finishes the file exit(); // Stops the program } // if (key == 'w' || key == 'W') } // if( keyPressed) } // draw () void serialEvent (Serial myPort) { String inString = myPort.readStringUntil('\n'); // get the ASCII string: if (inString != null) { inString = trim(inString); // trim whitespace: int[] vv = int(split(inString, ' ')); // println( inString ); output.println( inString ); float val0 = float(vv[0]); float val1 = float(vv[1]); val0 = map(val0, 0, 1023, 0, height*.95); val1 = map(val1, 0, 1023, 0, height*.95); stroke( 127,34,255); // color to draw line( val1, height - val0-1, val1+1, height - val0); // draw the line: if (xPos >= 6*width) { xPos = 0; // auto redraw background( 0); } // if (xPos >= 2*width) else { xPos= xPos+1; } // else } // if (inString != null) } // serialEvent (Serial myPort) ========Copy_Paste_Into_SciLab_Window=========================== z1 = read( '/Users/donsauer/Downloads/REF_SOURCE/WORK/curvetrace2/NPN.mat', -1, 2); V = 4.88e-3*z1( : , 2); I = 4.88e-3*z1( : , 1); plot( V,I ); xgrid(); xtitle( "NPN_Ib_equal_5_5uA_steps","Collector_Voltage_V","Collector_Current_mA"); ========Copy_Paste_Into_SciLab_Window=========================== z1 = read( '/Users/donsauer/Downloads/REF_SOURCE/WORK/curvetrace2/PNP.mat', -1, 2); V = 5 -4.88e-3*z1( : , 2); I = 5 -4.88e-3*z1( : , 1); plot( V,I ); xgrid(); xtitle( "PNP_Ib_equal_5_5uA_steps","Collector_Voltage_V","Collector_Current_mA"); ========Copy_Paste_Into_SciLab_Window=========================== z1 = read( '/Users/donsauer/Downloads/REF_SOURCE/WORK/curvetrace2/NMOS.mat', -1, 2); V = 4.88e-3*z1( : , 2); I = 4.88e-3*z1( : , 1); plot( V,I ); xgrid(); xtitle( "NMOS_VG_equals_5_1Vsteps","Drain_Voltage_V","Drain_Current_mA"); ========Copy_Paste_Into_SciLab_Window=========================== z1 = read( '/Users/donsauer/Downloads/REF_SOURCE/WORK/curvetrace2/PMOS.mat', -1, 2); V = 5 -4.88e-3*z1( : , 2); I = 5 -4.88e-3*z1( : , 1); plot( V,I ); xgrid(); xtitle( "PMOS_VG_equals_5_1Vsteps","Drain_Voltage_V","Drain_Current_mA"); ============================================================== ===========Cut_Paste_Into_Octave_Window=========================== load -ascii /Users/donsauer/Downloads/REF_SOURCE/WORK/curvetrace2/NPN.mat V = 4.88e-3* NPN( : , 2); I = 4.88e-3* NPN( : , 1); plot( V,I ); grid title ( "NPN Ib equal 5 5uA steps") xlabel ( "Collector Voltage V") ylabel ( "Collector Current mA") ===========Cut_Paste_Into_Octave_Window=========================== load -ascii /Users/donsauer/Downloads/REF_SOURCE/WORK/curvetrace2/PNP.mat V = 5 -4.88e-3*PNP( : , 2); I = 5 -4.88e-3*PNP( : , 1); plot( V,I ); grid title ( "PNP Ib equal 5 5uA steps") xlabel ( "Collector Voltage V") ylabel ( "Collector Current mA") ===========Cut_Paste_Into_Octave_Window=========================== load -ascii /Users/donsauer/Downloads/REF_SOURCE/WORK/curvetrace2/NMOS.mat V = 4.88e-3*NMOS( : , 2); I = 4.88e-3*NMOS( : , 1); plot( V,I ); grid; title ( "NMOS Vg equal 5 1V steps") ; xlabel ( "Drain Voltage V"); ylabel ( "Drain Current mA"); ===========Cut_Paste_Into_Octave_Window=========================== load -ascii /Users/donsauer/Downloads/REF_SOURCE/WORK/curvetrace2/PMOS.mat V = 5 -4.88e-3*PMOS( : , 2); I = 5 -4.88e-3*PMOS( : , 1); plot( V,I ); grid title ( "PMOS Vg equal 5 1V steps") xlabel ( "Drain Voltage V") ylabel ( "Drain Current mA") =================================================================