Newbie 1st project - Will this work?

Hello all,

I am taking the plunge into Arduinos and I am working on programing for an Ethanol analyzer and fuel pressure system. I have taken 2 sketches that I found from different sources and tried combining them for this task. Can someone please take a look at this coding and advise if this should work? I am still working on the wiring and Bluetooth app for this device, so at the moment I don't have a way to inspect. Any help would be appreciated.

https://create.arduino.cc/editor/gjohnson7771/6c198dcd-fd49-4c71-a61d-2b1c4cad4b95/preview

Thank you ,

Grant

Welcome to the forum.

Please read and follow the instructions in the how to use the forum post.

For a question like yours, post the code in line, using code tags, links to all the devices, and a wiring diagram. Hand drawn is fine (Fritzing is not).

Unless someone has exactly the same hardware as you intend to use, no-one is going to go line-by-line through 18kB of source

As AWOL said.
Please, try it yourself and see what happens. I guarantee it won't work as you hope.

You should start small, get little bits of code working doing small parts of your project and build up from there, you can't expect 18k of code to just work!

Ok, I will keep building the app and just hope for the best.

I don't think I actually have 18k worth of code. I had a lot of stuff that I had to comment out, but I didn't want to just delete the lines because I didn't know if it would cause issues.

Thank you regardless.

1 Like

Hope will only get you so far.

Posting the codec(properly) will help, but experimentation and growth while learning will go a long way.

I want to to use a non-digital analogon to explain:

imagine you want to do free-style BMX-biking:

Your momentary knowledge about riding a BMX-bike in an artistic way is:

  • I can ride a bike on a street, I am a little shaky while riding but basically it works.
  • I can visually distinguish between a street-racebike, a mountain-bike and a downhill-bike and a BMX-bike.

Your momentary approach is:
"can you please show me how you are doing back-flips in the half-pipe?
I will watch you driving and then I try on my own"

Well this won't work. You don't start artistic back-flips in the half-pipe if you are still a little shaky on bike-riding.

You start with much smaller and easier exercises.
Your own brain has to learn how to move your body for things like jumps.
It is very different to do jumps coming from the low-side jumping up in the air
or coming from the up-side jumping down a halfpipe.

Well this analogon does not work out in all details.
In programming you can't break your bones - of course
You don't need to do training on the braincells responsible for balancing

If a bug occurs you need knowledge about how programming works and what could cause this bug.

As you are working with electronic parts you need at least a basic knowledge about electronics because the parts are not superstandardised like ready to use USB- or blue-tooth-devices.

pre-programmed text that lists up what you have to do:

You are welcome on this forum! You are working on an informatic project and what is most needed in an informatic project is information imagine: do the other users here in the forum have a clear picture of what you are trying to do?

To speed up finishing your project you should invest some time into writing additional information I'm 100% sure that this WILL speed up finishing your project.

So please go through this checklist and if you find an item you haven't posted yet post it

  • did you write which exact type of microcontroller you are using?
  • description of your programming skills and knowledge
  • description of your knowledge about electronics
  • description of the functionality you want to have written in normal works avoiding programming terms
  • do you have an oscilloscope? Yes / No
  • do you have a digital multimeter (DMM) Yes / No)
  • your age
  • did you post your complete sketch?
  • if relevant did you post a link to a datasheet of each component you are using?
  • if relevant did you post a handdrawn schematic or your wiring?
  • if you got a compiler-error. Did you post the complete compiler-output into a code-section?

If you don't post all this information because you want a "quick answer" to your detail problem It is very likely to turn out that all that happens is having mutliple waiting-times with mutliple asking back for details until the other users do have a clear picture of what you want to do.

best regards Stefan

Hi, @gjohnson7771
Welcome to the forum.

If you have two sketches. BEFORE combining them, get them working on your hardware first.

Can you post links to the 2 ORIGINAL sketches?

What ethanol analyser do you have? (link to data/specs)
What fuel pressure sensor do you have?(link to data/specs)

Can you please tell us your electronics, programming, arduino, hardware experience?

Thanks.. Tom... :smiley: :+1: :coffee: :australia:

The 2 original sketches I am using are:

https://create.arduino.cc/editor/gjohnson7771/ac570864-dbb1-4960-bf6a-896eea8f9554/preview

https://create.arduino.cc/editor/gjohnson7771/cda87020-6c8d-4c3e-9347-d2c7c982d159/preview

They are being built off of these projects:

However, I decided not to use a LCD screen. I am using the coding form the Ethanol analyzer above to create an App to view the information on my Android Headunit.

Hi,
Can you please post your code in your post please.
To add code please click this link;

@yarmisa codes.

/*Code Start */

/* This example demonstrates how to take a standard 3-wire pressure transducer
 *  and read the analog signal, then convert the signal to a readable output and
 *  display it onto an LCD screen.
 *  
 *  Contact Tyler at tylerovens@me.com if you have any questions
 */

#include "Wire.h" //allows communication over i2c devices
#include "LiquidCrystal_I2C.h" //allows interfacing with LCD screens

const int pressureInput = A0; //select the analog input pin for the pressure transducer
const int pressureZero = 102.4; //analog reading of pressure transducer at 0psi
const int pressureMax = 921.6; //analog reading of pressure transducer at 100psi
const int pressuretransducermaxPSI = 100; //psi value of transducer being used
const int baudRate = 9600; //constant integer to set the baud rate for serial monitor
const int sensorreadDelay = 250; //constant integer to set the sensor read delay in milliseconds

float pressureValue = 0; //variable to store the value coming from the pressure transducer

LiquidCrystal_I2C lcd(0x3f, 20, 4); //sets the LCD I2C communication address; format(address, columns, rows)

void setup() //setup routine, runs once when system turned on or reset
{
  Serial.begin(baudRate); //initializes serial communication at set baud rate bits per second
  lcd.begin(); //initializes the LCD screen
}

void loop() //loop routine runs over and over again forever
{
  pressureValue = analogRead(pressureInput); //reads value from input pin and assigns to variable
  pressureValue = ((pressureValue-pressureZero)*pressuretransducermaxPSI)/(pressureMax-pressureZero); //conversion equation to convert analog reading to psi
  Serial.print(pressureValue, 1); //prints value from previous line to serial
  Serial.println("psi"); //prints label to serial
  lcd.setCursor(0,0); //sets cursor to column 0, row 0
  lcd.print("Pressure:"); //prints label
  lcd.print(pressureValue, 1); //prints pressure value to lcd screen, 1 digit on float
  lcd.print("psi"); //prints label after value
  lcd.print("   "); //to clear the display after large values or negatives
  delay(sensorreadDelay); //delay in milliseconds between read values
}

*/ Code End

Only one code is accesible.

Tom... :smiley: :+1: :coffee: :australia: