Help! Newbie, and i dont know where to go

Hi there.

I am trying to modify the aerodynamics around my car, and before I do anything I need data. I need to measure the air pressure at a couple of hundred points around the car.

I have been doing a LOT of research, and doing the data gathering with a manometer tube on the seat next to me while barreling down the highway seems a bit...... dangerous? Inefficient to say the least.

What I am thinking of doing is placing 4 pressure sensors in specific locations, reading the values into a spreadsheet and then repeating, for a couple of times.
I purchased a computer and a learning kit for me and my son to learn how to do stuff and I want to use this opportunity to develop our first project.

Has anyone done something like this? Pointers and advice is really needed.
I am on the mechanical side of the aircraft industry, so the building of stuff is a piece of cake. The moment electrical stuff is added, I lose the plot completely.

Any help will be greatly appreciated.
Regards
Alexander

Welcome to the forum

Your topic has been moved to the Project Guidance category of the forum as it is more appropriate for your question

Thank you, I was just about to ask the same question in this category. been reading through the forum lists.

i really dont know what I am doing.

Asking the same question in 2 or more categories is regarded as bad manners so please don't do it

If you are unsure where to post a question then you could PM a moderator asking for advice

This is what dataloggers are for.
That link will let you save data from an arduino to an SD card with a timestamp. You will also need an arduino (Adafruit Feather) and pressure sensors.

There are other arduino datalogger shields, but that's the only one I've actually used. Or you can purchase prebuilt dataloggers off the shelf. It's a pretty mature technology.

Thank you very much.

I plan on buying 5 HKD BAROMTRC SENSR-BMP280-3.3. They seem to sensitive enough to measure increments of inches of water. I was pointed to a website with an arduino program and wiring to read one sensor at a time. I will order the Hardware after payday and then get one sensor to work. Then will modify the program to read 5 at a time.
Where can I look for the programming to add the data logger?

First, get the hardware. Second get the one sensor working.
I will ask for advice again as soon as I have that sorted.

Thank you

You'll probably have to write that yourself. The Adafruit site is very helpful and has lots of tutorials on using their products.

Adafruit sells pressure sensors, too. Support for their products by paid professional engineers is available free on the Adafruit user forum.

Then you understand the need for a controlled environment, not an open highway with a multitude of random wind and air movements. Do like the Wright brothers and make a wind tunnel and a model of your car with sensors.

Hi @alexvanwyk I suggest you to go for a raspberry Pi or something similar. Through raspberry Pi you can directly obtain your data in a csv file or Google Sheets {The best} which can be easily accessed. This will ensure the effort to setup your requirements will remain low and you can spend time on mechanical stuff. There are a lot of tutorials online on how you can achieve the same.
Forum members correct me if wrong.

Thanks

Thank you for the replies.

I will look into the different computer options. My main point is that I already have the arduino computer. They are ridiculously expensive here, probably because the market is limited to a very small group, and the exchange rate is horrendous.

As for the wind tunnel.....
I have given it a large amount of thought. Its what keeps me up at night.
Most of the information on the internet is focused at high performance and high speed.
I drive a station wagon that I use off road a lot. In fact I bought it specifically for its reputation as a good offroader, and I have been to places where the average 4X4 driver is scared to go. I also haul the family on long distance trips very frequently.

So it boils down to....
1: The stupid plastic panel Under the engine has disintegrated with time.
2: I have time and a bucket load of fibreglass that is going to expire soon.
3: I plan on measuring the real world conditions around the car and then making one change, and then measuring the difference. My daily commute consists of a stretch of highway that is perfectly flat, straight, smooth and undisturbed by any buildings, or even trees for that matter. I can gather data twice everyday for a week, spend the weekend modifying and then repeating.

I dont expect to see any spectacular changes, but even a 5% improvement will make a massive difference over the distances I drive. And I have to replace the panel, so I can just as well do it properly and learn a new skillset.

Update.....

I bought a XGZP6857D010KPGPN sensor
Its a -10kpa to +10kps module that will measure the range of pressure i need.( I hope)

There is a code for the Arduino computer on the website where i bought it specifically for that sensor but.....

They don't define what pins are the input pins.
I have ground, and 3.3V connected.
where do I plug the other 2 pins in.
SCL is the clock
SDA is the Data.

Code is copied below.

//Libraries

#include <Arduino.h>

#include <Wire.h>

 

//constants & variables

bool error=0;                             //reading error variable (not used in this sketch)

float pressureKPA=0.0;                    //declare pressure KPa variable

float pressureCMH2O=0.0;                  //declare pressure cmH2O variable

float temperatureC=0.0;                   //declare temperature Celsius variable

float temperatureF=0.0;                   //declare temperature Fahrenheit

