Author Topic: wheater station with Oak wheater shield  (Read 10945 times)

who

  • Newbie
  • *
  • Posts: 12
wheater station with Oak wheater shield
« on: March 25, 2016, 10:25:08 am »
Hi,
finally I have managed to get the Oak wheater shield running.

I am measuring the wheater data (temperature, ambient, humidty and pressure) with the Oak and sending them to the Particle cloud. With a small python script I fetch this data and store it in a MySQL database. An apache webserver, running on the Onion Omega, is visualising the data with Highcharts.

You'll find all sourcecode (Oak code, python and HTML) on Github: https://github.com/who93/oak_weathershield

Thanks to the forum for helping me!
« Last Edit: March 25, 2016, 10:30:16 am by who »

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
Re: wheater station with Oak wheater shield
« Reply #1 on: March 25, 2016, 10:31:08 pm »
Awesome - thanks for sharing!

tincoyote

  • Newbie
  • *
  • Posts: 2
Re: wheater station with Oak wheater shield
« Reply #2 on: March 29, 2016, 05:55:57 pm »
Thanks for sharing all this. I'm very new to all this and I greatly appreciate the work you've shared so that I can tinker around with my oak.

I'm beginning with just the oak code and need some help.

I unplug my oak. ground pin 1 and plug back in then remove the jumper to pin 1. This gets the led flashing and I'm able to flash the code to my oak. I'm watching my progress on the particle dashboard and the oak reboots and the weather station comes on-line with a single reading. Exactly one minute later, the oak goes to sleep and never comes back.

I've changed the sleep timer to every number I can think of from zero to leaving it alone at 150. To get it to run again, I have to unplug everything, reset the oak, and flash it again.

Any suggestions on what I might be missing?

exeng

  • Sr. Member
  • ****
  • Posts: 454
Re: wheater station with Oak wheater shield
« Reply #3 on: March 29, 2016, 06:16:58 pm »
I don't have a weather shield, but if you are using the code that @who posted which does a deep sleep, you need to connect the WAKE pin 10 to the RST pin. If you have already done this, sorry can't help. But if you haven't, the Oak is not going to wake up.

tincoyote

  • Newbie
  • *
  • Posts: 2
Re: wheater station with Oak wheater shield
« Reply #4 on: March 29, 2016, 07:02:33 pm »
Thanks @exeng! that did it! I guess now I have to learn python and msql  :-\

but that was why I supported this project, so I'd have a new hobby!

who

  • Newbie
  • *
  • Posts: 12
Re: wheater station with Oak wheater shield
« Reply #5 on: March 30, 2016, 06:02:37 am »
Hi,

I am glad, that this project could help you. Connecting WAKE and RST is also described on the Github page.

Please feel free to ask if something is unclear with the Python code and the MySQL setup.

emardee

  • Full Member
  • ***
  • Posts: 135
Re: wheater station with Oak wheater shield
« Reply #6 on: March 30, 2016, 01:15:29 pm »
Thanks for posting this info. Can I ask how you are powering this? If it is on a battery, what capacity battery are you using, and how long does it last for? If it is on a solar panel, what size panel does it need?

Thanks.

Mike

who

  • Newbie
  • *
  • Posts: 12
Re: wheater station with Oak wheater shield
« Reply #7 on: March 30, 2016, 02:59:51 pm »
currently I am using the USB port with an charger to power it. But I am planning to run it in the next few weeks with 4 AA batteries (around 10.000mAh) and hopefully it is possible to keep it running for about 4 weeks.

Without the LED mod I measured a power consumption of 60mA at fetching and sending data, on deep sleep mode I measured around 1mA. But my ampere meter isn't really good, so an exact measurement isn't possible for me..

exeng

  • Sr. Member
  • ****
  • Posts: 454
Re: wheater station with Oak wheater shield
« Reply #8 on: April 20, 2016, 07:52:44 pm »
@who, First, thanks for doing the tutorial. Just soldered up my weather shield and looking at output. Have you wired up your LDR yet? The reason I ask is I'm seeing values that I don't believe are correct. Do you know if the LDR is the top or bottom of the voltage divider? I'm seeing 255 value for dark and lower values for greater ambient light. Is that what you would expect or are seeing?

exeng

  • Sr. Member
  • ****
  • Posts: 454
Re: wheater station with Oak wheater shield
« Reply #9 on: April 20, 2016, 08:16:19 pm »
Perhaps this is the answer to my own question. From Ohm'ing our the board it appears that the LDR sits at the bottom of the voltage divider. Also, looking at the PCF8591 conversion for analog the output range is 0 - 255. So when dark one would expect to see a larger value as the LDR is in a high resistance state. When light, the value would be low as the input to the ADC is near or at ground due to the LDR low resitance state.

Finally, why the double wire read in fetchAmbient() in your example code?
Code: [Select]
void fetchAmbient()
{
  byte value0;
  Wire.beginTransmission(PCF8591); // wake up PCF8591
  Wire.write(ADC0); // control byte - read ADC0
  Wire.endTransmission(); // end tranmission
  Wire.requestFrom(PCF8591, 2);
  value0 = Wire.read();
  value0 = Wire.read();
  delay(200);
  ambient = value0;
}

who

  • Newbie
  • *
  • Posts: 12
Re: wheater station with Oak wheater shield
« Reply #10 on: April 27, 2016, 01:39:27 am »
Hi,

Perhaps this is the answer to my own question. From Ohm'ing our the board it appears that the LDR sits at the bottom of the voltage divider. Also, looking at the PCF8591 conversion for analog the output range is 0 - 255. So when dark one would expect to see a larger value as the LDR is in a high resistance state. When light, the value would be low as the input to the ADC is near or at ground due to the LDR low resitance state.

correct, I also expected 255 to be bright and 0 dark. But with this hardware setup we'll get opposite.

Finally, why the double wire read in fetchAmbient() in your example code?
Recording to the datasheet of the PCF8591, the IC sends first the previously measured value first, so therefore we need two Wire.read()

exeng

  • Sr. Member
  • ****
  • Posts: 454
Re: wheater station with Oak wheater shield
« Reply #11 on: April 27, 2016, 09:16:09 am »
@who,
Thanks. I see the reference to the double read requirement now in this link... http://tronixstuff.com/2013/06/17/tutorial-arduino-and-pcf8591-adc-dac-ic/

I ended up inverting the LDR read value in software before output. It bugged me the way it was.

exeng