An SHT-30 that WONT return values

Excellent post @AndrewBG, beat me to it, lol.
I note @Andre191880 has another post titled SHT-20 Wiring.

cheers
Jim

2 Likes

@Andre191880 hang 5 while I replicate everything that I have told you so that I can 100% confirm that you wont have any issues.

Hi James

I don’t know how fitting a terminating resistor on the receiving ENDS of a cable run and nowhere else has to be a headache. The headache arises when trying to explain WHY a resistor should be placed there and only there. Severe confusion arises when a manufacturer fits these terminations internally which is probably OK if only using one device at each end but no good if you are using several devices in parallel across the transmission line.

Internally fitted resistors as pull up and pull down on the A and B line of an RS485 system are another pet bug of mine also. I have mentioned this often but no one has come up with a valid explanation yet. Only one contributor (forget who now) agreed with me in that they should not be there.

All personal preferences these. I myself tend to steer away from RPi because from what I can understand from browsing the Forum RPi seems a bit thin when it comes to compatibility between models and operating systems etc. Indeed some time ago the general fix for everything seemed to be re-flash or re-install everything until something worked. That method seems to have disappeared somewhat lately and a more structured approach seems to have crept in.

Also not a big fan of 3.3V. All good if you keep it all inside the same box probably but when you get out into the big nasty world where you might have to go somewhere with it it is possible to come across small losses here and there and it does not take too much chipping away until most of the useful bit of 3.3V has disappeared. Similar occurs with 5V I agree but there seems to be a bit more head room here.
I stress these are only my opinions and feel free to use whichever suits the occasion.

Cheers Bob

2 Likes

OK I changed the code slightly and it is working now.

I can 100% confirm that all the steps that I gave you above work perfectly and reads the SHT31 and outputs the values.
Follow my guide above and it will work.

2 Likes

@Andre191880 are you going to come back and give us an update?
It would be good to close of this saga knowing that you were able to get a positive outcome.

3 Likes

Thanks Bob for your words of wizdom and appologies for the delay in getting back to you, but 12 hour days have taken their toll and i am only 4 days into 5 days off to get here.
Yes I have got single units to work in the wild and was ever only going to run the R-Pi in close proximity to the solenoid and let the water pressure do the grunt work over the watering zone under 240 volt pump pressure (external to the R-Pi controllers).
The code now only has one item on at a time and even shuts off the power whilst changing over watering zones. The code may be a little long hand, but as you have said, One thing working at a time & build on that. I arrived at this independently and really appreciate the confirmation.
Although the code is repetitive and probably better looped in other ways, I am doing a full live test now.
The code now looks like this

#!/bin/python 
#
#       small glasshouse automation -watering
#       script \\CELESTE\projX\operations\11_water_11_minutes.py on 2022.10.17
#
import RPi.GPIO as GPIO
import subprocess
import time
import os
import logging
#
watert = 672  #-- Time Watering eg 3.3 seconds
#-- or = 190  #-- short Watering in seconds
#-- or = 672  #-- Long or First Waering in seconds
waitt =  5    #-- Time Waiting  eg 1.6 seconds
pse = 1       #-- timing pause
#
LoK = "./"    #-- Location of sub-scripts
logname =  "../log/log.txt" #-- Location of LOG file
S2 = " ON"
S3 = " OFF"
wds = "watering " # Function appropriation for logging
pwr = "power    "
#--        All Off
S1 = "190" # GPIO 2 off
subprocess.run(['python', LoK+ S1+'.py'])
S1 = "210" # GPIO 3 off
subprocess.run(['python', LoK+ S1+'.py'])
S1 = "230" # GPIO 4 off
subprocess.run(['python', LoK+ S1+'.py'])
S1 = "270" # GPIO 17 off
subprocess.run(['python', LoK+ S1+'.py'])
S1 = "290" # GPIO 2 off
subprocess.run(['python', LoK+ S1+'.py'])
S1 = "330" # GPIO 3 off
subprocess.run(['python', LoK+ S1+'.py'])
S1 = "350" # GPIO 4 off
subprocess.run(['python', LoK+ S1+'.py'])
S1 = "370" # GPIO 4 off
subprocess.run(['python', LoK+ S1+'.py'])
#
logging.basicConfig(filename=logname,
    filemode='a', format='%(asctime)s - %(message)s',
    datefmt='%Y-%m-%d %H:%M:%S', level=logging.DEBUG)
