mp-se / kegmon

DIY scale for beer keg monitoring
MIT License
12 stars 4 forks source link

Not detecting scales until serial monitor is connected #23

Closed whywouldi closed 1 year ago

whywouldi commented 1 year ago

When starting up ESP-8266 or after re-booting the scales are not detected.

If I start serial monitor on laptop and re-boot the ESP-8266 the scales are detected and everything works ok.

mp-se commented 1 year ago

That is strange, i have never had that issue. Could it be a power adapter issue ? How do you power the device ?

whywouldi commented 1 year ago

Agreed it is a weird one. I'm currently powering via the micro-usb via either laptop or PSU. I have found powering by Micro-USB with my brewpiless keeps things more stable than via 3v3 or 5v.

The condition is totally repeatable.

mp-se commented 1 year ago

What board are you using? Have you tested with another esp? I dont think this is software related

whywouldi commented 1 year ago

I'm using the D1-mini. I will flash another board and report back in a day or so.

Much appreciate the guidance and the project is outstanding cheers.

mp-se commented 1 year ago

Which hx board are you using, green, red or purple?

whywouldi commented 1 year ago

Its the green HX711. I have a few of these too so will replace both boards and see if that fixes it.

whywouldi commented 1 year ago

I have created a new circuit board so I can change out the D1 mini and HX711. Have tried to boards of each and the same thing. Stumped.

I will keep paying with now I have a better setup and report back if I get it going.

mp-se commented 1 year ago

Ok, i can see if i can replicate the issue with a green board

mp-se commented 1 year ago

I have a firmware that I use to the sensors and the hardware setup. You could install this on an esp8266 and see what the result is. I will just display the raw values on the 1st OLED screen. If you want to build it via platformIO its the hardware target. This could be extended to help check for hardware issues.

hw_firmware.zip

whywouldi commented 1 year ago

Again thanks so much for your time and help.

I have flashed the Bin file to the ESP8266: Display show temp with live data, Scale 1 is 0, Scale 2 is 0, Raw 1 is 0 Raw 2 is 0.

After a few minutes I started serial monitor and within 5 seconds the scale 1 starts to read a value along with the temp. All others remain at 0.

This is repeatable.

whywouldi commented 1 year ago

May have just found an article that could explain it?

https://www.esp8266.com/viewtopic.php?p=53827

I am using D3 as the data connection to the HX711. Will have to solder up a new board to try on the "scale 2 input" but unsure if that would work with the detail on the site (only one scale can be used with esp8266).

mp-se commented 1 year ago

If you use the hx711 you can use 2 scales without probleme on esp8266, its the i2c based adc that is limited to one since the esp8266 only supports one i2c bus.

mp-se commented 1 year ago

Can you upload a picture of your esp board? Back and front.

mp-se commented 1 year ago

May have just found an article that could explain it?

https://www.esp8266.com/viewtopic.php?p=53827

I am using D3 as the data connection to the HX711. Will have to solder up a new board to try on the "scale 2 input" but unsure if that would work with the detail on the site (only one scale can be used with esp8266).

I dont think this is related. If this is the case it would not boot at all. You could try to add a 3k resistor between d3 and 3v as a test. You could do the same with d4 as well. This shoudl force it to be high and not trigger the boot mode.

whywouldi commented 1 year ago

IMG_0004 IMG_0003

whywouldi commented 1 year ago

These are the two types but I have tried a couple of the v3 boards. All doing the same.

I currently have a 4k7 across D3 and 3v3. I’ve tried 4k7 across just data and data + clock all making no difference. Also good to know about two scales using the hx711 thanks.

mp-se commented 1 year ago

I've tried to replicate your problem but on my test build it works fine- I've tested with external power supply to the 5V and both the purple and green HX boards. It boots fine and reads the data as it should

Let me know how your tests are progressing

whywouldi commented 1 year ago

I am stumped. I Will continue to try different things and see if I can get it going.

I’m now heading out of the UK for a few weeks so will not make any progress for a while. I will report back though should I manage to sort it or fail and give up (unlikely).

As always I appreciate you taking the time to help.

cheers,

mp-se commented 1 year ago

Do you have an esp32 s2 mini to see if that works better ?

whywouldi commented 1 year ago

Hi, back from my vacation and I've spent this morning using a breadboard to aid testing. Following on from the gpio0 (D3) link I decided to move the scale to gpio15 (D8) & gpio14 (D5) and it was recognised. It calibrates and functions correctly every time.

Is it possible to alter the code to move scale one to D8/D5 and scale two to D3/D4? Would this be a lot of work or just on the inital pin setup?

I dont have an ESP32 I'm afraid but I might have to get one.

mp-se commented 1 year ago

Yes you can alter the pins in the main.hpp file and then compile your own version.

Just make sure that you dont use the same pins for several functions.

mp-se commented 1 year ago

An option would be to let the user set the pin configurations in the UI to allow for more flexibility. I will add this as a feature to the backlog.

whywouldi commented 1 year ago

That would be fantastic.

I have been struggling to get platformio to build the project as I am not a very experienced user and I have a lot of dependency library issues. This would, as you say, provide great flexibility without the need to amend any code.

Much appreciate your time and help.

mp-se commented 1 year ago

Try this build, https://github.com/mp-se/kegmon/blob/dev/bin/firmware.bin

You can change pin config in the web ui. you need to reboot for it to take effect. I have just done some simple testing...

whywouldi commented 1 year ago

Thanks so much for updating the .bin in such a short time.

I have been working with the new .bin all morning and I keep getting the same issue. when I go to the config page I get the error "unable to get data from the device". every other page works ok just the config page. Other symptoms are no detail in the new drop down boxes and inability to save with the error "Invalid ID".

I've now tried this on the original three chip and two brand new chips purchased in the hope of resolving things (all wemos D1 mini's). Note that when testing the new chips I have not connected anything to them and not even soldered the pins on the board yet the error is repeated.

sorry for the continued issues.

image

mp-se commented 1 year ago

I know what the problem is, will fix it later today when im at a computer

mp-se commented 1 year ago

I've checked in the fix, should be ready in a few minutes when the buiid has been completed

whywouldi commented 1 year ago

Just uploaded, altered the pin setting, calibrated and tested. Everything is working perfectly!

Thank you so much for all the effort and time you've spent. Absolute legend.