Bert Wagner
2 min readOct 6, 2016

--

Roelof Loots Thanks for the comment. I am actually in the process of writing up my most recent coffee roasting project, which uses the MAX31855 and relays, here: https://github.com/bertwagner/Coffee-Roaster . Hopefully in the next week or so it will all up there and documented.

To connect the relay, you can plug a GND pin on your Raspberry Pi to the negative terminal of your relay, and a GPIO pin to the positive terminal.

In the above photo, the grey wire is connected to the 4- terminal on the relay and a GND pin on the Raspberry Pi. The white wire is connected to the 3+ terminal on the relay and a GPIO pin on the Raspberry Pi. The 2+ terminal on the relay is connecting to my 18v power source for my fan via the red wire. The 1- terminal on the relay is then connected to my DC fan via the yellow wire.

After the relay is hooked up following the above, I use the Relay.cs class in my code (https://github.com/bertwagner/Coffee-Roaster/blob/master/WebRoasterAPI/Controllers/Device/Relay.cs) to switch the relay on/off. For example, if my white wire was connected to GPIO 16 (pin 36 on the Raspberry Pi 3 https://ms-iot.github.io/content/en-US/win10/samples/PinMappingsRPi2.htm ) I can then turn my fan on/off with the following code:

// Connected my relay to a DC fan
Relay fan = new Relay(16);
// Turn fan on
fan.On();
// Turn fan off
fan.Off();

Last thing to note about switching a relay on/off with the Pi — the Pi’s GPIO pins are 3v. Your relay will only switch on if it is expecting a 3v input (in my picture above, you can see the relay says it accepts 3–32V as an input). If you have a relay that needs to be triggered by a higher voltage, you will need to add a transistor and higher voltage power line.

As for the MAX31855, I am using the following breakout board: https://www.adafruit.com/product/269 . My understanding is that the MAX31865 chip is similar, so you might be able to try the following:

Vin is connected to grey, 3Vo is left unconnected, blue is connected to GND, purple is connected to DO, black is connected to CS, and white is connected to CLK.

Vin (grey) i connected to 5v power on the Pi (pin 2), GND (blue) is connected to GND (pin 6), DO (purple) is connected to SPI0 MISO (pin 21), CS (black) is connected to SPI0 CS (pin 24), and CLK (white) is connected to SPI0 SCLK (pin 23).

Once hooked up, I use my temperature probe class for the MAX31855 to communicate with the chip: https://github.com/bertwagner/Coffee-Roaster/blob/master/WebRoasterAPI/Controllers/Device/TemperatureProbe.cs

Assuming that class doesn’t need to be modified for your chip (make sure the clock frequency is the same), you should just be able to write:

TemperatureProbe probe = new TemperatureProbe();
decimal temp = probe.GetProbeTemperatureDataFahrenheit();

Good luck, hope you are able to get it working!

--

--