# Projects - just for fun

(Sorry, all images lost in a former migration.)

The M-Bus (short for meter-bus) is primarily used for household meters for water, gas and electric power. See here and here.

This is an attempt to build a simple master for this bus, which is a single-master multiple-slave bus, to be controlled using an Arduino system.

Master to slave communication is performed by lowering the voltage at the bus by 12V, so here, from 30V to 18V. In the above schematic, T2 and IC1 together with the divider of R1 and R2 are forming a voltage source. When T1 is blocking, the bottom part of the divider is inactive and full 30V is the reference for the voltage source and the output voltage at the bus is 30V. When T1 is conducting (high signal at TX), the bottom part of the divider becomes active and the reference voltage is lowered to 18V, consequently the output voltage at the bus is 18V too.

(Maybe the signal driving T1 needs to be inverted first to get the correct logical polarity, not yet verified.)

This is the waveform with a feed of 10kHz at TX:

Ch. 2 (blue) is the input signal from the function generator, Ch. 1 (yellow) is the output signal at the bus terminals. It still needs to be verified whether the setup time (delay between falling edge of input and raising edge of output) is short enough.

R5 is a current sense for the receive path, R4 is a ground-load for an open bus and C1 serves to filter the output voltage. Only a rather small capacitor is used here to only filter the high-frequency noise (around 1MHz) from the source but not the signal of about 10kHz fed through T1 from TX.

Slave to master communication is performed by changing the current sinked by the slave. A logical "1" is signalled by a current of maximum 1,5mA, a logical "0" is signalled by a current of 11-20mA. This is sensed at R5 and needs to be conditioned before feeding as RX into the microcontroller.

The voltage over R5 is in the low load situation about 100mV, in the high load situation about 1V. These are good voltages to block or conduct a PNP transistor, in the following schematic T3.

The voltage of the signal at the point RX is limited using a Z-diode to fit into the range acceptable for a microcontroller. It is:

Ch. 1 (yellow) is the signal from the generator to switch the load situation, Ch. 2 (blue) the signal at RX.

The MOSFET T1 has been replaced by a NPN transistor BC547, the waveforms are still very good:

Ch. 1 (yellow) is the voltage on the M-bus terminal, Ch. 2 (blue) is the generator signal at TX.