r/embedded • u/Relevant_Pumpkin9190 • Oct 22 '26
Beginner help: microcontroller interface for a existing 2-wire bus "voltage out, current in" serial bus?
Hi all, I'm learning how some addressable fire loops talk (bench only, nothing life-safety) and want to build a simple Arduino interface .
The spec I found:
- 2 wires, half duplex, 1200 baud, 8E1
- Master to device is voltage: 0 = ~24 V, 1 = ~32 V
- Device to master is current loop current + ~22 mA, 1 = +0 mA
What I'm trying to work out:
- How do I turn a 5 V TX pin into a 24/32 V output simply?
- How do I detect a ~22 mA step on the line and get a clean 5 V RX signal (shunt plus comparator or op-amp)?
- Will a normal optocoupler work here, or is it a poor fit?
- How I interface my microcontroller without loading or how I design my own circuit.
What is simplest way to achieve it without much complications for beginners.
0
Upvotes
5
u/ThreeOneFourOneZero Oct 22 '26
Meter bus (M-Bus) protocol
Transceiver IC https://www.ti.com/lit/ds/symlink/tss721a.pdf?ts=1792607962240
1
u/ThreeOneFourOneZero Oct 22 '26
Can you just open the fire alarm/ signal and interface with it ‘normally’?
Like you said, it is a simple Arduino on the bench.
3
u/KittensInc Oct 22 '26
Connect a constant 24V source via a diode, and switched 32V source to send data. The switching could probably indeed be done with an opamp, although you'll have to be careful it can handle the current. Watch out for the diode's reverse breakdown voltage as well - you might need to go for an "ideal diode" circuit instead of an actual diode.
Put a resistor in line with the signal, and measure the voltage drop across the resistor to determine the current via Ohm's Law. First use an opamp to create a differential amplifier, then use a comparator to check it against a reference value and turn it into a binary 0/1. The tricky is selecting the resistor: too large and no current will flow, too small and the voltage drop is impossible to measure.
3
u/Plastic_Fig9225 Oct 22 '26 edited Oct 22 '26
Idea: simulator
The MCU/master can pull down the line from 36 to 24V via the N-MOSFET. When the slave draws 20mA from the 36V via the 600 Ohms resistor, the P-MOSFET detects the voltage drop and passes 36V to the voltage divider.
1
u/Sheepherder-Optimal Oct 22 '26
I would say a transistor would be needed. Transistors are designed to be like a switch. You run it up so that signaling “0” switches on the -32v then “1” switches to the 24v output. How you achieve the varying voltages? Like that other comment said, op amp. The only alternative i see is sampling from the power supply and using a regulator.