Step 3: Hooking it all up
The hot plate AC control system is detailed in the Extreme Surface Mount Soldering Instructable already mentioned, or you can buy your own SSR (solid state relay). Be sure it can handle the hot plate load with sufficient margin, say a 20 to 40 watt rating, since the testing done by the Chinese may leave something to be desired. If you use the hot plate AC controller from my Instructable, then run a jumper from the resistor on the control input to ground on the Ard/Free-duino and a jumper from the control output (B4, or whatever you chose) to Control Signal Input. See the picture of the controller. The yellow jumper is the Control Signal Input and the green jumper goes to Ground. I like to use an blinkenlight (led with a resistor to ground) on the output pin so I know when it's on. Connect your jumper between the led and the port as shown. Refer to the Teensy++ Hookup Diagram.
Now rig up a support to hold the IR temperature sensor over your hot plate. The picture shows what I did. Simple but sturdy is the rule. Keep anything flammable well away from the hot plate; the sensor is plastic and seems to be just fine 3 inches above the surface of the plate. Run wires from the connector on your sensor to the appropriate pins on your Ard/Free-duino. Connections for the IR sensor are shown in the Teensy++ Hookup Diagram. Adapt these as needed for your Ard/Free-duino.
Important Safety Note: The IR sensor has an led pointer that aids in aiming it. If you have cats like mine, they love to chase the led pointer. So cover the led with some opaque tape to keep your cats from jumping on the hot plate when you're using it.
Before you plug the hot plate AC controller into120V, here's how to test the system out and set initial target values for temperature. I suggest a target temperature of 20 C so heating doesn’t start immediately. These values will be stored in EEPROM and used next time, so be sure you always store a low value as the target temperature when you’re done with a soldering session. I find it a good idea to start the temperature controller with the hot plate unplugged at first. Make sure everything is working before you plug it in.
Connect your serial port to your Arduino and power it up. Compile the Arduino sketch and download it. Start the Processing sketch to interact with the controller and display results. Occasionally, the Arduino sketch will not synchronize with the Processing sketch. When this happens, you'll see the message “No Update” in the console window of the Processing sketch. Simply stop and restart the Processing sketch and things should be OK. If not, have a look at the Troubleshooting section below.
Here are the commands for the controller. “Delta” is the amount that a parameter will change when commanded. First set the value of delta that you want to use. Then adjust the desired parameter using that delta. For example, use the + and – to make delta 10. Then use T (capital “T”) to increase the target temperature setting by 10 degrees C, or t (lower case “t”) to decrease the target temperature by 10 degrees. Commands:
+/- : adjust delta by a factor of ten
P/p : up/down adjust p gain by delta
I/i : up/down adjust i gain by delta
D/d : up/down adjust d gain by delta
T/t : up/down adjust set temp by delta
h : toggle help screen on and off
R : reset values – do this the first time you run the controller
Once you’re getting temperature updates, the graphic window of the sketch should look like the picture. If you have a large grey area imposed on the screen with some commands described, simply type “h” to clear it. When you start for the first time, you may be prompted to reset the initial values. Go ahead and do that. The values in the upper right corner are the current readings and settings. “Goal” is the current target temperature and is changed by the “t” command as described above. “Curr” is the current temperature reading from the sensor. “P”, “I” and “D” are the parameters for the PID control algorithm. Use the “p”, “i”, and “d” commands to change them. I'll discuss them in a moment. “Pow” is the power command from the PID controller to the hot plate. It's a value between 0 (always off) and 1000 (always on).
If you put your hand under the sensor, you should see the temperature (Curr) reading jump up. If you now increase the target temperature, you’ll see the power (Pow) value increase and the output led will blink on. Increase the target temperature and the output led will stay on longer. When the hot plate is connected and operating, increasing the target temperature will cause the hot plate to turn on. As the current temperature approaches the target temperature, the on time will decrease so that the target temperature is approached with minimal over-shoot. Then, the on time will be just enough to maintain the target temperature.
Here’s how to set the parameters for the PID algorithm. You can start with the values I use. P of 40, I of 0.1 and D of 100. My system will do a 50C step in about 30 seconds with an overshoot of less than 5 degrees. If your system performs significantly differently, then you will want to tune it. Tuning a PID controller can be tricky, but the article referenced above explains how to do it very effectively.
Now it's time for the real thing. Plug the hot plate into the hot plate AC controller as described in Extreme Surface Mount Soldering. Be sure to read all the cautions in there as well. Position your temperature sensor so it is about 3 inches above your hot plate and pointing directly at it. Power up your Ard/Free-duino. Make sure all the connections are correct and that your software (the PID controller and the monitoring program) is running properly. Start with the target temperature set to 20 C. Then increase the target temperature to 40 C. The hot plate should come on and the temperature should increase smoothly to 40C +/- 2 C. You can now try increasing temperature as you observe the performance of your system. You'll notice that it takes much longer for the plate to cool down than it does to heat it up.
If the Processing sketch doesn’t run or doesn’t update the temperature, stop the Processing sketch and start a serial terminal (Hyperterminal on Windows, for example). Tap the space bar and hit return. The Arduino should respond with the current temperature reading. Adjust settings of baud rate, etc. until you get the desired response. Once this works, the Processing sketch should run. If you still have problems, be sure your pin assignments agree with your physical wiring and that you’ve connected power and ground to the appropriate pins of the temperature sensor.