|
Post by mickey53usa on Jun 10, 2020 12:30:06 GMT -8
I have the WeatherBoard for Pi Arduino. This is connected to a Raspberry Pi through the PiGrover Board. The WeatherBoard.py program reads the sensors that are connected with out issue, I have three problems:
1) Using the AM2315 - On the program display I show two "InTemp" and two "press" - How do I tell which is which?
2) Temperature reading is in Centigrade and I would like Fahrenheit. Which script do I change this in?
3) Barometric Pressure is reading as "Kpa" and not "PSI" (?) which script and how do I change this.
Appreciate the help. Google searches indicate a section of code must be added to do the conversion, but I do not know where this would be added or to what script (WeatherBoard. BMP280, etc).
|
|
|
Post by SDL on Jun 10, 2020 13:57:12 GMT -8
1) Please give a picture to show me what you are seeing.
2) Which exact software (give me the URL please) that you are using so I can answer this.
3) All of the values you need to change from metric to english units. Part of answer to #2!
BP
|
|
|
Post by mickey53usa on Jun 11, 2020 11:53:22 GMT -8
Well, this morning I received an error when I tried to launch the program.
I received - "sudo python /home/pi/SDL_Pi_Weatherboard/WeatherBoard.py Error accessing 0x48: Check your I2C address Error accessing 0x48: Check your I2C address Type Error DS3231= 2020-06-11 14:33:18 ----------------- ----------------- AT24C32 EEPROM ----------------- writing first 4 addresses with random data address = 0 writing value=146 Traceback (most recent call last): File "/home/pi/SDL_Pi_Weatherboard/WeatherBoard.py", line 198, in <module> bmp280 = BMP280.BMP280() File "build/bdist.linux-armv6l/egg/Adafruit_BMP/BMP280.py", line 46, in __init__ self._device = i2c.get_i2c_device(address, **kwargs) File "build/bdist.linux-armv6l/egg/Adafruit_GPIO/I2C.py", line 65, in get_i2c_device File "build/bdist.linux-armv6l/egg/Adafruit_GPIO/I2C.py", line 57, in get_default_bus RuntimeError: Could not determine default I2C bus for platform."
I can see what is causing the error, just not how to correct.
WeatherBoard for Pi - JP4 connects to Pi2Grover I2C header WeatherBoard for Pi - J4 connects to Pi2Grover I2C header WeatherBoard for Pi - JP11 connects to RTC WeatherBoard for Pi - J3 connects to AM2315
Consequently, I cannot provide the requested information regarding changing Metric to English.
WeatherBoard is 0010-052516-01 Pi2Grover is 0100-062416-01 Raspberry Pi - Zero W
Thanks
|
|
|
Post by mickey53usa on Jun 11, 2020 13:01:19 GMT -8
And, as I keep working on this issue - by loading Adafruit_Python_GPIO, Adafruit_Python_BMP, and Adafruit_I2C manually before running WeatherBoard.py - I get the following error -
pi@raspberrypi:~ $ sudo python /home/pi/SDL_Pi_Weatherboard/WeatherBoard.py Traceback (most recent call last): File "/home/pi/SDL_Pi_Weatherboard/WeatherBoard.py", line 39, in <module> import Adafruit_BMP.BMP280 as BMP280 ImportError: No module named BMP280
And it all worked so well yesterday before I turned it off -
|
|
|
Post by mickey53usa on Jun 12, 2020 12:56:25 GMT -8
Well, after much trial and error - I am back operational - This is what I get -
---------------- DS3231 Real Time Clock Not Present ----------------- ----------------- WeatherRack Weather Sensors WeatherRack Local ----------------- ----------------- AM2315 Temperature/Humidity Sensor ----------------- AM2315 temperature: 23.5 AM2315 humidity: 1.0 AM2315 crc: 1 ----------------- ----------------- SDL_CWS = 0.000000, SDL_Pi_WeatherRack._shortestWindTime = 4294967295, CWCount=0 TPS=0.000000 Rain Total= 0.00 in Wind Speed= 0.00 MPH MPH wind_gust= 0.00 MPH ----------------- ----------------- BMP280 Barometer ----------------- Temperature = 25.46 C Pressure = 91.21 KPa Altitude = 878.72 m Sealevel Pressure = 91.21 KPa ----------------- ----------------- HTU21DF Temp/Hum Not Present ----------------- ----------------- ----------------- AS3935 Lightning Detector Not Present ----------------- ----------------- ----------------- FRAM Not Present ----------------- -----------------
----------------- SunAirPlus Not Present ----------------- Sleeping 10 seconds
|
|
|
Post by SDL on Jun 12, 2020 18:10:34 GMT -8
Mickey,
Bizzare. Glad you have it working. I didn't even get back to you in time to help.
What is the GitHub archive that you got the software from? Then I can point you to the place to make the changes (hint - right around your print statements).
BP
|
|
|
Post by mickey53usa on Jun 13, 2020 6:54:07 GMT -8
github.com/switchdoclabs/SDL_Pi_WeatherBoardWeatherBoard.py is Version 1.8 August 22, 2016 I tried a simple change on Line 557, changing it from "C" to "F" Change line 558 from "KPa" to "mbar" (found out that it should change from "KPa" to "inches") Those changes did nothing - still displaying "C" and "KPa" Does some conversion language need to be added? Thanks
|
|
|
Post by SDL on Jun 14, 2020 14:49:32 GMT -8
Did you do the conversions? Or just change "C" to "F". You need to do the math to convert from C to F.
Same with Koa to inches.
Check out the formulas for the conversions on line.
BP
|
|
|
Post by mickey53usa on Jun 15, 2020 7:02:06 GMT -8
Your response is not helpful, especially when compared to your response on June 12 _ "What is the GitHub archive that you got the software from? Then I can point you to the place to make the changes (hint - right around your print statements).
BP"
I can find conversion scripts. Question is where do they get inserted in the WeatherBoard.py program. At the start? Line 557, line999?
Now a problem with the Wind Vane has arisen - it does not show up. I make an assumption that the Pi2Grove board that I purchased is an Analog to Digital Converter. So, why doe I not get the reading from that device. I found the mention of an ADC in this post -https://forum.switchdoc.com/thread/484/weather-board-rack-help-needed.
Additionally, starting at line 499 - currentWindSpeed = struct.unpack('f', str(block1[9:13]))[0] /1.6 currentWindGust = 0.0 # not implemented in Solar WXLink version
totalRain = struct.unpack('l', str(block1[17:21]))[0]/25.4
print("Rain Total=\t%0.2f in")%(totalRain) print("Wind Speed=\t%0.2f MPH")%(currentWindSpeed) if (config.OLED_Present): Scroll_SSD1306.addLineOLED(display, ("Wind Speed=\t%0.2f MPH")%(currentWindSpeed)) Scroll_SSD1306.addLineOLED(display, ("Rain Total=\t%0.2f in")%(totalRain)) Scroll_SSD1306.addLineOLED(display, "Wind Dir=%0.2f Degrees" % weatherStation.current_wind_direction())
currentWindDirection = struct.unpack('H', str(block1[7:9]))[0] print "Wind Direction=\t\t\t %i Degrees" % currentWindDirection
It appears that the code is incomplete as there is no "Scroll_SDD1306." for the Wind Direction.
I am beginning to remember why I have abandon Switchdoc programs - Now I have $100 plus in boards that I can't use for anything else.
|
|
|
Post by SDL on Jun 15, 2020 14:26:53 GMT -8
Mickey, I'm confused. You need to add the python code that will convert C into F (and the other units). Here is an example of how to do that: Here is the current line: print 'Temperature = \t{0:0.2f} C'.format(bmp280.read_temperature()) Now the modified Lines: bmpTemp = bmp280.read_temperature() TempF = bmpTemp* (9.0/5.0) +32.0 print 'Temperature = \t{0:0.2f} F'.format(TempF) The ADC is on the WeatherBoard. Please look at the specification. www.switchdoc.com/wp-content/uploads/2016/07/WeatherBoard_CurrentSpecification.pdfNo ADC on the Pi2Grover board. Check your wiring carefully on the Wind Direction Sensor. Also, check the voltage on the Wind Direction pin (see the specification) with a voltmeter and make sure it changes (according to the WeatherRack specification) as you move it. BP
|
|
|
Post by mickey53usa on Jun 17, 2020 9:42:44 GMT -8
This was a very helpful reply - It put things on the proper track to get all the conversions done. Thank you.
|
|
|
Post by mickey53usa on Jun 17, 2020 16:36:00 GMT -8
The next place the Celsius to Fahrenheit conversion needs to take place is for the AM2315. I have looked for and cannot find a AM2315 configuration file. I have looked in several places and failed to find a location where the calculation can be placed and work.
(python) 339 # Detect AM2315 340 try: 341 from tentacle_pi.AM2315 import AM2315 342 try: 343 am2315 = AM2315(0x5c,"/dev/i2c-1") 344 temperature, humidity, crc_check = am2315.sense() 345 print "AM2315 =", temperature 346 config.AM2315_Present = True 347 if (crc_check == -1): 348 config.AM2315_Present = False 349 except: 350 config.AM2315_Present = False (/python) (python) 453 if (config.AM2315_Present): 454 temperature, humidity, crc_check = am2315.sense() 455 print "AM2315 temperature: %0.1f" % temperature 456 print "AM2315 humidity: %0.1f" % humidity 457 print "AM2315 crc: %s" % crc_check (/python) (python) 515 # now do the AM2315 Temperature 516 temperature = struct.unpack('f', str(block1[25:29]))[0] 517 elements = [block1[29], block1[30], block1[31], block2[0]] 518 outHByte = bytearray(elements) 519 humidity = struct.unpack('f', str(outHByte))[0] 520 print "AM2315 from WXLink temperature: %0.1f" % temperature 521 print "AM2315 from WXLink humidity: %0.1f" % humidity (/python)
TIA
|
|
|
Post by SDL on Jun 18, 2020 16:34:05 GMT -8
You do the same type of conversion in these lines.
454 temperature, humidity, crc_check = am2315.sense() 455 print "AM2315 temperature: %0.1f" % temperature 456 print "AM2315 humidity: %0.1f" % humidity 457 print "AM2315 crc: %s" % crc_check
The temperature comes in in C and you convert to F and then print it out.
BP
|
|
|
Post by mickey53usa on Jun 20, 2020 7:06:16 GMT -8
I will give that a try - Thanks
|
|