Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

[SOLVED] PIC24FJ256GB210 Controlling Output Voltage

ninnymoggin

Newbie level 4
Joined
May 24, 2020
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
47
I'm extremely new to this so please bear with me. I'm trying to turn on an LED (4v max.) using one of the digital i/o pins, but the pin is only outputting about 1.5v. The pin is set as an output. I also have a 12v power supply connected to the board to power several 12v push buttons. I have no experience with electrical or C (I'm a mechanical engineering student), so the simpler you can explain this the better. Thank you!
 

ninnymoggin

Newbie level 4
Joined
May 24, 2020
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
47
It's 1.5v with nothing attached. I'm using a 470 ohm resistor with my LED (no idea if that's right) and the light is very dim.
 

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
14,119
Helped
4,676
Reputation
9,366
Reaction score
4,414
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
120,649
The resistor and LED seem OK but what is the supply voltage (VDD) to the PIC. It needs to be a little higher than the LED needs to allow for some drop in the internal circuits. The maximum according to the data sheet is 3.6V with a nominal 3.3 normally being supplied. The pin should go higher than 1.5V but maybe not enough to drive the LED adequately. The best solution would be to use the PIC to drive an NPN transistor and the transistor to drive the LED from the 12V supply.

PIC ---- Resistor (~2.2K) ----- transistor base
VSS ---- transistor emitter
VDD ---- Resistor ---- LED ----- transistor collector.

Use Ohms law to work out the resistor value in series with the LED. R = (12 - Vled)/Iled.
Iled is in AMPS so for a typical 10mA use 0.01A. The result is in Ohms.

Brian.
 

stenzer

Full Member level 4
Joined
Oct 1, 2012
Messages
204
Helped
23
Reputation
46
Reaction score
22
Trophy points
1,298
Activity points
3,105
Hi,

1.5 V is too low for an open digital-output pin, you should expect 3.3 V. According to the datasheet the IO pins are capable to deliver 18 mA, which is sufficient to drive a LED.
The solution suggested by Brian will work for sure, but I'm more curious about the low PIN voltage whithout an attached load.

Which board do you use exactly?

greets
 

FvM

Super Moderator
Staff member
Joined
Jan 22, 2008
Messages
46,775
Helped
13,884
Reputation
28,016
Reaction score
12,522
Trophy points
1,393
Location
Bochum, Germany
Activity points
272,973
To decide if a LED is suited for direct drive by a 3.3V microprocessor, you'll check it's forward voltage at the expected low mA current. Some LEDs have too high forward voltage and should be better supplied by 5V IO.

Said 1.5 V suggests an incorrectly configured GPIO or additional circuit reducing the output.
 

KlausST

Super Moderator
Staff member
Joined
Apr 17, 2014
Messages
17,288
Helped
3,914
Reputation
7,826
Reaction score
3,778
Trophy points
113
Activity points
114,765
Hi,

Be sure you connected the negative DVM input to PIC_GND.
Do verifying measurements to
* VCC
* LED (each pin)
* resistor (each pin)

And also be sure that that the PIC pin is steady (DC, non switching, nonnPWM, PIC not in reset...)

Klaus
 

ninnymoggin

Newbie level 4
Joined
May 24, 2020
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
47
Thank you all for the help. It turns out this issue was that my code was not in an infinite loop in my main function, so each time it looped back to the main it reinitialized the pin as an input and then an output again, so I was essentially picking up an average of the two voltage values.
 

Toggle Sidebar

Part and Inventory Search


Welcome to EDABoard.com

Sponsor

Sponsor

Design Fast


×
Top