Not connecting to device resolved

Hi Bob, A few weeks ago I asked my technical contact to redesign the main board to accommodate screw terminals on one side of the device - which he did and i received a test unit, which I plugged in today. The initial setup worked like a bomb, I was able to connect to the wifi config and then set up local LAN. With the device now connected lights are green and I can see the device registered as “iotawatt” on my LAN. I cannot, however, access the device (index.htm). I get “this site cannot be reached”. I can ping the device and as stated see it on the LAN.

I have included the very brief log which I am hoping you can see where my issue lies?
Your feedback appreciated.

Tx , WayneIOTAMSGS.TXT (44.2 KB)

It’s taking an exception while trying to handle a request to upload a file. I don’t have the name of the file, but it is probably index.htm or one of it’s dependent files. You should probably take a look at your SDcard and make sure it’s formatted correctly and that you have copied in all of the files in the SD directory on github.

Thanks for the response Bob. I thought it may have been a Mac formatting issue with the SD card , so did a reformat on a Windows machine as FAT32 and uploaded a fresh set of files from Git ( 9 files ) but to no avail. Still not connecting via local lan and cannot access index.htm.

Any other thoughts or suggestions to help please?

It does connect to WiFi and successfully transacts with my server for version check. It also appears to have successfully read the configuration file from the SD.

I have no idea why you would get an exception in the file download code. Is this a binary firmware from the Github site or are you compiling the code yourself?

Bob its code straight from Github.

I tried to recompile again but the same - one thing i did notice in the log is that its referring to “IoTaWatt 4.x, Firmware version 02_05_02” - i believe the firmware version is correct but why 4.x ? shouldn’t this be 5.x - as i have ver 5 hardware. ( hoping this sheds further light to resolve ). I have also attached the serial output from VSC - does that help at all?

Looking forward to your update.

Tx , WayneVSC Terminal Ouput.pdf (14.9 KB)

No idea what’s happening. The last thing in the trace is entering the “load from sd” code. The trace lacks granularity there so I have no idea where it takes the exception. Since you are compiling the code, you can do what I do: add more trace entries and print statements to narrow down what’s happening.

You could also use the stacktrace routine available in the arduino IDE (I use the arduino IDE serial monitor during debugging even though I use PIO to compile and load firmware).

Regarding the V4 vs V5 issue, the manufacturing test software sets the version into the EEprom along with other variables like the value of the voltage reference shunt and burden resistors. The EEprom is read in Setup.cpp. There is also some commented out code there that you could use to initialize your EEprom.

Not sure what you are using for a nodeMCU. I use the ESP12S which is not commonly available. I special order them from a manufacturer in China. It is the only model that has the required FCC identification for compliance with FCC Part B. Most common nodeMCU use esp12F or ESP12E. It should not matter, but some of them are not well tested. I have not run a V5 board on anything other than an ESP12S.

So that points you in the right direction. You will need to open up the hood and start debugging. That’s the deal with homebrew. If you cannot get it going, you might try buying a production model and trying your code on that because at this point you don’t really know if it’s hardware or software.

I do have a production model purchased from you, so I will upload the GitHub code to it to rule out any software issues.

Not sure which esp I have but upon inspection pinout seems the same as the production version ( could you confirm Bob - I’ve uploaded a picture )?

I am adding the esp8266 library to Arduino IDE to debug as you suggested and will report back.

Hi Bob - i have progressed in narrowing down my issue.

I took the production V5 unit and recompiled code and uploaded via PlatformIO and i took my own hardware and did the same. ( i have attached serial monitor logs of each ).

In both instances i used a fresh SD and also used my existing SD card from the production unit that already had a months of data on it. And , in both instances i have a failure of being able to connect to the device via browser.

This leads me to believe that i am missing something in the PIO compiler? I have attached a 3rd file which is the PlatformIO build terminal output and i am hoping that this provides the info we need to find my issue?

Looking forward to your response.Iotawatt Hardware.pdf (61.5 KB) My Hardware.pdf (31.7 KB) PlatformIO Build Terminal Output.pdf (17.1 KB)

Nothing jumps out at me.

Is the “Espressif 8266 1.8.0” correct as i see this even goes upto a newer 2.3.2 ? Could it be a Mac issue with PlatformIO? do we know if anyone has successfully recompiled the standard firmware to work on a production unit?
It seems it is not a hardware issue so its simply getting the production firmware to work on the production hardware with PlatformIO in my mac environment.

I am sure you are busy Bob, but please could you try and point me in some direction here?

I do it all the time.

I have made some suggestions about where in the code to start debugging and how to approach it. I have told you where to find code to initialize your EEPROM. That’s how I would approach this.

