Powering a SEEED XIAO NRF52840 sense

Greetings

I want to use a SEEED XIAO NRF52840 sense in a small device, all other controllers are to big.
Additionally, i use a HX711 Sparkfun breakout board to read a load cell. For powering the board, 3 SR44 batteries are implemented to a total of about 4.5 V and about 160 mAh.
Now I am unsure how to connect the batteries: Available are a 3V3, 5V and BAT+ pin.
All other options to power the setup are to big (e.g. a LiPo battery).

For my debuging setup, I connect the XIAO to an Arduino via Serial and print my results there (the HX711 library and USB serial via Adafruit_TinyUSB.h do not work at the same time on the XIAO for some reason).

  • Scenario 1: Power XIAO via USB: Data send sucessfully to Arduino UNO and can read the values of the load cell.
  • Scenario 2: 4.5V supply into 5V pin: Onboard LEDs blink, but only gibberish (those [] characters) received on the Arduino.
  • Scenario 3: 4.5V into BAT+: Same as Scenario 2.

Only i found nothing usefull and I am unable to read the schematics of those electronics. I hope you are able to help me.

Thank you kindly.

First, the SR44s are not rechargable so you must never have the batteries and USB connected at the same time
Where does the HX711 get it power from?

Hi jim-p

Yop, of this i am aware, but thank you nevertheless. I never connected them together in the scenarios above.
The HX711 preferably also from the SR44 as it should be usable with 2.7-5V.
I will also read the voltage from all the batteries and send a signal when they have to be replaced. In the end, readings with 50 Hz should be send to another SEEED XIAO via Bluetooth with the Load cell values. This in small bursts of about 5 seconds, and in between i will power down the HX711 (i use the library from bogde). Hopefully the batteries will hold for a few hours, but i do not expect them to run for a full day.

Depending on the load cell, the HX711 could draw much more current than the SR44s can deliver and the voltage may drop well below 1.5V.
For the datasheet I looked at, the 150mAh rating was true for a current draw of only 300uA

1 Like

Hmm, i did not find any datasheet with this information to the ones i will use (RS Pro). But i have to mention, in this setup i use a lab power supply to "simulate" the batteries until everything works, therefore this cannot be the case of this strange behaviour in this case. But it s a good point to consider, i did not know that this may become an issue.
AFAIK the HX711 only needs about 1 mA, the XIAO maybe 15 mA depending mostly on the bluetooth. But wouldnt be the first time a datasheet is wrong (or i read it wrong).

That does not include the current drawn by the load cell.

in this setup i use a lab power supply to "simulate" the batteries until everything works, therefore this cannot be the case of this strange behaviour in this case.

If it works via USB power, it should also work with a power supply connected to Vin, provided the supply is not current limiting and you don't have something in your code preventing it from starting like while (!Serial)

The load cell(s) i will use should have a max current draw of about 15 mA. I tested it with a cheap loadcell with quite similar specs (internal resistance etc.) and measured also around 14mA with an amperemeter.

I only have the SoftwareSerial, and this one doesnt even wait with the typical while(!Serial). Also a reset after powering it up did not solve the problem.

Stupid question, what is the Vin on the SEEED XIAO NRF52840 sense? I have the 5V, 3V3, BAT+/BAT- on the back and the USB connector... I would have guessed it's the 5V pin, but i'm not sure as other Arduinos have a dedicated Vin pin.

I'm also confused
On the product page the show VUSB in one image and 5V in another
Then they say "Input voltage (VIN): 5V"
On the schematic they call it VBUS but that is connected directly to the USB connector.

You can supply the 5V pin with 5V but you better be 100% sure you have nothing connected to the USB.
It may be safer all around to only supply 5V via the USB connector.

In my device is not enough space to plug in the USB connector, so i have to power it externally. Would be nice if I could acess the USB power pins somewhere...

My newest test is with a 3.7V stable power supply connected to BAT. If I understand it corretly i'm able to power it via this connection with a LiPo batterie. That also did not work, i get trash characters in the serial plot of the connected Arduino... At least some other characters than before, now i get a lot of questions marks and some asian symbols in between, so something changed.
Well the program always seems to work somehow in all the mentioned scenarios, as the onboard LED does what it should to (blinking Red and blue with 1Hz). Not sure if this is helpfull in any case....

