Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics 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.

ammeter for microcontrollers

Status
Not open for further replies.

cipi-cips

Member level 4
Joined
Jun 30, 2008
Messages
76
Helped
2
Reputation
4
Reaction score
1
Trophy points
1,288
Activity points
1,867
Hello,

If someone can help with this problem. I have dc power supply that powers LED. Output is 48V when LEDs are turned on and current is 800mA. I want to measure the current so I can know if LEDs are working or not.

If LEDs are broken and not working then voltage at output is 100V and current is 0.

This data I want to connect to microcontroller.

I've searched over internet and there are some circuits with OP AMPS and Shunt resistor but everything is for 30-40V maximum I would need up to 100 V.

Thx for help
 

If you want to measure a DC current with absolute isolation, use a hall-based current sensor.

The ACS712-xx are very popular and reasonably priced devices.
 

Why not just measure when the voltage goes to 100V, if that is a good indication that the LEDs are not working?
That's easier to measure than current.
You can use a simple resistive voltage divider to reduce the 100V to a voltage the microcontroller can measure.
 

THx for reply,

I want to measure current because LEDs are dimmable.
 

Hi,

Is it possible to connect LED_GND and microcontroller_GND?
(Usually it should be no problem, as long as both are "floating" before).

If so, then three resistors and a simple NPN BJT will do the job.

One resistor as shunt for current measurement: Let's say 1.2V at 0.8A making 1.5 ohms. Use at least a 2W rated.
One resistor for current limiting to BJT base: Let's say 2mA @ 0.8A: (0.6V / 0.002A) = about 300 ohms
A bjt: emitter to common GND. Base ..see above, collector to microcontroller port.
One pullup resistor. Just use about 10k. From microcontroller port to microcontroller_VCC.

When LEDs are dark, then port pin is high.

One problem is dimming: We need more information about this. Is it DC dimming, or PWM, or something else?
Dimming means lowering average current. What lowest dimming level (average LED current) do you expect?

If PWM, then an additional 1uF at the port pin will do the job.

Klaus
 

Did you consider using a conventional opto-isolator? It should be possible to include one without much hassle.
 

Thx for replay,

here are more details.

LEDs are driven via dimmable led driver. Driver has input DIM pins (+DIM and GND). To be able to DIM one pulse has to be repeated every 10sec - 120 sec. Pulse duration has to be between 1ms - 11ms (1ms 10% brightnes and 11ms 100%).

current goes from 120mA to 790mA (1ms - 11ms)

Thx for help
 

Hi,

You did not mention if you may connect microcontroller_GND with LED_GND.
There is a good chance.

If you connect both GNDs, then my solution of post#5 will work with the added capacitor.

O the other hand the solution with an optocoupler has its benefits: Safety because of truegalvanic isolation, and it avoids to introduce noise into your microcontroler circuit.
For the optocoupler solution:
The current measuring shunt needs to drop more voltage to drive the optocoupler inside LED. Maybe 0.5V more than the LED voltage. Add a 47 ohms resistor to the optocoupler LED to about 10mA.
The higher voltage drop results in higher power dissipation in the shunt. You need a shunt with higher power rating.
The output of the optocoupler is a bjt.
Connect E and C like the bjt in post#5. Add the capacitor.

Klaus
 

Yes I can connect GND mcu to GND of LEDs.

Is this ok or I failed everything

ss.png
 

Hi,

I'm confused...

******
O.K. .
Isolated solution with optocoupler:
Don't connect GNDs.
Let's assume the optocoupler_LED forward voltage is 1.3V.
Shunt: voltage 1.3V + 0.5V = 1.8V. Current = 0.8A. R = U / I = 1.8V / 0.8A = 2.25 ohms. Use 2.2 ohms, at least 3W
Current limiting resistor = 47 ohms

Connect the shunt in the power_LED line.
Connect the optocoupler_LED anode to the negative shunt side. Cathode with 47R to the other shunt side.

Optocoupler_emitter to microcontroller_GND.
10k k pullup.
1u to GND.

Klaus
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top