Integration of Sparkfun-style Weather Kit into HA via ESPHome.io

I really like the idea of trying to capture real-time weather data so I’ve been eyeing these kits from Sparkfun:

Looking at the details, datasheets, and instructions there doesn’t appear to be very much information on sending the data to another device and no circuit board comes with the standalone SEN kits which seems dumb.

I’d like to integrate the outputs of the sensors into an esp8266 or something similar via esphome.io and send that onto home assistant. I’m trying to figure out what I need to get this going and I’m wondering if anyone has successfully integrated something like this into Home Assistant previously. Searching this forum and Google for weather kits and Home Assistant, sadly, yields very little. :slightly_frowning_face:

I did find this: esphomeweatherstation. Where @mkuoppa built something like what I’m wanting from a “MakerLife Weather Station Kit”. That seems pretty darn close (seems to only be missing wind direction) but I couldn’t find that kit by Googling around and the details on his github page are quite sparse.

Thanks,
-Greg

2 Likes

I did not build such a weather station but I’m looking to.

Searching for the MakerLife Weather Station Kit with Google, I found this link where, I think, you will find a lot of informations:
https://projects.raspberrypi.org/en/projects/build-your-own-weather-station

On page 9, on first picture we can see sensors from the SEN-15901 kit and on page 10, on the first picture we can see adapters (RJ11 to ‘terminal blocks’).
I think that with such adapters (you can find some on aliexpress or you can solder directly to the ESP) you will be able to get data and use part of the code from esphomeweatherstation

Someone has posted the code for the wind direction + a wiring schematic in an issue: https://github.com/mkuoppa/esphomeweatherstation/issues/2

2 Likes

I based mine largely on the code that @mkuoppa was working on, and largely on the hardware/wiring from https://tysonpower.de/blog/esp8266-weather-station and other breakout board similar to the SparkFun board. @pilotak has a github project using an ESP8266 without ESPHome, but I could not get it to compile. He also has .h libraries that should be able to be included in ESPHome for all of the weather calculations (and I mean all, excellent library!)

It’s been running now about 2 months with no issues. I am still tweaking the code and it is accurate enough. Wind speed readings are pretty close to my local PWS. I have not recorded any of the recent 50mph winds we had, even though I had when I first put it in position. This may be either that the software pulse counter cannot keep up in the ESP8266, or the station being placed on my detached garage in a back alley, roughly 15’ in the air. If the wind is from the east or west, it is buffeted by the surrounding houses (all attached). So my current location is not ideal, but I have just got a pair of ESP32’s to play with, adding hardware pulse counter and more ADC for solar/battery monitoring. If all goes well, once I have roof access it’ll be 30’ up on top of the house.

I posted my project on reddit: https://www.reddit.com/r/Esphome/comments/g385ls/wemos_d1_mini_esphome_powered_weather_station/

For the terminal blocks, I used some CAT5e keystones since I had them lying around. RJ11 uses the inside 6 of the RJ-45. Or you could always cut off the RJ11 ends on the sensors. There’s only 6 wires from the unit, with 3 of them being grounds.

I would recommend you give it a try. It works and was fun! Would be happy to answer any questions!

1 Like

Let me just thank you for using my esphome weather station contribution. I’m truly honored since it’s my first and so far only contribution to this awesome community. :pray:

4 Likes

Nice to see someone spotted my weather station project, i have updated the dependencies for PlatformIO to compile correctly.

There is a future request for WeatherMeters in esphome https://github.com/esphome/feature-requests/issues/488

2 Likes

This gives me serious hope!! Thanks for the replies here guys. Lots of examples and resources here, I’m definitely going to have to try this. I wasn’t aware that some units have a 433MHz battery-powered transmitter included. I already have a Sonoff-bridge that is used to send/receive 433MHz signals (for door/window sensors). I wasn’t planning on using the weather device as a battery-powered setup but if I can find a setup that comes with the transmitter, I’d have to give that a try…

You can find it on AliExpress for example with this ref. MS-WH-SP-WS02
https://m.fr.aliexpress.com/item/1214985366.html

That’s the exact one I have. If you are ok with changing the 2xAA batteries, some were able to decode the 433mhz packets into readings. Protocol is Fine Offset I beleive
Great YouTube channel -> https://www.youtube.com/watch?v=L0fSEbGEY-Q
Old forum with entire process - > https://www.raspberrypi.org/forums/viewtopic.php?t=96780

