I have recently picked up a hakko 936 clone, analogue soldering station. After a little research i discovered that all the clones are pretty much the same as the real thing. especially the pencil.
opening up the clone, i realized it was a fairly simple circuit, using a dual op-amp for temp control and a triac to switch 24v AC. after some thinking i realized i can build a simple digital controller for it.
first i set out to reverse engineer the controller board. this is what i came up with.[attachment=0]
replacing the the analogue control with an 8 bit micro and a 3 digit 7 segment display would be straight forward.
using an pic16f883 or c8051f530 would allow fine control and be fast enough to run the display. either a pair of buttons or a rotary encoder to set the desired temp and calibrate the iron.
I wanted to do the same thing and then I found that I can locally purchase a hakko pencils so I decided to make a new soldering iron from scratch. Got myself a connector, a pencil, and made a simple 16F690 + 2x16 char lcd controller (24V AC is pushed into the pencil via triak) ... and I'm reading the temperature using 10bit adc on the pic ... I have 3 buttons +, - and menu .. had no rotary encoders at the time but it would be better to use one (especially if you can find one with a press function too for menu button :) )
What I never finished is to make a ADC_RAW -> Temperature function. I still display 0-1023 value for "temperature" as I was unable to find the thermistor data anywhere... and did not have a proper temp probe to make the table myself ... in the meantime I lost both schematic (it is rather simple) and source code (now this is a bummer) for the project so I use it "as is" :)

