Hi Peter, welcome to the forum.
I’ve got the Packom Hat running on a stock Raspberry Pi 2, running the emonSD-10Nov22 image. This post is more-or-less a summary of the setup process I went through to get it working. I don’t know much about the Emon TX3 though, so hopefully none of what I write here conflicts with how that’s set up.
I’m quite experienced with Linux and embedded systems (I’m an electronics engineer), so I’ve probably glossed over a lot here - happy to clarify anything as required.
M-Bus:
After following the steps “Powering On” and “Enabling Serial Access” in the Packom guide (M-Bus Master Hat Instructions – packom.net), the process for enabling the BUS power has changed since the guide was written, so here’s how to do that:
One of the GPIO pins needs to be set high to enable to on-board M-Bus power supply, which tripped me up at first. Without doing so, there will be no communication with the M-Bus meter. For newer Raspberry Pi images, this can be done with the terminal command gpioset gpiochip0 26=1
.
I’ve added this to at the end of /etc/rc.local
so that it happens on power-up of the RPi for convenience.
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi
# Update emonpi on first boot if applicable
su pi -c '/opt/openenergymonitor/EmonScripts/update/firstbootupdate'
# Start wifi AP if applicable
#/opt/openenergymonitor/emonpi/wifiAP/startAP.sh >> /var/log/wifiAP.log
# Enable MBus 36V power
gpioset gpiochip0 26=1
exit 0
The “BUS” LED on the M-Bus hat will illuminate clearly when the power is enabled correctly.
After that, the M-Bus hat uses /dev/ttyAMA0
on my Pi 2 as the serial port (I believe this is the same for other Pi versions, but can’t say for certain), and I’m talking to a Kamstrup 403, so my EmonHub interfacer configuration in emonhub.conf
looks like this:
[[MBUS-USB]]
Type = EmonHubMBUSInterfacer
[[[init_settings]]]
device = /dev/ttyAMA0
baud = 2400
[[[runtimesettings]]]
pubchannels = ToEmonCMS,
read_interval = 10
validate_checksum = False
nodename = heatmeter_oes27
[[[[meters]]]]
[[[[[heatmeter_oes27]]]]]
address = 1
#type = kamstrup403
type = standard
DS18B20:
I followed the “M-Bus Master Hat DS” section in the above guide. Then there’s an example interfacer for emonhub.conf
here: emonhub/conf/interfacer_examples/DS18B20 at master · openenergymonitor/emonhub · GitHub
You’re probably aware that the DS version of the Packom M-Bus hat has a built-in sensor, so you can experiment with getting this one to work before adding further external sensors.