Go Down

Topic: DC Voltage Needs logging to dBase (Read 564 times) previous topic - next topic

t0pc4t

Hi - I have a number of laser micrometers (most of which are 0 - 15v output (dependant upon diameter observed), while I have another that is -5vDC - +5vDC.

I would like to be able to input the 'variable' voltage into the Arduino Uno, and based on the input, a conversion will be applied (for example: 5v = 10mm, and 15v = 18mm) - I need to :
1) Convert the voltage into something the Arduino can manage,
2) have the Arduino ideally convert the data to a dimensional value,
3) transfer the data to a database (preferable m$ access - or if needs be, something like xampp)

Any advice, guidance would be appreciated.

robtillaart


1)
Use a voltage divider, see - http://en.wikipedia.org/wiki/Voltage_divider -
for 15V -> 5V  you need     

   15V -- 20K --+-- 10K -- GND 

Connect Arduino analog in to + 

2) Arduino reads 0..1023  == 0..5V
float voltage = 5.0 * analogRead(A0) /1023.0;

3) Check - http://www.mikmo.dk/gobetwino.html -

Succes
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

t0pc4t

Advanced thanks - I shall try and give this a go next week.
(Or at least my "student" will)

Will update if we get success, or if extra guidance is required.

Thankyou

t0pc4t

For those that are interested - We have had a level of success on this project (Have made a voltage divider that sits like a shield on the Arduino Board)

Voltage in is 0 - 10v, so a nice simple divider was implemented - only problem is resolution - as 10v = 40mm, and most of what is measured is at 20mm top end (after voltage division = 2.5v (511 digital).... Any way, we are using "plx_daq" to communicate with Excel, which automatically produces a histogram with Distribution plot, and updates the CP / CPK / MEAN / STdev etc.... and a live run chart that shows the last 20 results including the min and max of the 200 samples taken in the 1 second snapshop - this has been tested on about 40kilometers of product, and works well.

If anybody can suggest or better our structure, please feel free to do so - LET US KNOW as we want to improve more.. ideally get the arduion to calculate stdev on its own on the run

const int Analog_In_Pin = A1  ;

double Calibration = 1.0215 ; // Due to Resisistor Variances on Voltage Divider - Used to align with Known Diameter Output against Calibration Pins (6.00mm - 25.00mm)
double Digital_Reading = 0 ;
double Analog_Reading = 0 ;
double Storing_Array_Digital[200] = {} ;
double Storing_Array_Analog[200] = {} ;
double *Pointer_Digital ;
double *Pointer_Analog ;
double Output_Analog ;
double Output_Digital ;
double Sum ;
double Average ;
double Previous_Reading ;
double Max_Digital ;
double Min_Digital ;
double Max_Analog ;
double Min_Analog ;
int i = 0 ;

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

}
void loop() {
   Previous_Reading = 0 ;
   Sum = 0 ;
   Average = 0 ;
   for ( i = 0 ; i <=199 ; i = i +1 ){

   Digital_Reading = analogRead(Analog_In_Pin)  ;

   // C A L I B R A T I O N   S T A R T
   Digital_Reading = Digital_Reading * Calibration;
   // C A L I B R A T I O N   E N D
   Analog_Reading = Digital_Reading/1023*5 ;
   Storing_Array_Digital = Digital_Reading ;
   Storing_Array_Analog = Analog_Reading ;
   Sum = Sum + Analog_Reading ;
   Average = Sum/200 ;
     
     if ( i == 0) {
     Max_Digital = Digital_Reading ;
     Min_Digital = Digital_Reading ;
     Max_Analog = Analog_Reading ;
     Min_Analog = Analog_Reading ;
     }
     if ( i != 0 && Digital_Reading > Max_Digital ){
       Max_Digital = Digital_Reading ;
     }
     if ( i!= 0 && Analog_Reading > Max_Analog) {
     Max_Analog = Analog_Reading ;
     }
     if ( i!= 0 && Digital_Reading < Min_Digital ) {
      Min_Digital = Digital_Reading  ;
     }
     if ( i != 0 && Analog_Reading < Min_Analog) {
     Min_Analog = Analog_Reading ;
     }
   delay(5) ;
   } 
   
     Average = Average*8 ;
     Min_Analog = Min_Analog*8 ;
     Max_Analog = Max_Analog*8 ;
   Serial.print("DATA") ;
   Serial.print(",");
   Serial.print(Average,5);
   Serial.print(",") ;
   Serial.print(Min_Analog,5) ;
   Serial.print(",") ;
   Serial.println(Max_Analog,5) ;

}

Go Up