youcloudsofdoom
Posts: 32
Joined: Fri Mar 21, 2014 8:16 pm

Using sparkfun photon weather shield with a Pi

Mon Sep 04, 2017 11:04 am

Hello all,

I have this photon weather shield (https://www.sparkfun.com/products/13630) and I was hoping to be able to read the output from it on my Pi 3 (specifically the temp/humidity/pressure sensors and the input for wind direction). Has anyone got any suggestions for how to hook it to the GPIO pins on the Pi, and what the best way to read the sensor input on the Pi would be?

Thanks

User avatar
Ronaldlees
Posts: 294
Joined: Sat Apr 16, 2016 4:28 pm
Location: North Carolina, US
Contact: Website

Re: Using sparkfun photon weather shield with a Pi

Mon Sep 04, 2017 12:50 pm

I presume you also have the Photon? Anyway, the Photon is fairly versatile. You could run a webserver on the Photon, set it up to display sensor readings via its built-in WiFi, and then just use your Pi to view that webpage.

Edit: it looks like the Sparkfun tutorial talks mostly about using either the WiFi for monitoring the weather station, or using a serial cable for direct a connection to the Pi (rather than i2c). Probably the serial connection is best for following their tutorial. BTW: their tutorial is very detailed - it should get you pointed in the right direction straight off ...

Or, are you talking about trying to use the shield without a Photon? In that case you probably would use the i2c bus. Basically, what the Photon is giving you in this equation is communications and easy sensor interface (so it's probably the easiest way to go).
Last edited by Ronaldlees on Mon Sep 04, 2017 1:16 pm, edited 1 time in total.
I am the Umbrella man

youcloudsofdoom
Posts: 32
Joined: Fri Mar 21, 2014 8:16 pm

Re: Using sparkfun photon weather shield with a Pi

Mon Sep 04, 2017 1:11 pm

Thanks for your reply! I actually don't have a Photon, just came into posession of the board. It's what the process for connecting to the GPIO I'm confused about (found a diagram for doing so to a previous iteration of the shield, but it has a different power setup to this current version), and what the best approach to reading from the I2C would be (I've done previous things with similar sensors using some pre-written python scripts, but haven't done anything from scratch like this).

User avatar
Ronaldlees
Posts: 294
Joined: Sat Apr 16, 2016 4:28 pm
Location: North Carolina, US
Contact: Website

Re: Using sparkfun photon weather shield with a Pi

Mon Sep 04, 2017 1:19 pm

youcloudsofdoom wrote:
Mon Sep 04, 2017 1:11 pm
Thanks for your reply! I actually don't have a Photon, just came into posession of the board. It's what the process for connecting to the GPIO I'm confused about (found a diagram for doing so to a previous iteration of the shield, but it has a different power setup to this current version), and what the best approach to reading from the I2C would be (I've done previous things with similar sensors using some pre-written python scripts, but haven't done anything from scratch like this).
So, you don't intend to use a Photon?

Tying into the i2c bus directly wouldn't be much different than the situation where your sensors were directly tied only to the Pi, and your pre-written python scripts should still work that way. Except - there's the wind vane that is not on the i2c bus, which you'd have to figure out. A brief look tells me that it's using an ADC, which the Pi doesn't have OOTB. Maybe that's what you're worried about ...

That's another thing the Photon makes easier, since it has an ADC ...

I don't have this shield, so I'm generalizing. I haven't looked at the power supply setup. One thing that's nice about the Photon is that it uses 3.3V - so AFAIK - no level shifting required when connected to the Pi 3.3V GPIO. The Photon has an onboard regulator to drop any USB voltage to the 3.3V that it really needs to use, but it uses 3.3 volts itself. Make sure you never apply 5V to its 3.3 volt bus! I have a few of the Photons - love em!
I am the Umbrella man

youcloudsofdoom
Posts: 32
Joined: Fri Mar 21, 2014 8:16 pm

Re: Using sparkfun photon weather shield with a Pi

Mon Sep 04, 2017 2:04 pm

Thanks again for this thorough reply -

Yes, it was the ADC requirement of the Pi which is what I was wary of (I really want to use that wind direction monitor!), and what I assumed this shield solved for me. I was hopeful that I could run it from the 3.3v GPIO out on the Pi and pull data from it that way - the closest I could find was this description of running a Pi 2 into an older version of the shield, here: https://microsoft.hackster.io/en-US/win ... _&offset=1

That gives a pinout wiring diagram of this:
GND-------(black)------GND
5V----------(red)---------VIN
3V3-------(brown)------5V (shield hack; not a typo)
GPIO2-----(yellow)----SDA
GPIO3----(orange)----SCL
GPIO5-----(green)-----D8
GPIO6-----(blue)-------D7

Except on this newer weather shield that I have, there is no 5V in on the board. Any thoughts about a wiring diagram that could work? It looks to me like that's the only major difference here.

User avatar
Ronaldlees
Posts: 294
Joined: Sat Apr 16, 2016 4:28 pm
Location: North Carolina, US
Contact: Website

Re: Using sparkfun photon weather shield with a Pi

Tue Sep 05, 2017 12:28 pm

So, you want to power the shield from the Pi 3.3VDC bus. This *seems* to me to be OK (but again, I don't have that shield). The schematic on the Sparkfun site should give you an idea of where to tie into the shield, and where to bypass the shield's regulator.

I didn't look at the site you referenced in the link, but looking at the schematic, they're probably doing some kind of homemade ADC using a capacitor. It's possible to do this, and there are several techniques. I like the "active" technique shown in this little hackaday project:

http://hackaday.com/2014/07/13/adc-for- ... ng-an-adc/

I'm not saying I'm an expert of homemade ADC, and this is NOT advice, but the circuit looks a little more capable to me.

Really, it's gonna be a whole lot simpler to stick a Photon in the socket! It has a nice ADC onboard already!
Last edited by Ronaldlees on Tue Sep 05, 2017 1:03 pm, edited 1 time in total.
I am the Umbrella man

youcloudsofdoom
Posts: 32
Joined: Fri Mar 21, 2014 8:16 pm

Re: Using sparkfun photon weather shield with a Pi

Tue Sep 05, 2017 12:38 pm

Ah, yes, I suppose it will be! I'll get hold of one then. Thanks very much for your advice!

User avatar
Ronaldlees
Posts: 294
Joined: Sat Apr 16, 2016 4:28 pm
Location: North Carolina, US
Contact: Website

Re: Using sparkfun photon weather shield with a Pi

Tue Sep 05, 2017 12:55 pm

youcloudsofdoom wrote:
Tue Sep 05, 2017 12:38 pm
Ah, yes, I suppose it will be! I'll get hold of one then. Thanks very much for your advice!
LOL. I really don't give advice, but if I did the Photon wouldn't be a bad bet! They're a whole new world, sorta like the Pi is when you first look at it. They're nicely positioned between the low end (8 bit MCUs) and the Pi, for sort of "intermediate" level projects, or for interfacing to stuff (what the shield is doing). For projects, having the on-board WiFi is nice and handy.
I am the Umbrella man

Return to “Automation, sensing and robotics”