Go Down

Topic: What can Arduino MICRO input pins be used for? (Read 991 times) previous topic - next topic

32bit

Apr 20, 2017, 12:21 am Last Edit: Apr 20, 2017, 12:35 am by 32bit
Can the Arduino MICRO input pin, be used as a Voltage Follower?

The 1st Voltage Follower is connected to a variable voltage.
The 2nd Follower input, is exactly half the voltage of first.



My guess is Arduino inputs could not substitute for op-amp!

Also, can community suggest any books or info on the programing!
Has it got much similarity to basic?

DrDiettrich

Your circuit diagram does not make much sense to me, at least not without any load that unloads the caps. The feedback from the + output tends to make it quite unstable.

You'll need a 5V 20A supply to power the circuit.

Input pins are for input only, not for output. You can use the ADC and analogRead() to read the divided input voltage and the voltages on the caps, then output the required voltage to the TIP bases using PWM or DACs.

32bit

The capacitors are part of an experiment, work in progress.
I do have concerns about power segregation, and feedback from Capacitor Bank +.
This was drawn up initially to graphically represent the basic logic

After looking at a few related posts, I was pretty certain Arduino inputs could not substitute for op-amp.

I thought the Arduino might be able to act like a Half Bridge from a logical prospective!
New to Arduino, would you mind telling me a bit more to help.


ADC and analogRead()
It Reads the value from the specified analog pin.
Quote: to read the divided input voltage and the voltages on the caps.

How accurate is a Arduino analog pin?
What is your thinking in reading the Cap as well? (You are probably ahead of me)

Do you also refer to DACs function through Arduino?

This could be a tidy solution.
Appreciate any help with the basics.

JohnLincoln

It seems strange to want to use a £20/$20 complex digital device to try and emulate a £0.50/$0.50 analogue IC.

DrDiettrich

An opamp does not more than output vOut = (in+ - in-)*amplification, with vOut clipped to the operating voltage. This is what an Arduino can do as well. If you attach a H-Bridge, and assume infinite amplification, the bridge can be off (in+ = in-), source (in+ > in-) or sink (in+ < in-). Or from your circuit diagram, the attached TIP can only be turned on (source) and off, it cannot sink current.

If you want to use the Micro, look up its features in the data sheet. AFAIK the ADC has 10 bit resolution.

32bit


An opamp does not more than output vOut = (in+ - in-)*amplification, with vOut clipped to the operating voltage. This is what an Arduino can do as well. If you attach a H-Bridge, and assume infinite amplification, the bridge can be off (in+ = in-), source (in+ > in-) or sink (in+ < in-). Or from your circuit diagram, the attached TIP can only be turned on (source) and off, it cannot sink current.

If you want to use the Micro, look up its features in the data sheet. AFAIK the ADC has 10 bit resolution.
In the case of 1st op-amp it is operating off 5v and with follow voltage up to 3.529v.
The op-amps are being used as voltage followers, and are doing no more then volts out = volts in.
Basically, yes.

This is what an Arduino can do as well.
So are you saying there is no difference between the op-amp and Arduino in this application.
Good to know!

Quote: the attached TIP can only be turned on (source) and off, it cannot sink current.
Yes, the 2 TIP100 charge the Capacitor.

Quote: AFAIK the ADC has 10 bit resolution.
Is that a no?

I only mentioned H-Bridge because it has the same logic function as op-amps.
Please ignore any posters trying to insist I use H-bridge,or demanding answers.

=

So The Arduino can perform PWM and has suitable input pins.
Seems like it should be able to do follower and drive switches for series Capacitor Charger.







DrDiettrich

A digital solution can only work in discrete time steps. This delayed response may lead to overshooting output voltage or instabilities, unless taken into account in the regulator model.

You decide whether 10 bit ADC resolution is sufficient.

I'm not sure whether the lower opamp can do what it should in your circuit. The load draws the same current from both caps, and the upper opamp pushes the same current through both caps. If the capacities are the same, both caps will have the same voltage. So what's the effect of the lower opamp? It only can increase the voltage of the lower cap, so that it will have almost always a higher voltage than the upper cap has. If the lower opamp should compensate slightly different capacities or self-discharge of the caps, it must have push-pull capability.

