├── oled_temp2.ino └── readme.md /oled_temp2.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #define SCREEN_WIDTH 128 // OLED display width, in pixels 7 | #define SCREEN_HEIGHT 64 // OLED display height, in pixels 8 | 9 | // declarations for an SSD1306 OLED display connected to I2C (SDA, SCL pins) 10 | #define OLED_RESET 16 // Reset pin # (or -1 if sharing Arduino reset pin) 11 | TwoWire twi = TwoWire(1); // our own TwoWire instance on bus 1 12 | Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &twi, OLED_RESET); 13 | 14 | // declarations for the max6675 boards on SPI 15 | int thermoDO = 19; //called SO on the max6675 16 | int thermoCS = 23; //called CS on the max6675 17 | int thermoCLK = 18; //called SCK on the max6675 18 | 19 | int thermoCS2 = 5; 20 | 21 | // the default setting is celsius 22 | bool unit_F = false; //true = °F - false = °C 23 | 24 | MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO); 25 | MAX6675 thermocouple2(thermoCLK, thermoCS2, thermoDO); 26 | 27 | void setup() { 28 | Serial.begin(115200); 29 | Serial.println("MAX6675 test"); 30 | 31 | twi.begin(4,15); // Needs to come before display.begin is used 32 | if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { 33 | // Address 0x3C for 128x32 34 | Serial.println(F("SSD1306 allocation failed")); 35 | // for(;;); // Don't proceed, loop forever 36 | } 37 | 38 | display.clearDisplay(); 39 | display.setTextSize(3); 40 | display.setTextColor(WHITE); 41 | display.setCursor(0,0); 42 | display.println("start"); 43 | display.println("display.."); 44 | display.display(); 45 | 46 | delay(500); 47 | } 48 | 49 | // write data to the OLED 50 | void Display_WRITE(){ 51 | display.clearDisplay(); 52 | display.setTextSize(2); 53 | display.setTextColor(WHITE); 54 | display.setCursor(0,0); 55 | display.print("ET "); 56 | if (unit_F) { 57 | display.println(thermocouple.readFahrenheit()); 58 | display.print("BT "); 59 | display.println(thermocouple2.readFahrenheit()); 60 | } 61 | else if (!unit_F) { 62 | display.println(thermocouple.readCelsius()); 63 | display.print("BT "); 64 | display.println(thermocouple2.readCelsius()); 65 | } 66 | display.display(); 67 | } 68 | 69 | //Send Serial Data 70 | void Command_WRITE(){ 71 | Serial.print("0.00,"); 72 | if (unit_F) { 73 | Serial.print(thermocouple.readFahrenheit()); 74 | Serial.print(","); 75 | Serial.print(thermocouple2.readFahrenheit()); 76 | } 77 | else if (!unit_F) { 78 | Serial.print(thermocouple.readCelsius()); 79 | Serial.print(","); 80 | Serial.print(thermocouple2.readCelsius()); 81 | } 82 | Serial.println(",0.00,0.00"); 83 | } 84 | 85 | //Parsing Serial Commands 86 | void handleSerialCommand(){ 87 | 88 | if (Serial.available()>0){ 89 | String msg = Serial.readStringUntil('\n'); 90 | 91 | if (msg.indexOf("CHAN;")== 0){ //Ignore this Setting 92 | Serial.print("#OK"); 93 | } 94 | else if (msg.indexOf("UNITS;")== 0){ 95 | 96 | if (msg.substring(6,7)=="F"){ //Change to Farenheit 97 | unit_F = true; 98 | Serial.println("#OK Farenheit"); 99 | } 100 | else if (msg.substring(6,7)=="C"){ //Change to Celsius 101 | unit_F = false; 102 | Serial.println("#OK Celsius"); 103 | } 104 | 105 | } 106 | else if (msg.indexOf("READ")==0){ //Send Temps 107 | Command_WRITE(); 108 | 109 | } 110 | } 111 | 112 | } 113 | 114 | 115 | void loop() 116 | { 117 | 118 | handleSerialCommand(); 119 | 120 | Display_WRITE(); 121 | 122 | delay(500); 123 | } 124 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | ## ESP32 with OLED and MAX6675 to read thermocouples and function as TC4 for recording bean and environmental temperatures for Roastlogger and Artisan coffee roasting software ## 2 | 3 | ### Boards used ### 4 | ESP32:
5 | http://www.lilygo.cn/prod_view.aspx?TypeId=50032&Id=1152&FId=t3:50032:3
6 | ordered via: https://www.aliexpress.com/item/32824839148.html
7 | 8 | MAX6675:
9 | ordered via: https://www.aliexpress.com/item/1902975176.html
10 | 11 | Thermocouples:
(I've tried a few -- in addition to the ones that come with the MAX6675)
12 | ordered via: https://www.aliexpress.com/item/32848451468.html
13 | ordered via: https://www.aliexpress.com/item/32795229358.html
14 | 15 | Pin map for above the ESP32 board:
16 | https://0.rc.xiniu.com/g1/M00/29/CB/CgAGTF1agBWASwmZAAF9zU1LNpY299.jpg
17 | ![picture alt](https://0.rc.xiniu.com/g1/M00/29/CB/CgAGTF1agBWASwmZAAF9zU1LNpY299.jpg "Pin map") 18 | 19 | It's just a little code to use ttgo esp32 board with two max6675 and oled -- to work like a TC4 to artisan roasting software 20 | --------------------------------------------------------------------------------