Trouble Using Port D0 as a digital output on Wio Terminal

Hi All,

I’m at the very early stages of learning and hopefully there is a simple explanation or solution. I’m trying to use the port on the right (Not the I2C port) to switch a simple fan off and on. To keep things simple I’ve modified the example Blink program. The below code works perfectly with my Arduino Uno when I connect to Digital Port 7. However when I try to use port D0 or D1 (with the white wire) I get nothing.
If I physically complete the circuit with the red wire the fan spins, so there is enough power to run the fan.

What am I missing or not understanding?

#define FAN D0  //Yellow wire - Wio Terminal
// #define FAN 7  //Yellow wire - Arduino Uno

//To control a simple Fan using the Wio Terminal 

void setup() {
  delay(200);
  pinMode(FAN, OUTPUT);
}

void loop() {
  digitalWrite(FAN, HIGH);   // turn the FAN on (HIGH is the voltage level)
  delay(3000);                       // wait for 3 second
  digitalWrite(FAN, LOW);    // turn the FAN off by making the voltage LOW
  delay(3000);                       // wait for 3 second
}

Hi James,
Even though the VCC_3V3 (Red), D0 (Yellow), D1 (White) pins output the same 3.3V, the maximum power draw allowed for the pins are not the same. Here is a schematic of the Digital/Analog Grove Port to start with.
1603856798(1)
All the I/O pins from the ATMSAMD51, except the 3.3V and the 5V pins, output 3.3V with a maximum current draw of 15mA. You can see it from the ATSAMD51 datasheet in the below section:


Therefore each D0 and D1 pins can only draw 15mA of current.

However, the VCC_3V3 pin comes from the low-dropout (LDO) voltage regulator circuit as follows.


Therefore, the VCC_3V3 pin can draw a maximum current of 2A.

I assume the fan you are using draws much higher current than the D0 and D1 pins can handle which is 15mA. And it is possible to work on the VCC_3V3 pin because your fan might need a current less than 2A. You can look into the current specifications of the fan to confirm this.

Alternatively, if you want to use a fan, you should use a fan which draws less than 15mA of current. Also, you should carefully check about the current draw from devices before connecting, because a higher current draw from a pin more than it’s rated current can permanently damage that pin.

Hope it’s clear.

Best Regards,
Lakshantha

1 Like

Hi Lakshanka,

Firstly, thank you for the wonderful beginners videos you created for the Wio Terminal they are great.
Secondly, thank you fort such a wonderfully detailed response. You helped greatly with my emerging understanding of electronics. I indeed checked the voltage on the VCC_3V3 (Red wire) and the D0 (Yellow wire) and both wires gave a voltage around 3.23 volts (the yellow wire switching off and on as per the code I uploaded). Clearly the Ampage is the difference. The fan was harvested from a Gigabyte Video card which means the upper voltage range is likely 12v and the amps draw according to replacement fan specs is likely to be between .35A and .5A which means the pin is clearly underpowered to run the fan.

Also, thank you for pointing out that connnecting a device that draws more Amps than the pin can provide could permanently damage the pin. I thought I could only damage the connected fan if the pin being used provided too much voltage. I continue to learn and very much appreciate your clear instructions.

Thank you again,
James

1 Like

Hi James,

It’s my pleasure to help.
Hope you have fun with the Wio Terminal :slight_smile:

Best Regards,
Lakshantha