-
Voltage module testing
03/20/2014 at 00:31 • 0 commentsTesting some code to read the voltage divider and convert the A/D read to a voltage.
The 4.092 will need to be adjusted based on your resistors and tolerances.
This pix shows the web board, but the sample code is just testing the voltage divider.. I found the w5100 introduces resistance on pin A2,3,4,5 requiring some code tweeks. Also A0/A1 are not usable without modes the the network module since those pins are used for SD card control.
/*
Read voltage divider module.
Gary Sanders (N8EMR)
ohgary@gmail.com
*/
int volt_pin=5;
void setup() {
Serial.begin(9600); // initialize serial communications for debugging.
}
void loop() {
float voltage;
float l_volt;
l_volt=analogRead(volt_pin);
voltage=(l_volt/4.092)/10;
Serial.print(voltage);
Serial.println("V ");
delay(1000);
}
-
acs715 sketch
03/19/2014 at 00:42 • 0 commentsHere is a sketch to read the acs715 module and print the current going through the module. NOTE: the module is directional in nature. If your getting odd readings flip the connections on the acs715 module. I am not trying to lab grade current measurements, just get a reasonable look at current being used. If you need more accurate reading you might consider looping through the current read several times and averaging your results.
/*
Read http://www.pololu.com/ acs715 30amp 30v current modules
and serial print the value.
Gary (N8EMR)
ohgary@gmail.com
*/
float current_input_pin = A4; // Analog input pin that the carrier board OUT is connected to
float current_input_value = 0; // value read from the carrier boar
float amps = 0;
void setup() {
Serial.begin(9600); // initialize serial communications for debugging.
}
void loop() {
current_input_value = analogRead(current_input_pin);
amps = float ((((long)current_input_value * 5000 / 1024) - 500 ) * 1000 / 133)/1000;
if (amps < 0 )
amps = 0 ; // Get rid of sensor noise when current is at/near zero.
Serial.print(amps);
Serial.print("A ");
Serial.println("");
delay(1000);
}
-
Testing voltage modules
03/16/2014 at 20:46 • 0 commentsHere is the test setup for the voltage testing. A simple voltage divider network and sketch to look at an analog pin.
-
Current module testing
03/16/2014 at 20:43 • 0 commentsTesting the pololu.com
current module and sketches. Using a calibrated volt/amp meter to validate my readings. -
Basic hardware
03/12/2014 at 01:01 • 0 commentsGetting the basic hardware setup to do some testing of the voltage modules and the ethernet shield.