Step 9: Test it with code

You can take a look at the project code here. You will probably also need the max6675 library. The basic idea is that you pulse current across the resistors to heat up (by setting Arduino pin 7 to high); and turn on the fan to cool down (by setting Arduino pin 9 to high). You can check the temperature by polling the thermocouple.

The main thing is to not overheat (or even blow up) the resistors and sample. ***You never want to leave current running through the resistors for long periods of time!!!*** The thermocouple will not instantly respond to changes in temperature. Our 'heat up' code runs current through the resistors for about half a second and then checks the thermocouple. Every 15 seconds, the system times out and waits for a constant temperature to be reached. This ensures that we catch thermocouple delays, and also let the aluminum block heat evenly. Our heat-up code also has a few checks to make sure the thermocouple is properly connected, not heating up too fast, not overheating, etc.

Also, safety first, ***you don't want to leave this on running without watching it!!***

When cooling down, remember that the fan will continue moving for a few seconds after it's shut off, so it's best to shut off the fan 1 or 2 degrees before ideal temperature is reached.

The temperature is held constant by pulsing the resistors on for a tiny fraction of a second and constantly checking the temperature values. Given the limitations of the thermocouple and Arduino, you can get accuracy to +/-0.5C. However, since the Adafruit website reports a precision or +-2°C, you may also need to calibrate your thermocouple with an actual thermometer first.

