Hello all,
This is my first time with an Arduino and my plan is to use it together with a MKS 901p, which is basically a vacuum sensor that sends the value of the pressure in an analog signal, from 0 to 9vdc. Here is a link for a small document with the specifications of the gauge https://www.mksinst.com/docs/R/901PStandardSetup-MAN.pdf and another link for the manual https://www.mksinst.com/docs/R/901-MAN-RJ.pdf
My main question is not how to use the AnalogRead function, since I have watched videos and read the Arduino page explaining it, but from what I understand it has a maximum analog voltage of 5volts, while my gauge can send a signal of up to 9volts. So there you can see my problem.
Any guidance would be greatly appreciated, or also any book/webpage that works as a tutorial for a new Arduino user would also be greatly appreciated.
Thanks for reading!
Thanks! I am new to electronics so I didn't knew what a voltage divider was. I studied it a bit and I will be using a 3k9Ω and a 4k7Ω resistor, this way the voltage will be scaled down to 0-4.91V (those where the resistors I was able to get).
I will add the code I will use and photos of the setup, just in case someone wants to build their own high vacuum gauge.
I am in the process of coding at the moment. And since I want to know the code is reliable I am using a potentiometer connected to the 5v output pin of the Arduino, as if it represented the analog signal of the vacuum transducer. I am experienced with Python but not so with Arduino, so here is the code I am trying to do in python 3.6
#Voltage should be read by a voltmeter in an arduino
voltage = float(input("Voltage: "))
pressure = 10 ** (voltage - 6)
#We print accordingly to the range of the pressure
#First we define Torr above 0.99
if pressure > 0.99:
print round(pressure, 2), "Torr"
#In the latter we print only milliTorr (also known as microns)
elif pressure > 0.0009:
print round((pressure * (10 ** 3)), 2), "milliTorr"
#For smaller than microns we preffer to use exponents in Torr (e.g 1.2EE-6 Torr)
else:
print "{:.2e}".format(pressure), "Torr"
And this is what I have done using the Arduino, I am on the last line and can't figure out how to SerialPrint in scientific notation.
/*
MKS901p Vacuum Transducer 0-9VDC, 1VDC per Decade. Using a voltage divider of 5kΩ and 4kΩ to get the analog signal down to 0-5VDC.
*/
//the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 9V):
float voltage = sensorValue * (9.0 / 1023.0) - 6;
//Convert the voltage signal to presure
float pressure = pow(10, voltage);
//We print accordingly to the range of the pressure
//First we define Torr above 0.99
if (pressure > 0.99) {
Serial.print(pressure, 2);
Serial.println(" Torr");
}
//In the latter we print only milliTorr (also known as microns)
else if (pressure > 0.0009) {
Serial.print(pressure * (pow(10, 3)), 2);
Serial.println(" milliTorr");
}
//For smaller than microns we preffer to use exponents in Torr (e.g 1.2EE-6 Torr)
else {
Serial.print(pressure, 10) /*scientific notation here*/;
Serial.println(" Torr");
}
}
Any tips on how to get scientific notation?