When the USB is connected it will always run from the USB power, the battery will be disconnected but will be charging.
Are you sure you have the baud rate set correctly?

Also as I said you can supply to the VBUS/5V pin

I newer used an external supply and the USB at the same time, always one or the other.
The baud is set as 9600 on both the XIAO and the Arduino. And as soon as i use USB instead the external one it works, when i switch to external (whatever scenario i mentioned before, always without USB), it does not.
I found more sources in the internet where people just connected a 3.7V LiPo to BAT and it worked, so i'm totally confused...

Then I suspect the board is damaged somehow.
It should not make any differece whether the battery is connected or not, it will always use the USB power.

Well, good thing i ordered four of them an need only two. I will solder new wires on a spare one and try it with this. I will let you know as soon as i have some news.

No hurry be carful with the soldering.
Make sure the battery polarity is correct, it is not reverse polarity protected.

Same result, works with only USB connected, but does not work with only 3.7V on BAT connected. Battery polarity is correct (on both XIAOs).

I have to ask again.
How do you know it does not work with just the battery?
Are you blinking an LED or something?
You have nothing in the code that would use the the serial port

My Setup:
The XIAO reads a load cell with a sparkfun HX711 breakout board (load cell amplifier).
Connections: VCC to external power supply, VDD to 3V3 of the XIAO, GND to common GND, communication to XIAO pins 4 and 5. If the HX711 is recogniced, the onboard LED will blink green/blue. If not, it will become red.
XIAO is connected to an Arduino via SoftwareSerial, on XIAO pins 8 and 9. The Arduino writes the result to the serial monitor.

Power Scenario 1: USB to XIAO, external power supply to VCC on HX711 tested with 3.5...5 VDC.
Result: on my Arduino i recieve via software Serial the values from my load cell accuratly, as seen with the serial monitor. Independent of the voltage on VCC via external power supply (3.5 ... 5V).
Example output:

HX711 scale demo
Begin HX711 done
HX711 found.
Set Scale HX711 done
Tare HX711 done
Setup finished:
0.00
-0.00
0.00
0.00

Power Scenario 2: external power supply with 3.7V to BAT+/BAT- on XIAO and VCC on HX711.
Power Scenario 3: external power supply with 5V to 5V-pin on XIAO and VCC on HX711.
Result: on both scenarios, the onboard LED blinks green/blue, but on my Arduino i recieve no readable data.
Example output:

���=�=��o_����{{}ou�w}o��zuwmo�o_����oou��N_����wouow�
At the beginning a lot of characters appear, then only all second a new character as i programmed it with the non-blocking timing. And the onboard LED blinks, so the HX711 is recognised. Therefore the programm works somehow, but not fully.... which is confusing...

Here is my code of the reader:

/* Read load cell, sends data via SoftwareSerial to an Arduino */

// ======== BLE
//#include <bluefruit.h>

// ======== Serial for debug
//#include <Adafruit_TinyUSB.h>

// ======== Serial UART
#include <SoftwareSerial.h>
SoftwareSerial SUART(9, 8); // RX, TX

// ======== load cell amp
#include <HX711.h>
HX711 scale;
#define calibration_factor 12160.0
const int LOADCELL_DOUT_PIN = 4;
const int LOADCELL_SCK_PIN = 5;
const int LOADCELL_GAIN = 128;

// ======== LED
bool ledState_red = HIGH; // HIGH == LED off
bool ledState_blue = HIGH;
bool ledState_green = HIGH;

// ======== timing
long currentTime = 0; // current time in ms
long lastTime = 0; // endTime of last loop
int rate = 1000; // rate of main loop in ms

