-
Notifications
You must be signed in to change notification settings - Fork 542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NodeMCU continuously rebooting using HX711 #67
Comments
First self-correction: Maybe it is related with the version of the compiler (it is running under Windows, Arduino IDE 1.6.12). Extremely slow compiler since last update. I will keep looking. |
can you post your sketch? i'm trying the HX711SerialBegin demo (MacOS, Arduino 1.8.1) on a "D1 mini WeMos.cc" and seems to be working after cleaning up the setup section. |
i just tried v1.6.9 on windows and it seems to work too, again, after removing most of the test code from the setup section. i'm going to update to 1.8.1 on windows too and give it one more try. |
Many thanks for the answer. I have tried the Arduino IDE V1.8.1, V1.6.9, V1.6.6 and V1.6.0. All under ubuntu 64 bits. No solution found, same error and reboot. I even reinstalled every library deleting the /home/user/Arduino directory. I paste below the code. It includes lots of comments, some timing variable and debugging flags. Please tell me if it is not clear and I will clean it. In line 93 is the scale initialization which causes the reboot. I also tested that it is not a power issue, powering from a bench DC power supply. I see a peak on current just in the reboot, but I supose it is normal.
|
Hi All, This code is is being executed and therefore yield() no longer works.
The long HX711::read() is also will lock the processor forever if the HX711 is never ready. |
Many thanks for your attention! I use basically the same hardware than you. NodeMCU and "micro" NodeMCU. All based on ESP8266 V1.0. I got several NodeMCUs and I get the same errors in them. Still no luck. I did not work too much last days but tonight I still do not get the answer. I do not understand the solution from Fishersolutions. Where I should comment the yield() function? Thanks! I will keep trying. I think it is related with the wdt. There are a lot of forums with the same issue but I still not found the solution. :-( |
if i were you, i would first isolate the issue by commenting out the oled display code, to test @fishersolutions tip. btw, thanks David for chiming in. or you can try commenting out: void yield(void) {}; in HX711.cpp and see how that works. |
Good advices. It worked!! :-) But still partially... I commented in HX711.cpp the lines: But the measure I obtain is continuously zero. In fact when I upload the HX711serial test code, I get the serial messages: I tested with different pins, different loads and different HX711 boards. I should construct the same with simple a Arduino for testing..... It is quite confusing (for a noob as me) to work with the different execution layers in ESP8266. Thanks again! |
you shouldnt comment out the is_ready code. you probably get 0.0 readings because the chip is indeed not ready. according to @fishersolutions tip, you should comment out the definition of yield. you should see that in HX711.cpp, in your arduino libraries folder. however, since the sketch seems to work without the is_ready code, but you dont get correct readings, that could mean your wiring is wrong, or something else is wrong with your hx711 board. is_ready should definitely return true if the communication is working. you might want to further investigate that with a more simple sketch. |
Isn't the normal state of DOUT always high, until the HX711 has a reading available? So then without the is_ready() wait loop in place, any call to read() during that (100msec) not-ready time will return all 1's, which is the bit pattern for -1. That is exactly what you are observing. If you are getting a watchdog reset when the is_ready() wait loop is not commented out, then that says that the loop is waiting too long for the watchdog timer. The purpose of having the "real" yield() in that wait loop is to kick (reset) the watchdog while waiting. As @bogde says you can't just cut out is_ready(), so one way or another you have to make sure that the watchdog timer gets kicked while you are in that wait loop. From @fishersolutions' post it sounds to me like without OLED, the watchdog was getting kicked often enough even with the do-nothing yield() call in the wait loop. Adding OLED caused enough delay (when added to the is_ready() wait loop delay) to time out the watchdog. His fix commented out the do-nothing yield() which then allowed is_ready() to call the "real" yield() -- i.e. the one that really does kick the watchdog timer. You need to do the same. |
Exactly! @fishersolutions gave the answer. Just commenting what he said solved the error. If not commented, watchdog is not feed in time and reboot occurs. My fault was mixed with a wiring error (.......) that I found testing with a clone of the hardware. Now I got problems with stability of the measures but it is for sure an algorithm issue. Thank you all again! Cheers from Spain. |
Good to know; thanks for the update! If you are having problems with random strange readings from the HX711, note that @bogde's library will do this if your system uses interrupts and those interrupts ever take longer than about 60 uSec to service. In that case, if one of these interrupts occurs during the time read() is clocking data out of the HX711, it can cause the HX711 device to go into shutdown mode, which corrupts the rest of that reading (all subsequent bits will read out as 1s). One possible fix for this problem is to prevent interrupts from occurring during the entire clocking sequence. See my pull request for one version of this solution. Poor connections on the HX711 wiring can also cause random strange readings, so make sure your connections are all good and tight. |
I have the same error on a NodeMCU v1. Managed to copy the entire code of HX711 into my program and it worked - got reasonable readings. However, whenever I import the HX711 library and use it my code, it restarts the device |
@zinkkrysty As per suggestions above, comment out or remove the section in HX711.cpp that says: |
Tried that. Not working. Actually I can reproduce the error with this code:
Where I'm not using the library at all besides initializing the instance. This code, on the other hands works: https://gist.github.com/zinkkrysty/3e0afdfb7c9a3cb219096555a4863d99 |
I suspect the |
Are you removing the problematic yield() definition from the correct version of your HX711.cpp file |
I am sure I am editing the right file because I tried to remove the I am trying to introduce the methods in the library one by one and see which one breaks the code. So far only having this in the headers doesn't break my program (also commented out the corresponding methods in the cpp file):
|
Ok, I managed to fix this. The issue was that I reversed the pins when instantiating the scale (maybe this tutorial was using older version of HX711 or they got it wrong) Trying to fix it by commenting out the
actually causes the error for me when the pins are in correct order. So the version that works for me:
and with the library as is in the master of this repository (that has Curiously enough, the difference between my version and the master is that the sides of the load cell are opposite (I have to use the other side to generate readings) |
hi AgordiGuerrero sir,we are facing the same problem with hx711 code which you have faced (ets Jan 8 2013,rst cause:2, boot mode:(3,6) can you please explain in detail |
Hi there, just wanted to let you know we are working on #123, which you might want to give a try. |
Hi guys,
many thanks for the nice work with this library. I am enjoying it and doing some nice scales.
I was using the library without problems in a NodeMCU 1.0 (ESP 12-E) but I changed to the smaller version of the board (ESP 12-F):
http://www.banggood.com/Mini-NodeMCU-ESP8266-WIFI-Development-Board-Based-On-ESP-12F-p-1054209.html?rmmds=search
With the same code, as soon as I include the line:
HX711 scale(D6, D8) // or whatever pins I choose.
it restarts over and over again and send the message via serie (115200 bd):
After looking in several forums, I have not found the answer. Can anybody give me a clue?
Thanks in advance!
The text was updated successfully, but these errors were encountered: