Learning/Studying Heatermeter Code


 

HPLadds

New member
Hey All,

Would anyone be so kind as to shed light on the process by which the HearterMeter-master.zip code is included with the openwrt-rpi.gz binary that is installed on the Heatermeter's RPi SDcard? (Decompression need not be explained, I'm not quite that noobish.) Since the openwrt-rpi binary is the only code supplied to the Heatermeter, as best I can discern, the openwrt-rpi.gz must also include instructions for the AVR. I believe that process is atypical of an ordinary openwrt install, and I wonder how that magic happens?

HearterMeter-master.zip may be downloaded from https://github.com/CapnBry/HeaterMeter

openwrt-rpi.gz may be downloaded from: http://heatermeter.com/devel/release/bcm2708/13/ .

Thanks,
H P
 
Use Win32DiskImager on your PC to write the SD card using the .img file, then put the SD Card in the rPi, boot the HM+rPi... When the rPi boots and sees a blank AVR it will flash the HM firmware to the AVR and reboot, then you should have a programmed AVR and working HM.
 
HearterMeter-master.zip is an archive of the entire source repo at https://github.com/CapnBry/HeaterMeter

openwrt-rpi.gz is simply the compiled product.

The AVR source code is contained within the arduino subdirectory of the main repo and the compiled AVR binary is also packaged inside of the openwrt/package/linkmeter subdir.

On the SD card, you find the AVR firmware file is located at /lib/firmware/hm.hex
 
Thanks Srteve_M, I guess I'm trying to figure out what is going on in the instructions below for compiling the binary. Certainly isn't "configure, make, make install" !

cd ~
git clone git://github.com/CapnBry/HeaterMeter.git heatermeter
git clone git://git.openwrt.org/12.09/openwrt.git openwrt
cd openwrt
git checkout f83d737
cd ~/heatermeter/openwrt
./install.sh BCM2708 ~/openwrt
cd ~/openwrt
make oldconfig
make V=s ; make package/mac80211/compile V=s ; make V=s
# The first make will error out on building incompat-wireless
# mac80211 has to be compiled on its own, then everything else
# will compile cleanly
 
That will compile the entire OpenWrt install (LinkMeter) for the SD card. If you want to compile the AVR firmware (HeaterMeter), the source code can be found here.

It's really 2 software projects.

1) LinkMeter - This is the OpenWrt distro that runs on the RasPi to provide a web gui, alarms, alerts, etc.
2) HeaterMeter - This is the firmware that gets installed on the ATMEGA chip on the HeaterMeter board.
 
Last edited:
Thanks again. My understanding increases each time I go through the script line by line.

cd ~
# goto home directory

git clone git://github.com/CapnBry/HeaterMeter.git heatermeter
# Clone HeaterMeter to ~/heatermeter

git clone git://git.openwrt.org/12.09/openwrt.git openwrt
# Clone openwrt to ~/openwrt

cd openwrt
# goto ~openwrt

git checkout f83d737
# update the files to f83d737 version

cd ~/heatermeter/openwrt
# goto ~/heatermeter/openwrt

./install.sh BCM2708 ~/openwrt
# run the install script using the arguments BCM2708 and ~/openwrt -- the script appears to update the drivers for BCM2708 and then writes them to ~/openwrt

cd ~/openwrt
# goto ~/(the now updated ~/openwrt).

make oldconfig
# Ah ha, perhaps this is why there are two openwrt folders (~/heatermeter/openwrt and ~/openwrt). In order to use "make oldconfig" , one must have a previous kernel for reference?

make V=s ; make package/mac80211/compile V=s ; make V=s
# Capnbry's comments below help a bit. Still much going on here is larger than me brain can hold!

# The first make will error out on building incompat-wireless
# mac80211 has to be compiled on its own, then everything else
# will compile cleanly
 
The install.sh script does a whole bunch of things from adding the linkmeter package to openwrt, as well as the other packages such as rrdtool. It also applies various kernel patches, wireless patches and other openwrt package patches. It also copies the kernel config file, which is what "make oldconfig" uses, rather than having to run "make menuconfig" and enable/disable everything manually.
 
I'm sorry if this is a bit off topic, or covered else where, but can the OpenWrt image be run from a virtual machine? Or be made to run from a virtual machine with minimal headache? OR the heatermeater software be installed in a virtual mache (w/ minimal headache)?
 
