Open RobertLRead opened 3 months ago
My Fluke 87 V doe not observe a difference in the voltage level of the output of the TMP36 sensor as the SCL and SDA wires are plugged in and unplugged. This suggest to me that the voltage of the sensor is not changing, but somehow the analog to Digital converter is failing, possible due to a lowered voltage as the I2C instrument draws power.
Note: This is just a silly note: when debugging by placing the PCB shield unstacked from the Arduino R4. This needs the to have A4 and A5 to be connected, apparently because these are overloaded to be SCL/SDA.
After connecting the A4 and A5 pins, D5, D6, and D7, and the SDA and SCL pins, as well as 5V and GND (with the shield not plugged into the system, incredibly the system now seems stable. When using a cell phone next to it I perceived some minor interference in the case of a lowered voltage value which was temporary. I cannot explain why it is working better now than previously.
After putting the shield back on, the erratic nature of the temperature readings has come back. In the output below, the raw readings oscillate between 140 and 181!!!
I have no explanation for this. Possibly the proximity of the shield to the mimina itself casues a problem. Possibly capacitance added by the wires (which i remove when I stack the shield) makes it behave better.
I am very confused by this.
Frequency Output: 165.00
reading: 146 volts: 0.71 21.29 degrees C filter: 21.60
Frequency Output: 170.00
reading: 146 volts: 0.71 21.29 degrees C filter: 21.59
Frequency Output: 170.00
reading: 142 volts: 0.69 19.34 degrees C filter: 21.55
Frequency Output: 169.00
reading: 140 volts: 0.68 18.36 degrees C filter: 21.50
Frequency Output: 169.00
Please capture the exact serial number of the Moonrat II hardware under test. Please capture the exact firmware with which this test was made, for each test. Please make a photograph of the setup(s) where you can reconstructing it (them). A photograph to capture what you mean by shield on and shield off would help.
Regarding, "However, after disassembling the board and connecting only the GND, 5V, 3.3V, and A5 lines, the temperature sensor does NOT fluctuate, " The A5 line is not the ADC for the TMP36 and so cannot work to measure temperature. Why is A5 involved?
I should have said A0. The temperature is read from A0.
There is no serial number on my board. There is a black smudge of ink that appears to have once been a serial number; it comes off when I rub it with my thumb.
I am now adding a set of facts which may be unrelated but make no sense.
The biggist unexplained problem right now is that when the shield is plugged in it is wildly erratic and yet when it is wired by hand it is stable. I have no explanation for this. I have moved the shield on top of the R4 (to the extent the wires allow me to) to see if physical proximity makes a difference and it does not appear to make a discernible difference.
Here are two photos showing the shield off the R4, completely wired with jumper wires, which seems to have a stable read of the TMP36 voltage on A0.
Note: When on a call with Lee Erickson using my Iphone while it was using Bluetooth hearing aids, it caused the A0 inputs to drop to nearly zero, as shown by the blue line here:
When NOT using Bluetooth, but on the phone, it produced a different but similarly interfered trace:
Here is a baseline with no use of cellphone as you suggested, @ForrestErickson
@RobertLRead Regarding,
Note: When on a call with Lee Erickson using my Iphone while it was using Bluetooth hearing aids, it caused the A0 inputs to drop to nearly zero, as shown by the blue line here:
and
When NOT using Bluetooth, but on the phone, it produced a different but similarly interfered trace:
Please add a base line oscilloscope graph to the above, with NO cellphone and NO bluetooth connection for the same setup. THIS WAS DONE, see above.
@RobertLRead
If time is critical for your trip, why are you using the R4? Use an R3. for which IIRC, @HJGV05 reported different and better behavior.
@ForrestErickson I think it is worth trying quickly to see if it solves some of these problems. When I began I was using an R3 (though I think it was knock-off imitation that was sent to me) and had the same problems. I am resistant to not solving this now that you have given me such good advice, but it may indeed be worth trying.
Note: When I added a debugging statement which STOPPED writing to the OLED display during the loop, the obvious oscillation in voltage in both the 5V line and A0 line disappeared (see image below). The temperature became much steadier. I hypothesize that this could be either A) a sag in the voltage due to drawing too much current or B) some sort of EMI can crosstalk. I will now attempt to test those hypotheses.
By calling "display.display" mulitple times, w can definitely create significant noise on the A0 line:
} else { display.clearDisplay(); display.display(); display.clearDisplay(); display.display(); display.clearDisplay(); display.display(); }
I sent this email to the team:
Dear Team, I have been working though a number of problems with the help of Lee. I have created a new version, which addresses significant problems, and makes some decisions which are merely taste. https://github.com/PubInv/moonrat/blob/main/moonratII/firmware_moonratII/production_R4/MoonRatRob6/MoonRatRob6.ino
I will describe this thoroughly in issues, the README, and internal documentation within the code. But I wanted to explain this all in one place, although there are multiple overlapping problems.
I have reorganized Horacio's code a bit, in ways that I think are simpler. I now must:
When I stack the board on top of the R4, the A0 signal becomes ridiculously populated with high frequency noise. Although this code in theory be smoothed with a capacitors, I do not find it hopeful---I would rather eliminate the noise than smooth it. I will compare this with an R3 after this.
Initial evaluation suggests the Arduino R3 does not suffer from the same instability in the voltage on A0.
@RobertLRead regarding, " Test actual heat production"
You will need to remove the 100 Ohm resistor in series with the heating pad in the unit. That was put there so that I could, in principle, test everything off of the USB supply at low current (low heating).
@RobertLRead Regarding, "When I stack the board on top of the R4, the A0 signal becomes ridiculously populated with high frequency noise." As time permits,
Characterize with oscilloscope waveforms as above.
I am still investigating, but it is clear we have a severe electrical problem with our temperature read.
In the first place, the code seems to presuppose we are using a TMP37, but we are really using a TMP36. When used in fully assembled mode, the Moonrat temperature readings very by as much as 20 degrees C. This is directly caused by the voltage reads on Pin A0 fluctuating.
However, after disassembling the board and connecting only the GND, 5V, 3.3V, and A5 lines, the temperature sensor does NOT fluctuate, but it relatively steady. It reacts to increase in temperature (generating by me placing my thumb on the sensor) by a direct increase in voltage represent about 5 degrees as it should.
However, the simple act of unplugging and plugging the I2C connections into the dissasembled board (that is,our PCB not mounted onto an R4 minima, but placed beside it and individaully wired, causes a change in the voltage level from approximate 163 to 173. Each digital tick is 0.5 millivolts, so this represents 50 millivolts, which on a TMP36 would correspond to 5 degrees C change in reported voltage. In the image below you can see the change in the "reading" which is a direct reading of the analog input pin (no match or conversion applied.)
I do not yet understand this, but it seems clear that the Display (which is our I2C element) is drawing too much current or produce an unexpectedly high capacitance on the line or doing something else naughty at an electrical level. I will conti