Jump to content
Ultimaker Community of 3D Printing Experts

Trying to add heated bed, Ulticontroller does not show temp correctly

Recommended Posts

Posted · Trying to add heated bed, Ulticontroller does not show temp correctly

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?


  • Link to post
    Share on other sites
    Posted · Trying to add heated bed, Ulticontroller does not show temp correctly

    Well.... You could just spend the $3 and get this:


    Everything you say makes sense. I'm wondering about the 1.1V reference I guess. Maybe it isn't properly going into the ADC mode you think it is. Maybe some code somewhere else prevents you or overrides you in some loop or ISR somewhere. I have done embedded programming before but not with Arduino. I would read about all the ADC modes and see if somewhere something is putting it in a mode you didn't expect.

    Did you measure the voltage at the input to the ADC? With a voltmeter? To see if the voltage is as expected?


  • Link to post
    Share on other sites
    Posted · Trying to add heated bed, Ulticontroller does not show temp correctly

    Thank you for your suggestion.

    I will buy that sensor from ultimaker to fix the problem.

    In the meantime it would be nice to figure out why the firmware doesn't work properly with the other sensor. I will try to measure the voltage at AREF pin. Probably I wont get much out of it, since the software is continuously changing between 5V and 1V1 AREFs. And I don't own an oscilloscope.


  • Link to post
    Share on other sites
    Posted · Trying to add heated bed, Ulticontroller does not show temp correctly

    Yes I realised that after sending last message, my bad.

    (btw, this "..post need approval from a moderator.." is kind of annoying)

    After doing some tests, I figured out that weird ulticontroller readings came from a simple problem. Measured ADC value was out of limits of the used temperature table.

    Changing AREF on the fly does not seem to work, this might be because AREF voltage needs some time to drop from 5V to 1V1. KTY81 sensor works fine, but with 5V AREF the measured range is only about 150 or-so steps. This limits the possible accuracy of the measurement. But for my purposes accuracy of 1 to 2 degrees celcius is close enough. I will use this setup until I can change the sensor to a 100k one.

    So the problem is, atleast partially, solved. Thank you gr5.

    If someone has figured out a way to dynamically change AREF very quickly, please let me know.


  • Link to post
    Share on other sites
    Posted · Trying to add heated bed, Ulticontroller does not show temp correctly

    > "..post need approval from a moderator.." is kind of annoying)

    I think that will go away after a bit. I'll "like" your post to help speed you on to a non-newbie poster.

  • Link to post
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
    • Our picks

      • Talking additive | The 3D printing podcast
        Why should we be the only ones asking questions? Join us and ask Jabil all your questions on September 22nd 5pm CET
          • Like
        • 3 replies
      • Ultimaker masterclass: Optimizing your Ultimaker Cura workflow
        Save your seat for either broadcast on September 23.
        What will you learn?
        · Best practices for iterative print preparation and every lesson you should learn from each print
        · The right way to use per-object settings and when they are most useful
        · Easy-to-use resources for anyone who wants to develop their own printer definitions, plugins, or print profiles
        · How to optimize print profile settings and whether to “keep” or “discard” changes
        · When is the right time to export your drawing from CAD? (Based on Ultimaker Cura’s surprising power as 3D control software)
        · And a whole lot more tips and tricks!
        How can I join?
        This free masterclass will take place twice:
        1. 11am CEST (5pm SGT, 5am EDT)
        2. 5pm CEST (11am EDT, 8am PDT, 11pm SGT)
          • Like
        • 0 replies
      • Do you use 3D printing at work? Let us know
        It doesn't matter if you are using 1 Ultimaker or 10, there is inspiration in everything. We're looking for ...
        • 1 reply
    • Create New...