This is the development sandbox for the DRV425EVM and its magnetic sensing.

Dependencies:   mbed

/media/uploads/Krabby127/ohmboyzvectorized.png

Repository for the 2015 OhmBoyZ Capstone group.

Revision:
16:65b7b24fe260
Parent:
15:478a1f3ad7c2
Child:
17:9af7969cd74e
--- a/main.cpp	Tue Dec 08 02:59:10 2015 +0000
+++ b/main.cpp	Tue Dec 08 03:39:41 2015 +0000
@@ -11,15 +11,15 @@
     printf("\n\rAnalogIn example\n\r");
     while(1) {
         meas = analog_value.read(); // Converts and read the analog input value (value from 0.0 to 1.0)
-        meas *= 3.3; // Change the value to be in the 0 to 3.3 range (currently to mV)
+        meas *= 3.3; // Change the value to be in the 0 to 3.3 range (currently to V)
         printf("meas = %fmV\n\r",meas*1000); // Print out raw measurement in terms of mV
-        b=(meas-(3.3/2.0))/(4.0*12.2*100.0); // Based on equation 1 from DRV425EVM pdf
-        //VVOUT [V] = B × G × RSHUNT × GAMP = B [uT] × 12.2 mA/mT × RSHUNT [Ω] × 4 [V/V]
+        b=(meas-(3.3/2.0))/(4.0*12.2*100.0); // Based on equation 1 from DRV425EVM pdf (in T)
+        //VVOUT [V] = B × G × RSHUNT × GAMP = B [mT] × 12.2 mA/mT × RSHUNT [Ω] × 4 [V/V]
         //VVOUT is with reference to REFIN
         // 0 Tesla is VDD/2
         // 12.2 mA/mT
-        printf("b = %fuT\n\r",b*1000.0); // Print out b field measure in micro-Tesla
-        printf("b = %f Gauss\n\r", b/100000.0); // Output B field in Gauss
+        printf("b = %fuT\n\r",b*1000000.0); // Print out b field measure in micro-Tesla
+        printf("b = %f Gauss\n\r", b*1000); // Output B field in Gauss
         if (meas > 1.65) { // If the value is greater than 1.65V then switch the LED on
           // positive magnetic field
           led = 1;