Page 1 of 1
Forum

Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!

Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.

Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is most likely no translated for the post!




AnalogRead with a d...
 
Share:
Notifications
Clear all

AnalogRead with a driver shield who's max is 3.3V


(@karol)
Active Member
Joined: 1 month ago
Posts: 8
Topic starter  

On the ARDUINO MOTOR SHIELD REV3's pins 0 and 1:

"On each channel will be a voltage proportional to the measured current, which can be read as a normal analog input, through the function analogRead() on the analog input A0 and A1. For your convenience it is calibrated to be 3.3V when the channel is delivering its maximum possible current, that is 2A. "

The Arduino analogRead gives 1023 at 5V.

I wrote:

int Reading=analogRead(SensePin);
float Ampere=((5/3.3)*Reading)/511.5;

1023/2=511.5

I get reasonable readings, but i don't know if they're true.


ReplyQuote
 Hans
(@hans)
Noble Member Admin
Joined: 8 years ago
Posts: 1832
 

Hi Karol,

The analogRead does not measure Amps. It measures Voltage (see this article).
I'm unaware of any method to read Ampere with this.

So I had to do some reading up on this: seems the Current Sensing pin some how converts Amps to Voltage.
Since I do not have this shield available, I cannot tell you much about it.

Maybe this article is helpful?

 

 

* Note: to "scale" a value you can also use the map function, eg.:

map(analogRead(SensePin), 0, 1024, 0, 2000)

This scales the result (between 0 and 1024) to a different scale (0 to 2000).

 

* if you would still like to read the voltage: 

The voltage would be calculated like so for a 5v microcontroller like an Arduino Uno:

float voltage= sensorValue * (5.0 / 1023.0);

 

For a 3.3v microcontroller this would be:

float voltage= sensorValue * (3,3 / 1023.0);

ReplyQuote

Like what you see and you'd like to help out? 

The best way to help is of course by assisting others with their questions here in the forum, but you can also help us out in other ways:

- Do your shopping at Amazon, it will not cost you anything extra but may generate a small commission for us,
- send a cup of coffee through PayPal ($5, $10, $20, or custom amount),
- become a Patreon,
- donate BitCoin (BTC), or BitCoinCash (BCH).

Share: