Air Pressure Sensor / Breath Controller / Arduino Nano

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
okay in this video we are going to revisit this little air pressure sensor which you can see on my breadboard now I made a previous video where interface this air pressure sensor up to a pick microcontroller using the scab 3 board but in this video we're going to interface it up to the Arduino Nano as requested so this is the actual air pressure sensor here it's a six pin device and inside this sensor there is a strain gauge which is configured as a wheatstone bridge now the output of the wheatstone bridge is fed into this chip here this hx710b now inside this chip there's an amplifier with a gain of 128 that's fed into a 24-bit ADC now we can extract air pressure data through the ADC from these four pins first pin is if ezc 5 volts second pin is the ADC output it's the serial bit stream the third pin is clock input and the fourth pin is a common ground and these four pins are connected up to the Arduino Nano and if you look at the schematic you can see the Arduino Nano is powering the pressure sensor with 5 volts the output the ADC output from the pressure sensor is fed into pin 2 of the Nano and the clock input comes up comes from pin three of the Nano into the clock input of the sensor and the two grounds are connected together and I have an LED on pin 13 which is the same LED that's on board the Nano so we could extract data from these four pins so every time I put one clock pulse into the clock input I'm going to get one bit out of the data output so if I put in 24 clock pulses into the clock input I'm going to get a 24 bit output the ADC output and that'll be that will be my pressure value okay I have a rubber hose connected up to my air pressure sensor and I have code running on the Arduino Nano which set up to be an air pressure threshold detector as opposed to when I had it hooked up to the scan 3 board and I put it into a glass of water you can see the column of air inside the hose would be compressed and we would get a display on the 16 LEDs but in this case I'm just using it as a threshold detector so at a certain pressure it's going to turn on the LED on pin 13 on the Nano so if I blow into the hose right now if I blow into it as at a certain pressure the LED is going to come on I have a glass of water which about it's about half full and that's my trigger so when I put it into the glass of water it's going to trigger the sensor at that pressure so it's just a threshold detector so when it when it sees a glass half full of water a certain pressure in the hose it activates the LED okay I have an empty glass and I have the hose fed all the way to the bottom so if I take some water and I fill it up to about halfway you watch the LED which it hits halfway LED comes on indicating the glass is half full okay so now you know how to interface this little air pressure sensor that has a range of 0 to 5.8 PSI to a nano now you could use the language of your choice or even the microcontroller of your choice all you need is two gpio pins to extract the data through the ADC I'm running interactive Arduino on the Nano which is a very simple fourth that I have written based on e4th now the next part of this video I'm going to show you how you could upload interactive Arduino into the Nano using this connector here the six pin icsp connector so all you have to do is get yourself a USB ASP programmer you get them online they're pretty inexpensive then you can upload interactive Arduino into the Nano okay here's the USB ASP programmer which we could use to upload a hex file into the Nano and it comes with a 10 pin JTAG connector with a 10 pin ribbon cable but we only need six wires to program the Nano so it comes with a little adapter so it's a 10 pin to six pin and with the ground on the top it plugs in this direction like that so now we could run some software called AVR dude and we can program a hex file into the Arduino Nano now AVR dude is a command line program but there's a GUI version called AVR dude s so we could use that to upload a hex file into the Arduino Nano okay I have AVR dudes up and running on my computer so the first thing we have to do we have to select a USB ASP programmer so if we go to the very top where it says programmer and we do the pull down menu now these are all the programmers that AVR dudes supports if we go almost to the bottom we could select USB asp now the port we select USB and we go over to MCU and we hit detect you see at the bottom upward screen it has detected that Mega 320p microcontroller so now we know it's communicating with a microcontroller so now we go to the fuses and lock bits so we read the fuses and we read the lock bits so low view should be hex FF the High View should be hex d8 extended few should be hex FD and the luck bits should be hex FF now if you don't get those values you could write them into text box and then hit the right button for the lock bits and the right button for the fuses so now next we have to upload the hex file so we go up to flash and if we hit our browse button and we find our hex file on our computer and you can see there I have IA dot hex that's my interactive Arduino so we go to right we select right and we go down to program so now it's starting to write the hex file into the microcontroller and after it's finished writing it's going to read to make a controller and do a verify so right now it's writing now it's reading now it's verifying The Flash and there it's done so it's verified and it's done so now interactive Arduino is running on my microcontroller okay here's the code running on the Nano and it's written in fourth using interactive Arduino so the first thing we do we initialize the gpio now pin 13 is configured as an output because that's connected up to the LED then pin three that's the clock input to the ADC and pin 2 is the D out of the ADC so we initialize all those pins right here so when we run init gpio it's going to initialize those those gpio pins D out at monitors pin 2 when D out is low that means it's not busy and we could actually read an ADC value pulse generates one pulse and that pulse is fed into the ADC now when we feed 24 pulses into the ADC that's what these two words do we'll get 24 bits back and that'll be our 24-bit word our ADC value our pressure value so I have a word test it's continuously reading the ADC so we could hook up a rubber hose and blow into it and we'll get values from about seven thousand to sixty five thousand five hundred thirty five that's zero pounds to 5.8 PSI so that's our test that's where we could actually get values and then here's air question mark this is where I put the hose into the half a cup of water and half a cup of water was about ten thousand so that's my threshold which I got from the word test I put that into the half a glass of water and it's it was ten thousand so anything after ten thousand will turn on the LED and below 10 000 we'll turn off the LED so we take this code right click we select all and we copy it now we can copy and paste it into Terra term and now we'll take this code and program it into the into the microcontroller okay I have terror term up and running on my computer and I have a USB cable from my computer to the USB connector on my Nano and if I hit the reset button on the Nano you see I get interactive Arduino hello screen and if I hit my Enter key again okay prompt and if we go to setup serial port you can see I'm on com9 my baud rate is 19.2 K bod data is 8 Bits parity is none One Stop bit flow control is none I got my delay my my millisecond per line delay to 120 milliseconds because the compiler is running on the microcontroller itself so we have to give it time to compile so that's my setting so now if I paste my code so I right click hit OK now she's starting to uh compile and you can see it on each end of each line I get an okay that means it's uh it's compiling okay not at the very end I get my okay prompt so now I could run the word test there's my value my EDC values with uh I'm not blowing into the rubber hose so I get in about 7 300 so now I'm going to blow into the hose and you see it maxed out to 65 535 so that's how we get our our test values if we hit any key to stop now we could use that in the code for our threshold triggering okay so now you know how to upload a hex file into a microcontroller and to get the fourth operating system up and running and to write some code and compile it using Terror term and run it on the Arduino Nano so once you get used to this setup you could probably think of some other projects using interactive Arduino
Info
Channel: 0033mer
Views: 26,948
Rating: undefined out of 5
Keywords: 0033mer, Forth, Interactive Arduino, Nano, Arduino, atmega328p, microcontroller, breath controller, air pressure sensor, eForth, Ting, HX710B, ADC, Scamp3, FlashForth
Id: FAIOIACJY0w
Channel Id: undefined
Length: 9min 49sec (589 seconds)
Published: Fri Feb 03 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.