long startMillis=0;                       //start sampling milliseconds time

const long period=2000;                   //time between samples in milliseconds

 

//hardware settings

 

//functions

bool readCFSensor(float &temp, float &press,byte sensorAddress);

 

void setup() {

  Serial.begin(115200);                     //begin serial port

  Wire.begin();                           //begin i2c bus

  delay(200);                             //wait for electronics

 

}

 

void loop() {

 

  Serial.println("");                                                                           //

  Serial.println(F("-------------------------------------------------------------------------"));  //samples division

  Serial.println("");                                                                           //

 

  startMillis=millis();                                             //save the starting time

  error = readCFSensor(temperatureC,pressureKPA,0x6D);              //start conversion and read on pressure sensor ad 0x6D address

 

  Serial.println("Temperature *C: " + String(temperatureC,1));      //print *C temperature

  temperatureF= temperatureC * 1.8 + 32;                            //*C to *F conversion

  Serial.println("Temperature *F: " + String(temperatureF,1));      //print *F temperature

 

  Serial.println("Pressure KPa: " + String(pressureKPA,3));         //print KPa pressure

  pressureCMH2O = pressureKPA * 10.1972;                            //KPa to cmH2O conversion

  Serial.println("Pressure cmH2O: " + String(pressureCMH2O,2));     //print cmH2O pressure

 

  while((millis()-startMillis) < period);                           //waits until period done

}

 

bool readCFSensor(float &temp, float &press,byte sensorAddress) {

 

  byte reg0xA5=0;

 

  Wire.beginTransmission(sensorAddress);    //send Start and sensor address

  Wire.write(0xA5);                         //send 0xA5 register address

  Wire.endTransmission();                   //send Stop

  Wire.requestFrom(sensorAddress,byte(1));  //send Start and read 1 byte command from sensor address

  if(Wire.available()){                     //check if data is available on i2c buffer

    reg0xA5 = Wire.read();                  //read 0xA5 register value

  }

  Wire.endTransmission();                   //send Stop

  Serial.println("Register 0xA5 read: " + String(reg0xA5,HEX));           //for debugging purposes

 

  reg0xA5 = reg0xA5 & 0xFD;                 //mask 0xA5 register AND 0xFD to set ADC output calibrated data

  Wire.beginTransmission(sensorAddress);    //send Start and sensor address

  Wire.write(0xA5);                         //send 0xA5 register address

  Wire.write(reg0xA5);                      //send 0xA5 regiter new value

  Wire.endTransmission();                   //send Stop

  Serial.println("Write 0xA5 register: " + String(reg0xA5,HEX));         //for debugging purposes

 

  Wire.beginTransmission(sensorAddress);    //send Start and sensor address

  Wire.write(0x30);                         //send 0x30 register address

  Wire.write(0x0A);                         //set and start combined conversion

  Wire.endTransmission();                   //send Stop

  Serial.println("Write 0x0A on 0x30 register and start conversion");    //for debugging purposes

 

  byte reg0x30 = 0x08;                      //declare byte variable for 0x30 register copy (0x08 initializing for while enter)

  while((reg0x30 & 0x08) > 0) {             //loop while bit 3 of 0x30 register copy is 1

    delay(1);                               //1mS delay

    Wire.beginTransmission(sensorAddress);  //send Start and sensor address

    Wire.write(0x30);                       //send 0x30 register address

    Wire.endTransmission();                 //send Stop

    Wire.requestFrom(sensorAddress,byte(1));//send Start and read 1 byte command from sensor address

    if(Wire.available()){                   //check if data is available on i2c buffer

      reg0x30 = Wire.read();                //read 0x30 register value

    }

    Wire.endTransmission();                 //send Stop

    Serial.println("Register 0x30 read: " + String(reg0x30,HEX));         //for debugging purposes

  }

 

  unsigned long pressure24bit;              //declare 32bit variable for pressure ADC 24bit value

  byte pressHigh=0;                         //declare byte temporal pressure high byte variable

  byte pressMid=0;                          //declare byte temporal pressure middle byte variable

  byte pressLow=0;                          //declare byte temporal pressure low byte variable

 

  Wire.beginTransmission(sensorAddress);    //send Start and sensor address

  Wire.write(0x06);                         //send pressure high byte register address

  Wire.endTransmission();                   //send Stop

  Wire.requestFrom(sensorAddress,byte(3));  //send Start and read 1 byte command from sensor address

  while(Wire.available() < 3);              //wait for 3 byte on buffer

  pressHigh = Wire.read();                  //read pressure high byte

  pressMid = Wire.read();                   //read pressure middle byte

  pressLow = Wire.read();                   //read pressure low byte

  Wire.endTransmission();                   //send Stop

 

  Serial.print(String(pressHigh));            //for debugging purposes

  Serial.print("," + String(pressMid));              //for debugging purposes

  Serial.print("," + String(pressLow));              //for debugging purposes

 

  pressure24bit = pressure24bit | pressHigh;

  pressure24bit = pressure24bit & 0x000000FF;

  pressure24bit = pressure24bit << 8;

 

  pressure24bit = pressure24bit | pressMid;

  pressure24bit = pressure24bit & 0x0000FFFF;

  pressure24bit = pressure24bit << 8;

 

  pressure24bit = pressure24bit | pressLow;

  pressure24bit = pressure24bit & 0x00FFFFFF;

 

  Serial.print(":" + String(pressure24bit));      //for debugging purposes

  int temp16bit=0;                          //declare 16bit variable for temperature ADC value

  byte tempHigh=0;                          //declare temperature high byte variable

  byte tempLow=0;                           //declare temperature low byte variable

 

  Wire.beginTransmission(sensorAddress);    //send Start and sensor address

  Wire.write(0x09);                         //send temperature high byte register address

  Wire.endTransmission();                   //send Stop

  Wire.requestFrom(sensorAddress,byte(2));  //send Start and read 1 byte command from sensor address

  while(Wire.available() < 2);              //wait for 2 byte on buffer

  tempHigh = Wire.read();                   //read temperature high byte

  tempLow = Wire.read();                    //read temperature low byte

  Wire.endTransmission();                   //send Stop

  Serial.print(" - " + String(tempHigh));           //for debugging purposes

  Serial.print("," + String(tempLow));            //for debugging purposes

 

  temp16bit = tempHigh * 256 + tempLow;     //merge of 16bit temperature ADC value

  Serial.println(":" + String(temp16bit));       //for debugging purposes

 

  temp = float(temp16bit)/256;              //real Celsius temperature calculation

 

 

  if(pressure24bit > 8388608) {                                         //check sign bit for two's complement

    press = (float(pressure24bit) - float(16777216)) * 0.0000078125;    //KPa negative pressure calculation

  }

  else {                                                                //no sign

    press = float(pressure24bit) * 0.0000078125;                        //KPa positive pressure calculation

  }

 

  return 0;

}

