Air Pressure Sensor to Turn Pump (on/off)

Please excuse if I'm asking ignorant question or using incorrect language as I'm extremely new to using Arduino.

The intent of this project is to have a switch or motion sensor turn on an air pump, open the first solenoid valve while the second solenoid valve is closed to inflate an air bladder. Once the blue silicone air bladder is filled to a specified pressure the pump should turn off and the second vacuum solenoid air valve should open to release the air out of the blue silicon bladder.

The reality is you need to test each sensor individually using a simple program until you can identify which sensor or device is giving you the problem. Testing individual devices once your project is complete makes no sense.
Paul

To be sure that it pays to analyze the code You forgot to post I ask You for a proper wiring diagram.

As I stated I did test each component independently prior to assembling the project. Please read more carefully before responding.

Code is posted as an attachment. How else should I post it? Could you recommend a way to produce a proper wiring diagram a few of the online apps I explored to produce wiring diagrams didn't have air pumps or air pressure sensors.

What method did You use when testing the parts? You're new to Arduino and likely new to this forum so mind Your language if You want to get advice.

Read the first topic telling how to use this forum. There is says, among others: format the code in the IDE, select and click copy. Then click on the code tag symbol here, </> and paste.

Why would helpers fill up their computers with code from members? Several helpers use equipment that can't download a .ino file.

Thank you for explaining how to upload code. I'll see if I can figure out how to do this in accordance with the forum.

Depending on the component either I used a multimeter, connected the device to a current or created/sourced code to test the device. The sensor is the only device that I'm less sure about if it is working within this setup or if I'm using code that is incompatible with the sensor. I know the sensor works and takes pressure readings. The test I ran on the sensor included the use of a library to evaluate the accuracy of the sensor.

Could you recommend a way to produce a proper wiring diagram as a few of the online apps I explored to produce wiring diagrams didn't have air pumps or air pressure sensors.

I apologize for any in appropriate language but am not sure what language are you referring to?

Here is the code for the project. I'm not sure how to post the code with line numbers to make it more easy for communicating (please advise).

You posted the code in the way forum asks for! Thanks!
To Your post #8.
Devices might be electrically okey but the way they are powered and interfaced, using drivers, is often the most important.
Suppose power or interface is not good in some way. Then no code will make it work.

Checking the list of components I react on the TIP120 transistor. That is a dinosaur from the stone age wasting voltage (1.5 - 2.5 volt), and power. Use logic level N-channel MOSFETS instead.

Maximum reading from an analog input is 1023!

reference_voltage_mv... That depends on the way the controller is powered. USB voltage is varying from unit to unit.

pinMode(2, INPUT); // switch
Do You use an external pullup or pulldown?
You can use INPUT_PULLUP using a controller built in pullup resistor. Else the input will be flying all over the place when it is not triggered.
That's why wiring diagrams are highly interesting.

Lot's of comments.....

Thank you for all the comments. Being new to this I'll have to decode what some of your comments mean.

I just downloaded Autodesk Eagle to see if I can create a wiring diagram to upload to the forum to help with the communication.

I'm using an external 9v power source through a LM2596S DC-DC Step Down Variable Volt Regulator Input 3.0-40V Output 1.5-35V Adjustable Buck Converter. 9v in stepping down to 6v. I'm using 6v to directly power the the pump and servo valves and using 9v to power the Nano which then powers the pressure sensor.

I'll look into getting some logic level N-channel MOSFETS

Do you have any experience with pressure sensors? I'm specifically hoping to find information on how to wire and code a pressure sensor that at a specified pressure it will trigger the air pump to turn off and open a vacuum valve. I'm thinking this would be a fairly common configuration but am not finding many resources that present information in a basic enough fashion for a beginner to understand.

Do you think I'd be better of using different pressure sensor one that doesn't have a breakout board?

Thanks for your perspective as they are much appreciated.

I think I see kickback diodes across the transistors (where they do nothing useful).
Leo..

Take a step back and make setups and code only running one peripheral at the time. That way You will learn how they work.

You tell about 9 volt powering. That makes the alarm go off here. What stuff is that?

Hi,

Just hand draw your circuit and post an image of it, rather than try and do a quick learn of Eagle.

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

Okay thanks I'll look into eliminating the diodes.

Here is a diagram I used of the circuit from the original source.

I thought having a power source going direct to the devices rather then pulling from the Nano eliminates noise in the circuit and would provide for more consistent power to the electromechanical devices.

Hi,
Just a quick look, you are going to need series resistors in each of the TIP120 base circuits.

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