User Tools

Site Tools


oak:tutorials:breadboard_power

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
oak:tutorials:breadboard_power [2016/08/12 14:10]
brohan
oak:tutorials:breadboard_power [2016/08/14 13:59]
brohan
Line 1: Line 1:
 ===== Oak: 9V Powered Breadboard ===== ===== Oak: 9V Powered Breadboard =====
  
-======= Work in Progress ======= 
  
-{{http://​digistump.com/​wiki/​_media/​oak/​tutorials/​powre_module_with_board.png?300| +{{http://​digistump.com/​wiki/​_media/​oak/​tutorials/​module_board_sleep.png?300| 
-{{http://​digistump.com/​wiki/​_media/​oak/​tutorials/​powre_module_with_board.png?600|}}+{{http://​digistump.com/​wiki/​_media/​oak/​tutorials/​module_board_sleep.png?600|}}
  
-The Oak is packed with a lot of features, including built-in Wifi, in a small package, making it ideal for somewhat remote projects. Projects where you won't always have access to a 110V  / USB power source. That's exactly where a powered breadboard comes in.+ 
 +The Oak is packed with a lot of features, including built-in Wifi, in a small package, making it ideal for somewhat remote projects. Projects where you won't always have access to a 110V  / USB power source. That's exactly where a powered breadboard comes in. Being powered by batteries though has it's own set of issues, namely power conservation.
  
 ===== Components used ===== ===== Components used =====
Line 15: Line 15:
 | 9V to Barrel Jack Cable |1| | | 9V to Barrel Jack Cable |1| |
 | 9V Battery |1| | | 9V Battery |1| |
-| Jumper Wires |2| |+| PushButton |1| | 
 +| Jumper Wires |4| | 
 + 
 +This tutorial will cover using a breadboard power module (DC), as well as Oak power conservation via a sleep function. There are more ways to conserve Oak power including cutting out the onboard LED power, but those are beyond the scope of this example.
  
-This tutorial is a very simple one, simply powering your Oak for portability. ​Different breadboard power modules should "​Spark"​ your ingenuity for powering the sensors as well. This particular power module offers many options. In addition to power by USB or by DC barrel connector, it has a wide range our outputs as well. This unit powers the rails on each side of the breadboard, but wait there'​s moreYou can also choose between 3.3V, 5V and off. One side can be 3.3V to power your Oak and your 3.3v sensors, the other side you can run 5V power for those things that require it.+Different breadboard power modules should "​Spark"​ your ingenuity for powering the sensors as well. This particular power module offers many options. In addition to power by USB or by DC barrel connector, it has a wide range of outputs as well. This unit powers the rails on each side of the breadboard. But wait there'​s moreYou can also choose between 3.3V, 5V and off. One side can be 3.3V to power your Oak and your 3.3v sensors, the other side you can run 5V power for those things that require it.
  
 ===== Concepts ===== ===== Concepts =====
  
  
-Deep Sleep+=== Sleep ===
  
 +The ESP8266 chip that is the heart of the Oak has the ability to put your device into a sleep mode to conserve power by way of 4 different Deep Sleep modes: WAKE_RF_DEFAULT,​ WAKE_RFCAL, WAKE_NO_RFCAL,​ and WAKE_RF_DISABLED. This tutorial will explore the basics of WAKE_RF_DEFAULT,​ which relies on the internal Oak timer (which remains active while in Deep Sleep) to wake the device automatically.
  
 +In order to recover from ANY Deep Sleep mode you MUST jumper the Reset pin and the Wake pin, otherwise the Oak can't trigger itself to wake up. If you fail to connect these two pins, the only option you have to wake the device is to manually enter Config Mode. In this tutorial, the Reset and Wake pins are connected via a yellow jumper wire
  
 +When the Oak wakes up from a deep sleep, it will ALWAYS start at the top of the loop function. ALWAYS. Plan accordingly.
  
 +In our example below the First Blink Sketch incorporates a Particle.publish to track our Oak's state, a switch the Oak between sleep and non-sleep mode via in if statement, and a button attached to a trigger pin.
 +
 +
 +The Oak pin diagram can be found here: [[http://​digistump.com/​wiki/​oak/​tutorials/​pinout]] ​
 +
 +
 +===== Circuit =====
 +
 +{{http://​digistump.com/​wiki/​_media/​oak/​tutorials/​module_board_sleep.png?​300|
 +{{http://​digistump.com/​wiki/​_media/​oak/​tutorials/​module_board_sleep.png?​600|}}
 +
 +Note: There is a yellow jumper between the Reset and Wake pins to enable to Oak to wake itself out of Deep Sleep, otherwise you will be stuck in Deep Sleep mode until you manually put the Oak into Config Mode via a jumper wire from Pin 1 to GND at start-up for a few seconds.
 ===== Code ===== ===== Code =====
  
-=== First Blink Sketch ===+=== First Blink Sketch ​with Sleep ===
  
-This is the simple code from the First Blink sketch. It's used simply to verify that your Oak is connected ​and working+This is the simple code from the First Blink sketchand an added line for "Deep Sleep"
  
 <​code>​ <​code>​
 +#include <​ESP8266WiFi.h>​
 +#include "​stdlib.h"​
 +
 +#define SLEEP_PIN 5
 +int sleepTimeS = 10; // Use this to easily change the sleep time
 +
 void setup() void setup()
 {                ​ {                ​
   pinMode(1, OUTPUT); //LED on Oak   pinMode(1, OUTPUT); //LED on Oak
 +  pinMode(5, INPUT);
 } }
  
Line 45: Line 70:
   digitalWrite(1,​ LOW);   digitalWrite(1,​ LOW);
   delay(1000);​   delay(1000);​
 +
 +  // Check to see if sleep mode selected
 +  ​
 +  if (digitalRead(SLEEP_PIN) == LOW) {
 +     ​Particle.publish("​Oak Setup",​ "​Entering Deep Sleep",​ 60, PRIVATE);
 +     ​ESP.deepSleep(sleepTimeS*1000000,​ WAKE_RF_DEFAULT);​ // Sleep
 +  }
 +  else
 +  {
 +     ​Particle.publish("​Oak Setup","​Entering Non Sleep Mode",​60,​PRIVATE);​
 +  }
 } }
 +
 </​code>​ </​code>​
  
-{{http://​digistump.com/​wiki/​_media/​oak/​tutorials/​power_supply_basic.png?300| + 
-http://​digistump.com/​wiki/​_media/​oak/​tutorials/​power_supply_basic.png?600|}}+{{http://​digistump.com/​wiki/​_media/​oak/​tutorials/​power_sleep_image.jpg?300| 
 +http://​digistump.com/​wiki/​_media/​oak/​tutorials/​power_sleep_image.jpg?600|}} 
 + 
 +When you run the above code, with your button in an open state, your onboard LED will blink once, then it puts the Oak in a timed Deep Sleep mode, meaning your onboard LED will cease to blink, until the Oak wakes itself up. blinks the LED once, and immediately goes back to sleep. Not enough time for your Oak to reconnect to the internet and send any information. Closing the button circuit however keeps your Oak from sleeping.
  
  
-Let's add / power a sensor ​as well. For this we'll use the US-100 ​Ultrasonic, powered via the module, and running ​the same sketch as in the starter lesson. Refer to that lesson ​for the sketch details.+To show you how to typically connect ​a sensor ​to a powered breadboard, take a look at the Ultrasonic ​example below for the connection details. As this is the same sketch as in the starter lesson, take a look there for the sketch details.
  
 === US-100 Ultrasonic === === US-100 Ultrasonic ===
Line 101: Line 141:
 ===== Conclusion ===== ===== Conclusion =====
  
-Creating IoT is good, creating IoT that are portable, without the need to run pesky wires, for your internet connection, or power is even better. In cases like this, energy is at a premium, and needs to be conserved at all costs, and luckily the Oak allows us to do just that with is sleep modes.+Creating IoT is good, creating IoT that are portable, without the need to run pesky wires, for your internet connection, or power is even better. In cases like this, energy is at a premium, and needs to be conserved at all costs, and luckily the Oak allows us to do just that with its sleep modes. 
 + 
 +What sensors will you replace the button with to keep you Oak awake long enough to send data, and then go back to sleep?
  
  
oak/tutorials/breadboard_power.txt · Last modified: 2016/08/14 13:59 by brohan