How carlsans/t4max6675emu works
Project Type and Purpose
• This is an embedded‐firmware project: an Arduino sketch that polls two MAX6675 thermocouple‐to‐digital converter modules, reads temperature data, and streams it out over the serial port.
• The goal is to “emulate” or drive two MAX6675 sensors on a shared SPI bus, each with its own chip‐select line.
Main Components
A. Arduino Board (ATmega328P)
– Runs the doublemax6675.ino sketch
– Hosts digital I/O: SPI clock, data in, two CS lines, plus USB‐serial
B. MAX6675 Modules ×2
– Each module connects a K‐type thermocouple and converts to 12‐bit SPI data
C. K‐Type Thermocouples ×2
– Physical sensors feeding the MAX6675 modules
D. Shared SPI Bus
– SCK (clock), SO/MISO (data output), VCC (+5 V), GND
E. Separate Chip‐Select Lines
– CS1 (e.g. D2), CS2 (e.g. D3) on Arduino
F. USB‐Serial Interface
– Arduino’s built‐in converter streams readings to a host PC
Relationships & Data Flow
• At runtime, the Arduino toggles CS1 low → reads 16 bits from MAX6675 #1 over SO → raises CS1 → toggles CS2 low → reads from MAX6675 #2 → raises CS2.
• Parsed temperature values are sent via Serial.write/println over USB to a PC or terminal.
• Power (5 V) and Ground are common rails feeding the Arduino and both modules.
Architectural Patterns & Design Principles
• Bus multiplexing: a single SPI bus shared by multiple peripherals, each demarcated by its own CS.
• Polling loop: simple “read‐delay‐read‐delay” in loop() for real‐time sampling.
• Layer separation: hardware interface layer (pin toggling, SPI bit‐banging or hardware SPI), data processing layer (convert raw bits to °C), communication layer (serial output).