Btw, my grove connector's vcc pins read exactly as the 5V pin of the mkr board. That is, my sensors are given the same volts that are read between 5V pin of mkr board and gnd pin of the board in all three cases.
As for the various voltages you measured, if VREF is using the same voltage as the voltage on the Grove connector it should work OK even if the voltage does change a little. The way I understand it. VREF is the voltage at which the ADC will give a reading of 1023 (for 10 bit). My pressure sensors will work on a range of voltages and return a voltage that is proportional to the applied +V so I think it should self-calibrate if I connect VREF to the Grove connector voltage. At least I hope so.
It is easy to connect all three points together using the strip headers, but How were you planning to disconnect the 5V from the connector carrier to the MKR NB 1500. Cutting the pin would be easy, but I wouldn't want to do that. Were you going to cut a PCB trace? Are their buried traces on the board that could cause problems? What have you figured out?
My idea is to remove the soldering at the pin at the connector carrier board, then try to extract the female metal part of that pin pounding from the bottom to the top. I have no idea of the internal structure of the female pin header but I agree damaging permanently the mkr board is not an option. Risking the connector carrier seems more reasonable. But in any case I would not do anything irreversible if I can figure out a method that allows me to fully restore the hardware to its original form.
So far i haven't tried because I cannot predict the outcome and I found how to make my system work in the shor term (plugging the usb and charger).
I have some spare female pins around to mess with before the real deal. Let's hope most female pins are made similar.
I agree on the expected linear behaviour of the sensors while their received VCC changes, but I'd prefer to keep it high to reduce error from noise, hysteresis and any other oscillations, as much as possible. Also, my sensor requires more than 3 volts, so if it ever received 2 like yours, it would not work.
I would prefer to lock VREF (received at AREF pin of MKR and VCC of grove connectors) as much as I can, then let that linear adaptability take care of the least possible amount of change.
@josiin I have two MKR connector boards and two MKR NB 1500 board. I have tried all combinations of these four boards and both of the MKR NB 1500 boards will not read the analog A6 pin. Both boards act the same way. They read a small value around 5-12 which fluctuates up and down a few numbers. I connected a variable resistor as a voltage divider and connected it to A6. Doesn't change as I rotate the knob. It works on A0-A5 just fine. I realize A6 is the second pin on the connector. When I first connect a voltage to pin A6 the numbers change to about where they are supposed to be but after a second go back to around 5-10. It acts like there is a capacitor in series with the input.
I think I confirmed the problem. I'll bet R19 and C16 on the carrier connector board are swapped. At least is seems like it. I put 1.5V directly on the MKR 1500 boards A6 pin and it read a little over 500 and was stable, The problem is on the Carrier board. I needed to use that connector too
If you have time, would you please verify if Grove connector A6 will read analog?
Looking at the carrier board under a microscope the components look correct, so there goes my theory. But A6 doesn't read analog on both Carrier boards and with two different MKR NB 1500 boards. Weird.
I recall the connector carrier documentation telling something about A5 and A6 being a double signal port. Not sure what it means, but definitely A6 is not a normal analog port.
I won't be able to test within the next 24 hours, sorry. I will be working at the farm today and hopefully leaving my first deployment test running the best i can.
A6 is on the second pin
@Juraj Thanks, I have the schematic for both boards in tabs on my browser. I mentioned in the first post that I knew that A6 was a second pin on the connector.
I used pin 2 instead of pin 1 on the connector. A5 works fine as an analog port. A6 doesn't work well, it does read analog values, sort of, but they are not stable. A6, however, does seem to work OK as a digital pin. I have tried this with two Connector carriers and two MKR 1500 boards, same results. I'm just looking for verification of the behavior.
@josiin I hope your deployment goes well at the farm!
The deployment was satisfactory being a first attempt. I made a noob mistake with the map() function, but it ended up playing in my favor, so no complains.
Did you manage to make your system work close to 5volts at grove VCC pins without USB power? Did you finally connect a jumper between VIN and 5V? Are you still working at 2 volts on the sensors then?
Although it was a simple circuit, I removed all of the wires and re-wired everything. A5/A6 seem to be stable and working OK now. Lost a day to that...
Glad your farm project went well! I am using my USB power blocker adapter so I never apply power through the USB. I put a jumper between 5V and Vin, this gives me about 5.05V at the Grove connectors. I may not need to also connect AREF as the voltage seems stable enough.
So in the end, connecting the output of the connector carrier regulator (VIN) and the output of the MKR board (5V) does work fine without cutting the connection between 5V pin at the MKR board and the corresponding pin at the connector carrier. Good to know.
In the absence of AREF and the external reference command you pointed out, MKR ADC is supposed to be using 5V of the MKR board as the ADC reference. If those correlate, perhaps the external reference is not required. Although I feel it would be more stable if used.
Now that I write it down, shouldn't AREF be 3.3volts? The MKR ADC actually receives the levelled down signals from the grove connectors through the levellers of the connector carrier, doesn't it?
@twesthoff, I came across this thread were someone suffers the same issue as you with 5V dropping to 2V when USB does not provide power.
https://forum.arduino.cc/t/mkr-wifi-1010-battery-circuit-operation/565243/49
The carrier board uses voltage dividers on the analog inputs so that when 5V is supplied what reaches the MKR 1500 is close to 3.3V. I connected an analog input to the Grove connector 5V pin and I got a reading of 1023 so it appeared to be just what is needed to work well.
Using the jumper is OK as long as you don't try to power from the USB. With the power blocker adapter, I leave the USB connected and can upload programs just like normal, but both boards are powered only by the 5V regulator on the Carrier connector board.
You do need to have the LiPo battery connected to the MKR NB 1500 board or the modem will not connect and work properly. On my completed install board, I used a DPDT switch to disconnect the LiPo battery and the main battery I am using to power everything. Otherwise the MKR NB 1500 continues to run when I disconnect power to the connector carrier board's Vin screw terminal.
What is the map() function you mentioned above?
That link is referring to the ability of the MKR 1010/1500 regulator to make 5V from the 3.3V and/or LiPo battery. It has that capability according to the datasheet. If that had been the case, the problem we are having, would not have been a problem.
For some reason unknown to me, Arduino chose to not implement the Boost functionality. The link to the solution is not valid anymore.
Wouldn't the ADC read 1023 for everything above the max voltage until the breaking point?
Why is there a difference in the behaviour of 5V pin if power comes from usb instead of VIN?
My current installation works fine with power from both usb and vin. No battery connected yet. I guess that as long as there is enough power for the mobile technology used. I forced mine to 2G without data connection. SMS are sent beautifully.
The map() function is an standard function to interpolate linearly the ADC measure, given twi samples of ADC measure and their "real' values. The trick to the function is that it works with integers, not floats. Basically truncating the decimal part.
Wouldn't the ADC read 1023 for everything above the max voltage until the breaking point?
Not sure how the DAC treats over voltage.
Why is there a difference in the behaviour of 5V pin if power comes from usb instead of VIN?
The USB voltage is connected directly to the 5V. With the jumper in, 5V is also connected to the output of the regulator on the carrier board. The two voltages are not the same so it should not be done. The USB, I think is current limited to 500mA, so it might not hurt anything. I didn't want to see any smoke so I didn't try.
There has been a lot of talk about needing the battery for proper operation on the forums. On mine, if I disconnect the battery the amber led flickers erratically and sometimes blinks. I have heard that some using the MKR 1400 also get erratic operation without the battery connected. The issue is that when transmitting the module needs high current spikes that the USB can't provide so the battery is necessary. Maybe using external power supply on the carrier board will work. My amber LED still goes funny when no battery is connected. I'd rather not use the battery because my system is powered by a 12V 6AH Lithium battery.
I had never seen the map() function before... it may be usefull. Would it take for example numbers from 500 to 1023 and map them to 0 to 50? Is that what it does?
that is normal. the battery control IC reports that a battery is not connected
https://docs.arduino.cc/built-in-examples/analog/Calibration
I intended to use a solar panel with car battery as the main power source, hence the convenience of using the connector carrier to power the mkr board. The connector carrier can stabilise the voltage variations that the power/charge regulator provides at the LOAD output. But having the small battery as a backup would help me implement some kind of survivability to properly detect and report that the main power input failed. It would need hardwiring to know if the reason is that the solar panels are broken, if the charger is broken or if the battery blew up, but at least I would know the issue was the power source and not some random software bug freezing the board beyond what the watchdog can help with.
I am still struggling with the pmic though. A function, for example, named canrunonbattery() actually returns true when battery voltage is below the acceptable minimum voltage. That means it cannot run on battery. To me. But it makes me wonder what am i missing that is so obvious. Anyway that was off topic. We are here for your 2 vdc at 5V pin when powered through the carrier without connecting VIN and 5V.
Btw, this evening i will try connecting mkr VCC pin (3.3v) to the analog input of the mkr board, beyond the sensor input of the grove connector and the levellers, to check if that also returns 1023. I think it will.
If it does, that would mean AREF has to be 3.3, not 5 volts.
@Juraj Thanks. I would have thought the Amber Led would blink in some kind of meaningful way if it was trying to say no battery is connected. This was sporatic and random. Good to know.