<p>Here is what I found to be the easiest solution. Please use <a href="http://www.robotrebels.org/gallery/16_08_07_17_7_42_19.jpeg" rel="nofollow noreferrer">this image</a> for reference. I recommend doing these instructions once from source, since a lot of things can go wrong,  then once everything works, go back and integrate them into your existing Marlin codebase.</p>
<ol>
<li><p>Get some 5V <a href="https://rads.stackoverflow.com/amzn/click/com/B07M88JRFY" rel="nofollow noreferrer" rel="nofollow noreferrer">relays</a> to run the infrared lamps. These relays take in a 5V digital signal from an arduino pin. When the arduino activates these pins, the lamps will turn on. Get a cardboard box, line it with aluminum foil, and attach a lamp to the top of it using a lamp switch. If you are going to do this NEVER leave the box unattended, as a relay can get fail especially when it gets warm (this happened to me). Dont cause a fire, make sure to keep it attended. Anyway, One wire for the lightbulb goes to <code>NO</code> on the relay, the other goes to <code>D-</code>. One wire from 120V power goes to <code>COM</code>, the other also goes to <code>D-</code>. The yellow &quot;jumper&quot; on the relay boards I posted goes between HIGH and the middle pin. These are pins on the relay, not the MKS GEN board.</p>
</li>
<li><p>On the MKS GEN board, we will be using the <code>X-MAX</code> endstop as the digital pin to run the chamber. Wire the <strong><code>5V</code></strong> pin on <code>X-MAX</code> to the <code>D+</code> of the relay. Wire the <strong><code>GND</code></strong> pin to <code>D-</code> of the relay with the two other wires there. Wire pin <strong><code>D2</code></strong> on the MKS GEN Board to <code>IN</code> on the relay. <strong>Bold</strong> means the pin is on the MKS GEN board.</p>
</li>
<li><p>Clone the Marlin-2.0 repo: <code>git clone -b bugfix-2.0.x https://github.com/MarlinFirmware/Marlin.git</code></p>
</li>
<li><p>In Configuration.h, change TEMP_SENSOR_CHAMBER to 1 or 11 (depends on your thermistor, might be other values.) Since we will be using the board's second extruder thermistor as the thermistor in this example, change TEMP_SENSOR_1 to 0 for now.</p>
</li>
</ol>
<pre><code>#define TEMP_SENSOR_0 1
#define TEMP_SENSOR_1 0
#define TEMP_SENSOR_2 0
#define TEMP_SENSOR_3 0
#define TEMP_SENSOR_4 0
#define TEMP_SENSOR_5 0
#define TEMP_SENSOR_BED 1
#define TEMP_SENSOR_CHAMBER 1
</code></pre>
<ol start="5">
<li><p>In the file src/pins/ramps/pins_RAMPS.h, add this line:
<code>#define TEMP_CHAMBER_PIN 15</code>. Note that this is the thermistor
slot usually used for a second extruder. If you're already using
this thermistor for the second extruder and want to use a different
analog pin, see <a href="https://3dprinting.stackexchange.com/questions/10891/weird-temperature-reading-using-thermistor-on-mks-gen-l-v1-0-aux-2-analog-pins">this question</a>. You'll need some resistors.</p>
</li>
<li><p>Also, around line 95 in pins_RAMPS.h, change <code>X_MAX_PIN</code> to use an unused pin. The number <code>4</code> is good. If you don't do this, your Chamber's digital Pin will be always &quot;on&quot; by default. You want it off by default, then activated by the Marlin code.</p>
</li>
<li><p>In Configuration_adv.h, change <code>//#define HEATED_CHAMBER_PIN 44</code> to <code>#define HEATER_CHAMBER_PIN 2</code> to use the <code>X_MAX</code> endstop's digital pin.</p>
</li>
<li><p>Upload...</p>
</li>
<li><p>Go into OctoPrint settings. Click Axes and Volume. Next to a checkbox for heated bed, there is a checkbox for heated chamber! Click that, and your chamber is active.</p>
</li>
<li><p>If some part is wrong (e.g. lamp doesn't go on because wire came loose on relay), debug that and keep working. Check the octoprint log to make sure the C value is shown.</p>
</li>
<li><p>Once everything works, generalize these solutions to your set-up (e.g. using multiple extruders).</p>
</li>
</ol>

CC BY-SA 4.0
2022-10-12T00:37:51.643Z
"*Please use this image for reference.*".  We would if it still existed. This is another example of why images etc. should always be permanently included in the post, not simply referenced by a mortal link.
Ray Butterworth
CC BY-SA 4.0
2019-09-17T19:54:44.117Z
2022-10-15T01:00:21.360Z
2022-10-15T01:00:21.360Z
K Mmmm
<p>I have an infrared lamp I'd like to use to heat my chamber. Right now I don't have plans to install a cooling fan, but I will if I need to. This question pertains to Marlin (2.0, preferably) in combination with an <a href="https://www.robotrebels.org/index.php?topic=769.0" rel="noreferrer">MKS Gen L v1.0 board</a>.</p>

<p>In the documentation for the <a href="http://marlinfw.org/docs/configuration/configuration.html#thermal-settings" rel="noreferrer">thermal settings</a> it specifies you can set a heater pin to be used to heat up the chamber. It says this variable is called the <code>CHAMBER_HEATER_PIN</code> but in Marlin 2.0's Configuration_adv.h file there is something called a <code>HEATER_CHAMBER_PIN</code> that has been commented out.</p>

<p>Secondly the <code>Configuration.h</code> file:  there is something called an <code>AUTO_POWER_CHAMBER_FAN</code>. Is this meant for a fan used for cooling, or a fan used for cleaning out the chamber of particles? In either case, I probably don't want to have this fan always on, but only use it to cool the temperature the heater has been on too long.</p>

<p>So really there should be only 2-3 changes I need to make right: </p>

<ul>
<li>I need to specify an already present digital pin for

<ul>
<li>the chamber heater</li>
<li>the chamber cooler (fan)</li>
</ul></li>
<li>Turn thermal runway active. </li>
<li>It needs to use the Marlin Chamber feature so that the readout temperature appears as "C:" in the arduino logs. This allows compatibility with octoprint</li>
<li>Lastly I need to set an analog pin for the chamber thermistor</li>
</ul>

<p>These are the things I can't fully figure out on my own. 
A detailed set of instructions or code snippets for a similar setup would be helpful</p>

CC BY-SA 4.0
2019-09-12T17:12:21.640Z
what board is this using?
Trish
CC BY-SA 4.0
2019-09-12T17:14:09.027Z
MKS Gen V1.0. I would prefer Marlin 2.0 actually. I am going to update the question actually to specify that firmware. I would prefer to use the X-MAX or Y-MAX endstop as the heated chamber digital pin. And the thermistor can be the second extruder thermistor
K Mmmm
CC BY-SA 4.0
2019-09-12T18:04:49.493Z
a [MKS Gen L 1.0](https://www.robotrebels.org/index.php?topic=769.0)? The board is relevent because you need to have some pins free, using the unused endstops could be an option, if the board can be retaught to do so.
Trish
CC BY-SA 4.0
2019-09-12T19:24:47.613Z
Yes I agree that there are a lot of other pins free on the Gen L. I want to use the max endstops though because they have a 3 wire slotted connection and won't come off the board when connected. They also have everything you need to activate a relay (5V, GND, D2). Im comfortable with activating new pins, it's just using the "Chamber" feature of Marlin that I specifically want to use because it is compatible with Octoprint. There doesn't seem to be any documentation on the web for it, except perhaps the answer to this question.
K Mmmm
CC BY-SA 4.0
2019-09-12T19:49:28.083Z
I tried to rework the question for easier readability.
Trish
<marlin><chamber>
How to set up Marlin to use a heated chamber?
K Mmmm
# How to set up Marlin to use a heated chamber?

(Asked by: username_0 on 2019-08-30)

I have an infrared lamp I'd like to use to heat my chamber. Right now I don't have plans to install a cooling fan, but I will if I need to. This question pertains to Marlin (2.0, preferably) in combination with an [MKS Gen L v1.0 board](https://www.robotrebels.org/index.php?topic=769.0).

In the documentation for the [thermal settings](http://marlinfw.org/docs/configuration/configuration.html#thermal-settings) it specifies you can set a heater pin to be used to heat up the chamber. It says this variable is called the `CHAMBER_HEATER_PIN` but in Marlin 2.0's Configuration\_adv.h file there is something called a `HEATER_CHAMBER_PIN` that has been commented out.

Secondly the `Configuration.h` file: there is something called an `AUTO_POWER_CHAMBER_FAN`. Is this meant for a fan used for cooling, or a fan used for cleaning out the chamber of particles? In either case, I probably don't want to have this fan always on, but only use it to cool the temperature the heater has been on too long.

So really there should be only 2-3 changes I need to make right:

* I need to specify an already present digital pin for
  + the chamber heater
  + the chamber cooler (fan)
* Turn thermal runway active.
* It needs to use the Marlin Chamber feature so that the readout temperature appears as "C:" in the arduino logs. This allows compatibility with octoprint
* Lastly I need to set an analog pin for the chamber thermistor

These are the things I can't fully figure out on my own.
A detailed set of instructions or code snippets for a similar setup would be helpful

**Tags:** marlin, chamber

> **Comments:**
> **username_1**: what board is this using?  
> **username_0**: MKS Gen V1.0. I would prefer Marlin 2.0 actually. I am going to update the question actually to specify that firmware. I would prefer to use the X-MAX or Y-MAX endstop as the heated chamber digital pin. And the thermistor can be the second extruder thermistor  
> **username_1**: a [MKS Gen L 1.0](https://www.robotrebels.org/index.php?topic=769.0)? The board is relevent because you need to have some pins free, using the unused endstops could be an option, if the board can be retaught to do so.  
> **username_0**: Yes I agree that there are a lot of other pins free on the Gen L. I want to use the max endstops though because they have a 3 wire slotted connection and won't come off the board when connected. They also have everything you need to activate a relay (5V, GND, D2). Im comfortable with activating new pins, it's just using the "Chamber" feature of Marlin that I specifically want to use because it is compatible with Octoprint. There doesn't seem to be any documentation on the web for it, except perhaps the answer to this question.  
> **username_1**: I tried to rework the question for easier readability.  

---

## 1 answers

### Answer by username_0 on 2019-09-17. Score: 5 | Accepted answer

Here is what I found to be the easiest solution. Please use [this image](http://www.robotrebels.org/gallery/16_08_07_17_7_42_19.jpeg) for reference. I recommend doing these instructions once from source, since a lot of things can go wrong, then once everything works, go back and integrate them into your existing Marlin codebase.

1. Get some 5V [relays](https://rads.stackoverflow.com/amzn/click/com/B07M88JRFY) to run the infrared lamps. These relays take in a 5V digital signal from an arduino pin. When the arduino activates these pins, the lamps will turn on. Get a cardboard box, line it with aluminum foil, and attach a lamp to the top of it using a lamp switch. If you are going to do this NEVER leave the box unattended, as a relay can get fail especially when it gets warm (this happened to me). Dont cause a fire, make sure to keep it attended. Anyway, One wire for the lightbulb goes to `NO` on the relay, the other goes to `D-`. One wire from 120V power goes to `COM`, the other also goes to `D-`. The yellow "jumper" on the relay boards I posted goes between HIGH and the middle pin. These are pins on the relay, not the MKS GEN board.
2. On the MKS GEN board, we will be using the `X-MAX` endstop as the digital pin to run the chamber. Wire the **`5V`** pin on `X-MAX` to the `D+` of the relay. Wire the **`GND`** pin to `D-` of the relay with the two other wires there. Wire pin **`D2`** on the MKS GEN Board to `IN` on the relay. **Bold** means the pin is on the MKS GEN board.
3. Clone the Marlin-2.0 repo: `git clone -b bugfix-2.0.x https://github.com/MarlinFirmware/Marlin.git`
4. In Configuration.h, change TEMP\_SENSOR\_CHAMBER to 1 or 11 (depends on your thermistor, might be other values.) Since we will be using the board's second extruder thermistor as the thermistor in this example, change TEMP\_SENSOR\_1 to 0 for now.

```
#define TEMP_SENSOR_0 1
#define TEMP_SENSOR_1 0
#define TEMP_SENSOR_2 0
#define TEMP_SENSOR_3 0
#define TEMP_SENSOR_4 0
#define TEMP_SENSOR_5 0
#define TEMP_SENSOR_BED 1
#define TEMP_SENSOR_CHAMBER 1

```

5. In the file src/pins/ramps/pins\_RAMPS.h, add this line:
   `#define TEMP_CHAMBER_PIN 15`. Note that this is the thermistor
   slot usually used for a second extruder. If you're already using
   this thermistor for the second extruder and want to use a different
   analog pin, see [this question](https://3dprinting.stackexchange.com/questions/10891/weird-temperature-reading-using-thermistor-on-mks-gen-l-v1-0-aux-2-analog-pins). You'll need some resistors.
6. Also, around line 95 in pins\_RAMPS.h, change `X_MAX_PIN` to use an unused pin. The number `4` is good. If you don't do this, your Chamber's digital Pin will be always "on" by default. You want it off by default, then activated by the Marlin code.
7. In Configuration\_adv.h, change `//#define HEATED_CHAMBER_PIN 44` to `#define HEATER_CHAMBER_PIN 2` to use the `X_MAX` endstop's digital pin.
8. Upload...
9. Go into OctoPrint settings. Click Axes and Volume. Next to a checkbox for heated bed, there is a checkbox for heated chamber! Click that, and your chamber is active.
10. If some part is wrong (e.g. lamp doesn't go on because wire came loose on relay), debug that and keep working. Check the octoprint log to make sure the C value is shown.
11. Once everything works, generalize these solutions to your set-up (e.g. using multiple extruders).

> **Comments:**
> **username_2**: "*Please use this image for reference.*".  We would if it still existed. This is another example of why images etc. should always be permanently included in the post, not simply referenced by a mortal link.  

---

