weewx with an arduino

241 views
Skip to first unread message

Ty

unread,
May 17, 2021, 10:22:02 PM5/17/21
to weewx-user
I've been working on making a weather station with some sensors from sparkfun and an arduino uno. I'm currently collecting data using grabserial on my pi but I think weewx could be more useful for me? I haven't used weewx before and I'm a bit confused. would I need to use owfs for arduino compatibility?

if anyone could point me in the right direction that would be great.

vince

unread,
May 17, 2021, 10:34:44 PM5/17/21
to weewx-user
On Monday, May 17, 2021 at 7:22:02 PM UTC-7 tyler...@gmail.com wrote:
I've been working on making a weather station with some sensors from sparkfun and an arduino uno. I'm currently collecting data using grabserial on my pi but I think weewx could be more useful for me? I haven't used weewx before and I'm a bit confused. would I need to use owfs for arduino compatibility?


Probably depends on whether the sensors are on the weewx pi or not.

If you have wifi-enabled arduino with sensors sprinked about the LAN, this is kinda what MQTT is for.   Publish your arduino data to a MQTT broker, ingest that data into weewx somehow.

I did it a little differently ages ago before I knew about MQTT.  I have an ancient model-B pi with some sensors on a breadboard outside, and I periodically write a little JSON file that the pi's nginx server can return if I do a web query.  I then wrote a weewx extension to periodically hit that URL and save the data into a weewx db.   A little heavy lifting was required to learn that stuff.  If I was doing it today I'd just feed MQTT from the satellite sensor rigs, regardless of whether they were pi or arduino.

Ty

unread,
May 17, 2021, 10:49:23 PM5/17/21
to weewx-user
The way I have it set up is all of the sensors are connected on a sparkfun board on my arduino, and then the pi is powering the arduino. I'm just sending the data from the arduino straight to the pi with a usb connection and outputting it into a .csv

I don't think using MQTT would be necessary. Maybe I should have described my setup a little more clearly.

p q

unread,
May 17, 2021, 10:49:54 PM5/17/21
to weewx...@googlegroups.com
+1 for MQTT. If I was starting now, I probably would use MQTT. I didn't know about it at the time, and I just wanted one more sensor (and then another, and another...)

I have a Acurite system but I was dissatisfied with the thermometer, and then the inside thermometer and humidity. So I added my own sensors. I used ESP8266 to control the sensor and send the data to the Pi running Weewx. It could have been a wifi enabled arduino. Anyway. I send the data to my pi using a UDP port and have a service on the PI that writes it to a file. I created my own weewx driver based on the Acurite one to read from the files.

Starting over, I'd probably go with MQTT.

--
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 weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/e6cd67a8-9e7f-4a48-8254-56267181d739n%40googlegroups.com.


--
Peter Quinn
(415)794-2264

Greg Troxel

unread,
May 18, 2021, 7:17:30 AM5/18/21
to Ty, weewx-user

Ty <tyler...@gmail.com> writes:

> The way I have it set up is all of the sensors are connected on a sparkfun
> board on my arduino, and then the pi is powering the arduino. I'm just
> sending the data from the arduino straight to the pi with a usb connection
> and outputting it into a .csv
>
> I don't think using MQTT would be necessary. Maybe I should have described
> my setup a little more clearly.

Basically you have to do some combination of putting your data into a
form that can be ingested by an existing driver, or creating a driver
that will ingest the data in some other form.

I too am in the "MQTT is the right answer". You can easily run a broker
on the Pi, or you can run it on whatever machine you are going to run
weewx on. Then you can use MQTTSubscribe which I am 95%+ sure supports
being a driver (rather than a service).

Probably you want to put json with everything from the csv into a topic,
but you may just want separate topics. Read the MQTTSubscribe info to
figure out what it wants and write the data in that format.

Also, once you have MQTT, you may want to do home automation or
something else, and then that will be able to read weather information.

Overall, I think the fastest path to success, with you writing the least
code, where success means things are 100% reliable, is writing the
sensors into MQTT and using MQTTSubscribe. At least that's what I
would do.

I have a bunch of ESP8266 with sensors all sending data in MQTT, read by
Home Assistant. weewx uses the Davis driver and then publishes every
archive interval to MQTT. So in weewx I just see weather, and in Home
Assistant I see weather and various indoor temps, battery voltage, etc.
signature.asc

Ty

unread,
May 18, 2021, 3:06:22 PM5/18/21
to weewx-user
okay, I'll try that out. thank you!
Reply all
Reply to author
Forward
0 new messages