Showing posts with label Thermocouple. Show all posts
Showing posts with label Thermocouple. Show all posts

Tuesday, July 28, 2020

Trying Things Out on An Airplane.

I finally did it. I have an ESP32 talking to a thermocouple connected to a Lycoming O-360!

I am using bayonet K type thermocouples, on the CHT ports built into the cylinder heads of the engine. They are in a 3/8-24 hole that is about 2 inches deep on the bottom of the cylinder near the bottom spark plug.

This is cylinder 1 near the prop. The bayonet adapter is the shiny metal part, just below the sparkplug. The tube on the left is the intake for the cylinder.

The temperature measurement is working, and seems pretty accurate. For now it is only reading one thermocouple, since that is all I have. I am using the MAX6675 Arduino module available from all the usual outlets for about $5 each. I have 4, but one isn't like the others, and doesn't seem to work. I'll have to order a couple more.

I only have one of these thermocouples, but I have 4 on order. The thermocouple I have only has about and 18inch wire coming out of it. The thermocouples I have on order have 3 meter wires, and should be more suitable for mounting the control box on the firewall.

The ESP32 controller I have now was hanging down between the USB cord and the thermocouple wire. It isn't suitable for use during the engine run. I ran the engine for about 3-4 minutes to get it up to about 200degrees F. I do have 2 sparkplug ring type thermocouples connected to an analog gauge that I can use while the engine is running. I can only read one CHT and EGT at a time, using a rotary switch.

After shutting down the engine, and ensuring all switches were off, I connected the esp32 to a laptop, and the thermocouple to the bayonet adapter. Then I used the Arduino serial monitor to read the output of the serialthermocouple example program that is available with the Adafruit MAX6675 library. The only changes I needed to make to the example program was tell it what pins the three SPI wires connect to.

A screen shot of the Arduino Monitor compares well with the analog gauge:

About 180-190 degrees F showing, while looking at cylinder 4 the opposite of cylinder 1 where the ESP32/MAX6675 was connected. (A Lycoming O-360 is a 4 cylinder boxer type engine, with cylinders 1 and 3 on onside of the engine and cylinders 2 and 4 on the other side of the engine).

The breadboad has expansion capabilities for up to 4 of these MAX6675 modules, a couple voltage dividers allowing the Oil and Fuel pressure analog sensor readings. The ESP32 WROOM module has capabilities for multiple SPI devices, all the analog readings that I may want, and more. It can do bluetooth, or WiFi.

As I work on this, I will add connectors for the additional modules. The USB connector is used for power and data transfer now. When I mount this in the airplane, I will supply power to the 5V input pin, and only use the USB connector for programming.

One thing I learned, the breadboard I bought was a terrible choice. There are a set of buses running the full length of the board. I need to cut traces like crazy. I forgot to cut the traced in the middle of the ESP32, and when I first powered it up, I could smell something. I hadn't soldered each pin in the socket, so I am sure that saved me, but a few power and ground pins ran into each other or other pins.



The scratches in the middle of the socket are where I needed to break the traces. I have to isolate the pads for the MAX6675 adapters since they are arranged longitudinally.

I've added the capability to display the temperature output via Bluetooth. The code is 90% the example code modified to output Bluetooth.


// this example is public domain. enjoy!
// https://learn.adafruit.com/thermocouple/
//
// Modified to output Bluetooth

#include "max6675.h"
#include "BluetoothSerial.h"

int thermoDO = 12;
int thermoCS = 14;
int thermoCLK = 27;

MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);

float tempC, tempF, tempK;
char *titleTemp; 

BluetoothSerial  SerialBT;

void setup() {
  Serial.begin(115200);

  SerialBT.begin("ESP32_EngMon");    // Pair to this device

  Serial.println("MAX6675 test");
  // wait for MAX chip to stabilize
  delay(500);
}

void loop() {
  // basic readout test, just print the current temp
  
   tempC = thermocouple.readCelsius();
   tempF = thermocouple.readFahrenheit(); 
   Serial.print("C = ");
   SerialBT.print("C = ");
   Serial.println(tempC);
   SerialBT.println(tempC);
   Serial.print("F = ");
   SerialBT.print("F = ");
   Serial.println(tempF);
   SerialBT.println(tempF);
   
   // For the MAX6675 to update, you must delay AT LEAST 250ms between reads!
   delay(1000);
}


The output can be displayed on an Android device using the Bluetooth Terminal application available from the playstore.


Until next time...


Monday, July 15, 2013

Chips Are Getting Smaller

I started building with integrated circuits in about 1976. Radio Shack started carrying the 7400 series chips sometime around then. In school I had learned about half and full adders, so I knew what AND, OR and NOT gates were. I imagine they were a couple bucks each back then, but I wanted to build something. I quickly soldered up a half adder using these chips on a piece of Formica, dead bug style.

Over the years I built many projects hand soldering huge boards of chips. In high school, me and three other guys (Scott and Steve) built Don Lancasters TV Typewriter II. We etched the board our selves, but without plated through holes, ended up soldering sockets on both sides of the board (Steve pulled his hair out troubleshooting the thing, eventually removing about half the sockets, soldering the chips in, on both sides). I built many expander boards for the various computers I've had in the last 40 years.



Tonight I soldered in the MAX31855KASA chip I got as a sample a couple months ago. Fun, cool, challenging. I cleaned the heck out of the soldering iron, had to refile the tip to get it sharp enough, and it happened. The first time, I got 4 of 8 pins, the second time I got 6 of 8, and finally with some heat, I got the other two. It doesn't look pretty, but it works, and no shorts. Mass production will require solderflow, if I am to use these chips.



Yesterday and today, I did some research. Yes, the Arduino supports SPI. There is a nice SPI reference library as well. The MAX31855 only does serial out, so I connected the pins like:

   44  - IO44  - Chip Select of the 31855
   50  - MISO  - Serial out of the 31855
   52  - SCK - Serial clock input of the 31855

I used my standard color coding, that I have been doing for over 30 years:
   Blue - Ground
   Red - Vcc
   White - Signal

Then the rainbow ribbon cable is:
   Red - T+ Thermocouple +
   Orange - T- Thermocouple minus

The results look a little messy:
   

I am a little nervous that the chip is at one end of the board and the SPI is at the other end, but that is the layout of this proto board. There is only one thermocouple input in this chip, so that also disapoints me, but who knows, working in eagle, and maybe it won't matter. 

I tested the K-thermocouple that I have using a soldering iron and my vold meter. It is hard to read the voltage in the meter, but it looks like 15mv:



I haven't written the code yet, but I'd like to as soon as I can. Maybe tomorrow.