logging.info( 'watercycle @ ' + str(watert) + ' seconds' ) 
logging.shutdown()
time.sleep(pse);
# 
S1 = "191"
Zn = " power  -ON"
subprocess.run(['python', LoK+ S1+'.py'])
logging.basicConfig(filename=logname,
    filemode='a', format='%(asctime)s - %(message)s',
    datefmt='%Y-%m-%d %H:%M:%S', level=logging.DEBUG)
logging.info(pwr+ S1+ Zn )
logging.shutdown()
time.sleep(pse);
# 
S1 = "231" 
Zn = " zone 1 -open"
subprocess.run(['python', LoK+ S1+'.py'])
print(Zn)
#-- log
logging.basicConfig(filename=logname,
    filemode='a', format='%(asctime)s - %(message)s',
    datefmt='%Y-%m-%d %H:%M:%S', level=logging.DEBUG)
logging.info(wds+ S1+ Zn )
logging.shutdown()
time.sleep(watert);
#
S1 = "190"
Zn = " power  -OFF"
subprocess.run(['python', LoK+ S1+'.py'])
#-- log
logging.basicConfig(filename=logname,
    filemode='a', format='%(asctime)s - %(message)s',
    datefmt='%Y-%m-%d %H:%M:%S', level=logging.DEBUG)
logging.info(pwr+ S1+ Zn )
logging.shutdown()
time.sleep(pse);
#
S1 = "371" 
Zn = " return -open"
subprocess.run(['python', LoK+ S1+'.py'])
logging.basicConfig(filename=logname,
    filemode='a', format='%(asctime)s - %(message)s',
    datefmt='%Y-%m-%d %H:%M:%S', level=logging.DEBUG)
logging.info(wds+ S1+ Zn )
logging.shutdown()
time.sleep(waitt);
#
S1 = "230" 
Zn = " zone 1 -closed"
subprocess.run(['python', LoK+ S1+'.py'])
#-- log
logging.basicConfig(filename=logname,
    filemode='a', format='%(asctime)s - %(message)s',
    datefmt='%Y-%m-%d %H:%M:%S', level=logging.DEBUG)
logging.info(wds+ S1+ Zn )  #-- adds a blank line to the log file
logging.shutdown()
time.sleep(pse);
#
S1 = "370" 
Zn = " return -closed"
subprocess.run(['python', LoK+ S1+'.py'])
logging.basicConfig(filename=logname,
    filemode='a', format='%(asctime)s - %(message)s',
    datefmt='%Y-%m-%d %H:%M:%S', level=logging.DEBUG)
logging.info(wds+ S1+ Zn )
logging.shutdown()
time.sleep(pse);
#
S1 = "191"
Zn = " power  -ON"
subprocess.run(['python', LoK+ S1+'.py'])
#-- log
logging.basicConfig(filename=logname,
    filemode='a', format='%(asctime)s - %(message)s',
    datefmt='%Y-%m-%d %H:%M:%S', level=logging.DEBUG)
logging.info(pwr+ S1+ Zn )
logging.shutdown()
time.sleep(waitt);
# 
S1 = "271" 
Zn = " zone 2 -open"
subprocess.run(['python', LoK+ S1+'.py'])
print(Zn)
#-- log
logging.basicConfig(filename=logname, 
    filemode='a', format='%(asctime)s - %(message)s',
    datefmt='%Y-%m-%d %H:%M:%S', level=logging.DEBUG)
logging.info(wds+ S1+ Zn )
logging.shutdown()
time.sleep(watert);
#
S1 = "190"
Zn = " power  -OFF"
subprocess.run(['python', LoK+ S1+'.py'])
#-- log
logging.basicConfig(filename=logname,
    filemode='a', format='%(asctime)s - %(message)s',
    datefmt='%Y-%m-%d %H:%M:%S', level=logging.DEBUG)
logging.info(pwr+ S1+ Zn )
logging.shutdown()
time.sleep(pse);
#
S1 = "371" 
Zn = " return -open"
subprocess.run(['python', LoK+ S1+'.py'])
logging.basicConfig(filename=logname,
    filemode='a', format='%(asctime)s - %(message)s',
    datefmt='%Y-%m-%d %H:%M:%S', level=logging.DEBUG)
