I just purchased the BCRobotics board and tried to install the required
software for it. I ran into problems when I tried to test the BME280 using
the Adafruit ADS1x15 library. Kept getting errors and the python
Adafruit_BME280 library is deprecated.
Instead of trying to fix the errors I went the hard way and upgraded to the
adafruit-circuitpython libraries so I can also run Python3
sudo pip3 install adafruit-circuitpython-bme280
sudo pip3 install adafruit-circuitpython-ads1x15
I then modified the BCRobotics-test-app.py to run under Python3 and the
upgraded Adafruit libraries.
Tested the program and it works!
I have attached the modified program.
I need to modify the driver to work the same as the updated code but not
sure how to do that. Can I just substitute the same modifications that I
made to the test program?
Thanks
Terry
On Sunday, 14 February 2021 at 04:59:48 UTC-8 [email protected] wrote:
> The Cheetah template for "Current Conditions" is the file
> /etc/weewx/skins/Seasons.current.inc. When the processing of templates
> occurs, it will get "included" into index.html.tmpl.
>
> So, if you wanted to add the current conditions for a new type, say
> something named 'myobs', to the bottom of the list of observations, you
> would add the highlighted lines
>
> ...
> #if $day.extraTemp3.has_data
> <tr>
> <td class="label">$obs.label.extraTemp3</td>
> <td class="data">$current.extraTemp3</td>
> </tr>
> #end if
> <tr>
> <td class="label">My new observation</td>
> <td class="data">$current.myobs
> </tr>
> </tbody>
> </table>
>
>
> This assumes, of course, that the type 'myobs' exists in the database
> and/or the archive record.
>
> -tk
>
> On Sat, Feb 13, 2021 at 6:29 PM D R <[email protected]> wrote:
>
>> I apologize for not having come up with the answer on my own. I have
>> gone through the User and Customization guides and am just not finding
>> clear guidance as to what to do, despite there being a lot of info in
>> those documents.
>>
>>
>> What I want to do is add a line to the collection of items in the left
>> hand "Current Condtions" list. This section preceeds the "Celestial"
>> and "High Low" portions of that column, and lies to the left of the
>> graphs for the day.
>>
>> From my reading, I assumed that the area I was looking for would be in
>> the /etc/weewx/skins/Seasons directory, in the 'skins.conf' file. Yet
>> as I scan through there I cannot find a series of entries that matches
>> the fixed output that would then have the data to display and formatting
>> info right after it.
>>
>> I've looked at the Standard report, and the skins.conf there, and
>> haven't found what I'm looking for.
>>
>> Despite fiddling with this for a couple weeks trying to figure it out on
>> my own, I'm just not making the connection or am really looking in the
>> wrong spot.
>>
>>
>> Where does this section of the home page get formatted and while I think
>> I know what I want to add so it shows up as the temperature change from
>> 24 hours ago, don't just want to start changing things which would no
>> doubt give an error if not done carefully.
>>
>> Can someone give me a hint as to what I'm missing to find the correct
>> file?
>>
>> Dale
>>
>>
>> --
>>
> You received this message because you are subscribed to the Google Groups
>> "weewx-user" group.
>>
> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/weewx-user/0aad41a8-e703-6a30-df85-e13811cd48fa%40gmail.com
>> .
>>
>
--
You received this message because you are subscribed to the Google Groups
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/weewx-user/f8dfa80a-d3e3-46cd-88a2-6de2600df59dn%40googlegroups.com.
import time
import board
import busio
import adafruit_bme280
import adafruit_ads1x15.ads1115 as ADS
from adafruit_ads1x15.analog_in import AnalogIn
from w1thermsensor import W1ThermSensor
import RPi.GPIO as GPIO
try:
ds18b20 = W1ThermSensor()
except Exception as err:
print ('Error:', err)
noTemp = True
else:
print ('carry on')
noTemp = False
i2c = busio.I2C(board.SCL, board.SDA)
bme = adafruit_bme280.Adafruit_BME280_I2C(i2c)
ads = ADS.ADS1115(i2c, gain=1)
chan = AnalogIn(ads, ADS.P0)
interval = 2 # Time between loops (seconds)
windTick = 0 # Count of the wind speed input trigger
rainTick = 0 # Count of the rain input trigger
# Set GPIO pins to use BCM pin numbers
GPIO.setmode(GPIO.BCM)
# Set digital pin 17 to an input and enable the pullup (wind speed)
GPIO.setup(17, GPIO.IN, pull_up_down=GPIO.PUD_UP)
# Set digital pin 23 to an input and enable the pullup (rain)
GPIO.setup(23, GPIO.IN, pull_up_down=GPIO.PUD_UP)
# Event to detect wind (4 ticks per revolution)
GPIO.add_event_detect(17, GPIO.BOTH)
def windtrig(self):
global windTick
windTick += 1
GPIO.add_event_callback(17, windtrig)
# Event to detect rain (0.2794mm per tick)
GPIO.add_event_detect(23, GPIO.FALLING)
def raintrig(self):
global rainTick
rainTick += 1
GPIO.add_event_callback(23, raintrig)
while True:
time.sleep(interval)
# Get temperature from DS18B20 sensor
temperature = ds18b20.get_temperature()
# Get Temperature from BME280
case_temp = bme.temperature
# Get Barometric Pressure from BME280 and convert to kPa from pascals
pressure_pa= bme.pressure
pressure = pressure_pa / 1000
# Get Humidity from BME280
humidity = bme.humidity
# Calculate wind direction based on ADC reading
# Read ADC channel 0 with a gain of 1
val = chan.value
windDir = "Not Connected" # In case wind sensor not connected
if 19600 <= val <= 20999:
windDir = "N"
if 9000 <= val <= 10799:
windDir = "NNE"
if 10800 <= val <= 13999:
windDir = "NE"
if 2000 <= val <= 2299:
windDir = "ENE"
if 2300 <= val <= 2999:
windDir = "E"
if 1000 <= val <= 1999:
windDir = "ESE"
if 4000 <= val <= 4999:
windDir = "SE"
if 3000 <= val <= 3999:
windDir = "SSE"
if 6600 <= val <= 8999:
windDir = "S"
if 5000 <= val <= 6599:
windDir = "SSW"
if 15900 <= val <= 16999:
windDir = "SW"
if 14000 <= val <= 15899:
windDir = "WSW"
if 24000 <= val <= 24999:
windDir = "W"
if 21000 <= val <= 21999:
windDir = "WNW"
if 22000 <= val <= 23999:
windDir = "NW"
if 17500 <= val <= 19599:
windDir = "NNW"
# Calculate the average wind speed over
# this 'interval' in km/h
windSpeed = (windTick * 1.2) / interval
windTick = 0
#Calculate the rainfall over this 'interval' in mm
rainFall = rainTick * 0.2794
rainTick = 0
# Print results
print ('Temperature: ', temperature, 'C')
print ('Humidity: ', humidity, '%')
print ('Case Temp: ', case_temp, 'C')
print ('Pressure: ', pressure, 'kPa')
print ('Dir ADC val: ', val)
print ('Wind Dir: ', windDir)
print ('Wind Speed: ', windSpeed, 'km/h')
print ('Rainfall: ', rainFall, 'mm')
print (' ')