Back
Loading views...HART
HART (Highway Addressable Remote Transducer)
Overview
HART is a hybrid analog/digital protocol overlaying FSK digital signals on the 4–20 mA analog current loop. It allows digital configuration, diagnostics, and multi-variable measurement on the same wiring as legacy 4–20 mA instruments.
1. Theory & Fundamentals
- Physical: 4–20 mA analog loop + FSK digital (Bell 202 modem: 1200 Hz=1, 2200 Hz=0)
- Simultaneous: Analog carries primary variable; digital adds additional data
- Master-slave: Host (DCS/handheld) initiates; field device responds
- Multi-drop: Up to 15 devices at fixed 4 mA current; no analog signal
- Addressing: Short address 0–15; long address (38-bit unique ID)
- Commands: Universal (0–30), Common Practice (32–127), Device-specific (128–253)
- WirelessHART: HART over wireless mesh (IEEE 802.15.4)
2. Frame / Packet Structure
HART Frame:
Preamble (≥5 bytes of 0xFF) | Start Byte | Address(1 or 5B) | Command(1B) | Byte Count | Data | Checksum
Start byte:
0x02 = STX (master→slave, short addr)
0x82 = STX (master→slave, long addr)
0x06 = ACK (slave→master, short)
0x86 = ACK (slave→master, long)
Command 0: Read Unique Identifier
Response: 254 | Mfr code | Device type | Req preambles | HART revision | SW revision | HW revision | Flags | Device ID(3B)
Command 3: Read Dynamic Variables
Response: 254 | PV units | PV | SV units | SV | TV units | TV | QV units | QV
3. Protocol Mechanics
- Collision avoidance: Master waits for line quiet before transmitting
- Preamble: synchronizes receiver clock; minimum 5 bytes
- Checksum: XOR of all bytes from address through data
- Response time: typically 250–300 ms per transaction
- Burst mode: field device sends periodic responses without master polling
4. Hardware Implementation
- HART modem: AD5700, HCF_TOOL-46 (reference design)
- Coupling: 470 µH inductor in series with 4–20 mA loop; HART signal couples across resistor
- Receive: bandpass filter (1200/2200 Hz), FSK demodulator
- Transmit: FSK modulator, current limited to ±0.5 mA superimposed
- MCU UART at 1200 baud; UART RX → demodulator output; UART TX → FSK modulator
5. Register-Level / Configuration
// HART command 0 via UART + AD5700 modem
void HART_SendCmd0(void) {
uint8_t frame[]={
0xFF,0xFF,0xFF,0xFF,0xFF, // Preamble ×5
0x02, // STX, short addr
0x00, // Address 0 (polling)
0x00, // Command 0
0x00, // Byte count 0
0x02 // Checksum = 0x00^0x00^0x00^0x02
};
// Assert RTS to key AD5700 TX
GPIO_Write(HART_RTS, 1);
UART_Send(frame, sizeof(frame));
while(!UART_TxComplete()); delay_us(300);
GPIO_Write(HART_RTS, 0); // Release
// Receive response
}
6. Driver / Software Development
- Implement init, TX, RX functions; use interrupts or DMA
- Handle errors: timeout, CRC mismatch, arbitration loss
- Use circular/ring buffers for high-throughput RX
- Add retry logic and watchdog for reliability
- Separate hardware layer from protocol logic
7. Debugging & Testing
- HART Communicator (Emerson 475): handheld HART tester
- SDC-625 HART modem + PC with HART master software
- Logic analyzer: decode Bell 202 FSK if supported; or decode via UART after demodulator
- Common issues: incorrect preamble count; line loading (too much capacitance); address conflict
8. Real-World Applications
- Smart pressure transmitters (Emerson Rosemount)
- Flow meters (Coriolis, magnetic, vortex)
- Level transmitters and radar gauges
- Control valves with positioners
- Motor protection relays
9. Advanced Topics & Edge Cases
- WirelessHART: HART over mesh network; same command set
- HART 7: Latest revision; adds burst publishing, enhanced status
- FDT/DTM: Universal device driver framework for HART devices
- HART-IP: HART over TCP/IP for modern DCS integration
- EDDL: Electronic Device Description Language for HART device descriptions
10. Standards & Variants
| Feature | HART | PROFIBUS PA | FF |
|---|---|---|---|
| Physical | 4–20mA+FSK | IEC 61158-2 | IEC 61158-2 |
| Speed | 1.2 kbps | 31.25 kbps | 31.25 kbps |
| Legacy | Yes (4–20mA) | No | No |
| Intrinsic safety | Easy | Yes | Yes |
💡 Practical Examples
Example 1
Command 0: read unique identifier → get device type, revision, ID
Example 2
Command 3: read 4 dynamic variables → PV=flow, SV=temperature, TV=density, QV=viscosity
Example 3
Command 35: write primary variable range limits (0–100% span calibration)
🧪 Practice Questions
Beginner
- What analog signal does HART ride on?
- What frequencies does HART FSK use?
- What is the maximum number of multi-drop devices?
- What is the HART response time?
- What is WirelessHART?
- Implement HART command 0 framing and checksum.
- Decode command 3 response to extract 4 process variables.
- How do you calculate the HART checksum?
- Design the HART modem coupling circuit.
- Implement HART burst mode in slave firmware.
- Build a HART master reading all commands 0–7 from a field device.
- Implement a HART slave (simulated transmitter) responding to commands.
- Design WirelessHART gateway converting to Modbus TCP.
- Implement HART over IP (HART-IP) server.
- Add HART to an existing 4–20 mA sensor design.
- HART Reader: AD5700 + STM32, read PV from pressure transmitter.
- HART Slave: simulate a HART temperature transmitter responding to commands.
- HART to MQTT: gateway reading HART devices, publish via MQTT.
Intermediate
Advanced
Hands-on Projects
Checklist
- [ ] Understand HART frame structure and checksum
- [ ] Calculate Bell 202 FSK timing (1200/2200 Hz)
- [ ] Design HART modem coupling circuit
- [ ] Implement HART master sending command 0
- [ ] Parse unique identifier response
- [ ] Read process variables (command 3)
- [ ] Handle multi-drop addressing
- [ ] Implement burst mode receive
- [ ] Debug with HART Communicator
- [ ] Add HART to custom sensor design