Team:Cambridge-JIC/Make Your Own js

           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 another fluorescent protein, 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\:


<thead></thead><tbody></tr>'
     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 += '</tr></tr>'
     }
     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 += '</tbody>
3D PRINTED COMPONENTS
#Part
1chassis
1base
2side supports for z axis
1cube holder
1z axis in 2 parts (vertical + horizontal)
13-legged camera holder
2slide clips
1bright-field cube (for RPi lens)
1bright-field cube (for ball lens)
1dark-field tube in 3 parts
3sets of 2 epicubes (1 for RPi lens and 1 for ball lens)
3sets of drawers (for filters and mirrors)
2sets of 2 epicubes (1 for RPi lens and 1 for ball lens)
2sets of drawers (for filters and mirrors)
1set of 2 epicubes (1 for RPi lens and 1 for ball lens)
1set of drawers (for filters and mirrors)
3manual gears
3screw holders
3motor-clip covers
3screw holders
3motor-clip holders
1battery holder for RPi
2battery holders for RPi
1battery holder for RPi
'

ret += 'All 3D printed components can be found in this ZIP file [LINK TO ZIP FOLDER WITH ALL SCAD & STL FILES]. For each of these parts, STL and SCAD files are provided. Use the STL file if you want to view the component, and the SCAD file if you need to edit it (using OpenSCAD or similar software).

However, when it comes to making the microscope, do print several components in one go - it will save some time. Just print everything that is in this file [INCLUDE COMBINED PRINT FILES]. And make sure to check out our 3D printing tips [LINK TO SO YOU THINK YOU CAN PRINT]

If you do not have access to a 3D printer, you can send your files to a 3D printing service and they’ll ship your printed parts.
'

