MAX6675
-
I have gotten a maxim MAX6675 board and a K-type thermocouple for measuring high temperatures working with mysensors and thought I would share my sketch.
board is off ebay http://www.ebay.com/itm/301283128770
I have found a library written by ryan j mclaughlin on github https://github.com/ryanjmclaughlin/MAX6675-Library
#include <MySensor.h> #include <MAX6675.h> #include <SPI.h> uint8_t CS0 = 4; // CS pin on MAX6675 uint8_t SO = 3; // SO pin of MAX6675 uint8_t SCLK = 5; // SCK pin of MAX6675 uint8_t units = 1; // Units to readout temp (0 = ΛF, 1 = ΛC) float temperature = 0.0; // Temperature output variable float lastTemperature; unsigned long SLEEP_TIME = 30000; boolean metric = true; MySensor gw; MyMessage msg(0,V_TEMP); // Initialize the MAX6675 Library for our chip MAX6675 temp0(CS0,SO,SCLK,units); void setup() { // Startup and initialize MySensors library. Set callback for incoming messages. gw.begin(); // Send the sketch version information to the gateway and Controller gw.sendSketchInfo("Max6675 Temperature Sensor", "1.0"); // Present all sensors to controller gw.present(0, S_TEMP); Serial.begin(115200); } void loop() { // Process incoming messages (like config from server) gw.process(); temperature = temp0.read_temp(); // Read the temp if(temperature == -1) { // If there is an error with the TC, temperature will be -1 Serial.println("Thermocouple Error!!"); // Temperature is -1 and there is a thermocouple error } else { Serial.print("Current Temperature: "); Serial.println( temperature ); // Print the temperature to Serial if (temperature!=lastTemperature) gw.send(msg.setSensor(0).set(temperature,1)); lastTemperature=temperature; } gw.sleep(SLEEP_TIME); }
-
Nice, thanks for the example.
Please enclose the source code between 4 backtick characters to format it correctly in the forum.
Backtick == ` x 4
-
Can you share the wiring diagram ?
-
@Ezequiel-Torres I did just connect pin 3,4,5 and vcc,gnd to module and sensor to module. Look in example code for directions.
Example is made for mysensors 1.4 or 1.5 so may have to modify it a bit.
-
Hy i
IDE upload:
MySensors.h:328:2: error: #error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless.
Bleas help
lg
Wolfgang
-
example has to be converted to 2.x of mysensors.
To do so you need at least to add
#define MY_RADIO_NRF24
remove all gw.
please look at any 2.x example to see what have changed.
-
I can not understand that!
I have not Radio my Arduino ist connect per USB.
-
@wthiess How do you plan to communicate with any sensors/actuators if you have no radio/supported transport attached???
-
Paspberry > USB > Ardunino-max6675
-
@wthiess You need to use a supported transport.
-
USB / Serial
/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A700RH5J-if00-port0@9600
-
@wthiess I suggest you read up on what MySensors is.
Here is a good start: https://www.mysensors.org/about/network
-
If you are not going to use mysensors look at library example
https://github.com/mcleng/MAX6675-Library/blob/master/examples/read_temp/read_temp.pde
-
If you are not going to use mysensors look at library example
https://github.com/mcleng/MAX6675-Library/blob/master/examples/read_temp/read_temp.pdeError:
MAX6875Temp.ino: In function 'void loop()':MAX6875Temp:24: error: 'class MAX6675' has no member named 'read_temp'
temperature = temp.read_temp();