Difference between revisions of "Team:Cambridge-JIC/Make Your Own js"

Line 160: Line 160:
 
       ret += '</table>'
 
       ret += '</table>'
  
     ret += '<br/><table><tr><th colspan="4" style="text-align:center">OFF-THE-SHELF COMPONENTS</th></tr><tr><th>Number</th><th>Part</th><th>Cost per unit (GBP)</th><th>Description/Provider</th></tr><tr><td>~5</td><td>bright-field LEDs</td></tr><tr><td>??</td><td>lenses</td></tr><tr><td>2</td><td>25 mm long M4 screws</td></tr><tr><td>1</td><td>40 mm long M4 screw</td></tr><tr><td>3</td><td>M4 nuts + washers</td></tr><tr><td>1</td><td>Raspberry Pi 2 Model B</td></tr><tr><td>1</td><td>Ralink RT5370 WiFi adapter</td></tr><tr><td>1</td><td>Arduino UNO with its USB B connector</td></tr><tr><td>1</td><td>breadboard</td></tr><tr><td>1</td><td>16GB micro SD card</td></tr><tr><td>1</td><td>20 ohm resistor</td></tr><tr><td>1</td><td>ethernet cable</td></tr><tr><td>??</td><td>insulated single-core wire</td></tr>'
+
     ret += '<br/><table><tr><th colspan="4" style="text-align:center">OFF-THE-SHELF COMPONENTS</th></tr><tr><th>Number</th><th>Part</th><th>Cost per unit (GBP)</th><th>Description/Provider</th></tr><tr><td>~5</td><td>bright-field LEDs</td><td>0.554</td><td><a href="http://uk.rs-online.com/web/p/visible-leds/7133955/?searchTerm=NSPW500DS&relevancy-data=636F3D3226696E3D4931384E4B6E6F776E41734D504E266C753D656E266D6D3D6D61746368616C6C7061727469616C26706D3D5E5B5C707B4C7D5C707B4E647D2D2C2F255C2E5D2B2426706F3D313326736E3D592673743D4D414E5F504152545F4E554D4245522677633D424F5448267573743D4E535057353030445326">Mfr. Part No.NSPW500DS</a> (must be bought in multiples of 5)</td></tr><tr><td>??</td><td>lenses</td></tr><tr><td>2</td><td>25 mm long M4 screws</td></tr><tr><td>1</td><td>40 mm long M4 screw</td></tr><tr><td>3</td><td>M4 nuts + washers</td></tr><tr><td>1</td><td>Raspberry Pi 2 Model B</td></tr><tr><td>1</td><td>Ralink RT5370 WiFi adapter</td></tr><tr><td>1</td><td>Arduino UNO with its USB B connector</td></tr><tr><td>1</td><td>breadboard</td></tr><tr><td>1</td><td>16GB micro SD card</td></tr><tr><td>1</td><td>20 ohm resistor</td></tr><tr><td>1</td><td>ethernet cable</td></tr><tr><td>??</td><td>insulated single-core wire</td></tr>'
  
 
       if(options[2] == 0 && options[3] == 0 && options[4] == 0) {
 
       if(options[2] == 0 && options[3] == 0 && options[4] == 0) {

Revision as of 15:12, 15 September 2015

           quiz = function(elem){
               this.elem = $(elem);
               this.steps = [];
               this.step = function(question, answers) {
                   this.question = question;
                   this.answers = {};
                   this.bind = function(target, keys) {
                       if (typeof keys === "undefined") {
                           keys = Object.keys(this.answers);
                       }
                       for (var i=0; i<keys.length; i++) {
                           key = keys[i];
                           this.answers[key].target = target;
                       }
                   };
                   this.elem = function(quiz, index) {
elem = $('
'); elem.append($('

').text(this.question)); for (key in this.answers) { elem.append($('
')
                               .text(this.answers[key].answer)
                               .data("key", key)
                               .data("step", this)
                               .data("quiz", quiz)
                               .data("index", index)
                               .click(function(){
                                   key = $(this).data("key");
                                   step = $(this).data("step");
                                   quiz = $(this).data("quiz");
                                   index = $(this).data("index");
                                   ref = quiz.steps[index];
                                   ref.elem.find('.cam-quiz-selected').removeClass('cam-quiz-selected');
                                   $(this).addClass('cam-quiz-selected');
                                   for (var i=quiz.steps.length; --i>index;) {
                                       quiz.steps[i].elem.remove();
                                       quiz.steps.pop();
                                   }
                                   quiz.steps[index].option = key;
                                   nstep = step.answers[key].target;
                                   switch (typeof nstep) {
                                       case "object":
                                           var nindex = quiz.steps.length;
                                           var nref = {
                                               'step': nstep,
                                               'elem': nstep.elem(quiz, nindex),
                                               'option': undefined
                                           };
                                           quiz.steps.push(nref);
                                           quiz.elem.append(nref.elem);
                                           break;
                                       case "function":
                                           options = [];
                                           for (var i=0; i<quiz.steps.length; i++) {
                                               options.push(quiz.steps[i].option);
                                           }
                                           var nref = {
                                               'step': undefined,
'elem': $('
')
                                                   .append(nstep(options)),
                                               'option': undefined
                                           };
                                           quiz.steps.push(nref);
                                           quiz.elem.append(nref.elem);
                                           break;
                                       default:
                                           alert("Quiz error! Please contact the site maintainers....");
                                           break;
                                   }
                               }));
                       }
                       return elem;
                   };
                   for (key in answers) {
                       answer = answers[key];
                       this.answers[key] = {
                           'answer': answer,
                           'target': undefined
                       };
                   }
               };
               this.start = function(step) {
                   index = this.steps.length;
                   ref = {
                       'step': step,
                       'elem': step.elem(this, index),
                       'option': undefined
                   };
                   this.steps.push(ref);
                   this.elem.append(ref.elem);
               };
           };
           $(document).ready(function(){
               q = new quiz('#cam-quiz');
               step0 = new q.step("Tell us which options you'd like for your microscope.", {
                   1: "Okay!"
               });
               step1 = new q.step("Besides bright-field, do you need dark-field imaging?", {
                   0: "Yes",
                   1: "No"
               });
               step2 = new q.step("Do you need to image GFP fluorescence?", {
                   0: "Yes",
                   1: "No"
               });
               step3 = new q.step("Do you need to image RFP fluorescence?", {
                   0: "Yes",
                   1: "No"
               });
               step4 = new q.step("Do you need to image other fluorescent proteins, e.g. YFP?", {
                   0: "Yes",
                   1: "No"
               });
               step5 = new q.step("Do you want your microscope to be manual, motorised, or will you need to swap between both?", {
                   0: "Manual only",
                   1: "Motorised only",
                   2: "Both",
               });
               step6 = new q.step("Do you need your microscope to be fully battery-powered, e.g. for fieldwork?", {
                   0: "Yes",
                   1: "No"
               });

final = function(options) {

     window.location.href="#CC0";
ret = '<h3>Thanks!</h3>

Here\'s what you\'ll need\:


'
     if(options[1] == 0) {
ret += ''
     }
     if(options[2] == 0 && options[3] == 0 && options[4] == 0) {
ret += ''
     }
     else if((options[2] == 0 && options[3] == 0) || (options[2] == 0 && options[4] == 0) || (options[3] == 0 && options[4] == 0)) {
ret += ''
     } else if(options[2] == 0 || options[3] == 0 || options[4] == 0) {
ret += ''
     }
     if(options[5] == 0 || options[5] == 2) {
ret += ''
     }
     if(options[5] == 1 || options[5] == 2) {
ret += ''
     }
     if((options[5] == 1 || options[5] == 2) && options[6] == 1) {
ret += ''
     }
     if((options[5] == 1 || options[5] == 2) && options[6] == 0) {
ret += ''
     }
     if(options[6] == 0 && !(options[5] == 1 || options[5] == 2)) {
ret += ''
    }
ret += '
3D PRINTED COMPONENTS
NumberPartCost per unit (GBP)STL fileSCAD file
1main stage
3legs
2side supports for z axis
1z axis in 3 parts (vertical + horizontal + connector)
1connecting ring bw z axes
13-legged camera holder
2slide clips
1bright-field cube
1dark-field tube in N parts
3epicubes
3drawers for the excitation filters
3drawers for the emission filters
3drawers for the dichroic mirrors
2epicubes
2drawers for the excitation filters
2drawers for the emission filters
2drawers for the dichroic mirrors
1epicube
1drawer for the excitation filter
1drawer for the emission filter
1drawer for the dichroic mirror
3screw gears
3manual gears
3screw holders
3screw gears for motors
3motor holders
1battery holder for RPi
2battery holders for RPi
1battery holder for RPi
' ret += '
'
     if(options[2] == 0 && options[3] == 0 && options[4] == 0) {
ret += ''
     }
     else if((options[2] == 0 && options[3] == 0) || (options[2] == 0 && options[4] == 0) || (options[3] == 0 && options[4] == 0)) {
ret += ''
     } else if(options[2] == 0 || options[3] == 0 || options[4] == 0) {
ret += ''
     }
     if(options[2] == 0) {
ret += ''
     }
     if(options[3] == 0) {
ret += ''
     }
     if(options[4] == 0) {
ret += ''
     }
     if(options[5] == 1 || options[5] == 2) {
ret += ''
     }
     if((options[5] == 1 || options[5] == 2) && options[6] == 1) {
ret += ''
     }
     if((options[5] == 1 || options[5] == 2) && options[6] == 0) {
ret += ''
     }
     if(options[6] == 0 && !(options[5] == 1 || options[5] == 2)) {
ret += ''
    }
     if(options[6] == 0) {
ret += ''
     }
     if(options[6] == 1) {
ret += ''
     }
ret += '
OFF-THE-SHELF COMPONENTS
NumberPartCost per unit (GBP)Description/Provider
~5bright-field LEDs0.554<a href="http://uk.rs-online.com/web/p/visible-leds/7133955/?searchTerm=NSPW500DS&relevancy-data=636F3D3226696E3D4931384E4B6E6F776E41734D504E266C753D656E266D6D3D6D61746368616C6C7061727469616C26706D3D5E5B5C707B4C7D5C707B4E647D2D2C2F255C2E5D2B2426706F3D313326736E3D592673743D4D414E5F504152545F4E554D4245522677633D424F5448267573743D4E535057353030445326">Mfr. Part No.NSPW500DS</a> (must be bought in multiples of 5)
??lenses
225 mm long M4 screws
140 mm long M4 screw
3M4 nuts + washers
1Raspberry Pi 2 Model B
1Ralink RT5370 WiFi adapter
1Arduino UNO with its USB B connector
1breadboard
116GB micro SD card
120 ohm resistor
1ethernet cable
??insulated single-core wire
3RPi cameras
1RPi ribbon cablecomes with RPi camera
2RPi cameras
1RPi ribbon cablecomes with RPi camera
1RPi camera
1RPi ribbon cablecomes with RPi camera
~5LEDs (GFP)
1dichroic mirror (GFP)
1excitation filter (GFP)
1emission filter (GFP)
~5LEDs (RFP)
1dichroic mirror (RFP)
1excitation filter (RFP)
1emission filter (RFP)
~5LEDstailored to FP
1dichroic mirrortailored to FP
1excitation filtertailored to FP
1emission filtertailored to FP
3stepper motors
2UNL2003A Darlington driver chips
19V battery connector
29V battery connectors
19V battery connector
11 MoPi power board
12A micro USB power cable
' ret += '

Assembly instructions:


  • Remove the lens from the Raspberry Pi camera. Using a pair of pliers (the kind with a ridged surface), grip the top circular plastic part of the lens and rotate counter-clockwise. We find it\'s easiest to grip the lens firmly and rotate the sensor, rather than the other way around.

  • Using super glue (we recommend Loctite\; apply with a brush) glue the following parts\:
    • nuts (x3) on the bottom of the stage
    • legs (x1 large + x2 small)
    • screw caps (x3)
    • '
           if(options[5] == 0) {
      
      ret += '
    • screw holders (x3)
    • '
           }
           if(options[5] == 1) {
      
      ret += '
    • motor holders (x3)
    • '
           }
           if(options[5] == 2) {
      
      ret += '
    • motor holders (x3) or screw holders (x3) depending on whether motorised or manual mode is used
    • '
           }
      
      ret += '
    • the 2 parts of the z axis together
    • RPi lens into lens holder
    • supporting axes (x2) into cube holder
    • washer into large leg (around the hole)

  • Fit the following parts in (you might have to file all holes until they are smooth and large enough...)\:
    • slide the main z axis into its slot (the central one) from the bottom, make sure it can move smoothly
    • slide the remaining z axis assembly in from top
    • make sure the main z axis fits into the slot in the camera holder, if it does - glue it in place
    • slide the lens (with its holder) into the camera cube
    • click the camera cube into the square hole of the camera holder, make sure it goes all the way down (front face of cube at the level of the bottom surface of the holder)
    • detach the camera sensor from the camera board, click the RPi Cam sensor into the camera cube, click the SUNNY back to the board (make sure it stays connected at all times!!!)
    • put screws into holes on the top cover, place a washer under each screwtop and screw into the nuts (make sure the superglue has dried...) - now you can move the stage and the z axis and you are ready to image!

' return $('
').html(ret)

}

               step0.bind(step1, [1]);
               step1.bind(step2, [0]);
               step1.bind(step2, [1]);
               step2.bind(step3, [0]);
               step2.bind(step3, [1]);
               step3.bind(step4, [0]);
               step3.bind(step4, [1]);
               step4.bind(step5, [0]);
               step4.bind(step5, [1]);
               step5.bind(step6, [0]);
               step5.bind(step6, [1]);
               step5.bind(step6, [2]);
               step6.bind(final, [0]);
               step6.bind(final, [1]);

               q.start(step0);
});