# Powering mbed externally with 5v supply

#### eb123

Joined Jul 3, 2017
74
I'm using a 5v power supply (http://www.hobbyandyou.com/adraxx-33v-and-5v-power-supply-module-for-mb102-bread-board) to power an mbed externally. Negative is connected to Vin, and Positive to GND. I've written a simple program which lights up all 4 LEDs on the mbed board. When the 5v supply is turned on, the LEDs do light up, but to a lower brightness than when connected via USB, and a faint flicker.

Can anyone explain why this is? I measured the voltage coming out of the 5v supply, and the figure tends to move between 4.9-5.1, which I believe is within the mbed's range.

#### shteii01

Joined Feb 19, 2010
4,644
Here is mbed microcontroller board.

It shows GND to be connected to 0V (Negative). Vin to be connected to some POSITIVE voltage.

#### eb123

Joined Jul 3, 2017
74
Here is mbed microcontroller board.

It shows GND to be connected to 0V (Negative). Vin to be connected to some POSITIVE voltage.

I have tried this configuration as well. Still no change.

#### shteii01

Joined Feb 19, 2010
4,644
I have tried this configuration as well. Still no change.
What are Vf for each led?
How much current do you want for each led?
Are you using resistors to control the amount of current each led gets?

How much current can each pin of the micro supply?
How much current can the micro supply in total?

#### eb123

Joined Jul 3, 2017
74
What are Vf for each led?
How much current do you want for each led?
Are you using resistors to control the amount of current each led gets?

How much current can each pin of the micro supply?
How much current can the micro supply in total?
I'm using built in LEDs on the mbed board. Not too sure what the ratings are for each LED. According to the supply specifications, it is capable of 5v at <700ma, which should be more than enough to power the mbed and LEDS, considering it works just fine with a direct USB connection which offers a lower current.

When the mbed is connected to the supply, the voltage reading is around 4.9v - I would imagine this should be enough.

#### shteii01

Joined Feb 19, 2010
4,644
I'm using built in LEDs on the mbed board. Not too sure what the ratings are for each LED. According to the supply specifications, it is capable of 5v at <700ma, which should be more than enough to power the mbed and LEDS, considering it works just fine with a direct USB connection which offers a lower current.

When the mbed is connected to the supply, the voltage reading is around 4.9v - I would imagine this should be enough.
Yeah, the built in leds should be setup properly. Meaning you don't need to do anything, just write the code.

Can you toggle on and off just one led? (there might be example provided by the mbed to do that, so you don't need to figure out the code, just run their example)
If that does not work, then I have two guesses:
or
- you fried the micro

#### eb123

Joined Jul 3, 2017
74
Yeah, the built in leds should be setup properly. Meaning you don't need to do anything, just write the code.

Can you toggle on and off just one led? (there might be example provided by the mbed to do that, so you don't need to figure out the code, just run their example)
If that does not work, then I have two guesses:
or
- you fried the micro
I'll give it a go.
I doubt the micro is damaged though, as it works perfectly well with the USB connection.

I should also point out that the status LED flickers on and off with the other LEDs, suggesting it is a power issue, as opposed to bad code.

#### eb123

Joined Jul 3, 2017
74
Yeah, the built in leds should be setup properly. Meaning you don't need to do anything, just write the code.

Can you toggle on and off just one led? (there might be example provided by the mbed to do that, so you don't need to figure out the code, just run their example)
If that does not work, then I have two guesses:
or
- you fried the micro
Right, I've used the demo "blinky" program with 1 LED and it seems to work just fine.
Perhaps the 5v supply isn't able to supply enough current to power all 4 LEDs? However, doesn't USB provide less current than the 5v supply I'm using?

#### eb123

Joined Jul 3, 2017
74
I've written a program which turns and keeps on all 4 LEDs, using the mbed library, and it works perfectly fine with the 5v supply.
The original program wrote directly to the port. Can you explain why it would work properly with the USB supply, but not with the external 5v supply?

#### eb123

Joined Jul 3, 2017
74
Code:
/*
====================================================================
Name        : Test.c
Author      : $(author) Version : Copyright :$(copyright)
Description : main definition
====================================================================
*/
#ifdef __USE_CMSIS
#include"LPC17xx.h"
#endif

#include<cr_section_macros.h>

// TODO: insert other include files here
// TODO: insert other definitions and declarations here

void delay_ms(unsigned int ms)
{
unsigned int i,j;
for(i=0;i<ms;i++)
for(j=0;j<20000;j++);
}

/* start the main program */

int main()
{
SystemInit();                    //Clock and PLL configuration
LPC_PINCON->PINSEL4 = 0x000000;  //Configure the PORT2 Pins as GPIO;
LPC_GPIO2->FIODIR = 0xffffffff;  //Configure the PORT2 pins as OUTPUT;
LPC_PINCON->PINSEL0 = 0x000000;  //Configure the PORT2 Pins as GPIO;
LPC_GPIO0->FIODIR = 0xffffffff;
LPC_GPIO0->FIOSET = 0xffffffff;
LPC_PINCON->PINSEL1 = 0x000000;  //Configure the PORT2 Pins as GPIO;
LPC_GPIO1->FIODIR = 0xffffffff;
LPC_GPIO1->FIOSET = 0xffffffff;
LPC_PINCON->PINSEL2 = 0x000000;  //Configure the PORT2 Pins as GPIO;
LPC_GPIO2->FIODIR = 0xffffffff;
LPC_GPIO2->FIOSET = 0xffffffff;
while(1)
{
LPC_GPIO2->FIOSET = 0xffffffff;     // Make all the Port pins as high
delay_ms(100);
LPC_GPIO2->FIOCLR = 0xffffffff;     // Make all the Port pins as low
delay_ms(100);
}
}
This is the original program used to turn on all LEDs. Yes, it's a pile of crap (I turned on all ports, because I didn't know which pins the LEDs were connected too. Ignore the delay too), but I don't see why it's operation would be affected by the choice of supply (i.e. USB/5v external supply).