Warning: Table './lockneyn_dorkbotpdx/cache_page' is marked as crashed and should be repaired
query: SELECT data, created, headers, expire FROM cache_page WHERE cid = 'http://dorkbotpdx.org/blog/scott_d/feed' in /home/lockneyn/public_html/dorkbotpdx/includes/database.mysql.inc on line 172
Warning: Cannot modify header information - headers already sent by (output started at /home/lockneyn/public_html/dorkbotpdx/includes/database.mysql.inc:172) in /home/lockneyn/public_html/dorkbotpdx/includes/bootstrap.inc on line 488
Warning: Cannot modify header information - headers already sent by (output started at /home/lockneyn/public_html/dorkbotpdx/includes/database.mysql.inc:172) in /home/lockneyn/public_html/dorkbotpdx/includes/bootstrap.inc on line 489
Warning: Cannot modify header information - headers already sent by (output started at /home/lockneyn/public_html/dorkbotpdx/includes/database.mysql.inc:172) in /home/lockneyn/public_html/dorkbotpdx/includes/bootstrap.inc on line 490
Warning: Cannot modify header information - headers already sent by (output started at /home/lockneyn/public_html/dorkbotpdx/includes/database.mysql.inc:172) in /home/lockneyn/public_html/dorkbotpdx/includes/bootstrap.inc on line 491 scott_d's blog
http://dorkbotpdx.org/blog/scott_d
enInexpensive Accelerometer and Breakout Board Design
http://dorkbotpdx.org/blog/scott_d/inexpensive_accelerometer_and_breakout_board_design
<p>While poking around Digikey for various sensor chips, I ran across the Freescale MMA7455. This seemed like a really nice 3 axis digital output accelerometer and it only costs $2.00 in single quantities. The specs seemed pretty nice for such an inexpensive chip: SPI or I2C output, 2g, 4g or 8g selectable range, tap, threshold and freefall detect with two interrupt outputs and/or continuous sample mode. So I ordered one and made a quick breakout board on one of the last group board orders. I didn't have a lot of time to get the design together so I made it pretty simple. There are a couple of board layout constraints in the data sheet and I followed those but other than that, I just ran the relevant inputs and outputs to headers, added the suggested power bypass caps and added pads for optional I2C pullup resistors on the bottom side. I haven't tested the I2C mode but I've got the board working in SPI mode with some simple test programs and everything seems to work fine. I also haven't tried any of the interrupt modes, only continuous sampling mode.</p>
<p>One issue with almost all of these accelerometer chips is that they come in LGA packages which means that there are no exposed pads to solder. So you pretty much have to do reflow of some sort to use this chip.</p>
<p>Since the chip costs $2.00 and the breakout board and the discrete components come to less than $1.00, the whole package for a quite functional accelerometer is less than $3.00, which seems like a very cheap price. The MMA7455 is a 3.3V chip and I didn't take the time to design in level shifters and a 3.3V regulator to this board (I might do another design which has those features) so you would also need to factor that into the cost of using this board. Or else do what I did and change a Teensy2 over to 3.3V operations (Paul has simple instructions in the Teensy documentation and it only takes adding a regulator on the bottom side).</p>
<p>The datasheet is pretty long and perhaps a bit daunting but it is actually pretty simple to get the chip running with an Arduino sketch. I've attached a simple sketch for setting up the chip in SPI mode and reading the x, y and z values continuously. In this test program, I sent the x, y and z values to the inputs of a three color LED so you can watch the colors change as you rotate the chip around. In this program, I'm using the SPI routines from the Arduino example program (ArduinoISP) which comes with Arduino 18. Since I'm running this on a Teensy2, I've changed the SPI pin numbers to correspond to the pinout for the Teensy2. But other than that, I am sure this sketch would work with a standard Arduino or most clones.</p>
<p>One other tricky bit is that there are two SPI modes available with the MMA7455: three wire and four wire. These are selected in the initial setup for the chip. Four wire is what this sketch uses since it is what the SPI hardware of an AVR normally does. Three wire mode essentially shares a single I/O line for MOSI and MISO.</p>
<p>Also, there is an initial calibration step in this sketch which assumes the MMA7455 is sitting flat with the z axis pointing up. There are calibration registers in the MMA7455 which need to be set using an interative procedure so that the x and y axis will initially read zero and the z axis will read 1g. This has to be done each time the chip gets power since the registers are volatile.</p>
<p>I've attached the Eagle files for the breakout board and the Teensy2 sketch to setup and run the chip. The MMA7455 datasheet is <a href="http://www.freescale.com/files/sensors/doc/data_sheet/MMA7455L.pdf">here</a> and a useful application note is <a href="http://www.freescale.com/files/sensors/doc/app_note/AN3468.pdf">here</a>.</p>
http://dorkbotpdx.org/blog/scott_d/inexpensive_accelerometer_and_breakout_board_design#commentsTue, 25 May 2010 14:21:43 -0500scott_d519 at http://dorkbotpdx.orgA Few Notes from the Open Workshop
http://dorkbotpdx.org/blog/scott_d/a_few_notes_from_the_open_workshop
<p>It was a good turnout for the open workshop at PNCA on Sunday. Don and Monty both got their hot plate systems up and running and soldered some boards. A couple of others started to put together their temperature controller boards and some questions came up about things I may not have made clear enough before: <!--break--> <ul>
<li> The output signal labeled RESET is currently programmed to return the controller to the initial conditions if you ground it. This is intended to be a quick way to reset the temperature once the reflow process is completed.</li>
</ul>
</p>
<ul>
<li> If you don't use the thermocouple interface chip, then you also don't need the bypass capacitor C4.</li>
</ul>
<ul>
<li> C3 on the bottom of the board is used to set up the AVR reset signal for auto reset during boot loader based programming. If you use a Benito or other MCU based serial programmer, then you should solder bridge or jumper the C3 pads. If you use a plain USB to serial cable (like an FTDI based cable) then you need to solder on a .1uF capacitor for C3. The pads will accommodate either an 0603 or 0805 sized cap.</li>
</ul>
<br class="clear" />http://dorkbotpdx.org/blog/scott_d/a_few_notes_from_the_open_workshop#commentsTue, 30 Mar 2010 01:29:04 -0500scott_d490 at http://dorkbotpdx.orgInstalling the Temperature Controller Code
http://dorkbotpdx.org/blog/scott_d/installing_the_temperature_controller_code
<p>The current versions of the Eagle files, .hex files and source code can be found at <a href="http://dorkbotpdx.org/blog/scott_d/temperature_controller_board_final_design">http://dorkbotpdx.org/blog/scott_d/temperature_controller_board_final_design</a></p>
<p>To install the temperature controller software on a new ATMega328 you can either load the .hex files or build from the Arduino source code. If you choose to load the .hex files, you should load both the temp_control.hex which is the program code which should be loaded into flash memory and also eeprom.hex, which contains some parameters for the controler which reside in eeprom memory.</p>
<p>If you want to build the Arduino source code, there are a few steps. 1) (Optional) Program the Arduino boot loader into your ATMega328.</p>
<p>2) Install the required libraries: RotaryEncoder and max6675. The procedure for installing libraries varies with your platform and version of the Arduino software. It is easiest if you use Arduino version 17 or higher. In that case, you can unzip the libraries into a libraries subdiretory in the directory where your sketches reside. In earlier versions of of the Arduino software, you need to unzip the libraries in the main Arduino library directory. Check the documentation at <a href="http://arduino.cc">http://arduino.cc</a> for further details.</p>
<p>3) Create a directory called tempcontrol in your Arduino sketch directory. Then unpack main.zip in that directory. When you start up the Arduino software you will see a new sketch called tempcontrol with a subfile called main. If you open tempcontrol/main you will see a number of tabs which contain the various source code files. You should be able to select "Arduino Duemilanove or Nano w/ ATmega328" as the target board and compile and load the code into the temperature controller.</p>
<p>4) You still need to set the eeprom parameters the first time you run the temperature controller. To do this, you could use and AVR programmer to write the eeprom.hex file into the eeprom memory of the temperature controller. Or you can use a serial connection to the temperature controller to set the parameters from a Processing sketch as detailed in this <a href="<a href="http://www.instructables.com/id/Closing-the-Loop-on-Surface-Mount-Soldering/step3/Hooking-it-all-up/">http://www.instructables.com/id/Closing-the-Loop-on-Surface-Mount-Soldering/step3/Hooking-it-all-up/</a>">Instructable</a>. The Processing sketch is also useful for graphing the temperature of the hotplate over time.</p>
<br class="clear" />http://dorkbotpdx.org/blog/scott_d/installing_the_temperature_controller_code#commentsThu, 25 Mar 2010 21:43:09 -0500scott_d489 at http://dorkbotpdx.orgTemperature Controller Board Soldered and Working
http://dorkbotpdx.org/blog/scott_d/temperature_controller_board_soldered_and_working
<p>I populated one of the temperature controller boards, did some testing and then loaded the PID software and tried out the IR sensor. So far, everything seems to be working. I don't have any of the thermocouple chips to try out so that will have to await the next parts order. But so far, so good. I'll be happy to help anyone get their board built out and running.</p>
<p>Edit- After checking some more, there is one thing to be aware of when building the board. It has to do with power from the programming headers. There are two different programming headers on the temp controller board. One is a standard 6 pin AVR ISP programming header. Most AVR programmers that I'm aware of have a provision for dealing with powered or unpowered target boards. There is usually a switch (or jumper, etc) to select whether or not the programmer will supply power to the target board. Since the temperature controller board is designed to be powered when it is programmed, you should set your AVR programmer to *not* supply power.</p>
<p>The second programming header is a standard Dorkboard 5 pin header. The middle pin of that header supplies 5VDC. However, there is no provision to select whether or not that pin is powered (it always is). So if you use a Benito, for example, to program your temperature controller board, you will have 5VDC coming in from the Dorkboard connector in addition to the 5VDC and 3.3VDC from the regulators onboard the temperature controller. This probably won't do anything bad but it would be better to avoid it. The simplest way to fix this is to not connect the middle pin on the Dorkboard header. If you populate that header to be compatible with a standard Dorkboard layout, you will put a female header in that position. So just pull the middle pin out of the female header before soldering it onto the temperature controller board and then the 5VDC will never be connected from the Dorkboard programming header. That way, there will never be 5VDC coming in from more than one source. On the next version of the board, I will probably not connect the 5VDC pin from the Dorkboard connector to avoid this issue.</p>
<p>If this isn't clear, just ask me.</p>
<br class="clear" />http://dorkbotpdx.org/blog/scott_d/temperature_controller_board_soldered_and_working#commentsMon, 08 Mar 2010 21:33:56 -0600scott_d484 at http://dorkbotpdx.orgTemperature Controller Board Final Design
http://dorkbotpdx.org/blog/scott_d/temperature_controller_board_final_design
<p>The temperature controller PC boards have arrived. I was amazed at the interest. In the end, fifteen of the boards were requested. There have been a few people who have asked for them since the order was placed so I'll probably do another order of the boards in the next PCB order.</p>
<p>Edit--<br />
Made a few small changes to the board for the next order. Mainly improved the silkscreen to make it easier to identify the inputs and outputs at the various headers. Updated Eagle files attached.<br />
I replaced a bad upload of the code. Also, I forgot that you will need a couple of non-standard libraries (RotaryEncoder, written by SunboX: <a href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1205879808" title="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1205879808">http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1205879808</a> and max6675 by Ryan McLaughlin: <a href="http://code.google.com/p/max6675-arduino-library/" title="http://code.google.com/p/max6675-arduino-library/">http://code.google.com/p/max6675-arduino-library/</a>). The files for these libraries are attached and you will need to install them in your Arduino libraries folder.<br />
The source code is in main.zip.<br />
In case it is easier, I've attached the .hex file for the code. You can just program that into your 328 and not bother to compile. If you load up the code in flash, you might also want to load up the eeprom.hex file as well (it contains the initial PID parameters). Otherwise, you need to set the PID parameters via a processing sketch as described by Jim in his Instructable (<a href="http://www.instructables.com/id/Closing-the-Loop-on-Surface-Mount-Soldering/step3/Hooking-it-all-up/" title="http://www.instructables.com/id/Closing-the-Loop-on-Surface-Mount-Soldering/step3/Hooking-it-all-up/">http://www.instructables.com/id/Closing-the-Loop-on-Surface-Mount-Solder...</a>).</p>
<p>I've attached the final Eagle files to this blog entry. I've also generated a bill of materials and a corresponding parts placement diagram which are also attached.</p>
<p>In order to put the system together, you will need to make a few choices:</p>
<p>First you will need a way to control the AC to your heater. The temperature controller puts out a strictly on/off 5V logic signal which is used to control temperature. I bought a solid state relay off of Ebay for around $7.00 (check with me if you want a pointer to the same unit). The specs were 3-34VDC control, 24-480VAC load at 25A. Since the hotplate is specified at 10A/120VAC that seemed to be adequate and I've run tests with holding a constant temperature for several hours with no noticeable heat buildup on the SSR. Alternatively, in his original <a href='http://www.instructables.com/id/Extreme_Surface_Mount_Soldering/'>Instructable</a> on surface mount soldering, Jim showed an AC control circuit you could build. He has since designed a PCB for that circuit and is willing to put some on the next PCB order if people are interested.</p>
<p>You will also need one or more temperature sensors. If you want the IR sensor, you need to buy the appropriate <a href='http://www.harborfreightusa.com/usa/itemdisplay/displayItem.do?itemid=93984'>IR thermometer</a> from Harbor Freight and do the modifications shown in this <a href='http://www.instructables.com/id/Closing-the-Loop-on-Surface-Mount-Soldering/'>Instructable</a>. If you want the thermocouple sensor in addition to or instead of the IR, then you need to have a K type thermocouple and buy the parts for the thermocouple interface. </p>
<p>The parts from the LCD/AVR section of the board are all required. These are sufficient to build an Arduino compatible (Dorkboard) processor with an LCD interface. This hardware will read the IR sensor. You will also need a suitable LCD (something like this 16x2 backlight <a href='http://www.sparkfun.com/commerce/product_info.php?products_id=255'>unit</a> from Sparkfun or any other HD44780 compatible). Note that the contrast control potentiometer specified is a thumbwheel style so that it is easy to adjust the contrast from the side of the board when the LCD is mounted on it.</p>
<p>You also need to decide what kind of switches you want to use to control the unit. I'm using an encoder with a switch (specified in the parts list) which provides a nice way to set the temperature but you could choose other combinations of switches instead if you prefer. The current code is set up for the encoder plus one push button to reset the system to the initial state. Once you decide on the inputs you can figure out what headers you want to populate. I've brought everything out to header pinouts where you can solder male header pins onto the board to use with plugs or you can solder wires directly to the board and run them to the switches and sensors. All of the headers are on the part of the board which is unobstructed by the LCD with the exception of the two pins for the thermocouple input. Those two will have to be right angle header pins to clear the LCD. There are also headers for both the five pin Dorkboard programming connection and a standard 6 pin AVR ISP header so you can choose which you want to use for programming the AVR. </p>
<p>I've attached my current Arduino sketch to run the temperature controller and a list of how I'm using the pins on the Atmega328 (Note that the current code requires an Atmega328 to provide enough RAM space).</p>
<p>The parts for the power regulator section are optional. You can leave that whole section out and provide 5VDC power for the temperature controller board. If you are using the IR sensor, you can either supply 3V to the appropriate pin on the controller board or you can leave the battery in the IR unit. Or you can build out the 5V and 3.3V regulator section and provide power from an appropriate wall wart (at least 6.5VDC and 200mA or so).</p>
http://dorkbotpdx.org/blog/scott_d/temperature_controller_board_final_design#commentsSun, 07 Mar 2010 00:07:03 -0600scott_d480 at http://dorkbotpdx.orgTemperature Controller Board Design (second pass)
http://dorkbotpdx.org/blog/scott_d/temperature_controller_board_design_second_pass
<p>I've done another iteration of the temperature controller board. I decided I really wanted to provide mounting holes and that caused me to rearrange the board layout a fair amount. I decided to try to get most of the components on the side of the board which would be covered up with the LCD (assuming you put a female header on the board to plug the LCD into). The image shows a standard 16x2 LCD part from the Sparkfun library (the big rectangle) and how it would fit onto the board. The right side of the board, which is not covered by the LCD, contains almost all of the I/O pins so they are unobstructed for running cables and/or plugs. I decided to keep the (optional) thermocouple input pins near to the MAX6675 thermocouple interface chip (on the left side) to have short runs onto the board and to the MAX chip.</p>
<p>I also kept all of the SMT parts from the last iteration. For those who don't want to do much hand soldering of surface mount parts, there are a few choices. For example, you can get a completely functional IR based hotplate setup by leaving off the regulators and the thermocouple interface. You would then either have to provide 3.3V and 5V power or just 5V and use the existing battery in the IR unit. If you do this, you only have three 0805 discrete components to solder and this is only slightly more difficult than building a Dorkboard at a Cult Induction. And , of course, I'll be happy to help anyone reflow the surface mount parts onto their board. Along those lines, I would like to either build or help build one board when they come in to make sure everything is OK. So if someone wants to volunteer their board to be the test, let me know. At this point, I'm ordering 12, all of which are spoken for.</p>
<p>The current software I'm running on my version of this board uses too much SRAM to fit onto an Atmega168 so I'm running it on an Atmega328. I'm pretty sure things could be pared down to fit on a 168 (right now it is an Arduino sketch which uses several libraries). But for the price difference between a 168 and 328 it isn't worth sweating over. However since Atmega328p chips seem to be hard to get currently, this will be an issue for building the boards right away. Unless someone has a stash of Atmega328p chips...</p>
<p>I've attached the Eagle files for this version. The board measures 2x1.7" so the cost to fab is about $5.70 each. Let me know if you have any suggestions on changes to this design. Otherwise, I'll send it along to Laen.</p>
<br class="clear" />http://dorkbotpdx.org/blog/scott_d/temperature_controller_board_design_second_pass#commentsFri, 26 Feb 2010 12:02:50 -0600scott_d476 at http://dorkbotpdx.orgTemperature Controller Board Design (first pass)
http://dorkbotpdx.org/blog/scott_d/temperature_controller_board_design_first_pass
<p>I've done a quick first pass on the PCB design for the temperature controller. There are a few things I'd like some feedback on:</p>
<p>1. There are five 0805 discrete components, two 3528 caps and two SOT223 regulators in this layout. The optional thermocouple interface adds one SOIC8 and one 0805 cap. These are all fairly large for surface mount and the board layout is not too cramped so hand soldering should be pretty easy. How do people feel about this level of surface mount? If it seems too hard, I can try to modify the design to use more through hole although the board will get larger (and the thermocouple chip isn't available in through hole anyway). Or else, I'd be happy to help anyone who needs it to get the surface mount soldering done with my hotplate. The bulk of the board is still through hole.</p>
<p>2. All of the inputs and outputs are connected to headers. This seems to be a good compromise since you can either solder in pins to connect plugs to or else you can just solder wires directly to the pads. But if you want something else like screw terminals, I can expand the board to make room. Let me know what kind of connections you would prefer. The inputs are set up for a rotary encoder and a push button. But the encoder inputs are basically just three switches so if you want, you can use those inputs for more switches instead.</p>
<p>3. How about mounting holes? I can make the board a bit bigger to make space for holes at the corners if you want. What size holes, if so?</p>
<p>4. There are both a Dorkboard programming header and a standard AVR 6 pin programming header. Is it worth having both?</p>
<p>There are still labels to add to some of the pins and other cleanups but I'll wait to do that until I get some feedback. And if anyone has any other suggestions for changes, I'd be happy to hear them. Please leave any feedback or suggestions in the comments to this entry. I've attached the Eagle files as well as images of the board layout and schematic.</p>
<br class="clear" />http://dorkbotpdx.org/blog/scott_d/temperature_controller_board_design_first_pass#commentsWed, 24 Feb 2010 01:57:38 -0600scott_d473 at http://dorkbotpdx.orgTemperature Controller Boxed Up
http://dorkbotpdx.org/blog/scott_d/temperature_controller_boxed_up
<p>I finished building a project box and adding inputs to allow the closed loop temperature controller (<a href="http://www.instructables.com/id/Closing-the-Loop-on-Surface-Mount-Soldering/" title="http://www.instructables.com/id/Closing-the-Loop-on-Surface-Mount-Soldering/">http://www.instructables.com/id/Closing-the-Loop-on-Surface-Mount-Solder...</a>) to stand alone (without needing to be connected to a computer to control it).</p>
<p>The front panel has terminal blocks for the thermocouple input and the control line for the SSR and a DB9 connector for the IR temperature sensor.</p>
<p>I used an encoder with a switch to allow the user to set the temperature. Originally I had planned to write the code to automatically ramp the temperature for the right solder paste reflow profile but so far I've found it pretty simple to just use the encoder to set the temperature to each of the points on the curve. I have the code reset the running timer on the LCD each time the temperature target is reset and this helps a lot to keep track of when the next temperature change is due. One other little trick on setting the temperature target is that the PID software that we are using (<a href="http://www.arduino.cc/playground/Main/BarebonesPIDForEspresso" title="http://www.arduino.cc/playground/Main/BarebonesPIDForEspresso">http://www.arduino.cc/playground/Main/BarebonesPIDForEspresso</a>) keeps the initial target temperature in EEPROM. When I reset the target temperature with the encoder, my code doesn't change the initial temperature in the EEPROM. That way, when the system starts up, it goes to a known temperature from the EEPROM (currently a nice safe 90°C) and not some arbitrary temperature left over from the last run.</p>
<p>The thermocouple interface uses a MAX6675 chip and a simple circuit from the Maxim datasheet to give an SPI digital input of the thermocouple temperature. A nice Arduino library is available for the MAX6675 (<a href="http://code.google.com/p/max6675-arduino-library" title="http://code.google.com/p/max6675-arduino-library">http://code.google.com/p/max6675-arduino-library</a>).</p>
<p>The LCD is currently programmed to display a timer, the target temperature and the temperature readings from the IR and thermocouple sensors. I'll probably change the code a bit to make a nicer looking display on the LCD and add some menus to change which temperature sensor is used by the PID controller and perhaps some other parameters. Maybe I'll add the automatic temperature ramping as well.</p>
http://dorkbotpdx.org/blog/scott_d/temperature_controller_boxed_up#commentsTue, 23 Feb 2010 12:20:20 -0600scott_d469 at http://dorkbotpdx.orgLCD DorkBoard V 2
http://dorkbotpdx.org/blog/scott_d/lcd_dorkboard_v_2
<p>I did another run of the LCD enabled DorkBoard design that I posted earlier. In this run, I made a few small changes to add a standard 6 pin AVR ISP header and put in the reset capacitor (a 0603 part which can be solder bridged if you have a programmer like a Benito which does the reset in software). The Eagle files are attached.</p>
<br class="clear" />http://dorkbotpdx.org/blog/scott_d/lcd_dorkboard_v_2#commentsTue, 16 Feb 2010 20:40:06 -0600scott_d464 at http://dorkbotpdx.orgInexpensive IR Based Temperature Sensor for Microprocessors
http://dorkbotpdx.org/blog/scott_d/inexpensive_ir_based_temperature_sensor_for_microprocessors
<p>After taking Jim Larson's <a href="http://dorkbotpdx.org/blog/laen/surface_mount_soldering_workshop_saturday_december_19th_at_techshop">workshop</a> on surface mount soldering, I wanted to set up my own hot plate system for reflow soldering. But rather than use an open loop temperature control system like Jim was using at the time, I thought I'd take a crack at a closed loop control system. The first problem was that I didn't have a convenient temperature sensor which would go up to over 200°C as would be needed to reflow lead free solder paste.</p>
<p>A thermocouple would do the trick but I didn't have one and all the other temperature sensors that I had handy (like a TMP36) topped out at about 100°C. However, I did have an <a href="http://www.harborfreightusa.com/usa/itemdisplay/displayItem.do?itemid=93984">IR thermometer</a> which I purchased from Harbor Freight Tools ($25 but often on sale for less) which has a range of up to 250°C. So I decided to break it open and see if I could find a way to get the temperature out to a micro. It turns out that the IR module inside this unit has a clocked serial output conveniently available on a header. And there is enough information on the web (<a href="http://www.zytemp.com/download/TNm_302.pdf" title="http://www.zytemp.com/download/TNm_302.pdf">http://www.zytemp.com/download/TNm_302.pdf</a>) to create an Arduino sketch to read out the temperature from the serial data. Here is a simple code example for how to do it which I have running on my <a href="http://dorkbotpdx.org/blog/scott_d/my_first_pcb_project">LCD/Dorkboard</a>:<br />
<code><br />
#include <LiquidCrystal.h><br />
#define D4 7<br />
#define D5 8<br />
#define D6 9<br />
#define D7 10<br />
#define RW 11<br />
#define E 6<br />
#define RS 12<br />
#define BL 5 // backlight control on pin 5 (pwm 0=bright, 511=off)<br />
#define CNTRL 13<br />
LiquidCrystal lcd(RS, RW, E, D4, D5, D6, D7);<br />
int blevel = 0;</p>
<p>#define CLK 3<br />
#define DATA 4</p>
<p>volatile int nbits = 0;<br />
volatile byte hexbyte = 0;<br />
volatile byte read_byte;<br />
volatile int byte_ready = 0;</p>
<p>volatile unsigned char message[4];<br />
volatile int nbytes = 0;<br />
volatile int message_waiting = 0;</p>
<p>unsigned long last_time = 0;</p>
<p>float temp;<br />
float ambient;</p>
<p>void setup() {<br />
delay(2000);<br />
lcd.begin(2,16);<br />
lcd.clear();<br />
pinMode(BL, OUTPUT);<br />
analogWrite(BL,blevel);</p>
<p> pinMode(CLK, INPUT);<br />
pinMode(DATA, INPUT);<br />
attachInterrupt(1, readBit, FALLING);<br />
}</p>
<p>void readBit() {<br />
int val = digitalRead(DATA);<br />
nbits++;<br />
int bit = (val == HIGH) ? 1 : 0;<br />
hexbyte = (hexbyte << 1) | bit;<br />
if (nbits == 8) {<br />
if (byte_ready == 0) {<br />
read_byte = hexbyte;<br />
byte_ready = 1;<br />
}<br />
if (hexbyte == 0xd) {<br />
nbytes = 0;<br />
message_waiting = 1;<br />
} else if (message_waiting == 0) {<br />
if (nbytes < 4) {<br />
message[nbytes] = hexbyte;<br />
}<br />
nbytes++;<br />
}<br />
hexbyte = 0;<br />
nbits = 0;<br />
}<br />
}</p>
<p>void loop() {<br />
if (message_waiting == 1) {<br />
last_time = millis();<br />
if (message[0] == 0x4c) {<br />
int t = message[1]<<8 | message[2];<br />
temp = t/16.0 -273.15;<br />
lcd.clear();<br />
lcd.print(millis()/1000.0);lcd.print(" ");<br />
lcd.print(temp);<br />
} else if (message[0] == 0x66) {<br />
int t = message[1]<<8 | message[2];<br />
ambient = t/16.0 -273.15;<br />
}<br />
message_waiting = 0;<br />
}<br />
if (millis() - last_time > 1000) {<br />
nbits = 0;<br />
nbytes = 0;<br />
hexbyte = 0;<br />
message_waiting = 0;<br />
byte_ready = 0;<br />
last_time = millis();<br />
}<br />
}</p>
<p></code></p>
<p>I combined that with an Arduino sketch which does PID control (<a href="http://www.arduino.cc/playground/Main/BarebonesPIDForEspresso">BBCC</a>, which was originally written to control the temperature of an espresso machine) and used an SSR I bought off of bay to control the hotplate AC. The result is a system which does a good job of holding the temperature since the IR sensor reacts very quickly to temperature changes. </p>
<p>Jim has now extended his original hot plate based surface mount reflow soldering system to include a version of this closed loop system and he has done a very nice <a href="http://www.instructables.com/id/Closing-the-Loop-on-Surface-Mount-Soldering/">Instructable</a> which shows how it is done, including pictures of how to modify the Harbor Freight IR unit. So you should check that out for the details. I'm posting this entry separately for people who could use a nice temperature sensing hack but might not look in an Instructable on surface mount soldering.</p>
http://dorkbotpdx.org/blog/scott_d/inexpensive_ir_based_temperature_sensor_for_microprocessors#commentsThu, 11 Feb 2010 01:58:49 -0600scott_d462 at http://dorkbotpdx.orgMy first PCB project
http://dorkbotpdx.org/blog/scott_d/my_first_pcb_project
<p>So have you ever wanted to use one of the ubiquitous 16 pin LCDs in a project but found it a pain to wire up all the signals (not to mention the pot for contrast control and maybe a backlight control as well)? Me too. Sure there are serial backpacks and other ways to cut down on the number of pins and connections that it takes to run the LCD but sometimes that seems like overkill for a simple one-off project.</p>
<p>When I took Don's Eagle class I needed a good small project to start off with. We were allowed 2 square inches on the DorkbotPDX <a href="http://dorkbotpdx.org/blog/laen/pcb_group_order_2">PCB group order</a> and it seemed like this would be a perfect opportunity to come up with a good solution to the LCD problem. So I decided to generate a design which is basically a Dorkboard on an expanded layout with the necessary header, connections and discrete components to drive the usual 16 pin LCD displays based on the Hitachi HD44780 and compatible controllers (including backlight PWM control). The Eagle files are attached as is a schematic image. It incorporates a new layout of Don's Dorkboard circuit. I left out a couple of features of his design: the pin 13 LED (which I didn't really want blinking away behind the LCD) and the optional DTR autoreset capacitor, which I didn't need since the USB-serial programmers I use (like the Benito) handle the reset pulse in other ways.</p>
<p>The idea was that you would then have a board which could be used as a Dorkboard (Arduino compatible except for the missing LED) but with the ability to easily plug in an LCD for a nice compact package. You can drive it with the <a href="http://arduino.cc/en/Reference/LiquidCrystal">LiquidCrystal library</a> which comes standard with the Arduino software. In addition, since serial and I2C lines are brought out on the board, you could use the board + LCD as a serial display to another processor if you needed more processor power or additional I/O pins.</p>
<p>The resulting board: <img src=" http://farm5.static.flickr.com/4042/4216226949_9a74471bce_m.jpg" alt="4216226949_9a74471bce_m.jpg" /></p>
<p>First one built out: <img src=" http://farm5.static.flickr.com/4052/4216227047_8b52a51242_m.jpg" alt="4216227047_8b52a51242_m.jpg" /></p>
<p>And running it's first program: <img src=" http://farm5.static.flickr.com/4012/4211047483_bd4574dc4b_m.jpg" alt="4211047483_bd4574dc4b_m.jpg" /></p>
<p>There were a couple of errors in the board (which are fixed on the attached Eagle files). One was an incorrectly wired pin on the MCU which I missed on proofreading the schematic (you have to be careful when you name nets in Eagle and allow it to autoconnect the signals). Fortunately, it was easy to cut a trace and attach a jumper wire at a convenient via to correct this. The other error is that there are a few surface mount components which I meant to have on the bottom side of the board. Somehow I failed to put them there but they are under the socket and are small enough so that they still fit fine. But it isn't the best arrangement since once you solder on the socket, you can't get to those components to fix any soldering problems. So you do it right the first time.</p>
<p>All of the example programs for the LiquidCrystal library seem to work fine. Here is one of my first test programs:</p>
<pre><pre class="geshifilter">#include <LiquidCrystal.h>
// LiquidCrystal display with:
// rs on pin 12
// rw is pin 11
// enable on pin 6
// backlight control on pin 5 (pwm 0=bright, 511=off)
// d4, d5, d6, d7 on pins 7, 8, 9, 10
#define D4 7
#define D5 8
#define D6 9
#define D7 10
#define RW 11
#define E 6
#define RS 12
#define BL 5
LiquidCrystal lcd(RS, RW, E, D4, D5, D6, D7);
int blevel = 0;
int blev_steps = 50;
void setup()
{
delay(2000);
lcd.begin(2,16);
// Print a message to the LCD.
pinMode(BL, OUTPUT);
analogWrite(BL,blevel);
lcd.print("Hello, world!");
lcd.setCursor(0,1);
lcd.print("1234567890123456789012345678901234567890");
}
void loop()
{
// scroll 13 positions (string length) to the left
// to move it offscreen left:
for (int positionCounter = 0; positionCounter < 13; positionCounter++) {
// scroll one position left:
lcd.scrollDisplayLeft();
// wait a bit:
delay(150);
}
// scroll 29 positions (string length + display length) to the right
// to move it offscreen right:
for (int positionCounter = 0; positionCounter < 29; positionCounter++) {
// scroll one position right:
lcd.scrollDisplayRight();
// wait a bit:
delay(150);
}
// scroll 16 positions (display length + string length) to the left
// to move it back to center:
for (int positionCounter = 0; positionCounter < 16; positionCounter++) {
// scroll one position left:
lcd.scrollDisplayLeft();
// wait a bit:
delay(150);
}
// delay at the end of the full loop:
delay(1000);
for (int j=blevel;j<blevel+blev_steps;j++) {
analogWrite(BL, j);
delay(20);
}
blevel += blev_steps;
if (blevel > 511)
blevel = 0;
}</pre></pre>
<p>I measured about 17uA draw with the backlight off and about 65uA with it full on with the particular 2x16 LCD I had in case anyone was interested in a compact LCD equipped, battery powered Arduino compatible.</p>
<p>I had the parts to build two of these boards and I promised Don the third one so that is it for this order. There are a few things I think I would change on a second version. The output headers were done in a hurry without a lot of thought. The serial output pins are redundant with some of the programming header pins and I'd like to find room for a standard 6 pin ISP header so that it would be easy to use the board outside of the Arduino environment. And I think adding the optional DTR reset capacitor would be a good idea. I will probably generate a new layout with those features and put some into the next group PCB order.</p>
<p>I'm primarily a scientist and software guy by training and experience although I've dabbled in lab automation and electronics off and on. I'm sure some of my fellow Dorkbots could generate a more professional design but I managed to get a functional and useful board out of my first try so I'm pretty satisfied.</p>
<br class="clear" />http://dorkbotpdx.org/blog/scott_d/my_first_pcb_project#commentsSat, 26 Dec 2009 19:09:17 -0600scott_d445 at http://dorkbotpdx.org