Hi! I am supposed to get a 20mA output when connecting this circuit to Arduino
And is this the correct coding?
void setup() {
Serial.begin(9600);
}
void loop() {
int currentValue = analogRead(A0);
Serial.println(currentValue);
}
From the uploaded image it looks like they're 100 and 10k Ohm, but still wonder what this cabling really is (DrDettrich asked a diagram and I endorse the request...).
It doesn't seem to me to be anyhow compliant with the above scheme, the formula, and the expected value of 20 mA (if Rset is 100 and Rout is the 10k, it gives 0.0101 mA, if Rset=10k and Rout=100 is still just 1.01 mA).
Waiting the OP to give more information.
This will mean 2V @ 20mA on Rout. Adding 1.2V minimal Vcc remain max. 1.8V on the load when everything is powered from a 5V output. I don't think that this is enough voltage for the receiver.
If the sketch measures Vout or Vset then the voltage seems to be about 100mV, just as expected from Rset = 10k.
Hi! I am supposed to get an output when connecting this circuit to Arduino. How do I get the output? Is the way I connect it correct? And is this the correct coding?
void setup() {
Serial.begin(9600);
}
void loop() {
int currentValue = analogRead(A0);
Serial.println(currentValue);
}
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, component names and pin labels.
What are you trying to measure and where from?
Current or voltage, we need to see a schematic.
Because your IC is mounted on a PCB we cannot make out what connections go where?
I think you have connected A0 to ground.
Then the value printed will of course be zero.
What are you going to do with this current source.
From the resistor values I think I see (100k + 10 ohm) I calculate that you just have a 100mA load on the 5volt supply. Doing nothing than loading the supply.
If you connect A0 to OUT, then you should get an A/D value of about 240.
Leo..
A fixed 10uA flows through Rset (see datasheet),
so if you use a 20k resistor, then the voltdrop across that resistor is 0.2volt (Ohm's law).
The chip forces that 0.2volt also across the 10 ohm Rout, resulting in 20mA (Ohm's law).
In your circuit you just dump that current to ground.
If you measure that 0.2volt across the 10 ohm resistor, then the 10-bit A/D of a 5volt-logic Uno will return in theory 0.2 / 5 * 1024 = 41. Practically it could differ, becasue of resistor and 5volt tolerances.
Leo..
Your two topics on the same or similar subject have been merged.
Please do not duplicate your questions as doing so wastes the time and effort of the volunteers trying to help you as they are then answering the same thing in different places.
Please create one topic only for your question and choose the forum category carefully. If you have multiple questions about the same project then please ask your questions in the one topic as the answers to one question provide useful context for the others, and also you won’t have to keep explaining your project repeatedly.
Repeated duplicate posting could result in a temporary or permanent ban from the forum.
Could you take a few moments to Learn How To Use The Forum
It will help you get the best out of the forum in the future.
Are you randomly juggling with the cables without knowing what you're gonna do, and hoping we can understand what you get, even after most of us asked you to post a schematic diagram and/or what is that PCB above (and you never answered)?
C'm on, if you need help please help us to help you, and make things easier. Thanks.
Under regular conditions the voltage on Rset and Rout are the same. You adjust it using Rset.
But all that does not help in a current-loop Serial output.
If you don't understand what you should do, then here a suggestion:
Connect a load (10 Ohm) between Rout and GND and measure the voltage on that resistor. Which ADC reading and which voltage can you expect from a properly configured 20mA source?