We had some storms come through Monday and finally recorded some sizable wind. Highest gust was 48mph. Otherwise pretty spot on with DarkSky…

btw…@SpikeyGG, I am running your washer/dryer sensors with the mpu-6050s. Fun project and works flawlessly!

1 Like

It seems that the 433Mhz transmitter works with RFLink (http://www.rflink.nl/blog2/devlist) but I did not found someone to confirm.

How long before changing batteries?
Power and WiFi are real issues with ESP boards when you want to put some outside!

I’ve been trying out this ESP 433MHz Finoffset sensors on a Sonoff RF bridge (rewired to bypass the RF chip). I have managed to get it to read my 433MHz humidity and temperature sensors. However since I have 3 of them I need to figure a way to sort them in manner that they show up as separate sensors in Home Assistant. As off now all sensor data is in a big pile…

Any progress on your project?

Nothing yet. I decided I want to do a wired solution using CAT5 and I’ve determined the location. I’m going to use RJ-45 and RJ-11 to run power and signal data to the location. On May 2nd I purchased RJ-11 and RJ-45 jacks along with some RJ-45 breakout PCBs from AliExpress and they still haven’t arrived. I think the shipping industry has been shocked by COVID-19 and it seems that AliExpress has extended all of the buyer protection to account for this. When this stuff arrives, I’m planning on buying the $65 weather station on Sparkfun’s website. Along with some of their RJ-11 breakout boards (I couldn’t find those an AliExpress for some reason).

@bassicrob, I just got the weather kit today and I’m messing around with it now. I’m trying to figure out what the wiring looks like for the wind direction. I realized that moving the vane around changes the resistance measurement between two of the pins on the RJ11 plug.

Do I take one of those pins to a A0 and the other to 3.3V? By the way the resistance_sensor option in ESPHome is written it sounds like I need to create a voltage divider circuit and I can label the resistor switch with the fixed value, is that what you did? I looked at the values in the comments and I couldn’t line up your voltage/resistance with the 10kΩ you listed.

I also tried to reference the “wiring” URL from your Reddit post (https://shop.switchdoc.com/collections/weather) but the content won’t display for me. It just says Weather at the top and then shows all the ads. It shows that for all five pages so something must be wrong with switchdoc.

Anyway, I’m really excited to try this bad boy out. I got an AS3935 lightning sensor to go with it and I’m waiting on a BME280 to integrate as well. Hopefully, I can get them all working together on one solution…

Thanks,
-Greg

That’s awesome @SpikeyGG. IMO it is easier using the RJ-45 / RJ-11 keystones and self-terminated cables, but the breakout boards will work just as well. I already had a bunch of those on hand.

As far as my reference readings, a number of factors may cause a different reading. Wire length and type will affect your readings, which may be one reason you are getting different numbers. I set mine up on the bench with estimated lengths of wire and set the vane in position with tape to record values. If using the Wemos D1 Mini, it already has a voltage divider circuit on A0 and my 10k resistor is based on that (220k + 100k) being already present on the board (See here, top right corner). Other NodeMCU’s may not have this built in. One wire will go to 3.3v and the other to pin with 10k resistor back to 3.3v. IIRC I realized I did something incorrectly, but had already calibrated my values and it worked, so… :man_shrugging:

What is important is setting the

accuracy_decimals: 3 ##or more

in your ESPHome sketch. This will give you better resolution for setting the ranges without overlapping. The link to the datasheet is here (PDF) if you haven’t found it already.

Direction is just a bunch of reed switches. Mine did not match their readings either, but they reference a 5v base voltage with a 10k resistor, other rebranded datasheets for the same product had a 3.3v reference voltage, so again :man_shrugging: HAHA

Mine’s still going strong. Only issue so far is the BME temps are incorrect on hot days and worse on hot sunny days. Radiation shield and fan would solve this issue on a build.

Good luck!!

Woah! I didn’t see that PDF. I looked at my pre-hookup measurements and they’re pretty much exactly what that doc shows but I didn’t realize that there were 16 variations… that’s crazy. I’m going to try to tune that in, and I’ll send the codes if I can get it working correctly.

Good to know about the wire length, I’ll watch out for it.

So I got this thing hooked up and working but when I swap out the ethernet cable for a longer one, ESPHome says it can no longer connect to the i2c devices.

Short (4ft) Ethernet Cable

[10:06:59][D][sensor:092]: 'Receiver Uptime Raw': Sending state 616.76501 s with 0 decimals of accuracy
[10:07:01][D][ads1115:163]: 'Wind Vane Raw': Got Voltage=4.095875V
[10:07:11][D][ads1115:163]: 'Wind Vane Raw': Got Voltage=4.095875V
[10:07:21][D][ads1115:163]: 'Wind Vane Raw': Got Voltage=4.095875V
[10:07:23][D][ads1115:163]: 'Receiver Illuminance': Got Voltage=0.197063V
[10:07:28][D][pulse_counter:159]: 'Rain Pulses 1min': Retrieved counter: 0.00 pulses/min
[10:07:28][D][sensor:092]: 'Rain Pulses 1min': Sending state 0.00000 in with 3 decimals of accuracy
[10:07:28][D][sensor:092]: 'Rainfall Per Minute': Sending state 0.00000 in with 5 decimals of accuracy
[10:07:29][D][sensor:092]: 'Receiver Uptime Raw': Sending state 646.75702 s with 0 decimals of accuracy
[10:07:31][D][ads1115:163]: 'Wind Vane Raw': Got Voltage=4.095875V
[10:07:32][D][pulse_counter:159]: 'Wind Sensor': Retrieved counter: 0.00 pulses/min
[10:07:32][D][sensor:092]: 'Wind Sensor': Sending state 0.00000 mph with 1 decimals of accuracy

Long (40ft) Ethernet Cable

[10:09:45][E][ads1115:077]: Communication with ADS1115 failed!
[10:09:45][W][i2c:070]: Received NACK on transmit of address 0x48
[10:09:52][W][i2c:070]: Received NACK on transmit of address 0x48
[10:09:54][D][pulse_counter:159]: 'Rain Pulses 1min': Retrieved counter: 0.00 pulses/min
[10:09:54][D][sensor:092]: 'Rain Pulses 1min': Sending state 0.00000 in with 3 decimals of accuracy
[10:09:54][D][sensor:092]: 'Rainfall Per Minute': Sending state 0.00000 in with 5 decimals of accuracy
[10:10:00][D][sensor:092]: 'Receiver Uptime Raw': Sending state 55.38400 s with 0 decimals of accuracy
[10:10:02][W][i2c:070]: Received NACK on transmit of address 0x48
[10:10:03][D][pulse_counter:159]: 'Wind Sensor': Retrieved counter: 0.00 pulses/min
[10:10:03][D][sensor:092]: 'Wind Sensor': Sending state 0.00000 mph with 1 decimals of accuracy

I tried putting level shifters before the transmission lines thinking that 3.3V was too low and I was losing signal, so stepping it up to 5V for transmission but it doesn’t seem to help. Any ideas?

I need to use a 35 foot cable to get to where I want my weather station. :cloud_with_lightning_and_rain:

I’m trying to figure out how to draw a schematic so I can share the wiring diagram but I haven’t been able to find a good way to create a diagram…

Originally, I bought one of those purple PCB AS3935 lightning sensors (as shown on the esphome AS3935 page). The esp8266 could see it on i²c bus, and HA created three entities (Distance Storm, Lightning Energy, and Storm Alert) for it. The problem is that those entities haven’t registered anything and we did have a single thunderstorm pass through recently. I also tried to test it out with a barbecue lighter and it didn’t respond to anything.

image

I more recently purchased an official red PCB SparkFun AS3935 device to see if I could make it work any better.

image

With this new one, I’ve found that I can get the esp8266 to see it on the i²c bus and HA creates all the entities like the purple one. However, I’ve noticed when I try the barbecue lighter near it and watch the logs I see this set of two entries every time I pull the trigger:

[09:29:28][W][i2c:070]: Received NACK on transmit of address 0x03
[09:29:28][W][as3935_i2c:029]: Read failed!

This makes me think that something is actually working but I still don’t know what it means…

Regarding the distance/power/data issue, you might consider the Olimex-ESP32-POE-ISO
POE will easily run much longer than 50 feet. :slight_smile:

That looks like a pretty cool device @FredTheFrog!

@SpikeyGG, one thing I discovered in several of my IoT creations and CAT-5, is be mindful of which wire pairs are used. You don’t want to pair 5v-Gnd on say orange and orange stripe, and the same for data connections (ie SDA SCL). I think I got lucky with my wire selection for this project, but have had bad connections on other projects using CAT-5 wire pairs. I usually run 1 like pair for power and 1 like pair for ground now, leaving 2 pairs left for sensors. IIRC, I ran SDA and SCL each on their own pair for this project, as I have a separate CAT-5 specifically for the I2C bus, and another run for the analog sensors/LED. Then again, I2C is designed for on-PCBoard comms and not long distance, so your luck may also be related to may other factors.

Hope you’ve made further progress with this fun project! Mine is still going strong!! Coincidently I just received some lux sensors to test in the build. I also need to mount everything in a box and on a pc board! I did add an LCD which prints out temp, humidity, wind speed, gust, and pressure.

Hey @bassicrob, I did get mine together around July of 2020 and it’s been working since then. However, because I’m trying to run i2c over cat5e run of ~40ft, I’m getting a lot of this:

[08:02:24][W][i2c:086]: Requesting 2 bytes from 0x48 failed!
[08:02:24][W][i2c:086]: Requesting 2 bytes from 0x48 failed!
[08:02:25][W][i2c:086]: Requesting 2 bytes from 0x48 failed!
[08:02:25][W][i2c:086]: Requesting 2 bytes from 0x48 failed!
[08:02:25][W][i2c:070]: Received NACK on transmit of address 0x48
[08:02:25][W][i2c:086]: Requesting 2 bytes from 0x48 failed!
[08:02:25][W][i2c:070]: Received NACK on transmit of address 0x48
[08:02:25][W][i2c:070]: Received NACK on transmit of address 0x48
[08:02:25][W][i2c:086]: Requesting 2 bytes from 0x48 failed!
[08:02:25][W][i2c:070]: Received NACK on transmit of address 0x48
[08:02:25][W][i2c:070]: Received NACK on transmit of address 0x48
[08:02:25][W][i2c:070]: Received NACK on transmit of address 0x48
[08:02:25][W][i2c:070]: Received NACK on transmit of address 0x48
[08:02:25][W][i2c:086]: Requesting 2 bytes from 0x48 failed!
[08:02:25][W][i2c:086]: Requesting 2 bytes from 0x48 failed!
[08:02:25][W][i2c:086]: Requesting 2 bytes from 0x48 failed!
[08:02:25][W][i2c:086]: Requesting 2 bytes from 0x48 failed!
[08:02:25][W][i2c:070]: Received NACK on transmit of address 0x48
[08:02:25][W][i2c:070]: Received NACK on transmit of address 0x48
[08:02:25][W][i2c:070]: Received NACK on transmit of address 0x48
[08:02:25][W][i2c:086]: Requesting 2 bytes from 0x48 failed!
[08:02:25][W][i2c:070]: Received NACK on transmit of address 0x48

Which bothers me greatly. However, the 0x48 is my ads1115 which gathers the data from my analog stuff (for illuminance and weather vane direction) and those do give me good values so I think it’s just lots of reports of noise since the i2c signal is too long. For example:

image
My analog illuminance sensor reporting


Remote sensor array “production” build


Local sensor array “production” build


Remote sensor array “production” build circuit board bare

I still want to fix this so researching, I have found this article on stackechange and purchased a set of P82B96s. They’re not cheap: about $3 per chip but they work. I’ve bread boarded a new design using these chips and it works with a 50 foot cat5 cable! :slight_smile: now I just need to build up the production boards and put it into use.


Bread board mock up using P82B96 chips with 50’ cat5e

I actually got the breadboard done in August 2020 but I haven’t gotten around to actually building the finished product yet. Mainly, because I want to be able to use i2c for everything now including the interrupt on the as3935.

I can put an I/O extender on i2c which would give me access to short distance I/Os on the remote. However, ESPHome does not allow the as3935 interrupt nor pulse_counter inputs to be assigned to IOs on an I/O extender. So, I’ve been stuck. :disappointed:

Error message:

sensor.pulse_counter: [source /config/esphome/weathernew.yaml:119]
  platform: pulse_counter
  pin:  [source /config/esphome/weathernew.yaml:121]
    
    [pcf8574] is an invalid option for [pin]. Please check the indentation.
    pcf8574: pcf8574_hub [source /config/esphome/weathernew.yaml:121]
    number: 1
    mode: INPUT_PULLUP

So, does anyone know how I can go about putting pulse_counter inputs and/or the interrupt for as3935 on an I/O extender using ESPHome? :smiley:

I actually made a post about this in July of 2020 and didn’t get anywhere with it :frowning: