Go Down

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

#### t0pc4t

##### Sep 21, 2011, 07:54 pm
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
##### Sep 22, 2011, 06:58 am

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

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

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

#2
##### Sep 23, 2011, 08:31 pm
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

#3
##### Nov 12, 2011, 10:00 pm
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 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 Max_Digital ;
double Min_Digital ;
double Max_Analog ;
double Min_Analog ;
int i = 0 ;

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

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

// C A L I B R A T I O N   S T A R T
// C A L I B R A T I O N   E N D
Sum = Sum + Analog_Reading ;
Average = Sum/200 ;

if ( i == 0) {
}
if ( i != 0 && Digital_Reading > Max_Digital ){
}
if ( i!= 0 && Analog_Reading > Max_Analog) {
}
if ( i!= 0 && Digital_Reading < Min_Digital ) {
}
if ( i != 0 && Analog_Reading < Min_Analog) {
}
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