logging.info(wds+ S1+ Zn )
logging.shutdown()
time.sleep(waitt);
#
S1 = "270" 
Zn = " zone 2 -closed"
subprocess.run(['python', LoK+ S1+'.py'])
#-- log
logging.basicConfig(filename=logname, 
    filemode='a', format='%(asctime)s - %(message)s',
    datefmt='%Y-%m-%d %H:%M:%S', level=logging.DEBUG)
logging.info(wds+ S1+ Zn )
logging.shutdown()
time.sleep(waitt);
#
S1 = "370" 
Zn = " return -closed"
subprocess.run(['python', LoK+ S1+'.py'])
logging.basicConfig(filename=logname,
    filemode='a', format='%(asctime)s - %(message)s',
    datefmt='%Y-%m-%d %H:%M:%S', level=logging.DEBUG)
logging.info(wds+ S1+ Zn )
logging.shutdown()
time.sleep(pse);
#
S1 = "191"
Zn = " power  -ON"
subprocess.run(['python', LoK+ S1+'.py'])
#-- log
logging.basicConfig(filename=logname,
    filemode='a', format='%(asctime)s - %(message)s',
    datefmt='%Y-%m-%d %H:%M:%S', level=logging.DEBUG)
logging.info(pwr+ S1+ Zn )
logging.shutdown()
time.sleep(waitt);
# 
S1 = "331" # 291
Zn = " zone 3 -open"
subprocess.run(['python', LoK+ S1+'.py'])
print(Zn)
#-- log
logging.basicConfig(filename=logname, 
    filemode='a', format='%(asctime)s - %(message)s',
    datefmt='%Y-%m-%d %H:%M:%S', level=logging.DEBUG)
logging.info(wds+ S1+ Zn )
logging.shutdown()
time.sleep(watert);
#
S1 = "190"
Zn = " power  -OFF"
subprocess.run(['python', LoK+ S1+'.py'])
#-- log
logging.basicConfig(filename=logname,
    filemode='a', format='%(asctime)s - %(message)s',
    datefmt='%Y-%m-%d %H:%M:%S', level=logging.DEBUG)
logging.info(pwr+ S1+ Zn )
#-- logging.info(pwr+ S1+ Zn )
logging.shutdown()
time.sleep(pse);
#
S1 = "371" 
Zn = " return -open"
subprocess.run(['python', LoK+ S1+'.py'])
logging.basicConfig(filename=logname,
    filemode='a', format='%(asctime)s - %(message)s',
    datefmt='%Y-%m-%d %H:%M:%S', level=logging.DEBUG)
logging.info(wds+ S1+ Zn )
logging.shutdown()
time.sleep(waitt);
#
S1 = "330" # 290" 
Zn = " zone 3 -closed"
subprocess.run(['python', LoK+ S1+'.py'])  
#-- log
logging.basicConfig(filename=logname, #-- log
    filemode='a', format='%(asctime)s - %(message)s',
    datefmt='%Y-%m-%d %H:%M:%S', level=logging.DEBUG)
logging.info(wds+ S1+ Zn )  #-- adds a blank line to the log file
logging.shutdown()
time.sleep(waitt);
#
S1 = "370" 
Zn = " return -closed"
subprocess.run(['python', LoK+ S1+'.py'])
#-- log
logging.basicConfig(filename=logname,
    filemode='a', format='%(asctime)s - %(message)s',
    datefmt='%Y-%m-%d %H:%M:%S', level=logging.DEBUG)
logging.info(wds+ S1+ Zn )
logging.shutdown()
time.sleep(pse);
#
S1 = "191"
Zn = " power  -ON"
subprocess.run(['python', LoK+ S1+'.py'])
#-- log
logging.basicConfig(filename=logname,
    filemode='a', format='%(asctime)s - %(message)s',
    datefmt='%Y-%m-%d %H:%M:%S', level=logging.DEBUG)
logging.info(pwr+ S1+ Zn )
logging.shutdown()
time.sleep(waitt);
# 
S1 = "331" 
Zn = " zone 4 -open"
subprocess.run(['python', LoK+ S1+'.py'])
print(Zn)
#-- log
logging.basicConfig(filename=logname, #-- log
    filemode='a', format='%(asctime)s - %(message)s',
    datefmt='%Y-%m-%d %H:%M:%S', level=logging.DEBUG)
