Digistump Forums
The Oak by Digistump => Oak Projects => Topic started by: who 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 (https://github.com/who93/oak_weathershield)
Thanks to the forum for helping me!
(https://raw.githubusercontent.com/who93/oak_weathershield/master/doc/screenshot.png)
-
Awesome - thanks for sharing!
-
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?
-
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.
-
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!
-
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.
-
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
-
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..
-
@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?
-
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?
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;
}
-
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()
-
@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/ (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