You are on page 1of 2

Sketch utilizado en el Arduino

Grupo 9 del laboratorio de Fisicoquímica 2

Héctor Mauricio Morales Rincón, Diana Patricia Luengas Castro

#include <Q2HX711.h>

#include <OneWire.h>

#include <DallasTemperature.h>

const byte MPS_OUT_pin = 2; // OUT data pin

const byte MPS_SCK_pin = 3; // clock data pin

int avg_size = 10; // #pts to average over

Q2HX711 MPS20N0040D(MPS_OUT_pin, MPS_SCK_pin); // start comm with the HX710B

const int SENSOR_PIN = 13; // Arduino pin connected to DS18B20 sensor's DQ pin

OneWire oneWire(SENSOR_PIN); // setup a oneWire instance

DallasTemperature tempSensor(&oneWire); // pass oneWire to DallasTemperature library

float tempCelsius; // temperature in Celsius

float tempFahrenheit; // temperature in Fahrenheit

void setup() {

Serial.begin(9600); // start the serial port

tempSensor.begin(); // initialize the sensor

void loop() {

float avg_val = 0.0; // variable for averaging


Sketch utilizado en el Arduino
for (int ii=0;ii<avg_size;ii++){

avg_val += MPS20N0040D.read()/100;// add multiple ADC readings

delay(500); // delay between readings

avg_val /= avg_size;

Serial.print("Presion (Pa)=");

Serial.println(avg_val,0); // print out the average

tempSensor.requestTemperatures(); // send the command to get temperatures

tempCelsius = tempSensor.getTempCByIndex(0); // read temperature in Celsius

tempFahrenheit = tempCelsius * 9 / 5 + 32; // convert Celsius to Fahrenheit

Serial.print("Temperature: ");

Serial.print(tempCelsius); // print the temperature in Celsius

Serial.print("°C");

Serial.print(" ~ "); // separator between Celsius and Fahrenheit

Serial.print(tempFahrenheit); // print the temperature in Fahrenheit

Serial.println("°F");

delay(300000);

You might also like