ret += '
<thead></thead><tbody>'
     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 += ''
     }
     else {
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 += '</tbody>
OFF-THE-SHELF COMPONENTS
#PartCost/unit (GBP)Details & link to provider
1white LED (bright-field)0.554<a href="http://uk.rs-online.com/web/p/visible-leds/7133955/?searchTerm=NSPW500DS&relevancy-data=636F3D3226696E3D4931384E4B6E6F776E41734D504E266C753D656E266D6D3D6D61746368616C6C7061727469616C26706D3D5E5B5C707B4C7D5C707B4E647D2D2C2F255C2E5D2B2426706F3D313326736E3D592673743D4D414E5F504152545F4E554D4245522677633D424F5448267573743D4E535057353030445326" style="color:#0000bb">Mfr: Nichia; Part No. NSPW500DS</a> (must be bought in multiples of 5)
1ball lens12.20<a href="http://www.comaroptics.com/components/lenses/simple-convex-lenses/sapphire-and-glass-ball-lenses#row-03_vq_04" style="color:#0000bb">Mfr: Comar; Part No: 03 VQ 04</a>
225 mm long M4 screws0.107Buy at hardware store<a ref="https://www.mackay.co.uk/forgefix-machine-screw-pozi-pan-head-zp-m4-25mm-blister-10-msph425b-screws-fixings-hardware-security-toolbank-brands.html" style="color:#0000bb"> (reference price/unit for a pack of 10)</a>
140 mm long M4 screw0.107Buy at hardware store<a ref="https://www.mackay.co.uk/forgefix-machine-screw-pozi-pan-head-zp-m4-40mm-blister-6-msph440b-screws-fixings-hardware-security-toolbank-brands.html" style="color:#0000bb"> (reference price/unit for a pack of 10)</a>
3M4 nuts0.0043Buy at hardware store<a ref="https://www.mackay.co.uk/forgefix-hexagon-nut-zp-m4-bag-100-100nut4-hexagonal-nuts-bolts-fixings-hardware-security-toolbank-brands.html" style="color:#0000bb"> (reference price/unit for a pack of 100)</a>
3M4 washers0.0037Buy at hardware store<a ref="https://www.mackay.co.uk/forgefix-flat-washer-heavyduty-zp-m4-bag-100-100hdwash4-washers-bolts-nuts-fixings-hardware-security-toolbank-brands.html" style="color:#0000bb"> (reference price/unit for a pack of 100)</a>
1Raspberry Pi 2 Model B26.60<a href="http://uk.rs-online.com/web/p/processor-microcontroller-development-kits/832-6274/" style="color:#0000bb">Processor part number: BCM2836</a>
1Ralink RT5370 WiFi adapter9.10<a href="http://www.amazon.co.uk/gp/product/B00IQFGJSS?psc=1&redirect=true&ref_=oh_aui_detailpage_o02_s00" style="color:#0000bb">Amazon Standard Identification Number (ASIN)\: B00IQFGJSS</a>
1Arduino UNO with its USB B connector21.00<a href="https://shop.pimoroni.com/products/arduino-uno" style="color:#0000bb">Mfr: Arduino; Part No. A000066</a>
1breadboard2.82<a href="http://uk.farnell.com/multicomp/mcbb400/breadboard-solderless-300v-abs/dp/2395961?ost=2395961&mckv=ezr2Yisy&CMP=KNC-GUK-FUK-GEN-SHOPPING-MULTICOMP&CAGPSPN=pla&gclid=Cj0KEQjwg9-vBRCK7L7wmO2u0JcBEiQA_tzoaEPR46s_SrENpnwFOv5PS_hqUNVzk8VV5QPxB9AZBwYaAupo8P8HAQ&CAWELAID=120173390000249291&gross_price=true" style="color:#0000bb">Mfr: Multicomp; Part No. MCBB400</a>
116GB micro SD card5.43<a href="http://www.amazon.co.uk/SanDisk-Ultra-Imaging-C10-MicroSDHC/dp/B00MBTP8Q4/ref=sr_1_6?ie=UTF8&qid=1442328635&sr=8-6&keywords=micro+sd+16gb+memory+cards" style="color:#0000bb">Model number: SDSDQUIN-016G-G4; ASIN: B00MBTP8Q4</a>
2220 ohm resistors0.065<a href="http://uk.rs-online.com/web/p/through-hole-fixed-resistors/0131794/" style="color:#0000bb">Brand: TE Connectivity; Part No. CFR100J220R</a> (must be bought in multiples of 10)
1ethernet cable9.99<a href="http://www.pcworld.co.uk/gbuk/computing-accessories/computer-accessories/power-and-cables/computing-cables-and-adaptors/sandstrom-scat65m12-rj45-to-rj45-cat-6-ethernet-cable-5m-12567142-pdt.html" style="color:#0000bb">Mfr: Sandstrøm; Product code: 874926</a>
1100 m spool insulated single-core wire13.45<a href="http://uk.rs-online.com/web/p/single-core-control-cable/7244311/" style="color:#0000bb">Brand: Lapp; Part No. 4510021</a>
4RPi cameras22.18<a href="http://www.misco.co.uk/product/217272/Raspberry-Pi-NoIR-Camera-Board?fromProductList=Search+result" style="color:#0000bb">Brand: Raspberry Pi; Part No. PiNoir</a>
1RPi ribbon cable0.00Comes with RPi camera
3RPi cameras22.18<a href="http://www.misco.co.uk/product/217272/Raspberry-Pi-NoIR-Camera-Board?fromProductList=Search+result" style="color:#0000bb">Brand: Raspberry Pi; Part No. PiNoir</a>
1RPi ribbon cable0.00Comes with RPi camera
2RPi cameras22.18<a href="http://www.misco.co.uk/product/217272/Raspberry-Pi-NoIR-Camera-Board?fromProductList=Search+result" style="color:#0000bb">Brand: Raspberry Pi; Part No. PiNoir</a>
1RPi ribbon cable0.00Comes with RPi camera
1RPi camera22.18<a href="http://www.misco.co.uk/product/217272/Raspberry-Pi-NoIR-Camera-Board?fromProductList=Search+result" style="color:#0000bb">Brand: Raspberry Pi; Part No. PiNoir</a>
1RPi ribbon cable0.00Comes with RPi camera
1blue LED (GFP)0.225<a href="http://onecall.farnell.com/kingbright/l-10934vbc-ds-d/led-3mm-blue-4000mcd-470nm/dp/2373492?ost=2373492" style="color:#0000bb">Mfr: Kingbright; Part No. L-10934VBC/DS-D</a>
1550nm dichroic mirror, 25x16mm (GFP)19.40<a href="http://www.comaroptics.com/components/filters/dichroic-filters/long-pass-dichroic-filters#row-550_iy_116" style="color:#0000bb">Mfr: Comar; Part No. 550 1Y 116</a>
1490nm excitation filter, 25x16mm (GFP)19.40<a href="http://www.comaroptics.com/components/filters/dichroic-filters/short-pass-dichroic-filters#row-495_ik_116" style="color:#0000bb">Mfr: Comar; Part No. 495 1K 116</a>
1500nm emission filter, 25x16mm (GFP)19.40<a href="http://www.comaroptics.com/components/filters/dichroic-filters/band-pass-dichroic-filters#row-515_ib_116" style="color:#0000bb">Mfr: Comar; Part No. 515 1B 116</a>
1amber LED* (RFP)1.088<a href="http://uk.rs-online.com/web/p/visible-leds/8107834/" style="color:#0000bb">Brand: OSRAM Opto Semiconductors; Part No. LY CKBP-JYKX-36-1</a> (must be bought in multiples of 5)
1dichroic mirror* (RFP)19.40<a href="http://www.comaroptics.com/components/filters/dichroic-filters/long-pass-dichroic-filters#row-650_iy_116" style="color:#0000bb">Mfr: Comar; Part No. 650 IY 116</a>
1excitation filter* (RFP)19.40<a href="http://www.comaroptics.com/components/filters/dichroic-filters/band-pass-dichroic-filters#row-534_ib_116" style="color:#0000bb">Mfr: Comar; Part No. 534 IB 116</a>
1emission filter* (RFP)19.40<a href="http://www.comaroptics.com/components/filters/gelatin-and-polyester-colour-filters#row-575_wb_75" style="color:#0000bb">Mfr: Comar; Part No. 575 WB 75</a>
5LEDs**?tailored to FP
1dichroic mirror**?tailored to FP
1excitation filter**?tailored to FP
1emission filter**?tailored to FP
3stepper motors3.95<a href="http://onecall.farnell.com/adafruit-industries/858/stepper-motor-512-step-5vdc/dp/MC02058?ost=MC02058" style="color:#0000bb">Mfr: Adafruit Industries; Part No. 858</a>
2UNL2003A Darlington driver chips0.42<a href="http://uk.rs-online.com/web/p/darlington-transistors/4368451/" style="color:#0000bb">Mfr: Texas Instruments; Part No. ULN2003AN</a>
19V battery connector0.172<a href="http://uk.rs-online.com/web/p/battery-holders-mounts/0489021/" style="color:#0000bb">Brand: RS; Stock No. 489-021</a>
29V battery connectors0.172<a href="http://uk.rs-online.com/web/p/battery-holders-mounts/0489021/" style="color:#0000bb">Brand: RS; Stock No. 489-021</a>
19V battery connector0.172<a href="http://uk.rs-online.com/web/p/battery-holders-mounts/0489021/" style="color:#0000bb">Brand: RS; Stock No. 489-021</a>
11 Low Profile MoPi power board25.00<a href="https://shop.pimoroni.com/products/mopi-mobile-pi-power?utm_medium=cpc&utm_source=googlepla&variant=909042229&gclid=Cj0KEQjwg9-vBRCK7L7wmO2u0JcBEiQA_tzoaMQfkAkb65Xgv6GXoWhTroobFXImuYP392yZocnZEJIaAoYM8P8HAQ" style="color:#0000bb">Product code: MOPI-LP</a>
12A micro USB power cable5.66<a href="http://uk.rs-online.com/web/p/plug-in-power-supply/7653311/" style="color:#0000bb">Mfr: RS; Part No. HNP10I-microUSB</a>
' ret += '
Important notes:

    '
         if(options[3] == 0) {
    
    ret += '
  • We haven\'t managed to get RFP imaging working yet so the items marked with an asterisk (*) are provided for guidance only\! You may need to find alternative LEDs, filters and dichroic mirror in order to achieve RFP fluorescence.

  • '
         }
         if(options[4] == 0) {
    
    ret += '
  • You are looking to image another fluorescent protein e.g. YFP. You will need to find adequate LEDs, filters and dichroic mirror - these items are marked with two asterisks (**). Otherwise, just follow instructions as usual.

  • '
         }
    
    ret += '
  • The filters and mirrors are larger than what is needed for a single epicube: if cut carefully into WxD rectangles, a single mirror or filter can be used for N epicubes.

  • Only 1 LED is needed per epicube, but we recommend purchasing a few so as to have spares.

  • We recommend purchasing 1 RPi camera for each imaging mode (e.g. if you want to image bright-field + GFP + RFP, buy 3 cameras). This is so that you can fix each camera to one cube and leave it there. You CAN buy a single camera for several imaging modes and swap it between cubes, but this will increase the risk of damaging the CCD.
' ret += '

Assembly instructions:


  • Make sure you have some superglue, blue-tak, sticky tape, a file and some pliers.

  • Print all the necessary parts. You\'ll notice that the printer adds a sort of brim to the bottom surface of each part. Cut away the brim for each of the parts, and file the edges if necessary.

  • Remove the lens from the Raspberry Pi camera. In order to avoid damaging the camera, first detach the sensor from the camera board (notice they are connected by an orange connector marked \"SUNNY\". Then, using a pair of pliers (the kind with a ridged surface), grip the top circular plastic part of the lens and rotate counter-clockwise. It may be easier to grip the lens firmly and rotate the sensor, rather than the other way around. Once the lens in fully unscrewed, you can just pull it out. Quickly cover the resulting hole in the sensor with some sticky tape to protect the CCD from dust particles. Click the sensor back onto the camera board, and make sure the SUNNY is properly connected.

  • Take the lens you just removed from the RPi camera and push it into the bright-field cube for RPi lens (into the round hole). Make sure that the larger side of the lens is facing outwards.

  • Whenever you need better resolution, use the ball lens instead of the RPi lens (keep in mind it will have a smaller field of view!). In that case, use the bright-field cube for ball lens. Push the ball lens into the round hole. You can pop the lens in and out if needed, but be careful not to damage it!

  • Let\'s assemble the main stage of the microscope. Use superglue (we recommend Loctite\; apply with a brush) for the following steps:
    • The chassis has 2 nut-shaped holes on its bottom surface. Glue one nut into each of the holes.
    • Glue the base onto the bottom the chassis such that they line up correctly.
    • The z axis comes in two parts - a long part, part A, and a part shaped like a square with a corner missing, part B. Glue 1 nut into the hole in part B.
    • Glue the 2 parts of the z axis together. Part A has a small tab which fits into the little slot in part B such that the two parts are at a 90 degree angle. The nut should be facing away from the longer end of part A.
    • The cube holder has 3 slots, two of which are symmetrical. Glue the 2 side supports for the z axis into these symmetrical slots. Orient the side supports such that their tabs are facing inwards and are close to the cube holder.
    • Push 2 25mm long screws into 2 screw holders, and 1 40 mm long screw into the final screw holder - it may take a bit of force, since the screws need to fit in tightly (do put some glue in the hole before pushing the screws in).

  • Fit the following parts in (you might have to file all holes until they are smooth and large enough...)\:
    • Turn the chassis upside down. There is a small rectangular slot at the centre: push the z axis into this slot, until part B sits at the same height as the bottom of the chassis. Make sure the z axis can slide smoothly up and down. Return the chassis to its upright position.
    • From the top of the chassis you will see two rectangular slots: use them to slide in the supports for the z axis (which are glued to the cube holder) - part A of the z axis should now fit into the remaining hole in the cube holder. Glue it in place.
    • Now put a washer in each of the screws, push the screws through the 3 holes in the chassis and screw them into the nuts.
    • '
           if(options[5] == 0) {
      
      ret += '
    • Push the 3 motor clip covers into the L shaped protrusions at the top of the chassis.
    • Push the 3 manual gears into the screw holders.
    • '
           }
           if(options[5] == 1) {
      
      ret += '
    • Push the 3 motor clip holders into the L shaped protrusions at the top of the chassis.
    • Mount the 3 motors: push the camshafts of the motors into the screw holders.
    • '
           }
           if(options[5] == 2) {
      
      ret += '
    • When using manual mode, push the 3 motor clip covers into the L shaped protrusions at the top of the chassis. For motorised mode, use the 3 motor clip holders instead.
    • For manual mode, push the 3 manual gears into the screw holders. For motorised mode, push the camshafts of the motors into the screw holders.
    • '
           }
      
      ret += '


  • Take the bight-field cube of your choice (either the one with the RPi lens or the one with the ball lens) and slide it into the cube holder, with the lens facing down. Make sure the cube goes all the way down (front face of cube at the level of the bottom surface of the holder).


  • Remove the protective sticky tape from the RPi camera, then click the sensor into the back of the bright-field cube. Ensure that the SUNNY remains connected at all times.

  • '
        if(options[2] == 0 || options[3] == 0 || options[4] == 0) {
    
    ret += '
  • Make one epicube per FP to be imaged. You will need a diamond glass cutter. To make one epicube:
    • Decide whether you will be using the ball lens or the RPi lens, and print the corresponding epicube. Add the lens as previously explained.
    • Using the glass cutter, cut the dichroic mirror into rectangles of size 10x10 mm, and the excitation and emission filters into rectangles of size 10x6 mm. Make sure you don't get the filters mixed up!
    • Place the dichroic mirror into the large drawer, and use the remaining two drawers for the excitation and emission filters. Make sure the mirror and filters are clean.
    • Slide the large drawer, with the dichroic mirror, into the diagonal slit of the epicube.
    • On the side of the epicube is a small hole for the LED: slot the drawer with the excitation filter in front of this hole, with the handle facing away from the lens.
    • Slide the 3rd and final drawer into the remaining slot.
    • Slide the epicube into the cube holder from the top, as far as it will go.
    • Slot the RPi camera sensor (minus the lens) into the back of the epicube.
    • Push the LED into the small hole on the side of the epicube: it should just stay there, but feel free to add some blue-tak if necessary.

    '
        }
    
    ret += '
' 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);
});