Hacks to the RepRap Extruder Controller v2.2

From RepRap
Revision as of 04:55, 26 November 2011 by Glenn (talk | contribs) (+ Category:Darwin)
Jump to: navigation, search

Thermocouple input

There is an alternative to this approach, using the AD595 chip here, it does need one more modification to work correctly, you need to remove R6.

In-use.jpg

This allows you to use a K-type thermocouple for temperature sensing as opposed to the standard thermistor. It uses the [MAX6675] chip, and is easily put together on a small piece of stripboard that plugs into the I2C connector on the extruder controller board.

Board-mods.jpg

The first thing you'll need to do is to remove the 10uF capacitor C8 from the board at B in the picture. You can also remove the thermistor connector (at A) and replace it with a pin. Alternatively, just screw the connection from the new board into the thermistor connector. Getting the capacitor off can be a bit tricky: I levered too hard as I melted the solder and so removed the pad underneath. That's why there is the short white wire connected to the top of R6 is in the picture. If you are more careful, you won't need this...

The I2C connector that you will plug the device into is the 4-pin connector just below R6 in the picture.

Schematic.png

Here is the schematic. This is in [the RepRap subversion repository here].

Stripboard-top.jpg Stripboard-bottom.jpg

The MAX6675 is only available as an SMT device. Start by soldering fine wires onto its pins (hold it in a blob of Blu Tack). Cut the tracks on the stripboard, then solder the wires to that. Finally add the connectors, the smoothing capacitor, and the flying lead. You can probably think of a neater wire layout than mine - this evolved as I experimented with the device.

Finally, here's the code to drive it. Thanks to [Ryan Mclaughlin for this]. This will give you back the temperature in oC.

 

#define SO 18    // MISO
#define SCK 19   // Serial Clock
#define TC_0 17  // CS Pin

// Put this next bit in your startup function:

  pinMode(SO, INPUT);
  pinMode(SCK, OUTPUT);
  pinMode(TC_0, OUTPUT);

// End of startup


// This returns an integer which is the temperature in deg C from the MAX6675

int getTemperature()
{
    int value = 0;
    byte error_tc;
    
    digitalWrite(TC_0, 0); // Enable device

    /* Cycle the clock for dummy bit 15 */
    digitalWrite(SCK,HIGH);
    digitalWrite(SCK,LOW);

    /* Read bits 14-3 from MAX6675 for the Temp
	 Loop for each bit reading the value 
    */
    for (int i=11; i>=0; i--)
    {
	digitalWrite(SCK,HIGH);  // Set Clock to HIGH
	value += digitalRead(SO) << i;  // Read data and add it to our variable
	digitalWrite(SCK,LOW);  // Set Clock to LOW
    }
  
    /* Read the TC Input inp to check for TC Errors */
    digitalWrite(SCK,HIGH);
    error_tc = digitalRead(SO); // Read data
    digitalWrite(SCK,LOW);
  
    digitalWrite(TC_0, HIGH); //Disable Device

    if(error_tc)
      return 2000;
    else
      return value/4;
}

If it detects an error, this code returns a silly high temperature rather than, say, -300. The latter obviously doesn't exist as a temperature and so might make a better error flag. But returning a big positive value is safe if the device is being used in a thermostat loop: it'll turn off the heater if there's an error, rather than locking it on. Note that the final division by four dumps a couple of bits of precision to get an integer value in oC. The MAX6675 can measure to 0.25 oC, and so you may want to preserve those bits if you need the precision.

Back-thermistor.jpg

If you want to swap easily between using a thermocouple and a thermistor, just wire a 10 uF capacitor across the thermistor's connector to replace the one you removed from the PCB. Take care to get the polarity right: the negative capacitor connection goes to the ground pin on the PCB. Upload the original firmware without the function above, and you're good to go.

If you want to use thermocouples with the AD595 board ([described here]) then reprapper pjr writes:

I checked the Extruder controller 2.2 and there are two extra analogue pins A6 and A7 brought out to 3 pin headers with 5v and ground (next to the trimpot).

I tweaked the configuration.h to use pin 6 instead of pin 3 and wired in the thermocouple board 1.0 and it works fine.

Notes:

- The pinouts are not the same: TC 1.0 and 2.1 have <Ground-Signal-+5v-> but the extruder controller has <Ground-+5v-Signal> so wires needs swapping.

- The silkscreen on the controller is reversed (when facing the board with the crystal on the bottom side: ground is top, +5v is centre, A6/7 are at bottom)

- The A6 may be already used in firmware as temperature pin for heated bed, but A7 may be free. Better double check this on the current firmware release.

No need for any board mods this way.