The releases are there in the git. At this stage I think I would be trying to reflash the production unit with the released binary as a sanity check.

I am pretty busy. I use pio with vscode on windows 10.

Maybe i wasn’t clear - i did try and reflash the production unit with the github code - thats the file i attached called "iotawatt hardware " - which didn’t work , so my working production unit is now not working. Surely there is no point in looking in code to initialise eeprom as its a production unit ( we know it was working )… perhaps i should move this post out of “homebrew” as it has nothing to do with "homebrew unit - it is my production unit that is not working…

“do we know if anyone has successfully recompiled the standard firmware to work on a production unit?” by that I mean someone other than you in your environment.

Lets get the production unit back up and running please.

Ps. I am using PIO with vscode on Mac

Is reflashing the same as compile and upload in PIO? if so i have done just that and it didnt help with my sanity, it has made it worse :wink:

or is reflashing perhaps pressing the “flash” button on the actual ESP device?

You reflash with esptool. It simply uploads a binary file to the ESP. You can find ample docum3ntation online. That is what pio uses to upload the binary it links.

In the git, all of the releases are encapsulated. Each one, in addition to all of the source files at the time of the release, contains a binary called iotawatt.bin. You flash that to the ESP8266 using

Bob, sorry - i am learning. Ive spent some more time now with PIO and i may have been doing things incorrectly. I was opening a folder from VScode and not using the PIO menu - now i am using the PIO menu and see there are 2 differing IotaWatt versions.

I am guessing i need to use the “latest stable” version. I did that now and tried the build option but i received errors? I have attached the output . I didnt have the device connected to my Mac when i did this - should it be? ofcourse i know its need for the upload - but thought the build should work without device connected? Why the errors? maybe this helps with what my issue is …

I also see there is a “erase flash” command in the PIO menu ( would this be the equivalent of the reflash with ESPtool you mentioned?
PIO - Iotawatt Stable firmware build.pdf (24.2 KB)

The two branches that are relevant are master and staged. I try to keep master as the latest release, and staged as including what I have developed for the upcoming release. Needless to say, master is by far the least risky. It is also possible to clone the sources from a release. is used directly (not through PIO) to flash the units with diagnostic test firmware during manufacture. Once passed, and prior to shipping, that same manufacturing test firmware is activated to download and install the latest production release directly from the server, exactly the same way your unit does when versions change or you change the auto-update class.

I am assuming from what I see in your logs that your unit will start but then takes the exception when you try to run the config app. If that is the case, then you can probably get it to download and install firmware in the same way.

First, make sure the config.txt file has an auto-update class set to one of the valid classes. ALPHA or MINOR would be good choices. Then change the version define in your iotawatt.h file to say 02_05_00. Compile and load that to the production unit and do NOT try to run the configuration utility. The unit should recognize that it needs 02_05_02, download it, and restart.

You would be able to see that happening in the serial monitor.

Bob - thanks as always for your reply. I am a little unsure of what you suggest and will number for sake of clarity:-

  1. I need to flash the production unit with “diagnostic test firmware” using If so, where do i find the diagnostic test firmware ?
  2. I then change iotawatt.h to “02_05_00” and make sure “minor” is set in config.txt. Then using the “stable” version of github firmware i then “build” in PIO and then “upload”. after the upload i wait for sometime ( 10minutes ? ) and the device should have updated to ver 02_05_02.
  3. I should then be able to access menu of the device in my browser.

As a side note - did you see that in my previous post that PIO was failing to “build” the stable version ? i did post the log ( i take it then that in point 2 above i should rather use the “staged” version?

Yea Wayne, I’m not going to get into trying to figure out your PIO VScode environment on a mac (or windows actually). You are working in a domain where you are expected to be able to deal with these issues and find problems and solutions. That’s what I would have to do for you.

The two environments in platformio.ini are currently identical except that iotawatt specifies an explicit upload port of COM3. So that’s a red-herring.

All I’m trying to do with the previous instructions is respond to your request to restore your production hardware to the latest production release.

To that end, follow the instructions above:

If you start a serial monitor after the upload, you should be able to watch in real time as the IoTaWatt recognizes the need to update from 02_05_00 to 02_05_02, and proceeds to download, install and restart the new release.

After that, you are back where you started with the production unit. You will need to take a step back and learn more about the PIO and ESP8266 environments and figure out why it isn’t working. If you find a bug in the code, I’ll be happy to address that.

Got you Bob. Sorry thought the PIO issue was firmware based and later realised it was my environment ( wouldn’t have expected you to figure that out , lol. I’m going to load vscode and Pio on a Windows machine and then run through your suggestion.

Will report back. Thank You