complete noob needs advice

Hello, i need your advice/idea on a project of mine. I recently started watching videos with arduino and got interested in a few projects, so i wanted to make one of mine that i didnt actually see before. I couldnt find anything useful for my idea looking around the web so i decided to ask you here. I ordered one arduino uno that im waiting to arrive soon, but i wanted to ask a few things before i do something wrong with the board and burn it out. I have tried to find a good explanation of how the output pin setup worked, so what i could understand is that on uno's 3, 5, 6, 9, 10, and 11 pins we can have an analog signal between 0-5V with a duty cycle 0-100%. Does that mean that for example with duty cycle ot 50% i would have 2.5Volts DC after a RC filter for example, or did i understand that wrong? So at 100% will be 5V constant and on 5% duty cycle it would be 0.25Volts? If thats the case, can i use the arduino with some sort of amplifier so i can have a voltage supply between 0 and 100 volts for example controlled by the uno ? And is the current supply from the arduino enough to support that ?

telski:
on uno's 3, 5, 6, 9, 10, and 11 pins we can have an analog signal between 0-5V with a duty cycle 0-100%.

Despite the name, the Uno's analogWrite() does not produce an analog signal. It produces a PWM signal, which is quickly switching between 0 V and 5 V. However, you are correct that you can add an RC filter to convert the PWM signal to an analog voltage.

telski:
is the current supply from the arduino enough to support that ?

It's not clear which supply you're talking about. The absolute maximum current from the Arduino Uno's IO pins is 40 mA. However, you should never subject the Uno to absolute maximum conditions. I would say 35 mA is the highest I would consider, and even then being careful that it will never be exceeded.

The 5 V pin on the Uno can supply more current. How much depends on how you have the Uno powered.

If it's powered via the USB jack, or the 5 V pin, it will be limited by the power supply.

If the Uno is powered via the barrel jack or the Vin pin, it will be limited by the capabilities of the voltage regulator on the Uno. That will depend on the input voltage, and a bit by the ability of the regulator to dissipate heat (ambient temperature and ventilation being factors). You might expect to get somewhere around 150 mA total from the voltage regulator.

pert beat me to it, so this is mostly redundant...

so what i could understand is that on uno's 3, 5, 6, 9, 10, and 11 pins we can have an analog signal between 0-5V with a duty cycle 0-100%. Does that mean that for example with duty cycle ot 50% i would have 2.5Volts DC after a RC filter for example, or did i understand that wrong? So at 100% will be 5V constant and on 5% duty cycle it would be 0.25Volts?

That's all correct, except PWM is not analog until you filter it. analogWrite() doesn't really write analog.

In case you don't know this, the "load" on a filter can affect the cutoff frequency, and it makes a voltage divider along with the resistor in the filter. So, in general the load resistance be high relative to the "R" in the filter.

And, there's a trade-off between filtering, the speed that the analog can respond, and the PWM frequency. If you are making a power supply, the voltage doesn't have to change quickly so you can use a slow (low cut-off frequency) filter and get fairly-smooth DC.

If thats the case, can i use the arduino with some sort of amplifier so i can have a voltage supply between 0 and 100 volts for example controlled by the uno ?

That can be done but a linear amplifier is not an easy thing to build. And, transistors or MOSFETs in this kind of linear application where the transistor/MOSFET s partially-on have to dissipate lots of power/heat.

A "modern" power supply would generally be a switching (AKA switchmode) design. Switching power supplies (and Class-D audio amplifiers) use a kind of very-fast PWM in a feedback loop to hold the voltage constant and an L-C filter. (The inductor is a very-important part of switchmode designs.) With transistor/MOSFET switching on-or-off, it doesn't have to dissipate nearly as much power. With very little power wasted in heat, switching power supplies are nearly 100% efficient.

Typically, a "simple" power supply doesn't have a programmable microcontroller.

And is the current supply from the arduino enough to support that ?

Not directly. As you know, the Arduino puts-out 5V. And the "absolute maximum" allowable current is 40mA. That's why you need an amplifier to boost the voltage & current.

And of course, you need a power source for the required voltage & current.... Basically, a "simple" power supply putting-out 100V or more at the required current, with a transformer, rectifier, and capacitor.

Commercial switching supplies rectify the line voltage and there's a high-frequency oscillator feeding a high-frequency transformer, and that's all integrated into the PWM/switching. ...It's complex, it takes a special transformer, there's enough current & voltage to fry components during development & testing and I wouldn't attempt to build anything like that at home!


You didn't ask this, but if you have a 100V DC motor (or a 100V lamp) you can simply amplify the PWM. That's a LOT easier than building a linear amplifier. Of course 100V POW would require a 100V source, but [u]here is a driver circuit[/u] that can "boost" the PWM.

P.S.
Anything greater than 50V is considered dangerous and we always get nervous when "noobs" ask about projects using lethal voltages...

Thanks for the replies so far!

pert:
The absolute maximum current from the Arduino Uno's IO pins is 40 mA. However, you should never subject the Uno to absolute maximum conditions. I would say 35 mA is the highest I would consider, and even then being careful that it will never be exceeded.

The 5 V pin on the Uno can supply more current. How much depends on how you have the Uno powered.

If it's powered via the USB jack, or the 5 V pin, it will be limited by the power supply.

If the Uno is powered via the barrel jack or the Vin pin, it will be limited by the capabilities of the voltage regulator on the Uno. That will depend on the input voltage, and a bit by the ability of the regulator to dissipate heat (ambient temperature and ventilation being factors). You might expect to get somewhere around 150 mA total from the voltage regulator.

Appears i didnt know that, i thought the IO pins always provide 40ma, but is that adjustable from the code itself? And for the supply i will most likely power the arduino vie my laptop (with whatever cable it comes with). I think it was USB in the pictures.

As for the other part of my question, i want to make a controllable voltage source between 0-100 volts, depending on the output of the arduino, for example 20 times multiplied, so 50% is 50volts, 25% is 25volts and 100% is 100 volts. Doesnt have to happen really fast, but i dont understand the circuits that much. I read about the low-pass filter, and it takes like 300ms to reach the stable dc value, and that is completely ok for me. I was looking in the internet about voltage boosters, or step-up controllers and etc, but i didnt find anything compatible with the arduino 0-5 volts as input. Most of them are modules with pots and are 5 volts supply and can for example vary between 20-40 volts or etc. So my other idea i got was to somehow connect the arduino to that pot and control the output value of that converted via the arduino instead of the pot, is that a valid option, what is your opinion about it? Is this easy to do, and will it work, if so, how can i possibly do it?

telski:
i thought the IO pins always provide 40ma

They provide whatever you draw from them, until something burns up inside the microcontroller and breaks the circuit. 40 mA is the point where damage starts to occur.

telski:
is that adjustable from the code itself?

The current isn't determined by the microcontroller. It's determined by whatever circuit you have connected to the microcontroller's pin.