EmonTx4 not showing in Emoncms

No IDE will run on an Arduino. Look at
https://docs.openenergymonitor.org/electricity-monitoring/arduino-ide/macoside.html

To the libraries list, you’ll need to add emonLibDB and RFM69_LPL

You won’t need RFu_JeeLib or GLCD_ST7565, and I can’t see why it’s asking for EEPROM.h because that’s not asked for in the source file I think you’re using. SPI.h is part of the Arduino IDE, as far as I’m aware.

I updated the platformio.ini to this

[platformio]
default_envs = default
src_dir = .

[env]
platform = atmelmegaavr
framework = arduino
board = AVR128DB48
platform_packages =             ; Compiles without this set?
  ; DxCore AVD-DB
  platformio/framework-arduino-megaavr-dxcore@^1.5.6
  
board_build.f_cpu = 24000000L   ; 24 MHz
# board_hardware.oscillator = external

board_hardware.uart = uart3     ; May not be required? 
monitor_speed = 115200

lib_deps =
  https://github.com/SpenceKonde/OneWire
  https://github.com/openenergymonitor/RFM69_LPL
  https://github.com/openenergymonitor/emonEProm#avrdb
  https://github.com/openenergymonitor/emonLibDB

[env:default]
build_flags = -DUSING_OPTIBOOT  ; Upload via uart
upload_protocol = arduino
upload_speed = 115200
upload_flags = -v               ; Verbose

only change was [Preformatted text](https://github.com/openenergymonitor/EmonLibCM#avrdb) to [Preformatted text](https://github.com/openenergymonitor/emonLibDB) which is clearly the correct one now for my set up.

Tantalizingly close, the attempt to compile leaves only the one error looking for EEPROM.h which seems to be sourced from emonEProm.cpp.o (that’s probably the wrong terminology):

Executing task: platformio run 

Processing default (platform: atmelmegaavr; framework: arduino; board: AVR128DB48)
-------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelmegaavr/AVR128DB48.html
PLATFORM: Atmel megaAVR (1.9.0) > AVR128DB48
HARDWARE: AVR128DB48 24MHz, 16KB RAM, 128KB Flash
PACKAGES: 
 - framework-arduino-megaavr-dxcore @ 1.5.6 
 - toolchain-atmelavr @ 3.70300.220127 (7.3.0)
Converting EmonTx4_DB_12CT_WiFi_TSMod1.ino
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 22 compatible libraries
Scanning dependencies...
Dependency Graph
|-- OneWire @ 2.3.5+sha.36e2604
|-- RFM69_LPL @ 0.0.0+20231004175757.sha.b6dbef8
|-- emonEProm @ 1.0.0+sha.b0859d6
|-- emonLibDB @ 0.0.0+20231004175758.sha.c9bd452
Building in release mode
Compiling .pio/build/default/src/EmonTx4_DB_12CT_WiFi_TSMod1.ino.cpp.o
Compiling .pio/build/default/liba6e/OneWire/OneWire.cpp.o
Compiling .pio/build/default/libcfe/RFM69_LPL/RFM69_LPL.cpp.o
Compiling .pio/build/default/lib985/emonEProm/emonEProm.cpp.o
Compiling .pio/build/default/lib9f5/emonLibDB/emonLibDB.cpp.o
Compiling .pio/build/default/FrameworkArduino/Tone.cpp.o
Compiling .pio/build/default/FrameworkArduino/UART.cpp.o
Compiling .pio/build/default/FrameworkArduino/UART0.cpp.o
Compiling .pio/build/default/FrameworkArduino/UART1.cpp.o
.pio/libdeps/default/emonEProm/emonEProm.cpp:12:10: fatal error: EEPROM.h: No such file or directory

****************************************************************
* Looking for EEPROM.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:EEPROM.h"
* Web  > https://registry.platformio.org/search?q=header:EEPROM.h
*
****************************************************************

 #include <EEPROM.h>
          ^~~~~~~~~~
compilation terminated.
Compiling .pio/build/default/FrameworkArduino/UART2.cpp.o
Compiling .pio/build/default/FrameworkArduino/UART3.cpp.o
*** [.pio/build/default/lib985/emonEProm/emonEProm.cpp.o] Error 1
Compiling .pio/build/default/FrameworkArduino/UART4.cpp.o
================================================= [FAILED] Took 0.45 seconds


Yes:

emonEProm.cpp has an include for EEPROM.h which I don’t know how to obtain… well, I have one, but not one that works apparently!

#include <Arduino.h>
#include <avr/pgmspace.h>
#include <EEPROM.h>
#include <emonEProm.h>

This must be another fault in platromio. I don’t use it because it’s malware in my book: when I tried it, it moved my downloaded stuff from Github - proof was scripts to do the download suddenly stopped because the destination directory wasn’t there.

Your work-around will be to copy EEPROM.h into the same place as all your OEM libraries.

Ouch, not a pleasant experience! I see why you stay away from it.

Regarding EEPROM.h, the weird thing is I do already have it sitting in the root directory with the other header files. I can’t remember where I grabbed it from, certainly could not be the file that is expected.

Thanks for your help. Maybe Trystan will be able to pop back here and sort me out.

If not I guess I’ll try to set up Arduino IDE. Maybe I’ll try the ‘portable’ linux download and run it on the machine that the emonTx4 is actually connected to.

Ok… after one newbie hurdle (or two) I got my custom firmware compiled using the legacy version of Arduino IDE and uploaded using avrdude on the machine that runs emonhub. Thanks for your help Robert!

I’m very pleased and can finally close some browsers windows I had open for reference!

1 Like