This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
digispark:tutorials:temp [2016/03/21 16:05] digistump |
digispark:tutorials:temp [2016/06/09 12:03] (current) |
||
|---|---|---|---|
| Line 75: | Line 75: | ||
| This example uses P5 by default - to use P1 change this line: OneWire ds(5); to OneWire ds(1); | This example uses P5 by default - to use P1 change this line: OneWire ds(5); to OneWire ds(1); | ||
| + | |||
| + | |||
| + | ---- | ||
| + | |||
| + | ---- | ||
| Line 90: | Line 95: | ||
| ===== What's required: ===== | ===== What's required: ===== | ||
| - | - Oak by Digistump [http://digistump.com/products/145] | + | - Oak by Digistump [[http://digistump.com/products/145]] |
| - | - Active Particle.io account [https://www.particle.io/] | + | - Active Particle.io account [[https://www.particle.io/]] |
| - The Oak configured with the latest firmware | - The Oak configured with the latest firmware | ||
| - The Oak claimed as a device on your Particle.io account | - The Oak claimed as a device on your Particle.io account | ||
| - | - DS18B20 1-Wire Digital Thermometer [http://digistump.com/products/57] | + | - DS18B20 1-Wire Digital Thermometer [[http://digistump.com/products/57]] |
| - 4.7K Ohm resister (3.3K and 2.2K can be substituted) | - 4.7K Ohm resister (3.3K and 2.2K can be substituted) | ||
| - OneWire library supporting the ESP8622 | - OneWire library supporting the ESP8622 | ||
| Line 167: | Line 172: | ||
| Particle.publish("Temp (F)", tempFstring, 60, PRIVATE); where “Temp(F)" is the event name and tempFstring is the actual temperature reading in string format. | Particle.publish("Temp (F)", tempFstring, 60, PRIVATE); where “Temp(F)" is the event name and tempFstring is the actual temperature reading in string format. | ||
| - | [[oak-temp-sensing-1-wire-bus-1.jpg|{{oak-temp-sensing-1-wire-bus-1.jpg}}]] | + | ==== Particle.io Log Example: ==== |
| - | ==== Example: ==== | + | |
| + | {{:oak:tutorials:oak-temp-sensing-1-wire-bus-1.jpg?direct&200|}} | ||
| + | |||
| + | |||
| + | ==== Code Example: ==== | ||
| <code> | <code> | ||
| Line 219: | Line 228: | ||
| - Yellow wire - pin 10 (WAKE) to RESET (RST) | - Yellow wire - pin 10 (WAKE) to RESET (RST) | ||
| - White wire – pin 2 to DS18B20 DQ (note: 4.7K pull-up resister) | - White wire – pin 2 to DS18B20 DQ (note: 4.7K pull-up resister) | ||
| + | - DS18B20 leads from left to right: (1) GND, (2) DQ, (3) Vdd | ||
| - | [[oak-temp-sensing-1-wire-bus-2.jpg|{{oak-temp-sensing-1-wire-bus-2.jpg}}]] | + | {{:digispark:tutorials:oak-temp-sensing-1-wire-bus-2.jpg?direct&200|}} |
| In Sleep Mode (after reading and publishing temperature data) the Oak enters deep sleep and delays for a user specified number of seconds. When sleep time has expired, a RESET is triggered via pin 10 (WAKE). Following a RESET, the sketch starts from the beginning and never enters loop(). | In Sleep Mode (after reading and publishing temperature data) the Oak enters deep sleep and delays for a user specified number of seconds. When sleep time has expired, a RESET is triggered via pin 10 (WAKE). Following a RESET, the sketch starts from the beginning and never enters loop(). | ||
| Line 261: | Line 271: | ||
| - White wire – pin 2 to DS18B20 DQ (note: 4.7K pull-up resister) | - White wire – pin 2 to DS18B20 DQ (note: 4.7K pull-up resister) | ||
| - Blue wire – pin 5 to GND (ground) | - Blue wire – pin 5 to GND (ground) | ||
| + | - DS18B20 leads from left to right: (1) GND, (2) DQ, (3) Vdd | ||
| + | |||
| + | {{:digispark:tutorials:oak-tem-sensing-1-wire-bus-3.jpg?direct&200|}} | ||
| - | [[oak-temp-sensing-1-wire-bus-3.jpg|{{oak-temp-sensing-1-wire-bus-3.jpg}}]] | ||
| Note the addition of the Blue wire connecting pin 5 to ground. In non-sleep mode the Oak enters setup() and reads pin 5 to determine the desired mode. Since pin 5 is pulled to ground (LOW) the sketch will enter loop() where it continually requests temperature data from the DS18B20 and publishes that date to the particle.io Dashboard log. Data is requested at intervals set by “sleepTimeS” which specifies the number of seconds to delay between readings. | Note the addition of the Blue wire connecting pin 5 to ground. In non-sleep mode the Oak enters setup() and reads pin 5 to determine the desired mode. Since pin 5 is pulled to ground (LOW) the sketch will enter loop() where it continually requests temperature data from the DS18B20 and publishes that date to the particle.io Dashboard log. Data is requested at intervals set by “sleepTimeS” which specifies the number of seconds to delay between readings. | ||