logging.info(wds+ S1+ Zn )
logging.shutdown()
time.sleep(watert);
#
S1 = "190"
Zn = " power  -OFF"
subprocess.run(['python', LoK+ S1+'.py'])
#-- log
logging.basicConfig(filename=logname,
    filemode='a', format='%(asctime)s - %(message)s',
    datefmt='%Y-%m-%d %H:%M:%S', level=logging.DEBUG)
logging.info(pwr+ S1+ Zn )
#-- logging.info(pwr+ S1+ Zn )
logging.shutdown()
time.sleep(pse);
#
S1 = "371" 
Zn = " return -open"
subprocess.run(['python', LoK+ S1+'.py'])
logging.basicConfig(filename=logname,
    filemode='a', format='%(asctime)s - %(message)s',
    datefmt='%Y-%m-%d %H:%M:%S', level=logging.DEBUG)
logging.info(wds+ S1+ Zn )
logging.shutdown()
time.sleep(waitt);
#
S1 = "330" 
Zn = " zone 4 -closed"
subprocess.run(['python', LoK+ S1+'.py'])
#-- log
logging.basicConfig(filename=logname, #-- log
    filemode='a', format='%(asctime)s - %(message)s',
    datefmt='%Y-%m-%d %H:%M:%S', level=logging.DEBUG)
logging.info(wds+ S1+ Zn )  #-- adds a blank line to the log file
logging.shutdown()
time.sleep(waitt);
#
S1 = "370" 
Zn = " return -closed"
subprocess.run(['python', LoK+ S1+'.py'])
logging.basicConfig(filename=logname,
    filemode='a', format='%(asctime)s - %(message)s',
    datefmt='%Y-%m-%d %H:%M:%S', level=logging.DEBUG)
logging.info(wds+ S1+ Zn )
logging.shutdown()
time.sleep(watert);  #-- log sys empty
#
logging.basicConfig(filename=logname,
    filemode='a', format='%(asctime)s - %(message)s',
    datefmt='%Y-%m-%d %H:%M:%S', level=logging.DEBUG)
#loging.info( 'watercycle @ ' + str(watert) + ' seconds' ) 
logging.info( 'finished ------------------'+ '\n' )  #--  adds a blank line to the log file 
logging.shutdown()

Bob,
Yes knowing what I know now about R-Pi, you are perhaps very correct. Now I just need some ROI for the hardware I have been advised I really need, but selling the lot is also very on the cards regardless of the financial losses.
Sanity will the return to reasonable and frustration should return to zero though.

@Andre191880 was any of the great effort that I put in to help you used or was it a waste of my time?

Thanks James,
this is something equally valid for me to think about, but will need to balance this against selling the whole R-Pi fiasco and go back to a simple bunnings timer.

Thanks again Jim,
I am reassured that even a seasoned veteran gets frustrated.
The simple thing with the SHT-30 is that is should be easy to figure out if it returns a voltage or a measure of resistance. Basic stuff, even for newbies like me.

Very happy for the offer of help as i see I have enough bits to do what i need done.
I am also playing with synergy between my Desktop and the R-Pi and sorted out some connectivity (WiFi) issues after blowing up a 240v controller and finally getting th3e correct replacement.

Thanks Andrew,
basically I have a SHT-30 and need the 101 lesson, am i looking for a change in voltage with a base line of 2.0 volts = something that can be calculated as the actual temperature,
OR
am I looking at a resistance based sensor.

I asked, not in anger, but absolute and complete frustration as this sort of information should be basic and not “depends on your system” or some other guff.
It is an environmental sensor that gives readings that change. What is changing that I need to measure ?
The chip has fallen off the sensor which may very well be why I can not get any values returned too.

None of that makes any sense based on your previous posts in both your threads.
You have never been looking for change or voltage or resistance as you are using a digital pins and sensor.

I give up.

I went to a lot of trouble to answer the question that you had, specifically, and you toddled off on your merry way without even acknowledging anyones help, and now have some TOTALLY different comments.

1 Like

Thanks Andrew,

the questions u start with in summary are:

  • a simple wiring diagram without crossed lines and guff:
    Screenshot 2022-10-20 121025

The R-Pi on the left has pin numbers and these are then used in the individual scripts as pin then Bolen as in pump off is 190.py
Therefore the log file reads as a series of on and off with a descriptor:

