Difference between revisions of "M-bus Linux"
From Teknologisk videncenter
m |
m (→Display) |
||
Line 21: | Line 21: | ||
*P9-19 - I2C2_SCL connect to display SCL | *P9-19 - I2C2_SCL connect to display SCL | ||
*P9-20 - I2C2_SDA connect to display SDA | *P9-20 - I2C2_SDA connect to display SDA | ||
+ | ====Backlight==== | ||
+ | *Anode - A to 5 volt through 2 resistors of 150 ohm in parellel | ||
+ | *Katode - K to GND | ||
+ | |||
===mbus=== | ===mbus=== | ||
Wires: | Wires: |
Revision as of 09:48, 22 November 2023
Contents
Beagleboard Black
Installing libmbus
Upgrade and install dev tools Beaglebone Black/Updating
git clone https://github.com/rscada/libmbus.git
sudo apt install libltdl-dev
./build.sh
./configure
make
sudo make install
Hardware configuration
Display
- Newhaven display 2x20
- Onboard display controller Sitronix ST7036i
Configure display for I2C bus 2
- P9-1 or P9-2 to display VSS (Ground)
- P9-3 or P9-4 to display VDD (3,3 volt)
- P9-16 - GPIO51/EHRPWM1B connect to display RST
- P9-19 - I2C2_SCL connect to display SCL
- P9-20 - I2C2_SDA connect to display SDA
Backlight
- Anode - A to 5 volt through 2 resistors of 150 ohm in parellel
- Katode - K to GND
mbus
Wires:
- P9-11 (BBB-RX) to MIKROE-3880 M-BUS MASTER CLICK TX
- P9-13 (BBB-TX) to MIKROE-3880 M-BUS MASTER CLICK RX
- P9-1 or P9-2 (BBB-GND) to MIKROE-3880 M-BUS MASTER CLICK GND
- P9-3 or P9-4 (BBB-3V3) to MIKROE-3880 M-BUS MASTER CLICK 3V3
- P9-5 (BBB-5V) to MIKROE-3880 M-BUS MASTER CLICK 5V
Configure BBB GPIO for UART - /dev/ttyS4
sudo config-pin P9_11 uart
sudo config-pin P9_13 uart
- OLD: Install libmbus - notice: ln -s /usr/local/lib/libmbus.so.0 /usr/lib/
mbus-serial-request-data-multi-reply -d /dev/ttyS4 68
main: debug: sending init frame
[2023-01-05 09:24:46] SEND (005): 10 40 FF 3F 16
[2023-01-05 09:24:47] SEND (005): 10 7B 44 BF 16
[2023-01-05 09:24:47] RECV (205): 68 C7 C7 68 08 44 72 68 43 35 80 2D 2C 35 0C 07 10 00 00 04 06 00 00 00 00 04 FF 07 00 00 00 00 04 FF 08 00 00 00 00 04 14 00 00 00 00 84 40 14 00 00 00 00 84 80 40 14 00 00 00 00 04 22 DF 07 00 00 34 22 00 00 00 00 02 59 A2 08 02 5D 5E 08 02 61 44 00 04 2D 00 00 00 00 14 2D 00 00 00 00 04 3B 00 00 00 00 14 3B 00 00 00 00 04 FF 22 00 01 00 00 04 6D 19 2B E5 21 44 06 00 00 00 00 44 FF 07 00 00 00 00 44 FF 08 00 00 00 00 44 14 00 00 00 00 C4 40 14 00 00 00 00 C4 80 40 14 00 00 00 00 54 2D 00 00 00 00 54 3B 00 00 00 00 42 6C E1 21 02 FF 1A 01 1B 0C 78 68 43 35 80 04 FF 16 E6 84 1E 00 04 FF 17 C1 D5 B4 00 B1 16
mbus_frame_print: Dumping M-Bus frame [type 4, 205 bytes]: 68 C7 C7 68 08 44 72 68 43 35 80 2D 2C 35 0C 07 10 00 00 04 06 00 00 00 00 04 FF 07 00 00 00 00 04 FF 08 00 00 00 00 04 14 00 00 00 00 84 40 14 00 00 00 00 84 80 40 14 00 00 00 00 04 22 DF 07 00 00 34 22 00 00 00 00 02 59 A2 08 02 5D 5E 08 02 61 44 00 04 2D 00 00 00 00 14 2D 00 00 00 00 04 3B 00 00 00 00 14 3B 00 00 00 00 04 FF 22 00 01 00 00 04 6D 19 2B E5 21 44 06 00 00 00 00 44 FF 07 00 00 00 00 44 FF 08 00 00 00 00 44 14 00 00 00 00 C4 40 14 00 00 00 00 C4 80 40 14 00 00 00 00 54 2D 00 00 00 00 54 3B 00 00 00 00 42 6C E1 21 02 FF 1A 01 1B 0C 78 68 43 35 80 04 FF 16 E6 84 1E 00 04 FF 17 C1 D5 B4 00 B1 16
<MBusData>
<SlaveInformation>
<Id>80354368</Id>
<Manufacturer>KAM</Manufacturer>
<Version>53</Version>
<ProductName></ProductName>
<Medium>Heat: Inlet</Medium>
<AccessNumber>7</AccessNumber>
<Status>10</Status>
<Signature>0000</Signature>
</SlaveInformation>
<DataRecord id="0">
<Function>Instantaneous value</Function>
<Unit>Energy (kWh)</Unit>
<Value>0</Value>
<Timestamp>2023-01-05T09:24:47</Timestamp>
</DataRecord>
<DataRecord id="1">
<Function>Instantaneous value</Function>
<Unit>Manufacturer specific</Unit>
<Value>0</Value>
<Timestamp>2023-01-05T09:24:47</Timestamp>
</DataRecord>
..................................................... DATA REMOVED ..................................
<DataRecord id="29">
<Function>Instantaneous value</Function>
<Unit>Manufacturer specific</Unit>
<Value>11851201</Value>
<Timestamp>2023-01-05T09:24:47</Timestamp>
</DataRecord>
</MBusData>