Skip to content

Buffer 8Bit, 16Bit, 32Bit, 64Bit, 128Bit ... reading with SDM630 power meter

Adam Nielsen edited this page Jul 23, 2018 · 3 revisions

Watch the YouTube video for SDM630 reading Modbus buffer in Node-RED flow.

The msg.payload.buffer is an 8Bit buffer, which you can read as you need it.

first 8Bit: msg.payload.buffer.read...(0,1)

first 16Bit: msg.payload.buffer.read...(0,2)

first 32Bit: msg.payload.buffer.read...(0,4)

first 64Bit: msg.payload.buffer.read...(0,8)

first 128Bit: msg.payload.buffer.read...(0,16)

and so on ...

Happy reading!

2018-07 update

Looks like the buffer library has changed to remove the buffer field. Now it works like this (using an optional async function):

let r = await client.readHoldingRegisters(3000, 4);
let value1 = r.payload.readFloatBE(0);
let value2 = r.payload.readFloatBE(2);