// ======== Setup
void setup() {
  delay(100);
  SUART.begin(9600);  // Start USB SUART communication
  delay(50);
  
  // initialize the Bluetooth® Low Energy hardware
  //BLE.begin();
  /*while (!SUART) {
    delay(10);  // Wait for the USB connection
  }
  */
  pinMode(LED_BUILTIN, OUTPUT);
  pinMode(LED_BLUE, OUTPUT);
  pinMode(LED_GREEN, OUTPUT);
  ledState_blue = LOW;
  digitalWrite(LED_BLUE, ledState_blue); // set red LED high
  SUART.println("");
  SUART.println("===");
  SUART.println("HX711 scale demo");
  scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN, LOADCELL_GAIN);
  delay(250);
  scale.power_up();
  delay(250);
  SUART.println("Begin HX711 done");
  if (scale.wait_ready_timeout(1000)) {
    SUART.println("HX711 found.");
  } else {
    ledState_red = LOW;
    digitalWrite(LED_BUILTIN, ledState_red); // set red LED high
    SUART.println("HX711 not found.");
  }   // print a raw reading from the ADC
  scale.set_scale(calibration_factor);
  //scale.set_scale(); // DEBUG Scale
  SUART.println("Set Scale HX711 done");
  scale.tare();
  SUART.println("Tare HX711 done");

  SUART.println("Setup finished:");
  
  ledState_blue = LOW;
  digitalWrite(LED_BLUE, ledState_blue); // set red LED high
}

// ======== Main loop
void loop() {
  currentTime = millis();
  if(currentTime-lastTime >= rate){
    if (!scale.is_ready()) {
      ledState_red = LOW;
      digitalWrite(LED_BUILTIN, ledState_red); // set red LED high
    }
    else{
      ledState_red = HIGH;
      digitalWrite(LED_BUILTIN, ledState_red); // set red LED high (off)
      ledState_blue = !ledState_blue;
      digitalWrite(LED_BLUE, ledState_blue); // set blue LED blinking
      ledState_green = !ledState_green;
      digitalWrite(LED_GREEN, ledState_green); // set green LED blinking
      //SUART.print("Reading: ");
      float result = scale.get_units();
      //long result = scale.get_units(10); // DEBUG scale
      SUART.println(result);
      //SUART.println(" N");
    }
    lastTime = millis();
  }
}

And this would be my receiver on an Arduino UNO:

#include<SoftwareSerial.h>
SoftwareSerial SUART(2, 3); //SRX = 2, STX = 3


void setup() {
  Serial.begin(9600);
  SUART.begin(9600);
  Serial.println();
  Serial.println("==============");
  Serial.println("Setup finished");
}

void loop(){
  byte n = SUART.available();
  if (n != 0)
  {
    char ch = SUART.read();
    Serial.print(ch);
  }
}

Are you saying you connected a power supply to the battery input?
Not sure what kind of problems that would cause.

Is the example output from the "Arduion" of from the PC via USB cable

Problem solved.

I have to elaborate on my Setup:
XIAO was connected via USB to my Laptop.
Arduino was connected via USB to my PC.
If XIAO was used with the external lab power supply, no USB was connected to the XIAO.
All of those are connected on the same extension cord.
My collegue noticed that the XIAO is connected to the Arduino via RX and TX, but not the GND. Apparantly not an issue with the Laptop and PC, but an issue with the external PS and the PC.
... Connected GND of XIAO and Arduino toghether, and the gibberish in the serial monitor is gone.

Additionally, i can confirm that the external power supply on the BAT pins seems to work. I kind of expected this, as i thinkt the BAT pins do not care where the 3.7V come from, at least with my meager understanding in electronics.

Next stept would be to implement bluetooth, but that a problem for tomorrow.
Thread closed, thanks Jim P. for the support. An additional brain with good questions and triple-checking is always helpfull.

Hi poster!
Sorry to bother, but my knowledge of circuits is quite limited, and the information in the manual is too vague. So, although this might sound like a silly question, I want to confirm: Can I simply connect an external power source to the BAT+ and BAT- terminals on the back of the development board to power it?
I have three LR44 batteries in series, which can output 3.3V through a voltage regulator module. Will this be sufficient to successfully power the development board? If not, how should I wire it correctly?I would really appreciate any guidance or suggestions. Thank you in advance!