Hackster is hosting Hackster Holidays, Ep. 5: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 5 on Friday!
MrNacho
Published

Mobile Weather Station for Your Smartphone

Mobile station for weather exploration with ATttiny85 and BME280 for your smartphone.

BeginnerFull instructions provided3 hours1,193

Things used in this project

Story

Read more

Custom parts and enclosures

case_1_uFh1zlnBII.stl

Cover

To create a small case for our system, I used Tinkercad to draw a case and print it in a 3D printer.

Schematics

Circuit diagram of the station

This is a very easy circuit to recreate. At first solder the ATtiny85, the OLED display and the BME280 onto the PCB. I soldered female pin headers to flash the ATtiny after it is on the PCB.

After finishing the first task, you can now solder the wires according the circuit diagram. Please prepare on the PCB two wires for VCC and GND of the Micro USB.

To get the smartphone work for us as a power supply, we need to activate the OTG. That means, that our smartphone can act as a host, if there is a male USB inserted into the female USB port of the phone. Therefore we need to connect the ID of the Micro USB Male Adapter with its GND.

After the soldering

First test

How to program the ATtiny85 with an Arduino Nano

I have used a Arduino Nano to program the ATtiny85 with the Arduino IDE. To not explode the frame out of this instruction, please see this site to program your ATtiny with your Arduino Nano.

https://arduinodiy.wordpress.com/2012/02/28/program-an-attiny-with-an-arduino-nano/

Code

Code for the system

Arduino
After building up the circuit, I have coded this script to get the system run. The libraries I have used are: TinyWireM.h, Tiny4kOLED.h and MyBME280.h
#include <TinyWireM.h>
#include <Tiny4kOLED.h>
#include <MyBME280.h>

#define BME280_I2cAdd 0x76 //I2C-Adresse

MyBME280 BME(BME280_I2cAdd);

float t, d, f;


void setup() {
    
  oled.begin();
  oled.clear();
  oled.on();
  TinyWireM.begin();
  BME.init();
}

void loop() {
  t = BME.readTemp();
  d = BME.readPress();
  f = BME.readHumidity();

  oled.setFont(FONT6X8);
  oled.setCursor(0, 0);
  oled.print("Temp.: ");
  oled.print(t);
  oled.println(" 'C");
  oled.print("Druck: ");
  oled.print(d);
  oled.println(" mBar");
  oled.print("Fcht.: ");
  oled.print(f);
  oled.println(" %");
  oled.println(" . . . . . . . . . . ");
  oled.println(". . . . . . . . . . .");
}

Credits

MrNacho

MrNacho

1 project • 1 follower

Comments