Introduction: Grove Voltage Divider

In a the last tutorial I showed you how to design a battery monitor, but it had a down side the which was it could not mes sure voltage ranges above 5v. To measure higher voltage ranges all you need is a grove voltage divider. The grove voltage divider was meant to monitor voltages and calculate it with high accuracy. It can measures voltages of up to 33v over the standard 5v which I showed you earlier.

So lets get started....

Step 1: Tools and Components

All that you need to get started with this instructable is -

Step 2: Circuit

There is not much of a circuit all that you have to connect is -

  • Arduino +5V - Grove Voltage Divider VCC
  • Arduino Gnd - Grove Voltage Divider Gnd
  • Arduino A0 - Grove Voltage Divider Sig

After getting the hardware ready it is time to upload the code.

Step 3: Code

All that the code does is reads the analog value and does some mathematics and prints it out on a serial monitor. The processed data can be used to control a robot which I will show soon.

void setup(){
Serial.begin(9600); }

void loop(){ long sensorValue=analogRead(A0); long sum=0; for(int i=0;i<1000;i++) { sum=sensorValue+sum; sensorValue=analogRead(A0); delay(2); } sum=sum/1000;

Serial.print("if you set the Gain to 10,the input voltage:"); Serial.println(10*sum*4980/1023.00); Serial.print("if you set the Gain to 3,the input voltage:"); Serial.println(3*sum*4980/1023.00); delay(1000); }