Xiao Samd21 Undervoltage 200mv Output on pin 10 with digitalWrite High?


Seeed Studio XIAO SAMD21

USB type C port from pc, however, it has been powered by both usb and 3.3v to the 3.3v pin(11) at the same time for programming. It was my intention to power via the 3.3v pin only for long term operation. 3.3v power was applied via adafruit 3.3v buck converter. See links at bottom for product details.

To measure voltage I am simply measured from pin 10 to ground. A 3.3v relay is attached to pin 10. See links at bottom for product details.

The test code is simply the blink example with the pin number changed with additonal time between state changes so I have enough time to measure.

const int ledPin =  10;      // the number of the LED pin

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(ledPin, OUTPUT);

// the loop function runs over and over again forever
void loop() {
  digitalWrite(ledPin, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(5000);                       // wait for a second
  digitalWrite(ledPin, LOW);    // turn the LED off by making the voltage LOW
  delay(5000);                       // wait for a second

Both relay contacts and pin to ground measuring methods report roughly 200mV during the 5 seconds it is set to High. It does cycle between 200mV and 0 as instructed by the code but that isn’t enough to energize the relay coil. I did the same test with pin 9 and it outputs 3.3v like its supposed to. I am wondering if there is any know issue like this or a problem with my setup. I have it soldered into a custom pcb and I’d like to know if there is anything I can do before doing a lot of disassembly work. I do have schematics for my pcb design if that is needed.

Attempts to fix
I have tried both resetting and loading bootloader mode and powering with only the usb. Also I mentioned before I tested pin 9 which works correctly. I have also verified the 3V relay is functional by applying 3v to the coil which does activate normally. For reference the coil resistance is 28ohms. I measured the voltage in from the buck converter and its normal. I tested another xiao with the same code by itself outside the circuit and it works just fine. My next step would be to replace the Xiao but if something I did will break this one too I want to know before I replace it. Should the Xiao only be powered by the pads on the back with 5V? Is powering via the 3.3V pin wrong? Thanks in advance for any advice!

Product links:
3.3v Buck Converter: MPM3610 3.3V Buck Converter Breakout - 21V In 3.3V Out at 1.2A : ID 4683 : $5.95 : Adafruit Industries, Unique & fun DIY electronics and kits
3.3v Relay: https://www.amazon.com/gp/product/B00IIDY8JU/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

Hi there, Austin_Dutenhoeffer,
Curious to know if you read the Amazon Reviews on those relays,
E. R. 5.0 out of 5 stars Shipped as expected, packaged well, I was wondering more about this relays specs. Reviewed in the United States on July 26, 2022 Verified Purchase Upon receiving, I observed, the coil's holding current around 95-100ma@3vdc
That’s no.1 You never sink enough current AFAIK.
also the strong and weak pullup resistor needs consideration I think.

Have you read the WiKi on the SAMD21 there is additional info that may be helpful to you too.
I would use a fet and boost the current like this.


GL :slight_smile: PJ

@PJ_Glasso Oh duh, can’t belive I didnt consider that. Too much current draw. Didnt think the relay would pull that much. I’m used to using other microcontrollers where that isnt an issue. Since I’m trying to put this all into a pcb couldnt I just use an NPN transistor to allow more current flow from main power?

Yes, Indeed use a mosFET :smile: :+1:
GL :slight_smile: PJ