32bit

The language has similarities to basic,
what is available in books or code for Arduino.

analogRead(pin)integer values range from 0 to 1023
analogWrite(pin,value) range from 0 to 255

So:
0 to 5v
Write limit = 256
5/256= 0.01953125v resolution

It can do what the op-amp does within limited resolution.

I understand the PWM output spending more time high for increasing voltage.
Is their an example code for Arduino input and output used as follower?
Any tricks to getting more resolution.

6 PWM outputs adds versatility
Still, Arduino is of interest!

32bit

A digital solution can only work in discrete time steps. This delayed response may lead to overshooting output voltage or instabilities, unless taken into account in the regulator model.

You decide whether 10 bit ADC resolution is sufficient.

I'm not sure whether the lower opamp can do what it should in your circuit. The load draws the same current from both caps, and the upper opamp pushes the same current through both caps. If the capacities are the same, both caps will have the same voltage. So what's the effect of the lower opamp? It only can increase the voltage of the lower cap, so that it will have almost always a higher voltage than the upper cap has. If the lower opamp should compensate slightly different capacities or self-discharge of the caps, it must have push-pull capability.
You are right, I will need to fix that:

Grumpy_Mike

#9
Apr 20, 2017, 08:52 pm Last Edit: Apr 20, 2017, 08:55 pm by Grumpy_Mike
Quote
So:
0 to 5v
Write limit = 256
5/256= 0.01953125v resolution
But understand that the analogue write only produces PWM and not an analogue signal. See http://www.thebox.myzen.co.uk/Tutorial/PWM.html

Quote
Is their an example code for Arduino input and output used as follower?
Code: [Select]
analogWrite(outPin,analogRead(inPin) >>4);

DrDiettrich

A voltage follower can be programmed like this:
Code: [Select]
 int vSet = analogRead(vInPin); //or use any other source for the setting
 int vDiff = vSet - analogRead(vFeedbackPin);
 analogWrite(vOutPin, (vDiff+offset)*amplification); //chose proper offset and amplification

According to your circuit you'd connect vSetPin to the voltage divider (+in), vOutPin to the TIP base, and vFeedbackPin (-in) to the cap.

32bit

But understand that the analogue write only produces PWM and not an analogue signal. See http://www.thebox.myzen.co.uk/Tutorial/PWM.html

Code: [Select]
analogWrite(outPin,analogRead(inPin) >>4);
In which case I would need a H-bridge to reproduce the input voltage.
I wanted to learn a bit about Arduino, will buy the Arduino MICRO.

The Arduino is not really much good compared to op-amp for this task.
But the power to create PLC circuits on the PC is game changing for me.

32bit

#12
Apr 20, 2017, 09:31 pm Last Edit: Apr 20, 2017, 09:44 pm by 32bit
A voltage follower can be programmed like this:
Code: [Select]
int vSet = analogRead(vInPin); //or use any other source for the setting
 int vDiff = vSet - analogRead(vFeedbackPin);
 analogWrite(vOutPin, (vDiff+offset)*amplification); //chose proper offset and amplification

According to your circuit you'd connect vSetPin to the voltage divider (+in), vOutPin to the TIP base, and vFeedbackPin (-in) to the cap.
I missed part of your post, are you saying the PWM output of Arduino would hold the Darlington, effectivly at the input voltage or analogRead.

Grumpy_Mike

Quote
In which case I would need a H-bridge to reproduce the input voltage.
No.

The analogue input can't read negative voltages. You have to bias it at 2.5V, so that bias is carried over when you do the read / write.

DrDiettrich

While the Darlington is continuously turned on and off by the PWM signal, the RC low pass filter will result in a minor ripple of the voltage on the cap. With a H-bridge output the bridge should be turned off when the voltage difference becomes lower than some arbitrary amount, depending e.g. on the ADC resolution.

In the given circuit, with a 5V supply, no negative voltages can occur.

Go Up