Have you told us which Arduino board you are using ?

Whatever it is, then its data sheet/specification will tell you which pins to use for SDA and SCL and they may even be marked as such on the board

No I didn't..... sorry.

I bought it as part of a starter kit, so there were no data sheets involved.
All I see is Arduino UNO R3 development board.

Did some research and found the data sheet.
plugged it in like i thought it should and it works.

Thank you very much.

My next step is to confirm it works and build the hardware to make it work in the vehicle.

Step after that will be to figure out how to measure up to 5 points at the same time.

Will post at the next stumbling block.

I assume that you have discovered that for a Uno SDA is pin A4 and SCL is pin A5 but be aware that there is a trap for the unwary on some Uno boards. They have pins explicitly labelled SDA and SCL as well as separate pins labelled A4 and A5. However, both pairs are connected to the same pair of pins on the processor so you cannot use say SDA and A4 pins for two different purposes in the same sketch

Good to know.

Mine only has A4 and A5.
I appreciate the info. I will squirrel it away for the next board I buy.

Thanks

Good morning.

I got all the hardware and fitted, and I got some readings that I can use.
I have edited the program to give me data in a format that I can make work and 1 out of 5 data runs I can make conclusions on what to modify on the car.

This brings me to 3 questions where I ask for help and pointers in the right direction.

1: Is there a tutorial / class on how to write the programs?
I did computer programming as a subject at school, 25 years ago. ( good grief I am getting old) :hushed: There are a lot of lines of code that I dont understand the reasoning for and even the basic format is not very clear. I would like to understand that better

2: I am reading 1 digital input at a time. Can I read more that one sensor at a time? do I need other hardware to combine the readings to the computer?

3: I am doing a data run with the computer plugged into the Arduino board, then displaying the readings on the serial screen. At the end of the run I copy the screen and paste in word, then convert to .TXT and import to excell and then have to convert to meaningfull readings before analysing.
Its working, but not optimal. The computer is on the back seat of the car while barreling down the highway. So start the program, check that it is reading, jump in the front, hit the gas, do the run, stop, hop out and then stop the computer.

Suggestions please?
Thinking a data logger? ( adding complications to the program and cost to the hardware, but not too a big concern. It will just add time to the project as I buy when I have spare cash )
Is there a way to read the data into a file on the computer so I dont need to copy and paste?

Its clunky, Its complicated, Its fiddly. Part of the challenge is to learn a skill, and to play with the car.

Thanks for the help so far. I am learning a lot.