Boron Low ADC Readings

In my current project, I am noticing ADC values that are unexpectedly low. When 3.3V is applied to the A2 pin, one Boron I have reads it as 4027 and the other reads it as 4000. I dumbed down the entire project and connected the D2 pin to the A2 pin. When I set the D2 pin as HIGH and read it through the A2 pin, the ADC averages around 4000. A multimeter shows it at 3.3V so I am puzzled. Here is my code:

void setup() {
  Serial.begin(115200); //open serial console
  delay(10000); //10 seconds
  
  pinMode(D2, OUTPUT);
  pinMode(A2, INPUT_PULLDOWN); 

}

void loop() {
  int adc_value = 0;

  digitalWrite(D2, HIGH);
  delay(2000);
  adc_value = analogRead(A2);
  Log.info("ADC: %d", adc_value);
  delay(5000);
  
}

Try removing the pinMode(A2, INPUT_PULLDOWN) line.
When you attach an internal pull-down resistor you shouldn’t be surprised to sense a pulled-down value :wink:

Good point. I removed it and now the values are around 4030 for 3.3V applied to A2.

What do you read when directly reading 3v3?

So just so I understand, I have a wire directly from the 3v3 pin to A2, it reads around 4030.

Exactly. This should be the only connection to A2. The device should not even sit in a breadboard or some antistatic sponge or anything else.

Additionally, how are you powering the device (battery only, USB + battery, USB only)?

Yup that’s how I have it. No breadboard. I was only powering it with USB. Let me add a Lipo that is charged and then test it.

I’ve tried both USB and USB+LiPo and get 4095 in all cases with this code

SerialLogHandler serLog(LOG_LEVEL_WARN, {{"app", LOG_LEVEL_INFO}});

void setup() {
  Serial.begin(115200); //open serial console
  pinMode(D2, OUTPUT);
}

void loop() {
  int adc_value = 0;

  digitalWrite(D2, HIGH);
  delay(2000);
  adc_value = analogRead(A2);
  Log.info("ADC: %d", adc_value);
  delay(5000);
}

so I have plugged in a LiPO and USB and it is still reading around 4030. I swapped out and tried another Boron and now get values around 4060?
0000051476 [app] INFO: ADC: 4070
0000058478 [app] INFO: ADC: 4060
0000065479 [app] INFO: ADC: 4062
0000072481 [app] INFO: ADC: 4062
0000079481 [app] INFO: ADC: 4057
0000086483 [app] INFO: ADC: 4060
0000093484 [app] INFO: ADC: 4057
0000100485 [app] INFO: ADC: 4061
0000107487 [app] INFO: ADC: 4059
0000114488 [app] INFO: ADC: 4058
0000121490 [app] INFO: ADC: 4060
0000128491 [app] INFO: ADC: 4057
0000135492 [app] INFO: ADC: 4062

Do I need to make some sort of adjustment to factor for this difference? The voltage coming into the pin is still 3.3V.

That shouldn't be required.
Have you tested with my code? I can't make any of my Gen3 devices report anything but 4095 (occasionally 4094) with that code and a D2-A2 bridge :confused:

Yep I am using your code. I have 3 Borons doing the same thing. BUT I tested the same setup and code on an Argon and it works fine, 4095. Its hard for me to believe I have 3 bad Borons?

That is rather peculiar - maybe @marekparticle can take this one from here.

BTW, can you post a photo of your Boron setup?

Here is a picture of the setup. The USB cable is going to my MacBook Pro.

I see you have no antenna attached - if you have the cell module on you should not do that. These modules are not meant to be running without load on the output stage.

2 Likes

I actually did not know that. I do have SYSTEM_MODE(SEMI_AUTOMATIC); at the top of my code. Does this change things?

When the radio is not on (as in SEMI_AUTOMATIC) it shouldn’t matter.

I’m seeing similar results with a Boron LTE that was shipped recently.
All tests with Cellular Antenna Connected, USB powered, and Li-Po connected.


// Using 3V3 Pin Bridge
0000013954 [app] INFO: ADC: 4079
0000018955 [app] INFO: ADC: 4075
0000023955 [app] INFO: ADC: 4081
0000028956 [app] INFO: ADC: 4082
0000033957 [app] INFO: ADC: 4078
0000038957 [app] INFO: ADC: 4085
0000043958 [app] INFO: ADC: 4083
0000048958 [app] INFO: ADC: 4081
0000053959 [app] INFO: ADC: 4079
0000058959 [app] INFO: ADC: 4079
0000063960 [app] INFO: ADC: 4081
0000068961 [app] INFO: ADC: 4078

// Using D2 Pin Bridge
0000035008 [app] INFO: ADC: 4081
0000040009 [app] INFO: ADC: 4088
0000045009 [app] INFO: ADC: 4079
0000050010 [app] INFO: ADC: 4082
0000055010 [app] INFO: ADC: 4074
0000060011 [app] INFO: ADC: 4071
0000065012 [app] INFO: ADC: 4087
0000070012 [app] INFO: ADC: 4085
0000075013 [app] INFO: ADC: 4079
0000080013 [app] INFO: ADC: 4081
0000085014 [app] INFO: ADC: 4076

Huh? :flushed:

That’s something @marekparticle and @oddwires1 may want to chime in on - that seems rather wrong to me.

Hi @Particle9 - sorry to be getting to you so late, had a break for the holiday weekend (thanks for the ping, @ScruffR). I can’t reproduce this on my own device, so it looks like something must be up hardware-wise. Would you mind creating a support ticket (support.particle.io) and we can determine whether or not a replacement is in order?

@marekparticle, I’m reproducing this with “replacement” Boron’s that were recently shipped to me.
Note: This ADC error isn’t a concern for me personally, but I wanted you to be aware.
Do you have a Boron from a recent production run to try ?

I switched to A3 Pin, and disconnected the Li-Po during the test, no significant change:

// A3 to 3V3 Pin Bridge
0000014060 [app] INFO: ADC: 4088
0000019060 [app] INFO: ADC: 4079
0000024061 [app] INFO: ADC: 4088
0000029062 [app] INFO: ADC: 4079
0000034062 [app] INFO: ADC: 4077
// Disconnected the Li-Po, Boron was Re-Charging previously
0000039063 [app] INFO: ADC: 4075
0000044063 [app] INFO: ADC: 4078
0000049064 [app] INFO: ADC: 4088
0000054065 [app] INFO: ADC: 4082
0000059065 [app] INFO: ADC: 4074