Raspberry Pi Analog Water Sensors ADC Tutorial

  Переглядів 105,974

rdagger68

rdagger68

7 років тому

Tutorial demonstrating how to connect analog sensors to the Raspberry Pi using SPI and I2C analog-to-digital converter chips such as the MCP3002 and the ADS1115. Examples include low cost analog water level/detection and water pressure sensors.
All code, schematics, notes and updates are available on my website:
www.rototron.info/raspberry-pi...
Additionally here's a link to my Raspberry Pi AVR Programmer & SPI Tutorial:
www.rototron.info/raspberry-p...

КОМЕНТАРІ: 147
@dustintravis8791
@dustintravis8791 6 років тому
That moment when you realize you're not quite ready to start your water monitoring project. Great detailed video, thank you.
@cam_DA_Hawkdriver
@cam_DA_Hawkdriver 4 роки тому
Another great video! The linear equation helps to explain the relationship of your results. Excellent work.
@lucasi8455
@lucasi8455 4 роки тому
This is just the most perfect explanation I have ever seen... Thank you so much for this effort
@balajitj
@balajitj 6 років тому
Thank you for taking the efforts to post the video! Really helps.
@russelljazzbeck
@russelljazzbeck 4 роки тому
This is very thorough. I have a lot to learn but your videos and website are so helpful. Thank you
@YousefElarian
@YousefElarian 7 років тому
Really excellent explanation. Will try it soon. Thanks
@venkateshgovindaiah5826
@venkateshgovindaiah5826 3 роки тому
Awesome!! tutorial. Just what I needed to get started.
@Snickerswolf
@Snickerswolf 3 роки тому
Awesome Video. It really helped me get started using the pressure transducer/sender. Any chance you could do another video showing the programming for the updated Adafruit Libraries and Python 3x? I have it working but I am not that great with programming and I can't figure out how to make my sensor more accurate the way you did with the line voltage equation.
@k4kyd698
@k4kyd698 7 років тому
This is exactly what I have been looking for to setup a pressure gauge on my pool pump so I can check the pump pressure remotely via a web app. I am already using a Pi and two 1-wire temp probes to read the outside temp and pool temp now I just need to add the pressure sensor and I will be all set. Thanks for this videos its made that project move up the list :)
@rdagger
@rdagger 7 років тому
Thanks for the positive feedback. You can also measure water level with a pressure sensor if you can place it near a bottom drain (good for water tanks and above ground pools).
@muthumuthuhadini8114
@muthumuthuhadini8114 5 років тому
Well done buddy, very informative
@JayakrishnanChathu
@JayakrishnanChathu 7 років тому
Nice Presentation, Very useful !
@mikewalker4062
@mikewalker4062 2 роки тому
Hi. I know this is older but it’s a great video. Thank you
@Shornski
@Shornski 4 роки тому
Thanks for the awesome videos, perfect pace and detail. I have an analog temperature probe but it only has two wires. I can see resistance change with water temp but not sure how to wire it using adc without a signal wire.
@rdagger
@rdagger 4 роки тому
Get a resistor and then you can use your sensor as one half of a voltage divider. As the sensor resistance changes the divider's output voltage will change which you can measure with an ADC.
@Shornski
@Shornski 4 роки тому
@@rdagger Thank you so much, I'll have a go
@moinshaikh6684
@moinshaikh6684 2 роки тому
Superb explanation!
@jamescullins2709
@jamescullins2709 5 років тому
Outstanding video!!
@ishy2217
@ishy2217 5 років тому
good videos, very informative
@metachildhood
@metachildhood 3 роки тому
Thankyou ,,, this is awesome tutorials. .
@olgertorres1712
@olgertorres1712 6 років тому
you are a master budy!
@netdudeuk
@netdudeuk 7 років тому
Great video thanks.
@itisno1
@itisno1 4 роки тому
I'll model my code after yours to use with my mcp3008 to control an interface circuit which will control a 5vdc water pump contingent upon readings from a capacitive soil moisture sensor
@richmondxxxx
@richmondxxxx 2 роки тому
Hi, thanks for the video absolutely loved it. What can I do if I want a more precise readout on the LCD, closer to the master gauge
@rdagger
@rdagger 2 роки тому
There are more precise pressure sensors but they tend to be expensive. You can also get an ADC with higher resolution such as the 24 bit ADS1220. Performing multiple samples and statistical clean up also helps. For the record, the margin of error for the analog pressure gauge used in the video is probably comparable to the sensor.
@philwilkinson7228
@philwilkinson7228 6 років тому
Thanks. Great tutorial once again! I am really learning a lot about sensors, microcontrollers AND micropython from your tutorials! One question: your tutorial examples constantly poll the sensors with a While True loop. This must be quite a power drain. In your first example, you may only want to supply water when the moisture level hits a certain point. Can this be done by using a micropython interrupt (or something similar) when the ADC output hits a certain value? Will this make any difference to power consumption as the SPI is still running all the time anyway?
@rdagger
@rdagger 6 років тому
That’s a great question! The ADS1115 has 2 conversion modes (single-shot and continuous). In single shot mode the ADC performs a single conversion upon request. This can provide significant energy savings. There is an alert pin that can be triggered by the comparator when the ADC value hits a specified threshold. I have not tested this functionality. I’m not sure but I’m guessing you need to run the ADC1115 in continuous mode to use the alert pin. Therefore, you won’t necessarily derive any power savings. In my example code, the sleep method ensures the loop uses very little resources. Even an old Raspberry Pi A runs 7 million cycles per second. Polling a sensor every 2 seconds will not tax the CPU.
@sharmstr
@sharmstr 6 років тому
Appreciate the video. Its seems to be the information I need to monitor my coolant system on my cnc. The plan is to have a liquid level sensor along with 2 pressure sensors. The pressure sensors will sit on either side of filter which will allow me to monitor when the filter needs changing. I havent researched it yet, but I'm assuming instead of and LCD, I can use my 7" RPI touchscreen.
@rdagger
@rdagger 6 років тому
Sounds like a fun project. The touchscreen will work but you will need to program a GUI. For the liquid level sensor, you might want to check out eTape by Milone Technologies. I've been wanting to test their sensors, which purportedly give accurate level measurements.
@sharmstr
@sharmstr 6 років тому
Sounds like I'm on the right track then. I found the chemical resistant eTape sensor last week and I installed Kivy this morning. :) Thank you again for the videos!
@sharmstr
@sharmstr 6 років тому
I got it working with Kivy. Thanks again! instagram.com/p/BXI2RCmgMk4/?taken-by=sharmstr
@bobbycpr
@bobbycpr 6 років тому
I'm really enjoying all of your content. Thanks for the amazing work! Can you tell me which LCD screen you are using in this tutorial? I purchased one with only 2 pins for SDA and SCL and I'm having trouble figuring out how to integrate into your tutorial as I'm a beginner.
@rdagger
@rdagger 6 років тому
The display in the video is over 10 years old. I don't remember where I got it. Adafruit, SparkFun, AliExpress and eBay are great sources for basic HD44780 LCD displays. You have a display with an I²C interface. It is very easy to connect to the Raspberry Pi. I have a video dedicated to I²C LCD displays: ukposts.info/have/v-deo/oWVyaXeqe4iD2IU.html
@bobbycpr
@bobbycpr 6 років тому
rdagger68 Thank you again
@beegele8450
@beegele8450 3 роки тому
I am new to this and trying to learn. I need to keep track of pressure on a filter so your build it perfect for my needs. The question I have is why not use channel 2 on the MCP 3002?
@rdagger
@rdagger 3 роки тому
You can use any channel or all of them.
@chandrakanthsivaraman4099
@chandrakanthsivaraman4099 6 років тому
Can i use MCP3008 for this project.... Please reply it's urgent.........
@kirillbobko4557
@kirillbobko4557 3 роки тому
Great work and well explained. Did you have a chance to work with high temperature sensors (90C/210F)?
@rdagger
@rdagger 3 роки тому
I work with thermistors which are probably the most common temperature sensor for home 3D printers.
@GandalfInTraining
@GandalfInTraining 7 років тому
Very patient narration and very professionally made. Great job. Question: Can I add more than one Analog input onto a single ADS1115? If you have done this, please do share. Im planning to have a pH Sensor, Turbidity sensor, Pressure Sensor, Water flow sensor collect info and send to my Pi. This is for my swimming pool. Or am I better off simply connecting all of this to Arduino? But I havent seen an example of how to read Arduino from a Raspberry.
@rdagger
@rdagger 7 років тому
Yes the ADS1115 allows you to connect 4 analog devices to pins A0 - A3. Adafruit has a good example of how to read 4 inputs: github.com/adafruit/Adafruit_Python_ADS1x15/blob/master/examples/simpletest.py I'd go with the ADS1115 approach because it is simpler, less expensive and uses less power (assuming you need a Raspberry Pi too)
@GandalfInTraining
@GandalfInTraining 7 років тому
Thanks for responding. I already have a Raspberry Pi, but its almost 100+ft away from the pool equipments. So Im debating whether to buy another Pi or get a Arduino+wifi and use MQTT
@rdagger
@rdagger 7 років тому
I haven’t experimented with that long a distance. In theory, shielded CAT6 with a differential signaling approach might work, but there are a lot of factors that could cause problems. RS485 is a good solution for long cable runs. If you go with wi-fi, take a look at the ESP32 and Micropython. I plan on doing a video on the subject. I just did a video on setting up a wireless solar powered Raspberry Pi REST API: ukposts.info/have/v-deo/aYaphGlvj6KHpoU.html
@christianandersen7458
@christianandersen7458 5 років тому
Balaji Venkatesh so what did you go for and how did it turn out?
@MrJhardesty
@MrJhardesty 6 років тому
First, thanks for the tutorials. They have been very helpful. I have a pi 3. How are the pins different for the water sensing circuit.
@rdagger
@rdagger 6 років тому
The BCM GPIO pin numbers should be the same with regard to the pins used in this video.
@MrJhardesty
@MrJhardesty 6 років тому
I got it working. Sometimes I just need to go backwards and own the underlying theory and then move on from there. But the projects you have have been invaluable to my projects. I am setting up 21 temp humidity & water sensors in the clean rooms of my company. I also am setting up pressure and temp sensors for our cooling systems. Thanks Again!!!
@chandrakanthsivaraman4099
@chandrakanthsivaraman4099 6 років тому
Mr. Hardesty which ADC did you use???
@christianandersen7458
@christianandersen7458 5 років тому
On aliexpress the price for a mcp3008 is the same as for an arduino nano. Even less if you choose an attiny85 :-) I see that the ADS chip is a bit cheaper and offers 16bit A/DC, which would be superior to the 10bit of the arduino.
@SuperAsmit
@SuperAsmit 3 роки тому
Thank you sir..!! Absolutely loved it. Quick question, will multiple pressure sensors work?
@rdagger
@rdagger 3 роки тому
Yes. The MCP3002 supports 2 sensors and the ADS1115 supports 4 sensors. There are other chips that support more.
@SuperAsmit
@SuperAsmit 3 роки тому
rdagger68 Thanks a lot😊
@SzecskoSandor
@SzecskoSandor 5 років тому
Hi there rdagger68, I just watched your video about this pressure sensor (awesome results :) ) but I was just scratching my head why on earth you used those two other circuits. I use the MCP3008 to monitor my 12V backup battery state of charge or if it is being charged, and the PI's 5V (unregulated) rail voltage from the 3.3V (regulated) line used as ref. I used a voltage divider (which is only 2 resistors) per channel to reduce my "12V" to maximum 3.3V and and the "5V" to maximum 3.3V. If you put a 10k and a 2.7K resistors in series and you wish maximum 3.3V from the divider, it can handle up to 15.52Vs from the battery bank. Similarly for the 5V rail I used 10K and 9.1K resistors ending up with maximum measurable voltage of 6.92V on the 5V line. The S line of the pressure sensor could have gone to this exact voltage divider and using of some math after reading out the bits from the MCP3008. If you intend to build voltage dividers please avoid too little resistors (they pull lots of amps) and avoid shitty tolerance resistor bands. Regards, Sándor
@rdagger
@rdagger 5 років тому
Thanks for your feedback. Are you asking why I used a level shifter board instead of a voltage divider? If so it's a great question. The answer is mainly for convenience. Also you can buy a 5 pack of four channel level shifter boards for $1 on eBay. In low current applications, voltage dividers are often great solutions. However, voltage dividers can generate interference and performance issues with digital signals such as SPI and I2C (if used on the data lines). Therefore in these cases I usually use level shifters. Still your approach is perfectly valid and economical.
@modelrailwaytheeasyway9743
@modelrailwaytheeasyway9743 3 роки тому
great video new to all this i have connected the ads1115 to a raspberry pi 4 using the i2c pins and connected to water sensor to a0. i am also using the adafruit single ended exsample to run the sensor. this works well to show all is ok but i want to use the code you are running. how easy would it be to set that up?
@modelrailwaytheeasyway9743
@modelrailwaytheeasyway9743 3 роки тому
i have tried the code and it does not change the color of the led i have tried changing the channel setting as in the video but i can not get it to read any water detected. my sensor is on channel a0 and the ads is on chennel 00.48 on the i2c any idea what i am doing wrong?
@briwicklab
@briwicklab 5 років тому
already done it using raspi and rework it using arduino (temp and pH). I took time to think of em...why would i kill a bug with a bomb, if i could kill it with a sprayer. raspi is "almost there", u can't use it to do extreme processing such as machine learning and advance image processing, but still it's a "PC", but also it is too much CPU for temp, pH, PWM, etc. maybe they'll do sometin about raspi 4
@tableaux302
@tableaux302 3 роки тому
Hi rdagger, I was wondering if this could be used to convert inputs from a microphone? I don't have an exact setup at the moment but the idea is that the microphone would be used to detect an object and so past a certain threshold the mic would give us a 1 for example. Edit: I looked a bit into MEMS microphones that can output a digital signal so would we be able to use that as a direct input?
@rdagger
@rdagger 3 роки тому
You can buy an inexpensive sound sensor that will output a digital or analog signal depending on sound intensity such as this one from SparkFun: www.sparkfun.com/products/12642 Adafruit has a good tutorial on measuring sound levels with a mic and an amp: learn.adafruit.com/adafruit-microphone-amplifier-breakout/overview
@cristiantoma9386
@cristiantoma9386 Рік тому
hi, Could you connect 4 pressure sensors at the same time? like monitoring 4 air bags suspension for a car. Thank you !
@rdagger
@rdagger Рік тому
Yes, the ADS1115 has 4 channels so it could monitor 4 analog inputs.
@circlical
@circlical 4 роки тому
Your video convinced me to take the plunge! Thanks! I wired a RaspberryPi up to the ADS1115. `i2cdetect -y 1` sees the unit on 0x48. I connected the moisture sensor to A1 on the ADS1115. When I issue `i2cget -y 1 0x48 1` I keep getting 0x85, whether or not the unit is in soil or otherwise. I must be missing a step? Possible to get a reading at the command line? Thank you!
@rdagger
@rdagger 4 роки тому
You need a library to communicate with the chip such as the Adafruit one used in the video: github.com/adafruit/Adafruit_Python_ADS1x15 Otherwise you would have to send the correct bytes to configure and read the chip as specified in the ADS1115 datasheet.
@circlical
@circlical 4 роки тому
@@rdagger Thanks for the response. I saw the bitflags, but got a bit stressed with all the warnings that the i2c commands spit out! I'm trying to do this outside of Python/C++, but suppose I could byte the bullet (hah!) and make a CLI command w/Python.
@fisco2243
@fisco2243 6 років тому
Thanks for this great tutorial. Could you share which pressure sensor you have used?
@rdagger
@rdagger 6 років тому
I don't see any markings on the pressure transducer other than 200 PSI. I bought it on eBay 4 years ago. I don’t recall the store. It cost about $25.
@joshuabrand11
@joshuabrand11 3 роки тому
Would this work with a Resistance Level Sender for a water tank? The type with the float on that changes resistance as the float moves up or down?
@rdagger
@rdagger 3 роки тому
You could create a voltage divider using a resistor with the sensor. Then you'd be able to measure the voltage as the sensor changes resistance.
@josephboyk3269
@josephboyk3269 6 років тому
This video is excellent, However I want to verify for the pressure sensor I do not need the LCD. I am attempting to write code that has If/then or else statements based on the measured pressure.
@josephboyk3269
@josephboyk3269 6 років тому
@rdagger68
@tableaux302
@tableaux302 3 роки тому
Hi, I have another question regarding the choice of ADC... say for the project I mentioned I wanted to be able to analyze the signal from the microphone to observe a certain peak. Are there any relevant attributes I should take into account when choosing my ADC or is MCP3002 an all around good option. My setup would be the same as yours but instead I would be connection a microphone to the analog input of the ADC.
@rdagger
@rdagger 3 роки тому
Assuming you are measuring peak amplitude and you are going to use an electret microphone amplifier such as the Adafruit MAX4466 version, then it probably doesn’t matter. Although it depends on your timing and accuracy requirements. The MCP3002 is only 10 bit resolution. The ADS1115 is 15 bit resolution. The MCP3002 has a fast SPI interface. The ADS1115 has a slower I²C interface. I’d post your question to the Adafruit forum. Their engineers will be able to provide first hand advice: forums.adafruit.com/
@svenjooken3600
@svenjooken3600 2 роки тому
hello, i want to monitor the waterlevel in my rainwater bassin, i want to do that with a pressure sensor, in your tutorial you stated that the psi sensing range must be lower than the 200 psi range u use, how much lower and where can i order one
@rdagger
@rdagger 2 роки тому
I haven’t tried this approach but theoretically since pure water has a specific gravity of 1.000 at 39.2°F and every 27.71 inches of water height equals 1 psi, you could calculate water level using: P(psi) x 27.71 (inH2O/psi) = W (water level inH2O) Therefore a 5 psi sensor would accommodate a combined barrel height and elevation of about 11.5 feet. A 3 psi sensor would be adequate up to about 6.9 feet. Honeywell makes the ABP series of basic board mount pressure sensors that are available with I2C or SPI protocols in 3.3 or 5.0 Vdc. I haven’t tried them and they come in many variations so I suggest you contact Honeywell tech support for a recommendation. Alternatively, you could use ultrasonic or capacitive sensors.
@EpicFandi
@EpicFandi 7 років тому
Great video, very informative! I'm currently trying to motivate myself to learn python and electronics to combine both with a raspberry Pi. :) Do you know a good website/video playlist/etc. to learn python? - I already know the basics in programming (C#, PHP, JavaScript,...)
@rdagger
@rdagger 7 років тому
EpicFandi sendex has some very good videos: Python 3 Basics Tutorial Series: ukposts.info/slow/PLQVvvaa0QuDe8XSftW-RAxdo6OmaeL85M
@EpicFandi
@EpicFandi 7 років тому
Oh great! Thank you for the fast response :)
@moinshaikh6684
@moinshaikh6684 2 роки тому
Please make more videos.
@StaticLowLife
@StaticLowLife 6 років тому
Could this be a way to go for measuring oil temp and pressure in an older car engine? So totally noob on this that I don't even own a pi yet
@rdagger
@rdagger 6 років тому
It is possible. Here's a good example: hackaday.io/project/1276-carmin On newer cars you could just connect into the OBD-II port and read all the car's diagnostic info.
@flickmew99
@flickmew99 2 роки тому
Can you measure the sensor input voltage using multimeter? will it give the same voltage as what displayed in LCD?
@rdagger
@rdagger 2 роки тому
I think you mean output voltage. Generally speaking, if the sensor outputs a voltage then you can measure this output voltage with a multimeter assuming that you provide an appropriate power supply to the sensor.
@flickmew99
@flickmew99 2 роки тому
@@rdagger my bad, yeah output voltage. Sorry I'm newbie to electronic/electrical, so my question : is that any way we could get the sensor voltage value with multimeter? Just to compare the multimeter measurement vs the calibrated voltage (voltage from program's equation)
@rdagger
@rdagger 2 роки тому
@@flickmew99 Yes. The sensor output voltage can be measured by setting you multimeter to DC voltage and placing the red probe on the sensor output pin and the black probe on ground.
@thomasknightt
@thomasknightt 7 років тому
I wanted to set up mulitple pressure pads and connect them to raspberry pi using the ADS115. Each pressure pad would turn on/off a specific music track and activate an LED light. Is it possible to hook up multiple ADS115s to the raspberry pi? Does it make more sense to get this interaction using multiple arduinos? I'm unexperienced with this technology and curious to your opinion. Thanks
@rdagger
@rdagger 7 років тому
You can connect up to 4 ADS1115's (see Figure 35 in datasheet) using the built-in I2C pins on the Pi. Are your pressure pads just on/off switches or do you need to vary the LED light depending on the amount of pressure exerted on the pads? If they are just on/off switches then you can connect them directly to the Pi without an ADC. The choice between a Pi and an Arduino depends on your project requirements. An Arduino Mega with 16 built-in ADC pins might be a better choice if you need to measure the amount of pressure on 16 pads. It really depends on the quantity and type of pressure pads.
@thomasknightt
@thomasknightt 7 років тому
Yes they would just be on/off switches but i want the switch to be activated on release. So when you step on the pad it turns it on and stays on until you step on again to turn it off.
@trixiaannemorada4021
@trixiaannemorada4021 4 роки тому
Hi can you help me? I'm having a hard time to the connections of my ec and ph sensor i'm using the mcp3008
@rdagger
@rdagger 4 роки тому
What's the problem?
@BoostedVr5
@BoostedVr5 5 років тому
Can i measure also with 4 pressure sensors and control relais with it?🤔🧐
@rdagger
@rdagger 5 років тому
Yes, the ADS1115 has 4 channels so you could connect 4 analog pressure sensors. There are several relay boards available for the Pi. You might also want to take a look at some of the new Honeywell pressure sensors. They come in I2C so they can be hooked up directly to the Pi. They also provide temperature compensation for more reliable readings.
@1SmokedTurkey1
@1SmokedTurkey1 6 років тому
Would the first code for a generic ADC work with the MCP3424? I can't seem to get it to work at all.
@rdagger
@rdagger 6 років тому
No that code is for an SPI interface. The MCP3424 is an I2C interface. Here's a python library for the MCP3424: pypi.python.org/pypi/MCP342x
@1SmokedTurkey1
@1SmokedTurkey1 6 років тому
THANK YOU for sharing that library. I'll see if I can get it to work, now. I've already ordered the MCP3008. Seems there are many tutorials on it, unlike the 3424.
@Jasurf
@Jasurf 5 років тому
Are there Node-Red Nodes that will work with these sensors?
@rdagger
@rdagger 5 років тому
I haven't tried but I'm pretty sure Node-Red supports both the MCP3002 and the ADS1115.
@adamcymerman7856
@adamcymerman7856 4 роки тому
So I'm using an ADC1115 and I have it wired exactly as you do except Im using an capacitive soil moisture sensor. When I do i2cdetect -y 1 there are no values in any port. I installed the adc library exactly as you did. Is there something i'm missing?
@rdagger
@rdagger 4 роки тому
Sounds like a wiring issue.
@adamcymerman7856
@adamcymerman7856 4 роки тому
@@rdagger So I have VCC on the sensor and vdd on the ads1115 connected to 5v. gnd from both the vcc and ads1115 connected to ground. and aout on the sensor goes to a0 on the ads1115. Then the SCL and SDA pin on the ads1115 are wired identicle to yours.
@rdagger
@rdagger 4 роки тому
@@adamcymerman7856 Do you have a level shifter between the ads1115 and the Pi?
@adamcymerman7856
@adamcymerman7856 3 роки тому
rdagger68 I do not. Is it needed? You’re the first person I’ve seen use it
@rdagger
@rdagger 3 роки тому
@Adam Cymerman It may not be needed, but I recommend you use one. See 11:23 in the video. Please make sure you use good quality wire, keep the length as short as possible and use an I2C compatible shifter such as the Adafruit one used in the video.
@biyanakbar924
@biyanakbar924 6 років тому
I have a question...If I do not use bi directional in ADS1115, can it?
@rdagger
@rdagger 6 років тому
The I2C bus is bidirectional. The SDA line is used for both transmitting and receiving.
@LarsSchretlen
@LarsSchretlen 3 роки тому
Is there way to send a email with a text message that says you have water leak or something similar?
@rdagger
@rdagger 3 роки тому
Yes, I made a tutorial on sending email from the Pi using SendGrid. www.rototron.info/raspberry-pi-sending-responding-to-emails/
@kurtaaroncabrera3261
@kurtaaroncabrera3261 6 років тому
hello sir you got any tutorial for turbidity sensors with raspberry pi? :|
@rdagger
@rdagger 6 років тому
Sorry I do not, but the turbidity sensors I have seen have analog outputs that function the same as the analog sensors in this video. They also have digital ones that act like a switch when a certain threshold is reached
@kurtaaroncabrera3261
@kurtaaroncabrera3261 6 років тому
thank you for the reply sir
@SaeedAhmed-ix8nm
@SaeedAhmed-ix8nm 6 років тому
I have a question How i can have output in print statement. the value of psi.
@rdagger
@rdagger 6 років тому
Change lcd.message to print.
@SaeedAhmed-ix8nm
@SaeedAhmed-ix8nm 6 років тому
i have a question when i use sudo i2cdetect -y 1 I have all the answer as -- -- -- -- -- -- -- . just dashes not as in your video you have 48 value. can you please help me what may be the problem.
@rdagger
@rdagger 6 років тому
Which Raspberry Pi are you using? Which model level shifter are you using with the ads1115?
@SaeedAhmed-ix8nm
@SaeedAhmed-ix8nm 6 років тому
Thanks for the answer bundle of thanks. I am using raspberry pi 3 model b. I am not using any model shifter and I have connected ADS1115 direct with the PSI sensor. Can i connect ADS1115 with ACS712 sensor? I will be very thankful for your answer.
@rdagger
@rdagger 6 років тому
If the ACS712 module is 5V then I recommend you use an I2C-safe level shifter like the one in the video.
@noorkhokhar
@noorkhokhar 5 років тому
how to used Gas sensor mq-137(ammoina sensor with pi3) analog sensor.
@rdagger
@rdagger 5 років тому
I have not used this sensor but according to the datasheet it outputs varying resistance instead of voltage. You would add a resistor (RL) to act as a voltage divider and use the ADC to read this voltage (VRL). The datasheet provides the following formula to calculate the sensor resistance: Rs=(Vc/VRL-1)×RL. The datasheet figure 1 shows the logarithmic relationship between resistance and ppm.
@noorkhokhar
@noorkhokhar 5 років тому
can you provide me datasheet and also source code.
@rdagger
@rdagger 5 років тому
Here's a good sample with datasheet: tutorials-raspberrypi.com/configure-and-read-out-the-raspberry-pi-gas-sensor-mq-x/
@noorkhokhar
@noorkhokhar 5 років тому
it's too good but i think mq-137(Nh3) formula used this tutorial used mq-2 sensor.
@rdagger
@rdagger 5 років тому
Here's an Arduino example for your exact sensor: circuitdigest.com/microcontroller-projects/arduino-mq137-ammonia-sensor
@sivaranjani-qt5co
@sivaranjani-qt5co 6 років тому
Hai ,i am having an idea to convert a analog water meter to a digital water meter ,please give me some idea to do that
@rdagger
@rdagger 6 років тому
Does your meter have an analog output?
@sivaranjani-qt5co
@sivaranjani-qt5co 6 років тому
i have the analog instrument only it does not have any recording device
@rdagger
@rdagger 6 років тому
If your meter display has a spinning indicator, you might be able to use a non-contact reflective optical sensor like I used in my Motor Control and RPM Measurement Tutorial: ukposts.info/have/v-deo/mqKQjKxwj22Ku5c.html If your meter display has a reading like a car odometer then you might be able to use a web cam to OCR the reading. It might be easier and more reliable to add a digital flow sensor inline to your meter.
@sivaranjani-qt5co
@sivaranjani-qt5co 6 років тому
thank you so much ,if I have any doubt I will reach you.
@weschurch9344
@weschurch9344 7 років тому
Do you have an answer to this error? I have checked my code against your and seems ok. Traceback (most recent call last): File "/home/pi/Pressure Monitor.py", line 3, in lcd = Adafruit_CharLCD(rs=25, en=24, d4=23, d5=18,d6=15,d7=14, cols=16, lines=2) File "/usr/local/lib/python2.7/dist-packages/Adafruit_CharLCD/Adafruit_CharLCD.py", line 143, in __init__ gpio.setup(pin, GPIO.OUT) File "/usr/local/lib/python2.7/dist-packages/Adafruit_GPIO/GPIO.py", line 278, in setup pull_up_down=self._pud_mapping[pull_up_down]) TypeError: argument 1 must be string, not int
@rdagger
@rdagger 7 років тому
I don't see anything wrong with that line of code. Which Raspberry Pi are you using? Which version of Raspbian are you using?
@kaioid
@kaioid 5 років тому
if i am right its better and easy to do this project with arduino isn't it ? can anybody correct me if i am wrong ? cause i dont see why using a very strong device like raspberry instead of arduino
@rdagger
@rdagger 5 років тому
It depends on the scope of your project. If you just want a sensor and an LCD display than an Arduino would be a great choice. If you want network connectivity and remote configuration than a Pi would be a good choice. An ESP32 would also be an excellent choice because of the built-in ADC’s and Wi-Fi. The ESP32 also support MicroPython. I like the ability to wirelessly remote into devices once they are deployed for updates and maintenance.
@kaioid
@kaioid 5 років тому
i approve what you are saying. Thank you for your answer
@himchauhan1995
@himchauhan1995 2 роки тому
website is not working!!!!!
@rdagger
@rdagger 2 роки тому
Power outage. It will be back up in a few hours.
@dickman1981
@dickman1981 4 роки тому
Add a link @2:38! ;)
@rdagger
@rdagger 4 роки тому
I put the link in the description.
@dickman1981
@dickman1981 4 роки тому
@@rdagger ahhh. I wrote that when I came back to it after not being able to find it immediately.
@weschurch9344
@weschurch9344 7 років тому
PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)" NAME="Raspbian GNU/Linux" VERSION_ID="8" VERSION="8 (jessie)" processor : 0 model name : ARMv7 Processor rev 4 (v7l) BogoMIPS : 76.80 Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xd03 CPU revision : 4 processor : 1 model name : ARMv7 Processor rev 4 (v7l) BogoMIPS : 76.80 Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xd03 CPU revision : 4 processor : 2 model name : ARMv7 Processor rev 4 (v7l) BogoMIPS : 76.80 Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xd03 CPU revision : 4 processor : 3 model name : ARMv7 Processor rev 4 (v7l) BogoMIPS : 76.80 Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xd03 CPU revision : 4 Hardware : BCM2835 Revision : a02082 Serial : 00000000f04f4c84 So basically it is a Raspberry PI 3 B ver 2
@rdagger
@rdagger 7 років тому
It should work. You can send me your code and I'll take a look.
@weschurch9344
@weschurch9344 7 років тому
Thanks for the help. Bit of a beginner with python and raspberry from time import sleep #from Adafruit_CharLCD import Adafruit_CharLCD #lcd = Adafruit_CharLCD(rs=25, en=24, d4=23, d5=18,d6=15,d7=14, cols=16, lines=2) import Adafruit_ADS1x15 adc = Adafruit_ADS1x15.ADS1115(address=0x48, busnum=1) # Gain = 2/3 for reading voltages from 0 to 6.144v. # See table 3 in ADS1115 datasheet GAIN = 2/3 # Main loop while 1: value =[0] # read ADC channel 0 value[0] = adc.read_adc(0, gain=GAIN) # ratio of 15 bit value to max volts determines volts volts = value[0] / 32767.0 * 6.144 # tests shows linear relationship between psi & voltage: psi = 50.0 * volts - 25.0 # bar conversion bar = psi * 0.0689475729 print("PSI = " +str(volts), "Bar = " +str(bar)) lcd.clear() lcd.message("0:).3f}V [{1}]".format(volts, value[0])) lcd.message(" {0:0.0f} psi {1:0.1f} bar".format(psi,bar)) sleep(4)
@rdagger
@rdagger 7 років тому
First your lcd.message statement has incorrect syntax. It should be: lcd.message("{0:0.3f}V [{1}]".format(volts, value[0])) However, that is not causing your problem. Looks like something is broken in the latest Raspbian release with respect to the Adafruit GPIO Python library. Please try manually installing it: cd ~ git clone github.com/adafruit/Adafruit_Python_GPIO.git cd Adafruit_Python_GPIO sudo python setup.py install Then reboot your Pi and try again.
@mosampandya6248
@mosampandya6248 5 років тому
Voice is too low
Raspberry Pi Plant Watering (& Time Lapse)
23:41
ExplainingComputers
Переглядів 322 тис.
Raspberry Pi Weather Station
21:42
ExplainingComputers
Переглядів 285 тис.
I PUT MY ARMOR ON (Creeper) (PG Version)
00:19
Sam Green
Переглядів 5 млн
Raspberry Pi ADC: MCP3008 Analog to Digital Converter
10:37
Pi My Life Up
Переглядів 66 тис.
Make a Raspberry Pi Automated Gardener
9:07
Hacker Shack
Переглядів 176 тис.
We should use this amazing mechanism that's inside a grasshopper leg
19:19
Raspberry Pi GPIO - Getting Started with gpiozero
48:40
DroneBot Workshop
Переглядів 428 тис.
Raspberry Pi show real time sensor data in a graph Python
8:42
logMaker360
Переглядів 118 тис.
Adam Savage Unboxes a Mechanical Marble Run!
19:14
Adam Savage’s Tested
Переглядів 104 тис.
ИГРОВОЙ ПК от DEXP за 37 тысяч рублей из DNS
27:53
Ремонтяш
Переглядів 369 тис.