Screenshot 2022-10-20 121600

  • Version returned as PRETTY_NAME=“Raspbian GNU/Linux 11 (bullseye)”
  • I am trying to run any code as starting has not occurred.
  • Yes read the primer some time ago, and that got me nowhere constructive from my level of understanding then & my confidence, frustration and understanding today.

The cheat sheet has glimpses of recognised code instructions, so that will be my next route to explore.
The GPIO is my bible as that was what I was told from the get-go and it has served me well thus far. Confirmation is good.
I2cdetect has not ever yielded me anything and been all blanks.
Your tutorial is awesome and I will go through it line by line and run down any additional learning needed. tks.

No Arduino, but based on your post I may just go there and through the R-Pi in frustration.

Thanks Bob,

I think the rationale why I initially went with R-Pi was confirmed with both your & James’ Arduino comments.
tks.

You really need to just stop, go back to first principals and learn what you are doing.
Cutting code that is not physically implemented at this stage is a waste of time.
You have to follow the BASIC tutorial that I wrote, with nothing else going on, and LEARN how I2C works and how using sensors works.
As I said, cutting code now without the rest is a waste of time.

You are reading everything so far out of order, it is not helping.
No, dont go arduino now, you will get much more frustrated as you dont understand the core principals as to how this works.

Go back to my tutorial, replicate it, get it working, learn how and why it works, then proceed.

1 Like

Andrew,

Yes and that has helped now I come back to this.
The voltage comment comes from the Anemometer I got working that uses a base load, a resistor and I get a result in the change of wind moving the unit.

U have helped heaps and i need to get back into the suggestions that are pointing me toward a resolution.
Giving up is for my level and not of a sage trying to improve the experiences of others with this technology.
Yes I gave up, until I get domestically harassed into providing a return on investment including the death of $20k of orchids.
I can assure you it is still the same issue - getting a value out of a temperature sensor. Obviously i have a few sensors, but the use instructions are equally as scant on each of them. Without your guidance I would have thrown the R-Pi stuff out long ago. U have helped lotz & I thank you for that.

There are quite a few suggestions (over 50 forum notifications have been viewed and responded to today) that I need to explore now and yes I will keep you posted in due course.

Cheers

I fail to understand how you can take such a loss but be annoyed at low cost sensors, let alone just go buy something to do the job.
You’ve taken on too complex a project to start with.
I can assure you that no-one here started at that level, we all start simple and small and learn more and more and that progresses into combining small projects and culminates in big complicated lumbering projects.
We didnt start at the end goal.

Lesson one, learn what a digital vs analogue sensor is
two, learn what base system is best for which job.
three implement something real basic.

Raspberry Pi with a digital temp/humidity sensor running and outputting values is step one.
Step two is adding a solenoid and have the two work together for SINGLE channel.
Step three is to expand the lot into a working system, however I wouldnt do that, I would first implement a web server and status control page that can be accessed on the network, use an old iPad or tablet to do the viewing and control.
THEN I would build out multi channel etc.

It is a big project that wont be done in 6 weeks, your deadline cant be met, there is too much work to do especially while learning how it will work and working full time.
lastly, there’s not enough time to test it properly. You will need weeks of flawless running to establish the issues that you are going to have.
There are always issues that only arise in certain edge cases, but they are always present.

Im not trying to discourage you, I am trying to make you set realistic goals or you will be coming back here chucking hissy fits again when it falls in a heap and gets too complicated.

3 Likes

Hi Andre

A fair]ly good understanding of the “basics” such as Voltage, Current, Power, Resistance is pretty mandatory to have any sort of understanding re how anything works. Starting part way up the ladder with Bits, Bytes, and various other terms that float around will not and has never worked successfully. Crawl before walking as the old saying goes.

How the hell did that happen. Chips (another term) don’t “fall” off usually without a good bit of help. Can be difficult to remove sometimes actually. If that has been dodgy for some time you could well have introduced other problems trying to “fix” this one. Could be actually Chinese QA gone wrong perchance or has someone been playing with it.
Cheers Bob

2 Likes

Thanks Robert,

employed hired help on this one today & have failed at the first gate with the sht31. i2c fails. so onto trouble shooting this aspect as it appears to be pivotal before moving onto any subsequent steps

1106hrs

I have followed your instructs implicitly and had my work checked and double checked. Your attention to detail has assisted nicely as the single source of truth.
still working on it.

1 Like