The full 32 cycles take about 3 hours (depending on how the case is set up).
<p>nice project, I arrived here after my wife's pcr broke and I was told I need to build one asap, in a week, mine is supposed to have a heater on top to avoid evaporation, but I will definitely use the know how and experience from you guys, the drill bit IS an issue here in Argentina, will try to get it made (8 holes) by a shop. if anyone is interested in the outcome let me know and I'll report back.</p>
Ortega, My name is Leonardo, I am from Argentina too. Can we talk by email or skype? I have a project right now and I think you would like to be part of it. Anyway, contact me if you are interested on keep talking. leonardo.maddio@gmail.com good luck!
<p>has anyone successfully sequenced their own genome with this ? as in the whole thing?</p>
<p>it would be really really hard. you'd also need a spectrophotometer, as well as other imaging machinery. you'd need the proper reagents, water bath. microcentrifuge, etc. and you'd need to do dozens of restriction digests, then be able to utilize software to analyze the results and then have the acuity to make sense of that in any meaningful way. i imagine it would be more difficult with inadequate hardware</p>
Can i replace the heat source (relay and risitors with cermic heater )
<p>yes, and you probably want to </p>
<p>Awesome! </p><p>Does anyone who works in a lab know how well the rates of heating and cooling match a commercial/lab machine? </p><p>And has anyone tried it out to replicate DNA? Any success?</p><p>:)</p>
<p>Is it at all possible that you can make a video showing you using the machine with a kit like the one you suggested? I've never used a PCR machine before, commercial or non-commercial.</p>
<p>Can anyone confirm what the red board connected to the arduino is in the first picture? An exact name and model number would be much appreciated! </p><p>-Thank you!</p>
<p>Could there be any advantage in using a thermoelectric cooler instead of fans and resistors?</p>
<p>Great work! I have got one question: How did you manage to drill the holes so that the reaction vessels fit into them correctly? They are formed conically but the holes do not seem to be so.</p>
Cool project, but I have a question. There is no mention of any Vcc for the arduino in this project, only the power of the relay and the fan. how is supposed to work the arduino? Using the current flowing from the fan?
You ought to have a base resistor on your transistor. About 2.2kOhm should be good (assuming beta=100 for your transistor, which is derating by a factor of 10 from the spec'd 1000). <br> <br>Without a base resistor, your base voltage wants to sit at ~1 volt and your Arduino pin wants to be at 5v. This makes your Arduino unhappy.
This :) Also should probably also have a flyback diode to protector the transistor from back EMF from the fan. The tutorial linked to in the article mentions this. <br> <br>Great project nonetheless!
Actually, the diode is really only necessary with a FET. NPN transistors can typically withstand high voltages.
Yup, I just checked, and I actually do have that in my setup, but not in the writeup. Adding it in now, thanks for the catch!
I was blown away by this article. Incredible work... affordable, homemade laboratory equipment is long overdue. Biology should be accessible to hobbyists and tinkerers! <br> <br>Also, have you heard of the dremelfuge? It's an attachment for a standard rotatory tool or power drill which can generate pretty significant centrifugal acceleration. Figured you might appreciate hearing about it, if you hadn't already. <br> <br>Keep up the good work.
Although those wattage calculations are correct for 120 volts DC, they might not work so well with 120 volts AC, which is what you are giving them. As you probably know, Ac voltage in the states oscillates from negative to positive at about 60 hertz. While we think of our AC power as 120 volts, it is actually higher and lower. 120 is the RMS voltage (the root mean square http://en.wikipedia.org/wiki/Root_mean_square). This means that the &quot;average voltage&quot; of the entire sine wave is 120 volts. This is calculated by taking the peak voltage of the sine wave and dividing by sqrt(2). See this for details: http://en.wikipedia.org/wiki/Alternating_current#Example <br> <br>If the RMs is 120, the peak voltage is 120*sqrt(2)=169.706 <br> <br>so for a large fraction of the operating time, the resistors will be getting above 120 volts, all the way up to 170 volts. <br>I=V/R I=170/300 I=.56 <br>P=VI P=170*.56 P=68 watts <br> <br>Although you are not operating at 170 volts all of the time, you are exceeding the wattage rating for a significant amount of time every second. I sincerely suggest you use 100 watt resistors. These will protect you from peak voltage as well as any power surge/ripple. <br> <br>Besides that, I love the product! I am currently working in a bio lab with fancy thermo cyclers and they are essential to our work. <br> <br>I am sure you can large wattage wirewound resistors on the internet. Good luck. <br>
Hey, thank you so much for this, really appreciate it!! If I stick with the size that fits the block, I might use 2 of&nbsp;<a href="http://www.mouser.com/ProductDetail/Vishay-Dale/RH050300R0FE02/?qs=sGAEpiMZZMtbXrIkmrvidDNaDpN5VXc5bzLo3zOMhiM%3d" rel="nofollow">these</a>&nbsp;in series, 300ohms @ 50 watts.&nbsp;<br> <br> I = 170/600 = 0.28A<br> P=170*.28 = 48Watts (at peaks)<br> <br> Does that seem right?
Your math is correct, and those new resistors will be much better suited to the task.<br>However, to guarantee proper operation and long life, you might want to go even higher. Resistor wattage ratings are usually absolute maximum ratings which can be tolerated for only a short amount of time. With 300 ohm resistors, you go to 96% of the absolute maximum it would likely receive. In the name of caution, I only use resistors at up to 1/2 to 2/3 their rated wattage capacity. Depending on price and availability, I would recommend a total resistance of more than 750 ohms, this will place you below 40 watts at peak. <br>A few reasons for this caution are outlined below.<br><br>The tolerance on your wattage may be several percent, so your capacity could be from 47.5 to 52.5 watts with a 5% tolerance. Unfortunately tolerance on wattage is less prevalent than tolerance on resistance.<br>Also, grid surges and ripples do occur and you want to build your device to handle the worst case scenario. <br><br>It is good practice to err on the side of caution and never trust your components.
For 230V countries: Peak voltage = 325 V<br> <br> For power of 40W - implies 120mA current<br> Resistors would be 2.6 kOhm.<br> <br> Using preferred values:<br> - two 1500 Ohms resistors (choose devices with 25W or greater rating. Preferably 40W)<br> - gives us 110mA and 35 Watts.<br> <br> or: - two 1200 Ohm resistors (choose devices with 30W minimum ratings. Preferably 40-50W)<br> - gives us 135mA at 44 Watts.<br> <br> Use an <a href="http://www.ospid.com/blog/" rel="nofollow">osPID </a>to control the SSR driving the load.<br> Use a cheap (low temp 400C) k-type thermocouple to connect to the osPID controller.
FORGET IT. RMS values are all you need to consider.
This is wrong. <br> <br>The RMS value is THE SAME HEATING value as the equivalent DC. FORGET the peak. <br> <br>Your numbers are completely wrong. We cannot talk about &quot;peak power&quot;, there is no such thing. <br> <br>Steve
This sounds like a perfect candidate for a PID control loop. <a href="http://en.wikipedia.org/wiki/PID_controller" rel="nofollow">http://en.wikipedia.org/wiki/PID_controller</a>
Hey, great about about PID, there's actually an arduino library already written for it <a href="http://arduino.cc/playground/Code/PIDLibrary" rel="nofollow">http://arduino.cc/playground/Code/PIDLibrary</a> I'll try it out!
Also check out the OpenPCR PID library (they just released some new code July 1 2012): https://github.com/jperfetto/OpenPCR/blob/master/arduino/openpcr/pid.cpp <br> <br>Cool project, I'll make one. <br> <br>mac
osPID is a really nice kiln controller with thermocouple input (k-type by default). <br>The project uses the arduino PID library. You might want to check it out. <br>Works perfectly for me. Ramp controls and everything.
Using resistors as a heater? That's a nice idea but how about using peltier?
Very cool! <br> <br>How tightly does the conical section of the PCR tube fit into the heating block? Do you add a liquid or gel to transfer heat between the heater block and the PCR tube when the tube is in the block? <br> <br>Do you add mineral oil on top of the PCR reaction mix to prevent condensation in the cap of the PCR tube? <br> <br>I've seen a couple of other DIY PCR projects. We should get some funds (Kickstarter? a grant?) to manufacture drill bits for milling out the precise profile of a PCR tube. I'd use one. I bet you'd use one... wonder how much a batch of 20 would be. <br> <br>
Hey Mac!!<br> <br> The PCR tube sits really tightly circumference-wise, but the conical section is not tight at all :( We just used a regular drill bit, so our holes are a little longer than the height of the tube. Adding a gel/liquid to speed up heat transfer is a great idea, is there a material you recommend?<br> <br> Yes, def using mineral oil since there's no heated lid.<br> <br> A custom-drill bit might be nice. I found this: <a href="http://www.wolftooltech.com/Single_Diameter_Carbide_Drill_Quote_Request_Form.pdf" rel="nofollow">http://www.wolftooltech.com/Single_Diameter_Carbide_Drill_Quote_Request_Form.pdf</a> I could send in a quote, but if you're trying to build something for under $100, or preferably even under $50, it has to cost like &nbsp;$5-10 or it's probably not worth it...
I think adding mineral oil to fill the bottom of the tube in the heater block would work. <br> <br>It would be neat to find a $10 milling tool set that could be used to drill out the block. Maybe a standard tapered ball-point end mill &amp; a cylindrical drill bit? Not sure. <br> <br>Alternatively someone could have a bunch of 8-tube strip, 16-well, and 48-well blocks manufactured and sold near cost.
you don't need 150 Ohm resistors do you because i found 560 Ohm resistors for $438.
Just some thoughts... <br> <br>Why not use an &quot;off the shelf&quot; heat sink? <br> <br>Wouldn't the SCR last longer if it was mounted on a heat sink? <br> <br>Why not use &quot;off the shelf&quot; heater cartridges instead of those resistors?
This is neat! I've worked on two fully integrated PCR instruments (GeneXpert and a new one not yet on the market) and it looks like you have covered all the bases for a basic amplification machine. <br> <br>When you figure out how to add optics, you'll really have a platform to outcompete the big boys!
This is fantastic! I've been working on one using peltier heat pumps but it was too confusing for a poor molecular biologist like me. I can't wait to build my own and try it out in the lab.
Amazing project -- you made the build and theory easy to understand. Also - I suggest the project name 'PBR PCR'
LOL, thanks for the name suggestion, if i ever print a PCB for this, that's what i'll call it. PBR pretty much comes out of the tap in Pittsburgh
Nice - the 'PBR PCR PCB'
I love the enclosure design. The project's pretty cool too.
very good
very good
<a href="http://rent.tickets.ua/" rel="nofollow">Аренда квартир Одесса</a> <br>
<a href="http://rent.tickets.ua/" rel="nofollow">Аренда квартир Одесса</a> <br>

About This Instructable


284 favorites


More by staceyk: Arduino PCR (thermal cycler) for under $85 DIY Projects, Communities and Cultures Air quality balloons
Add instructable to: