Tadeas Dvoracek
Published © GPL3+

Emergency Power Bank

How to make this Emergency Power Bank.

AdvancedFull instructions provided20 hours8,023
Emergency Power Bank

Things used in this project

Hardware components

Arduino MKR Fox 1200
Arduino MKR Fox 1200
×1
GPS module
×1
18650 Li-Ion battery
×2
USB Li-Ion battery charger
×1
Step-up to 5V with USB
×1
Button
×1
LED (generic)
LED (generic)
×3
SparkFun Solder-able Breadboard - Mini
SparkFun Solder-able Breadboard - Mini
×1
Pin header
×1
Wires
×1
OLED display
×1
Slide Switch
Slide Switch
×2
Resistor 10k ohm
Resistor 10k ohm
×3
Resistor 100 ohm
Resistor 100 ohm
×1

Software apps and online services

Sigfox
Sigfox
Arduino IDE
Arduino IDE
Arduino Web Editor
Arduino Web Editor
DesignSpark Mechanical 2.0

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Prusa i3 MK2
Hot glue gun (generic)
Hot glue gun (generic)

Story

Read more

Custom parts and enclosures

Power bank part 1

Power bank part 2

Schematics

Schematics

Code

Code

Arduino
#include <SigFox.h>
#include <TinyGPS++.h>
#include <Wire.h>
#include <Adafruit_SSD1306.h>

#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);

uint16_t lat;
uint16_t lng;
uint16_t speed;
uint16_t course;

#define DEBUG 1
TinyGPSPlus gps;
#define gpsModul Serial1

void setup() {
  Serial.begin(9600);
  if (!SigFox.begin()) {
    if (DEBUG){
      Serial.println("Sigfox module unavailable !");
    }
    return;
  }
  gpsModul.begin(9600);
  pinMode(5, INPUT);
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
}

void loop() {

  int analogValue = analogRead(A1);
  int a = 2;
  float b = 0.00322265625; // 3.3 / 1024
  float voltage;
  voltage = analogRead(A1) * a * b;

  if(voltage < 2.800){
    display.clearDisplay();
    display.setTextColor(WHITE);
    display.setTextSize(1);
    display.setCursor(0, 0); 
    display.println("Turn off and");
    display.setCursor(0, 10); 
    display.println("charge the"); 
    display.setCursor(0, 20); 
    display.println("power bank."); 
    display.display();
  }
  else{ 
    if (gpsModul.available()) {
    gps.encode(gpsModul.read());
    }

    if ((gps.location.isUpdated()) && (gps.altitude.isUpdated())) {
      lat = gps.location.lat() * 1000;
      lng = gps.location.lng() * 1000;
      speed = gps.speed.kmph() * 1000;
      course = gps.course.deg() * 1000;

      display.clearDisplay();
      display.setTextColor(WHITE);
      display.setTextSize(1);
      display.setCursor(0, 0);  
      display.println(gps.time.hour());
      display.setCursor(12, 0);
      display.println(":");
      display.setCursor(18, 0);
      display.println(gps.time.minute());
      display.setCursor(30, 0);
      display.println(":");
      display.setCursor(36, 0);
      display.println(gps.time.second());
      display.setCursor(60, 0);
      display.println(gps.satellites.value());
      display.setCursor(85, 0);
      display.println(voltage);
      display.setCursor(115, 0);
      display.println("V");
      display.setCursor(0, 10);  
      display.println(gps.speed.kmph());
      display.setCursor(35, 10);
      display.println("km/h");
      display.setCursor(0, 20);  
      display.println(gps.course.deg());
      display.setCursor(45, 20);
      display.println("course");
      display.display();
      }


      if(digitalRead(5) ==HIGH){
        SigFox.begin();
        SigFox.debug();
        SigFox.beginPacket();
        SigFox.write(lat);
        SigFox.write(lng);
        SigFox.write(speed);
        SigFox.write(course);
        SigFox.endPacket();
        SigFox.end();
        }
      }
    }

Credits

Tadeas Dvoracek

Tadeas Dvoracek

10 projects • 41 followers

Comments