Advanced search FAQ Register Login

It is currently Tue Jan 23, 2018 2:31 pm

 

Postby Ruben » Tue Oct 17, 2017 11:18 am

Hi everyone

How could I read watermark moisture sensor, or gypsum sensor, with RPi3? What would I need exactly?

I have no electronic knowledgement... so I would need the easiest way to do it :)

Thanks in advance!!

Ruben
n00b

Posts: 8

Joined: Tue Oct 17, 2017 11:12 am

Postby Dave » Tue Oct 17, 2017 11:33 am

The simplest way would be to use the digital output from this sensor - https://www.modmypi.com/raspberry-pi/se ... h=moisture

Digital output is simply "yes I'm wet" or "no im dry" - This is calibrated by the little potentiometer on the sensor.

If you want to actually get the current level of moisture then you'll need to use the analogue output from the sensor. Unfortunately the Pi doesn't have any analogue pins, so you'll need a ADC (analogue to digital converter), something like this - https://www.modmypi.com/raspberry-pi/io ... search=adc

We have a tutorial for both digital and analogue outputs for this sensor

Digital - https://www.modmypi.com/blog/raspberry- ... n-tutorial
Analogue - https://www.modmypi.com/blog/raspberry- ... ue-signals

Dave
ModMyPi

User avatar

Posts: 2084

Joined: Wed Jul 22, 2015 11:36 am

Forum Administrator & Technical Support

Postby Ruben » Tue Oct 17, 2017 11:47 am

Thank you very much for your answer Dave,

yes, I actually want to get current moisture level and read it about each hour and to put data into a graph.

I'll try to perform this tutorial to get analog data through ADC

Thanks!

Ruben
n00b

Posts: 8

Joined: Tue Oct 17, 2017 11:12 am

Postby Dave » Tue Oct 17, 2017 12:15 pm

Ruben wrote:Thank you very much for your answer Dave,

yes, I actually want to get current moisture level and read it about each hour and to put data into a graph.

I'll try to perform this tutorial to get analog data through ADC

Thanks!


Not a problem, best of luck! Any problems, just shout and I'll see if I can help.

Dave
ModMyPi

User avatar

Posts: 2084

Joined: Wed Jul 22, 2015 11:36 am

Forum Administrator & Technical Support

Postby Ruben » Wed Oct 18, 2017 12:51 pm

Hello Dave

I've found this module :
MakerHawk Raspberry PI 16 Bits I2C ADS1115 Module ADC 4 Channel for Raspberry Pi 3/2 Model B/B+

With this module connecting it through RaspBerry3 GPIO?.. I would'n't need to connect the ADC through Breadboard and Cobbler. Is correct?

In descripition it is said that "can detect analog signal and convert..." Is only used to recieve input signal? I mean, to read a gypsum sensor a have to send a voltage signal and recieve a voltage signal. The difference between signals are "resistance" which we'll use to calculate hydric potential. Then, through this ADC module couldn't I read a gypsum sensor?

Thank you very much!

Ruben
n00b

Posts: 8

Joined: Tue Oct 17, 2017 11:12 am

Postby Dave » Wed Oct 18, 2017 1:04 pm

Ruben wrote:With this module connecting it through RaspBerry3 GPIO?.. I would'n't need to connect the ADC through Breadboard and Cobbler. Is correct?

That's correct, this looks like it connects directly to the Raspberry Pi's GPIO header. You would only need to hook up the analogue output of the sensor directly to the MakerHawk board.

Ruben wrote:In descripition it is said that "can detect analog signal and convert..." Is only used to recieve input signal? I mean, to read a gypsum sensor a have to send a voltage signal and recieve a voltage signal. The difference between signals are "resistance" which we'll use to calculate hydric potential. Then, through this ADC module couldn't I read a gypsum sensor?

With the sensor i previously linked, you supply it 3.3 volts, the analogue output will then be anything from 0 - 3.3v depending on the moisture level (resistance). You don't need to work out the resistance because the sensor does it for you. The ADC module will work just fine :)

I should point out that you will need to look into how you write a script to work with that ADC... I highly recommend the Adafruit or RasPiO ADC - https://www.modmypi.com/raspberry-pi/io ... nsion-1030 - as they have good documentation on how to use them

Dave
ModMyPi

User avatar

Posts: 2084

Joined: Wed Jul 22, 2015 11:36 am

Forum Administrator & Technical Support

Postby Ruben » Tue Nov 07, 2017 3:29 pm

Hello again,

I'm trying to complete the tutorial:
Analogue - https://www.modmypi.com/blog/raspberry- ... ue-signals

I try execute simpletest.py file from Adafruit_Python.../examples directory but I get this

this: (see attached picture)

Where come the problem from? is the problem in the code or maybe in the ADC (ADS1115 16Bit 12Ch) installation?
I'm not an welding expert. Could the problem be the welds I made in the ADC? I think they are not bridged

The sensor works. One light is on when connected to RPi and the second light is on when sumerged.

Any idea about what is the problem?

Thanks in advance,

Ruben
n00b

Posts: 8

Joined: Tue Oct 17, 2017 11:12 am

Attachments

IMG_20171107_150935.jpg

IMG_20171107_150935.jpg (2.92 MiB) Viewed 188 times

Postby Dave » Tue Nov 07, 2017 3:52 pm

Looks to me like I2C hasn't been enabled on the Raspberry Pi.

If you click the Pi icon top left of the desktop, go down to Preferences then select Raspberry Pi Configuration.

Click the "Interfaces" tab, then enable I2C. This should fix the problem.

Dave
ModMyPi

User avatar

Posts: 2084

Joined: Wed Jul 22, 2015 11:36 am

Forum Administrator & Technical Support

Postby Ruben » Tue Nov 07, 2017 5:29 pm

Thanks Dave,

next step. When I execute again simpletest.py it give me this result:

see attached picture

Is it again a RPi configuration problem? or is related to the code...?

Thanks

Ruben
n00b

Posts: 8

Joined: Tue Oct 17, 2017 11:12 am

Attachments

IMG_20171107_171415.jpg

IMG_20171107_171415.jpg (1.12 MiB) Viewed 186 times

Postby Dave » Wed Nov 08, 2017 9:56 am

Ah it looks like Adafruit have had a re-organise of their code, and potentially updated it.

That latest version of the code can be found here - https://github.com/adafruit/Adafruit_Python_ADS1x15 - which also has instructions on how to install the library before use:

sudo apt-get install git build-essential python-dev
cd ~
git clone https://github.com/adafruit/Adafruit_Python_ADS1x15.git
cd Adafruit_Python_ADS1x15
sudo python setup.py install


Give that a go and see if it resolves the issue.

I'll hopefully get around to updating the tutorial later this week.

Dave
ModMyPi

User avatar

Posts: 2084

Joined: Wed Jul 22, 2015 11:36 am

Forum Administrator & Technical Support
Next

Who is online

Users browsing this forum: No registered users and 2 guests

Board index

The teamDelete all board cookies • All times are UTC [ DST ]