Sure, you can emulate an ARM processor and get it running on a VM, but you won't have serial access to the HeaterMeter board. What is it that you're trying to accomplish?
 
Sure, you can emulate an ARM processor and get it running on a VM, but you won't have serial access to the HeaterMeter board.
What emulator are you talking about? I know serial access to arduinos from Virtualbox is no problem.
What is it that you're trying to accomplish?
Heatermeter sans rpi. Just put a hc-05 or esp8266 on the rx/tx -> wirelessly talk to the desktop computer inside the house that's running the server.
 
You can use QEMU. A better thing to do would be to re-compile openwrt with CONFIG_TARGET_x86 so that it will run natively on x86 hardware.

You'll still need a way to flash the ATMEGA chip on HM board when new firmware is out. That's done over the SPI bus, not serial. Personally, I'd just go with someone like this.
 
I started messing around with QEMU, the image booted but I started to get into that headache territory I mentioned earlier... I'll look into the re-compile. As far as flashing the ATMEGA, I flash that sucker wirelessly over serial with the esp8266 all the time! (esplink)
 
I started messing around with QEMU, the image booted but I started to get into that headache territory I mentioned earlier... I'll look into the re-compile. As far as flashing the ATMEGA, I flash that sucker wirelessly over serial with the esp8266 all the time! (esplink)

if you already have the esp8266 connected to your HM, why not try the express module software I wrote out....wouldn't hurt to try it first....if you need help, feel free to ask......heres the github link (binaries are there as well)...
 
What emulator are you talking about? I know serial access to arduinos from Virtualbox is no problem.

Heatermeter sans rpi. Just put a hc-05 or esp8266 on the rx/tx -> wirelessly talk to the desktop computer inside the house that's running the server.

Interesting! It does appear that rx/tx (and the reset) are the only connections between the rpi and AVR.

But if you have the geek chops for this project, how about crossing the project over to a x86 based server? Use https://www.dd-wrt.com/wiki/index.php/X86 on an old beast you have hanging. A quick rewrite of the Linkmeter and off we go without virtualization or rpi. Or maybe it would be easier to virtualize a x86 based router?

Some other threads that are on the same path:
http://tvwbb.com/showthread.php?630...ter-Module-(wifi-with-no-Pi-Linkmeter-needed)
 
A quick rewrite of the Linkmeter and off we go without virtualization or rpi

I look forward to Bryan's response to "a quick rewrite of linkmeter"

Seriously, if you want the full blown linkmeter experience, it doesn't get any cheaper / easier than using a raspi. Otherwise, follow what DavidNP has been doing.
 
if you already have the esp8266 connected to your HM, why not try the express module software I wrote out....wouldn't hurt to try it first....if you need help, feel free to ask......heres the github link (binaries are there as well)...
Nice project, David. I'll check it out. I've actually already written my own wireless controller with a web interface fairly similar to yours it appears! I am just interested in checking out the great work here in the HM project so that's why I was hoping for a simple way to get the HM software running on my current hardware. (AVR side works fine, just wanted to check out the HM UI)

You guys are so over my head it's ridiculous.
I'm sorry, and I hate to hijack your thread. I'll stop asking about this here.

I look forward to Bryan's response to "a quick rewrite of linkmeter"
Ha! I don't know about a rewrite but I wonder if recompiling/packaging for another architecture is as simple as changing a few flags? I play with *nix but haven't messed with openwrt specifically.

Seriously, if you want the full blown linkmeter experience, it doesn't get any cheaper / easier than using a raspi. Otherwise, follow what DavidNP has been doing.
Except I'd have to buy another rpi :) But I get what you're saying... I was just asking in the hope someone has already done the virtualization approach (possibly for development) and it was relatively straight forward.
 
Last edited:
I find the only way I learn things is to have a practical learning opportunity. That's what lead me down the path of figuring out how openwrt works with the heatermeter project and wound up fixing a whole bunch of little things that were broken with the build process. So my advice to you is to do the same. Grab the code and attempt to compile it for x86. 95% of the work should already be done. Right after you run a "make oldconfig" run "make menuconfig" and change things from bcm2708 to x86 and then attempt to compile and debug as necessary.
 

 

Back
Top