(http://https://picasaweb.google.com/lh/photo/S0xGAgtcoQyesrd79HVmBg?feat=directlink)
the temp sensor inside the heating element is a thermocouple and is nearly linear, i have a couple of multimeters with thermocouple and building in a self calibration would be rather easy.
my goal will be to fit the controller into the same case and make a new front panel out of scrap aluminum.
This is really interesting. You can get replacement iron+wire+plug for the Auyoe for $14 too (it that what you mean by pencil?). You can put together a custom digital adjustable iron for less than you can buy it :) I never thought about it before.
i did not spend much (basically shipping only) free day bounty
[quote author="ian"]This is really interesting. You can get replacement iron+wire+plug for the Auyoe for $14 too (it that what you mean by pencil?). You can put together a custom digital adjustable iron for less than you can buy it :) I never thought about it before.[/quote]
yes
Ive looked at the buy it now prices on eBay, if the total price of a completed controller + enclosure + transformer + iron is reasonable, this could make a decent diy kit.
Good luck marketing the "Dangerous Soldering Iron" ;)
Ive got a 936 clone myself, never really missed the digital control/feedback, but would be a nice addition.
i don't think a finished unit would be a good idea for dp, but just a controller board there might be interest.
I just want to do it for fun and personal enjoyment :) Publishing some designs is enough for me, not everything will appeal to everyone, or enough people to be saleable. If interest picks up we can blast it into production. That's the awesome thing about this business model :)
[quote author="ian"]I just want to do it for fun and personal enjoyment :) Publishing some designs is enough for me, not everything will appeal to everyone, or enough people to be saleable. If interest picks up we can blast it into production. That's the awesome thing about this business model :)[/quote]
Absolutely, i have the same feelings wither its a one off etched at home or a batch of 100. why not do it?
i have ordered some pic16f628a and some op amps to get started. the pcb layout is not quite there yet. will post as soon as it is happy.
Some opamp lessons might come in handy ;)
gotta work out some bugs
the box from microchip arrive today, i have to say they are extremely fast, i received it in 2 days from Thailand.
i have what i think will be the final schematic for the digital conversion, I am unfamiliar with the pin sharing techniques for the pic, and the resistor values have not been fully calculated for the analog portion.
[attachment=0]
Is this a clone, or a reverse engineer? I reviewed the thread and can't figure out how we got here :) It's super great though! Nice job :)
the digital portion is original, but the first post is a reverse of the stock controller.
I'm calculating the resistor values and running a simulation of the new analog portion.
I cut my teeth on the 16F628a, it's a great chip. Nice choice for this app.
Now-a-days I always hit up the 18F2xJ50 (3.3volt version of the classic 2550)... because everyone loves a USB-upgradable soldering station ;)
i chose the pic16f628a because:
1> it is familar with lots of people
2> 10 bit a/d
3> has enough pins (have to share #mclr with display, going to be a trick)
4> will run at up to 20mhz/5Mips
the overall idea is to be able to have built in calibration to any iron(combination and order of button presses)
when i choose the final parts ill look for parts that will handle up to a 100W iron.
you believe that mcp601 will be enough to push those few mV's to 0-5V for the pic? Have you tested it? I think I have 601 around here and I'll try it out immediately ... I tried something with mcp6022 but it looks like my input impedance of the op-amp was not high enough so I got nothing on the output :(
btw, MCLR is INPUT ONLY !!!! you cannot drive the display from it .. have you considered using 16x2 display? you get more characters with less pins :)
i have not settled on any op amp yet, ill be doing a parametric search to find out witch one has the best linearity for a reasonable price between .1v and 4.7v, otherwise ill use a standard lm3xx.
i was planing on disabling and removing the diode on the mclr after programing, unless there is a way around that.
i have not decided wither the decimal point is necessary thought it could display status. but i still need to share some pins anyway
[quote author="arhi"] I think I have 601 around here and I'll try it out immediately[/quote]
I tried with 6022 and 602 (same as 601 only 2 of them in same package) and - no go, I can't get valid readout from both standard Ktype thermocouple and from old hakko heater.
I think you need to make input impedance of the op-amp higher, or maybe you must use some other op-amp. Anyhow, when you get it working - please share :D ... attm I'm using some max6675 but I'd really like to have solution with op-amps as well :) (as I only got one max6675 as sample and don't have any shops around that sell those)
[quote author="sqkybeaver"]i have not settled on any op amp yet, ill be doing a parametric search to find out witch one has the best linearity for a reasonable price between .1v and 4.7v, otherwise ill use a standard lm3xx.
[/quote]
I use 6022 for most cases as it is very linear but I think you have much bigger problem here as reading the thermocouple requires very high impedance. Thermocouple will push those few mV's but current is 0 so with low impedance like the circuit you drawn you just can't read it properly.
i was planing on disabling and removing the diode on the mclr after programing, unless there is a way around that.
RA5 is INPUT port only. You cannot output anything on RA5! If you disable MCLR you can use RA5 but for input only.
i have not decided wither the decimal point is necessary thought it could display status. but i still need to share some pins anyway
think again about 16x2. you can display menu there, you can display "bar" in one line when you turn on the encoder (or +- buttons, whatever is your preference) and it uses less pins then this setup you have right now. Also I'd suggest using B0 and B1 for encoder input and B2 to drive the heater... I think quadrature encoder is much easier to use and if you find one with a push button it is the best deal ever :)
instead of 2n3096 I suggest moc3034 (30xx) and one LED in series with moc :) so you can show when the heater is on.
[attachment=0]
i have changed the op amp circuit some, in the original they used an lm358
i was thinking about a rotary encoder with a button would be easy to add.
an LCD would make it easier to calibrate too
i still want this to fit in the existing case, if i end up using an LCD it might end up being something like a 2x8 char.
I am using something very similar to the attached file only I use actually 16F688 and not 628 and I use 3 buttons as I had no encoder but I plan to change that once I find some time :) ...
also I use thermocouple as NTC !!! (in a voltage divider with 5K resistor) and it works :D and is linear :D ... it is totally wrong way to do it but it worked and I had no idea how to make proper driver for the thermocouple at the time I was making it :D ... now if you make proper driver with op-amp that works, I'll change my device :D too :)
[quote author="sqkybeaver"]
i have changed the op amp circuit some, in the original they used an lm358
[/quote]
still not working :( .. the output is more affected by the table lamp being on/off then me heating / cooling the thermocouple :(
as for the lm358 they probably powered it symmetrical and not with gnd-5v ... but anyhow I suck big time when all this analog stuff matters so .... I tried this as attached .. in simulation it works like a charm but in real life it fails miserably :(
i have yet to test the amp with a thermocouple, if it comes to it there are specifically designed amps in so8 packages that would work perfectly.
for cirousity i measured the voltage from a type k and room temp and get less than 1mV.
the thermocouple inside the iron starts rising rapidly (although in the mV range) as soon as heat is applied.
during your testing what are the highest temperatures you have tested?
yes it is around 1mV on 25C .. something over 12mV on 300C (as you can see in the simulation) ... I tested it with lighter so for sure over 300C as I can see on the scope how the voltage jumps on the output of the tc. It's just that op's don't get it up there :( ... no idea why.
I used AD595 some time ago but don't have any of them any more .. so wanted to make amp with op's .. no luck :(
i had my iron apart at one point, i had measured the thermocouple output with it turned all the way up, it hit about 50mV
the most recent schematic i posted has a gain of about 45x.
trying without the zener might give different results.
50mV is over 1200C ... are you sure ?
I don't think the gain is the problem, problem is the input impedance. Also no idea what you used to measure voltage on the thermocouple as regular mulimeter won't measure it at all in the low temp range as they don't have high enough input impedance to measure it without dropping the voltage they are measuring. I measure it with a scope as with multimeter I get unusable results.
I'm not using zener, not sure what would zener do on the output of a thermocouple? I'm not running it on thousands of C's to need to limit the input to the op
hm .. mine schematic (with 6022) actually works ... I just had to add capacitor over 4 and 8 (vss/vdd) and it started to work properly... darn op-amps :( .. spent whole day because of stupid mistake :(
[quote author="arhi"]hm .. mine schematic (with 6022) actually works ... I just had to add capacitor over 4 and 8 (vss/vdd) and it started to work properly... darn op-amps :( .. spent whole day because of stupid mistake :([/quote]
the cap is there it was just not obvious, sorry about that.
[quote author="arhi"]50mV is over 1200C ... are you sure ?
I don't think the gain is the problem, problem is the input impedance. Also no idea what you used to measure voltage on the thermocouple as regular mulimeter won't measure it at all in the low temp range as they don't have high enough input impedance to measure it without dropping the voltage they are measuring. I measure it with a scope as with multimeter I get unusable results.
I'm not using zener, not sure what would zener do on the output of a thermocouple? I'm not running it on thousands of C's to need to limit the input to the op[/quote]
a scope is on the top of the list, when tax return comes back. both of my multimeters have a 10M impedance. but are not very accurate in the lower ranges, probably an equipment error.
I always put the cap - but for some reason I didn't do it today :( .. I hoped a big output cap on the psu is enough :( .. simple 100uF solved everything .. darn op's
as for the multimeter, same here, all 5 have 10M impedance on DC voltage but I fear it might not be enough for the low values and since soldering iron don't usually go over 450-500C that's 20mV (500C is 20.644mV). I don;t have problems measuring when it goes over 10mV but below 10mV it is very inaccurate and 10mV is already 200+ (247C to be exact)!!
btw I attached ods file (open office spreadsheet) of the Ktype values .. might be useful to have in this format as from here it is simple to make tables for mcu if you want to use them instead to approximate using 2 points only (since k-type is very linear I usually only use 2 points)
spreadsheets are awesome!
i cant be sure of the type of thermocouple inside the heating element.
there may be other forces at work i have found a bug in my simulation software. I'm getting different results with the same circuit.
i have found the bug in my software, it really threw everything off.
the mcp601 appears to be a good fit.
i have spent some time re checking my calculations and have found an error(typo in spread sheet)
new values and some more changes to the analog part.
[attachment=0]
[quote author="sqkybeaver"]spreadsheets are awesome![/quote]
:)
i cant be sure of the type of thermocouple inside the heating element.
I'm not sure too and I assumed actually that it is J type but I have one K-type and when I attach it to the hakko heater (it's broken but thermocouple wires are available) the mV from the hakko are same as ones from the K-type so I assume it's K-type inside
[quote author="sqkybeaver"]
i have spent some time re checking my calculations and have found an error(typo in spread sheet)
[/quote]
care to share where the typo is?
new values and some more changes to the analog part.
I'm sticking with 6022 since I have bunch of those :) and I like the 2stage amplification as I can make the first stage with higher impedance (iirc the input impedance of the op-amp configured as non-inverting amplifier - what we both use - is R1||R2 so in your case 74R5 and in my test case 99K) ... I will try to use 50M and 10M on the first op .. just to see if it will work :) (never configured op with so high resistances but who knows it might even work :D )
i had a decimal in the wrong place.
it makes more sense to use a 2 stage amp, what i currently have is pushing a gain of almost 200, most op-amps don't do to well that high. a gain of about 100 is about the max before distortion kicks in, but shouldn't matter to much as the input is dc.
Nice conversation. It's been a blast to follow. I'm learning a lot about opamps this week :)
and there are a few things i am relearning <:)
I tried something else ... I have some mcp617 and they should be even better then 6022 as they have even lower input offset voltage and lower input offset current then 6022 (and the way I understand it - it is important in this case). Compared to 6022 they are low bandwidth (10Hz compared to 10MHz) but who cares as we have DC input as you already stated :) ... it is the microchip's choice of op-amp for test equipment so I believe it will be better suited then mcp6022. Now, I did a test with 6022 too and it works just the same as 617 :).
I'm not sure about C1, C2, C5 .. maybe they should be 100n .. I'l actually give it a try to see how much they affect the final result on the real circuit.
The gain is below 250 (around 240) and the input impedance is much bigger then other tests I made. It looks much more stable. Anyhow the RV5/RV6 are there for fine tuning :) ... the usable temp range goes from ~10C to 500C so ideal for soldering iron :).
One IMPORTANT NOTE ... this measures difference of temperature between "tip" of the iron and Handle! Because in the handle the 2 materials that make thermocouple are connected to the copper wire that goes trough the cable. Ideally one would want to add a NTC or some other temp sensor inside the handle and add that from the output of the thermocouple to get real temperature of the tip. I personally assume that handle is on same temperature as the housing of the iron so I just use a NTC on the PCB directly and feed it to free ADC port on the pic. Now if this ~20-30C difference are not important (or you just assume it is always 25C ambient temperature) then it gets bit simpler but why go to digital display then anyhow..
attached pic show the new schematic (top) and old one with attempt to make higher input impedance (bottom) ... I will finally go with the top one.
[quote author="ian"]Nice conversation. It's been a blast to follow. I'm learning a lot about opamps this week :)[/quote]
me too ... I always used them in some "general" setups so few standard configurations were doing it for me all the time, every time ... but this time I had to think about stuff more then usual :D .. . thx god for simulation software :D
[quote author="arhi"][quote author="ian"]What are you using?[/quote]
Proteus ISIS v7.7 sp2 (http://http://www.labcenter.com/products/vsm_overview.cfm)
simulates (realtime) also pic's (including pic24fj64ga002), avr's, 8051's, some generic arm7's, basic stamp, even some msp430's :) .. and bunch of external stuff like buttons, 16x2 displays some gfx displays ... it also can install virtual usb driver so you can actually simulate usb, so when I run my usb firmware on simulated mcu it actually behaves like I attached it to host computer ... etc etc .. it has a plugin for MPLAB so you can debug in mplab and watch it simulated environment with all the io stuff working..
very good software, very good pcb design tool too, excellon output (both RS274D and RS274X), unfortunately costs arm and a leg (if you are not the illegal download person)[/quote]
i figured as much, it is a lot nicer than the java applet I'm using. i wonder if there is a free version?
BTW i'm working on my server/router today ill be off and on most of the day.
looks like a great tool!
@sqkybeaver, no - [s:]no free version, not even a 10day trial afaik[/s:]
there is "demo" version here: http://www.labcenter.com/download/prodemo_download.cfm (http://www.labcenter.com/download/prodemo_download.cfm)
@sjaak, for 3500$ it must be :D
i tried thier online quote system, the most basic package to simulate pics and 8051 is US$500
back to the topic, I found my old project for my hakko driver (I have hakko pencils available here so I made a driver) ... you seen the picture .. as I said I use 16F688 (no idea why I decided to do so) and I read thermocouple from pencil as NTC (or PTC I don't remember really) :D (it actually works!!!) ... here's the code .. it is very simple, written in ccs c (I have some fairly old version I purchased with some DLP module few years ago, works with 16F and smaller pic's and unfortunately cannot be upgraded for free :( ) .. I never wrote the l2t function (convert ADC value to C):
// display the bar while changing the "target temp" in loops
#define BAR_DELAY 100
#define HEATER_ON() output_high(PIN_A4)
#define HEATER_OFF() output_low(PIN_A4)
#define BUTTON_UP PIN_A1
#define BUTTON_DOWN PIN_A2
#define BUTTON_F PIN_A3
#include <16F688.h>
#device adc=10
#FUSES WDT //Watch Dog Timer
#FUSES INTRC_IO //Internal RC Osc, no CLKOUT
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOMCLR //Master Clear pin used for I/O
#FUSES NOCPD //No EE protection
#FUSES NOPUT //No Power Up Timer
#FUSES NOIESO //Internal External Switch Over mode disabled
#FUSES NOFCMEN //Fail-safe clock monitor disabled
#use delay(clock=8000000,RESTART_WDT)
unsigned long temperature; //0-1023 ZELJENA TEMPERATURA
unsigned long current;
unsigned int f, i, j;
unsigned int DEBOUNCE_TIME;
unsigned int HYST;
// LCD.RS == PIN_A5
struct lcd_pin_map {
int data : 4;
BOOLEAN enable;
BOOLEAN rw;
BOOLEAN nc1;
BOOLEAN nc2;
} lcd;
#locate lcd = getenv("sfr:PORTC")
#define set_tris_lcd(x) set_tris_c(x)
#define lcd_type 2 // 0=5x7, 1=5x10, 2=2 lines
#define lcd_line_two 0x40 // LCD RAM address for the second line
BYTE const LCD_INIT_STRING[4] = {0x20 | (lcd_type << 2), 0xc, 1, 6};
// These bytes need to be sent to the LCD
// to start it up.
// The following are used for setting
// the I/O port direction register.
struct lcd_pin_map const LCD_WRITE = {0,0,0,0,0}; // For write mode all pins are out
struct lcd_pin_map const LCD_READ = {15,0,0,0,0}; // For read mode data pins are in
BYTE lcd_read_byte() {
BYTE low,high;
set_tris_lcd(LCD_READ);
lcd.rw = 1;
delay_cycles(1);
lcd.enable = 1;
delay_cycles(1);
high = lcd.data;
lcd.enable = 0;
delay_cycles(1);
lcd.enable = 1;
delay_us(1);
low = lcd.data;
lcd.enable = 0;
set_tris_lcd(LCD_WRITE);
return( (high<<4) | low);
}
void lcd_send_nibble( BYTE n ) {
lcd.data = n;
delay_cycles(1);
lcd.enable = 1;
delay_us(2);
lcd.enable = 0;
}
void lcd_send_byte( BYTE address, BYTE n ) {
output_low(PIN_A5); // lcd.rs = 0;
while ( bit_test(lcd_read_byte(),7) ) ;
output_bit(PIN_A5, address); //lcd.rs = address;
delay_cycles(1);
lcd.rw = 0;
delay_cycles(1);
lcd.enable = 0;
lcd_send_nibble(n >> 4);
lcd_send_nibble(n & 0xf);
}
void lcd_init() {
BYTE i;
set_tris_lcd(LCD_WRITE);
output_low(PIN_A5); // lcd.rs = 0;
lcd.rw = 0;
lcd.enable = 0;
delay_ms(15);
for(i=1;i<=3;++i) {
lcd_send_nibble(3);
delay_ms(5);
}
lcd_send_nibble(2);
for(i=0;i<=3;++i)
lcd_send_byte(0,LCD_INIT_STRING[i]);
}
void lcd_gotoxy( BYTE x, BYTE y) {
BYTE address;
if(y!=1)
address=lcd_line_two;
else
address=0;
address+=x-1;
lcd_send_byte(0,0x80|address);
}
void lcd_putc( char c) {
switch (c) {
case 'f' : lcd_send_byte(0,1);
delay_ms(2);
break;
case 'n' : lcd_gotoxy(1,2); break;
case 'b' : lcd_send_byte(0,0x10); break;
default : lcd_send_byte(1,c); break;
}
}
//1022 - room temp
//
unsigned long l2t (unsigned long a){ // get the temp in C from 0-1023
return (a*10+433)/3; //return C*10
}
void store(unsigned long x){
// SAVE TO EEPROM
write_eeprom(0, (unsigned int8) (x >> 8) & 0xff);
write_eeprom(1, (unsigned int8) x & 0xff);
}
unsigned long fetch(){
// FETCH FROM EEPROM
unsigned long x;
x = read_eeprom(0);
x = x << 8;
x = x + read_eeprom(1);
return x;
}
void menu(){
unsigned long temp;
temp = temperature;
temperature = fetch();
//turn off the heater
HEATER_OFF();
// DEFAULT TEMPERATURE
printf(lcd_putc, "f- menu +n ENTER ");
while (!input(BUTTON_F)) restart_wdt(); // wait for Function key to continue
delay_ms(DEBOUNCE_TIME);
while (input(BUTTON_F)) restart_wdt(); // wait for release
printf(lcd_putc, "f- %4Lu +n Power On TEMP ", l2t(temperature)/10);
while (!input(BUTTON_F)){
if ( input(BUTTON_UP) ){ // button pressed
delay_ms(DEBOUNCE_TIME); //debounce
if ( input(BUTTON_UP) ){
if (temperature < 1023) ++temperature;
}
}//BUTTON UP
if ( input(BUTTON_DOWN) ){ // button pressed
delay_ms(DEBOUNCE_TIME); //debounce
if ( input(BUTTON_DOWN) ){
if (temperature > 0) --temperature;
}
}//BUTTON DOWN
lcd_gotoxy(6,1);
printf(lcd_putc, "%4Lu", l2t(temperature)/10);
}
while (input(BUTTON_F)) restart_wdt(); // wait for release
//STORE VALUE
store(temperature);
temperature = temp;
// DEFAULT DEBOUNCE TIME
printf(lcd_putc, "f- %4u +n DEBOUNCE (ms) ", DEBOUNCE_TIME);
while (!input(BUTTON_F)){
if ( input(BUTTON_UP) ){ // button pressed
delay_ms(DEBOUNCE_TIME); //debounce
if ( input(BUTTON_UP) ){
if (DEBOUNCE_TIME < 250) ++DEBOUNCE_TIME;
}
}//BUTTON UP
if ( input(BUTTON_DOWN) ){ // button pressed
delay_ms(DEBOUNCE_TIME); //debounce
if ( input(BUTTON_DOWN) ){
if (DEBOUNCE_TIME > 5) --DEBOUNCE_TIME;
}
}//BUTTON DOWN
lcd_gotoxy(6,1);
printf(lcd_putc, "%4u", DEBOUNCE_TIME);
}
while (input(BUTTON_F)) restart_wdt(); // wait for release
//STORE VALUE
write_eeprom(2, DEBOUNCE_TIME);
// DEFAULT HYSTERESIS
printf(lcd_putc, "f- %4u +n HYSTERESIS ", HYST);
while (!input(BUTTON_F)){
if ( input(BUTTON_UP) ){ // button pressed
delay_ms(DEBOUNCE_TIME); //debounce
if ( input(BUTTON_UP) ){
if (HYST < 250) ++HYST;
}
}//BUTTON UP
if ( input(BUTTON_DOWN) ){ // button pressed
delay_ms(DEBOUNCE_TIME); //debounce
if ( input(BUTTON_DOWN) ){
if (HYST > 2) --HYST;
}
}//BUTTON DOWN
lcd_gotoxy(6,1);
printf(lcd_putc, "%4u", HYST);
}
while (input(BUTTON_F)) restart_wdt(); // wait for release
//STORE VALUE
write_eeprom(3, HYST);
}
void main()
{
setup_adc_ports(sAN0|VSS_VDD);
setup_adc(ADC_CLOCK_INTERNAL);
setup_timer_0(RTCC_INTERNAL);
setup_wdt(WDT_DIV_65536);
setup_timer_1(T1_DISABLED);
setup_comparator(NC_NC);
setup_vref(FALSE);
setup_oscillator(OSC_8MHZ);
current = 0;
f = 0;
set_adc_channel(0);
lcd_init();
printf(lcd_putc, " CRSN DOO Lemilon V2.1");
temperature = fetch();
DEBOUNCE_TIME = read_eeprom(2);
if (DEBOUNCE_TIME < 5) DEBOUNCE_TIME = 5;
if (DEBOUNCE_TIME > 250) DEBOUNCE_TIME = 50;
HYST = read_eeprom(3);
if (HYST < 2) HYST = 2;
if (HYST > 250) HYST = 3;
delay_ms(1000);
lcd_putc('f'); //clear display
loop:
read_adc(ADC_START_ONLY); // start the conversion
if ( input(BUTTON_UP) ){ // button pressed
delay_ms(DEBOUNCE_TIME); //debounce
if ( input(BUTTON_UP) ){
if (temperature < 1023) ++temperature;
f = BAR_DELAY;
}
}//BUTTON UP
if ( input(BUTTON_DOWN) ){ // button pressed
delay_ms(DEBOUNCE_TIME); //debounce
if ( input(BUTTON_DOWN) ){
if (temperature > 0) --temperature;
f = BAR_DELAY;
}
}//BUTTON DOWN
if ( input(BUTTON_F) ){ // button pressed
delay_ms(DEBOUNCE_TIME); //debounce
if ( input(BUTTON_F) ){
while (input(BUTTON_F)) restart_wdt(); // wait for release
while(input(BUTTON_F)); //wait for release
menu();
}
}//BUTTON Function
current = (current + read_adc(ADC_READ_ONLY)) >> 1; //read the data
if (f == 0){
lcd_gotoxy(1,1);
printf(lcd_putc, "Current: %4Lu.%1i ", l2t(current)/10, (int8) l2t(current)%10);
lcd_gotoxy(1,2);
printf(lcd_putc, "Target : %4Lu ", l2t(temperature)/10);
} else {
lcd_gotoxy(1,1);
j = temperature >> 6;
for (i = 0; i < j; ++i){
lcd_putc('#');
}
for (i = j; i < 15; ++i){
lcd_putc('.');
}
lcd_gotoxy(1,2);
printf(lcd_putc, "Target : %4Lu.%1i ", l2t(temperature)/10, (int8) l2t(temperature)%10);
}
if (current < temperature - HYST){
HEATER_ON();
}else if (current > temperature){
HEATER_OFF();
}
if (f > 0) --f;
goto loop;
}
I split the stuff about the simulation software to here:
viewtopic.php?f=56&t=1956&p=19099#p19053 (http://dangerousprototypes.com/forum/viewtopic.php?f=56&t=1956&p=19099#p19053)
i have cleaned up the schematic and added an LCD, i don't think an 16x2 is necessary. there is also a rotary encoder the dial definately has better feel than a few buttons.
[attachment=0]
8x1, 16x1, 8x2 ... all are enough ... I just have bunch of 16x2 that I use .. both small and big ones ... recently I purchased 10 COG 16x2 modules (http://http://www.mikroe.com/eng/products/view/277/various-components/) :D

(http://http://www.mikroe.com/eng/downloads/get/1008/cog_display_spec.pdf)
it is 16x2, beautiful :) use almost no power at all, they are small, great contrast ...
It does have downside
- no backlight (one could add some leds behind it ..)
- 5V only (so if you are using 2V or 3V design it gets ugly) and this is big - taking into account that you would probably select them for low power apps ..
- driver - it is "kinda" compatible with hd44780. mine code I use with all mine 16x2 works fine with all of them but I can't get this one to work properly - I only see left side of it (left 2x8) .. it works properly when I use mikroC compiler but since I use demo version it is limiting my code size so I prefer to use csc c for 16F or c18 for 18F that are not limited (one I purchased and other is free).... anyhow I will disassemble mikroC driver and find out what I am doing wrong :D
now with regards to that schematic, again few suggestions
1. move encoder+button to B port. One pin of the encoder link to B0 and other to B1. This way you can read encoder very simple. Just turn on the INT_EXT interrupt (interrupt on B0)
#define MAXTEMP 1020
#define MINTEMP 20
#define TEMPSTEP 1
volatile int8 encoder;
#int_ext
void detect_rb0_change() {
encoder = 1;
if (input(PIN_B0) == input(PIN_B1) ) { //direction
if(target < MAXTEMP-TEMPSTEP) target += TEMPSTEP;
} else {
if(target > MINTEMP-TEMPSTEP) target -= TEMPSTEP;
}
}
2. you need 10-100n from MCLR to Vss
2. you need 10-100n from MCLR to Vss
Do you often do this? We never use caps on MCLR, just a 10K and 1N4148 to keep VPP out of the power supply.
using interrupt on the encoder makes sense,
this will free up more of port a
[attachment=0]
[quote author="ian"]
2. you need 10-100n from MCLR to Vss
Do you often do this? We never use caps on MCLR, just a 10K and 1N4148 to keep VPP out of the power supply.[/quote]
since ~2-3 years - on EVERY project.
Before ~3 years ago I never did it, then I had some "weird" behaviour with one project (18F2550 but I was not using USB on it) that I was unable to debug ... mcu resetted from time to time, sometimes SPI was "missing" bytes .. and 1wire bus was working only 10% of the time and I checked the source few times and it was all perfect .. really weird stuff .. it was working "good enough" so after few weeks debugging I just left it "as is" ... couple of months after that I had issues with another project (16F877A this time) .. similar problems - random restarts, some peripherals were not working ok .. but this time it was driving a flyer (zeppelin) so it was really important for me to debug it. I asked a friend (old guy, he was doing electronics when I was not even born) to look at the schematic and to look at pcb as I might made some errors there (maybe some noise ... even it all works on very low frequencies) and first thing he told me was "put 10-100n from mclr to gnd" and let me know if it helps. I put the cap and it solved all problems on this 16F877A project .. it was crazy .. then (actually tomorrow) I remembered the "project from few months ago" and soldered 100nF directly onto mcu (mclr-gnd) and darn .. it solved all problems.
Why it solved the problem - I have no idea
Do I now put that cap on every single board - oh yes, on every single one
one more thing I do that is not "normal/usual" but it proved that it helps :D .... near the mcu I don't use 100n decoupling cap but I use 10-50pF + 10-33nF + 100nF + 1uF (tantalum). Yes, it is 4 capacitors instead of 1 but it's something I follow like a mantra :) ... if there is problem with pcb realestate then I skip the pF one and uF one, but 10n+100n is always there, but I keep 1uF tantalum on the Vdd/Vss somewhere on the board.
i have found that for most applications a single 0.1u ceramic is sufficient, usually add a 4.7uF tantalum near vreg.
"for MOST applications" being a key word :D .. since I figured out that I don't know "for what apps I need more" I decided to "overdo it" every time and just don't worry about it :D
btw as for the "near vreg" I was told a "secret formula" that I also follow like a mantra and that served me well :D . 1000uF per 1A that your circuit draws. So if your circuit will draw 100mA then 100uF, 4.7uF is right for the 5mA circuit by that formula .. again, this formula is "overdoing it" but the thing is - you will never be wrong with it .. and for hobby you don't really care if the board will be 15 or 15.5EUR .. you need to calculate "mininal settings" only if you make 1000+ and then that 0.5EUR makes a difference
EDIT: forgot to say, this 1000uF per 1A is only if you use voltage regulator or you don't know your voltage source (for e.g. usb powered devices - usb is "unknown" voltage source as it is known to produce very dirty 5V) .. if you use batteries or you are using "good voltage source" then you can go below those 1000uF/1A
on larger designs i try to use a few different size caps so i have flexibility, and don't have to redesign the board just to change a capacitor. i have found it is more important to have proper capacitance on the input of linear regulators.
for this application a few 0.1uF and a 4.7 on the output of the regulator will be fine, i don't expect the micro and amp to draw more than 10mA.
Great tips, thank you.
but 10n+100n is always there
I read an article about the history of 100nF and why we use it. I think is a Xilinx app note, and the up shot was that modern stuff if much happier with 10nF, 100nF is a hold over from analog designs or very early digital design. I forget the details, but the graphs were nice and convincing :)
yes, the "short circuit" digital circuits now make last for very very very short time so 10n fits better as it has enough capacitance and much lower esr .. .that is the way i see it .. 100n added to the 10n helps with higher frequencies as it allows 10n to "top up" faster
I'm awaiting delivery of a scope(from china) and will do a more through probe into the existing analog control circuit.
after some digging the iron i have is actually made by Atten, however i still believe there is enough in common with the Hakko it should work with their irons.
I have 1 pencil that is hakko original, one broken heater from hakko original (thermocouple is intact), one pencil that came with my QUICK 700 (hakko clone - made by QUICK, made in PRC) and 4 "noname" pencils that take same tips and have same connector at the end of the cable like hakko and quick only female!
The resistance of the heater is slightly different but the output of the thermocouple is identical from all pencils (I put all pencils in the same environment to test) in temperatures from 0-200C .. I did not try over 200C as my external heater don't go over 200C, so I'd say this board will work with any hakko clone pencil.
i have some thermocouple temp probes, the meters are not rated for over 250C,
the temp inside the heater element is going to be hotter than the tip of any iron, maybe as much as 50C.
I'm going to do a couple experiments with the common op-amps i have and some type K, I'll have to determine the input impedance needed for reliable amplification.
[quote author="sqkybeaver"]I'll have to determine the input impedance needed for reliable amplification.[/quote]
I tried your setup (mcp601, 75R on input, 14k negative feedback, nothing to ground) and it was noisy + it was not showing proper temperatures below 100C but that's not a problem as you would not run your iron below 100C anyhow and adding a capacitor on the output (ra0 to gnd) helped but not enough... The setup I use (mcp617, 10k on input, 100k to ground, 2 op-amps) show lot less noise (no noise at all to be honest, not what I expected but great :D ) and was stable and linear from 25C to 200C ...
I tested both setups with 601, 617 and 6022 and difference in op-amp version didn't make big difference.
would be nice to get the linear up to 500C
ill try some other configurations, maybe a 2 stage amplifier, noise is not that big an issue as long as it stays below a millivolt or so at 5v the resolution of the a/d will be about 4mV
[quote author="sqkybeaver"]would be nice to get the linear up to 500C
ill try some other configurations, maybe a 2 stage amplifier, noise is not that big an issue as long as it stays below a millivolt or so at 5v the resolution of the a/d will be about 4mV[/quote]
try the 2 stage one I made :) you will like it.
as for 200-500C - I have no idea, maybe it is linear (it is linear from 25-200) but I can't measure it as I don't have controlled heater 200-500C (I use aluminium piece with heater and calibrated thermistor with old hakko tip embedded in it sealed with fire cement for low theta). The simulation in ISIS show it is linear but I trust hard measured data better :D... also ISIS simulation do not show noise in your design and it is there...
just a thought >
switching to a different micro, one that has a programmable gain a/d converter, would simplify the analog circuit by about 30-40%
I have some experience with microchip's pga's (external not embedded to ad port) and I think they are great for auto ranging applications ... if one would want high precision over full range etc .. but I think for this application it is overkill :) ... I never tried any mcu with embedded pga
most of silabs micros have them, the will even run in differential mode too, used them in a bridge mode for strain gauge> extremely non-linear.
silabs make stuff "too analog for my taste" :D so I never used them :)
the larger options have a 16X16 mac and run at 100mips, external bus support. there have expanded their offerings since i first started using them. i just wish they had more with usb.
Hi guys,
So is this prototype working (the latest with encoder and 2x16)?
I ask as I am a poor student and am deciding between saving up and getting maybe an FX-888 or building my own. I have a Maplins cheapo one but don't like the large iron style, want to use a pencil like the Aoyue one ian was talking about.
Thanks
I have just added PID to my latest version of hakko&solomon driver (http://http://dangerousprototypes.com/forum/viewtopic.php?f=56&t=2457&start=105#p27554) and I'm finalizing the firmware (should be done during this weekend so on monday you can use the pcb+firmware based on 16F690). There's another one being made based on 18F2550 and the one from this thread (no idea where it ended up).