I am having difficulties with modifying marlin to accept heated bed thermistor. The process seemed simple enough, but problems appeared when I realised that with the sensor I use, I need to change analogReference to internal 1.1 Volt.
First the electrical side:
Heating resistors will be powered by and external power source, and the current will be switched on the low voltage side with an solid state relay. The system is grounded and shielded properly. Necessary fuses are added. So I would say that the problem is not here.
The thermistor I use is KTY81-210 from phillips. It differs from normal thermistors in that it has a positive temperature coefficient (resistance goes up with temperature).
I have added 15kohm resistor to R4 (as per http://reprap.org/wiki/Thermistor, KTY82-210 (Philips) (2kOhm SMD)).
I did not do anything to AREF (VREF) as it seemed not to be connected to anything.
I have calculated the resistor value (just to be sure) with basic voltage divider calculations, and by values obtained here: http://www.nxp.com/documents/data_sheet/KTY81_SER.pdf, 15kohm is spot on.
So the electrical side seems to be correct?
I think that the problems are on software side.
I have not connected the solid state relay to ultimakers mainboard yeat, because ulticontroller shows temperature wrongly.
I downloaded Marlin from daids github. From configuration.h I did the necessary modifications to enable heated bed. This seems to be done correctly, as ulticontroller now shows also the heated bed temperature. I had to add new temperature sensor setting (I used #11) as there were no config already for my thermistor.
From configuration_adv.h I only enabled quick_home, everything else is default.
I added new table to thermistortables.h, using the same notation as the other tables there. Table values I took from reprap wiki mentioned before.
Temperature.cpp is where the problem lives. Probably this line:
ADMUX = ((1 << REFS0) | (TEMP_0_PIN & 0x07));
If I read correctly that line makes the AREF to be VCC. For my sensor I need the reference voltage to be 1.1 V.
Doing this modification at the "case 2: // Prepare TEMP_BED" portion:
ADMUX = ((1 << REFS1) | (TEMP_BED_PIN & 0x07));
Only seemed to change the received ADC value about 200 units lower. This is strange. Writing 1 to REFS1 should make AREF internal 1v1?
I put SERIAL_ECHOLN function to temperature.h to line 1066, after temp_meas_ready = true;, to see what data is the ADC getting from the KTY sensor. With 1 written to REFS0 ADC will get about 1600 and with 1 written to REFS1 ADC shows ADC value of about 1800.
That is strange enough, since change from 5V reference to 1.1V reference should rise the value sharply?
The other, even stranger, problem is that ulticontroller shows bed temp to be 0/0° and when I grab the sensor (to elevate temperature) it changes first to '/0°, then (/0° and )/0°. After releasing it slowly goes back to 0/0°.
I would say that the problem is definitely in marlin settings, and I have done something wrong there. Should I upload the whole firmware to some website?