Analog out. Boo

28 Oct 2010

Hey guys, been ahwile. quick question, My analog out seems to be off... A value of 0.0 gives maybe 1.6-2.0 Volts tops (no meter with me) but it seems to be inverted... and the highest i can get to is about .30 and then voltage dies off completely. Any ideas?

 

p.s. i have some garbled files on my Mbed drive (one claims to be 3.82 GB)

(kinda a last minute haloween costume idea, haste would help :)

28 Oct 2010

I read something about Led's being dimely lit. im trying to run 6 LEDs off the one pin connected in parrellel. My electrical knowledge is kind of lacking (comp sci, by nature) it seems like digital out is pretty dim as well. but if i just bypass and connect to ground pin it seems quite bright. Can i compensate with a pull up resistor of any sort to get my 'brightness' turned up on the analog out pin? (if so how would i go about this? thanks in advance)

28 Oct 2010

The analogue out will not be able to source enough current to drive 6 leds (maybe not even one).

if you want to alter the brightness of the an LED attach it to a PWM out an alter the duty cycle. ( http://mbed.org/handbook/PwmOut )

I had the same problem once with a corrupt file, i just formatted the drive and it sorted it out.

 

28 Oct 2010

Would need to know more about how you've connected this up but:-

1) For a digitial out pin there's a "maximum current per pin" an LPC device can drive and also a "maximum total current" the device can drive (all pins).

2) I assume you have also connected an LED(s?) to the analog out pins? I'm not sure the AOUT are designed to drive currents that high and you would probably need an opamp buffer if you are trying to change the brightness of an LED based on an analog value.

As for "junk" on the Mbed. I have seen this most often on my Mbed's when I have "stupidly downloaded anything" from another website and accepted my browsers default store location, which I set to my Mbed for conveince. That's me putting rubbish onto my Mbed by mistake! and is often the reason I find "junk" on there ;) Pebcak in my case.

28 Oct 2010

Glen: Are you using Windows 7 or Vista?
In that case if you don't unplug it correctly, it may put some faulty data on the mbed.
You need to disconnect it in tray before taking out the USB cable.

Lerche

28 Oct 2010

Christian and Lee: Thanks. i reformatted and all looks good on the mbed now and no more yanking out usb plugs for me!

Lee: PWM doesn't seem to source enough current as well. The only difference i can see is that pwm pulsates in the upper float values....  So at 0.0 It's lit up (about half intensity) then as it moves further up towards 1.0 it gets dimmer and pulsates more. (anyone able to replicate this?)

Andy: Is there anyway to increase amp's? say using multiple pins to drive one LED? I would be experimenting, but I live quite far from a store in wich i could access any spare Electronic parts (Rural, Alberta, Canada), but i do have a bunch of resistors, just no extra LED's. My other thoughts were to run a resistor from ground to LED anode. So lets say the LED's are recieving 50% of their required full amp's, can i directly supply the other 50% from the ground through a resistore so that the LED's fluctuate between 100% and 50% instead of 0% and 50%?

Sorry, i'm quite horrible with volts/amps :)

28 Oct 2010

Glen,

Have a look at an article I wrote about scaling the analogue out. In that article it really just discusses how to alter voltage levels to a format that one may need for driving an external system (such as a DC servo amplifier). However, the technique isn't just limited to voltage, the output stage is capable of upping the current flow too, it's just a case of looking more at the OPAMP buffer as a current amplifier instead. When thinking in this way you really should be looking at articles like Wikipedia's Current Source to understand more about the subject.

The main problem you have is what can an Mbed (LPC1768) pin source or sink? And, as a device, what can all the pins source or sink as a whole. One method to increase the current through an LED via a digital out pin is to tie the LED anode to VCC and the cathode, via a resistor to the Mbed pin. The value of the resistor should be choosen to limit the current to the maximum of a single pin (which should be configured to sink current, not drive current). Then, if you tie two digital output pins together, you can alter the resistor to double the current (or use two resistors, one to each pin, thus connecting them in parallel which has the same effect as lowering the value of a single resistor). However, you cannot keep doing this, adding more and more pins as the chip itself will have a maximum sink current "overall" which you don't want to exceed without breaking it.

When it comes to joining two analogue pins together, well, without some sort of buffering all bets are off. No two analogue outputs are ever going to be identical and you may end up with a push/pull current flow between the pins, not so good. So in that case, I would just use a single output buffered with an Opamp that can deliver the current needed to drive the external circuit/LED.

But it seems you may need to get yourself an electronics catalogue for mail order components because it sounds like you may need some extra "ummmph"  to get those LEDs doing what you want ;)

28 Oct 2010

Oh, I should have mentioned also, as stated, you can use the Opamp/Analogue technique to raise the current. The other is to use a simple saturated FET amp and then alter the duty cycle. The duty cycle is of course what Lee W was talking about early.

In this setup, connect the Mbed pin to the FET gate directly. The Mbed pin is more than capable of switiching the FET on and off. Connect the FET drain to ground and then the FET source to the LED/resistor circuit to VCC. The FET is basically acting like a switch but can sink a lot more current than an MBed pin can. You can then select the resistor value to max the current through the LED when it's switched on. Altering the Mbed pin duty cycle then just changes the FET switching on/off speed thus altering it's brightness. And FETs (2n7000 or 2n7002 if using SMD parts) are pretty cheap and easily obtainable mail order.

28 Oct 2010

Usually logic pins are pretty poor at driving current, better at sinking! Still I would hesitate to sink more than a few milliamps on each pin. Use a FET or even cheaper a bipolar transistor to sink the current and use PWM to modulate the intensity!

Resistor in series with the diode (if 5 volt diode drops some 2 volt and hence you need to drop 3 volts over resisitor, i.e. 10 mA --> 300 ohm) connected to emitter of PNP, Ground the collector, and pull the base high with a ~1k-10 k resistor to Vcc. Use a low value resistor (~22 to 100 ohm) between base and your MBed I/O-port for added safety.

All resistor values are uncritical, use closest value at hand.

This way you can eaisily drive some high current diodes without any problems! If you run very high currents (>100mA) you may have to do something more fancy though...

Good Luck on the scary stuff :)

28 Oct 2010

To add to Lasse. This is basically how to drive the led. The left pin is an digital or analog out pin of the mbed.

 

 Image of the setup