User Tools

Site Tools


oak:tutorials:breadboard_power

This is an old revision of the document!


Oak: 9V Powered Breadboard

Work in Progress


{{http://digistump.com/wiki/_media/oak/tutorials/powre_module_with_board.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.

Components used

Part Quantity Identification
Oak with soldered headers 1
Breadboard Power Supply Module 1
9V to Barrel Jack Cable 1
9V Battery 1
Jumper Wires 2

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.

Concepts

Deep Sleep

Code

This is the simple code from the First Blink sketch. It's used simply to verify that your Oak is connected and working

void setup()
{                
  pinMode(1, OUTPUT); //LED on Oak
}

void loop()
{
  digitalWrite(1, HIGH);
  delay(1000);
  digitalWrite(1, LOW);
  delay(1000);
}


http://digistump.com/wiki/_media/oak/tutorials/power_supply_basic.png?600|

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.

US-100 Ultrasonic

int trigPin = 2; // Trigger Pin
int echoPin = 4; // Echo Pin
int LEDPin = 1; // Onboard LED
unsigned long Time_Echo_us = 0; 
unsigned long Len_mm  = 0; 
char post_Distance[16];

void setup() {
 pinMode(trigPin, OUTPUT);
 pinMode(echoPin, INPUT);
 pinMode(LEDPin, OUTPUT); // Use LED indicator for visual feedback
 }

void loop() {
 digitalWrite(trigPin, LOW); 
 delay(100); 
 digitalWrite(trigPin, HIGH);
 delay(10); 
 digitalWrite(trigPin, LOW);
 Time_Echo_us = pulseIn(echoPin, HIGH);  
 Len_mm = (Time_Echo_us*34/100)/2;
 sprintf(post_Distance, "%04d", Len_mm);
 Particle.publish("distance in mm:", post_Distance);
               
 if((Len_mm < 3000) && (Len_mm > 1)) {   // Length effective range (1, 3000).
 
 digitalWrite(LEDPin, HIGH); 
 }
 else { 
 digitalWrite(LEDPin, LOW); 
 }                           
 delay(1000);                                
 
}

}

When you initially power the oak via a breadboard power supply, you might think that you are “losing” a power pin on the Oak. As can see this isn't the case at all, as the power supply powers the rail, and your other connected devices, so there's no lose of pins.


http://digistump.com/wiki/_media/oak/tutorials/power_supply_sensor.png?600|

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.

oak/tutorials/breadboard_power.1471036048.txt.gz · Last modified: 2016/08/12 14:07 by brohan