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 no translation for that post!



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

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

2 Posts
2 Users
0 Reactions
2,325 Views
(@karol)
Eminent Member
Joined: 4 years ago
Posts: 12
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)
Famed Member Admin
Joined: 12 years ago
Posts: 2859
 

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
Share: