NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Microcontroller Programming » Varying voltages

September 05, 2011
by ednachman
ednachman's Avatar

I want the output of voltage to be randomly selected from 0 to 5 volts. Can I program the MCU to do this?

September 05, 2011
by hariharan
hariharan's Avatar

i think pwm will solve the problem. go to the library and check out how to dim and brighten up a LED. but, that is not exactly variying voltage. I think a DAC (digital to analog) might solve the problem. u can do it with a couple of resisters and create a R-2R DAC. Check out this link: http://www.youtube.com/watch?v=b-vUg7h0lpE But it really depends upon what u r trying to achieve. what r u trying to do?

September 05, 2011
by ednachman
ednachman's Avatar

I'm attempting to randomly change voltages from three directions to a point. Once I figure out how to do one, I'll be able to configure the other two.

September 06, 2011
by ednachman
ednachman's Avatar

Hariharan: Using the mcu provided in NerdKits what pins should I be using to have the same configuration as the video you suggested.

September 06, 2011
by bretm
bretm's Avatar

Can you explain more about what you're trying to build? I'm not clear what "randomly change voltages from three directions to a point" means.

I wouldn't use an R-2R ladder just because it takes so many MCU pins and so many resistors. A single pin, a resistor, and a capacitor will do the trick for many applications, but not all.

September 06, 2011
by hariharan
hariharan's Avatar

for the R-2R dac, use a register on the mcu,PORTC, for example. but as bretm mentioned, it will take a lot of resistors and mcu pins. u need to tell us wat ur building. the solution could be much simpler

September 06, 2011
by Ralphxyz
Ralphxyz's Avatar

Come on hari. [quote] u need to tell us wat ur building. [/quote]

"you need to tell us what you are building" really is not that hard to type out.

Ralph

"I would rather be unemployed and healthy, than to sick to go to work." me

September 07, 2011
by bretm
bretm's Avatar

Come on, Ralph, it's "too sick", not "to sick". :-) Seriously though, he might only have one hand, with just a thumb or something, or be texting from a phone without T9, or be typing with a stick in his mouth because he's quadraplegic--who knows.

September 07, 2011
by ednachman
ednachman's Avatar

Here is the link to what I want to do: http://i.imgur.com/GkHIb.jpg

September 07, 2011
by bretm
bretm's Avatar

I see. I might be wrong, but I don't think that the small amount of current that the microcontroller can provide by itself will be enough to make a magnetic field strong enough to move iron filings on paper in any exciting way.

You can, however, use an external battery to power some electromagnets, and have the microcontroller control the current flow to each magnet. Take a look at "The coil driver" diagram at http://mekonik.wordpress.com/2009/03/17/arduino-magnet-levitation/ and see if that's something you're up for building (just the first circuit, not the whole article).

Post a Reply

Please log in to post a reply.

Did you know that you can build a circuit to convert the "dit" and "dah" of Morse code back into letters automatically? Learn more...