Mobile Weather Station for Your Smartphone

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

projectImage

https://hackster.imgix.net/uploads/attachments/1291711/cover_Snuv2jbd3J.gif?auto=format%2Ccompress&gifq=35&w=900&h=675&fit=min&fm=mp4

Things used in this project

 

Hardware components

HARDWARE LIST
1 DFRobot Gravity: I2C BME280 Environmental Sensor
1 Microchip Technology ATtiny85
1 Arduino UNO
1 OLED Display, Blue on Black
1 Micro USB Male Adapter
1 Capacitor 10 µF
1 Wires
1 Digilent Female Right Angle 6-pin Header

Software apps and online services

 

Arduino IDE

Story

 

There are couple weather stations which are build with a BME280 and Arduinos, ESP32/ESP8266, Raspberry Pi's. But not everyone wants to use these big boys for some "small" tasks like getting weather data. Also, these kind of microcontrollers are not that handy to take with you.

 

While walking with my dog at night, the temperature changes between inhabited areas and on the fields. Just to measure the temperature and the humidity, I wanted to create a small handy device to carry around with me while going for walks.

 

So the main issue for a station like this was the power supply. I didn't want to carry around a powerbank with me. Everytime when going out for walkies I carried my phone with me, which I could use as a power supply for my project. So I choose to build a weather exploration station which could fit into the USB C/Micro USB port of my smartphone to get the required power.

Custom parts and enclosures

 

case_1_uFh1zlnBII.stl

icon case_1_uFh1zlnBII.zip 0KB Download(0)

Cover

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

icon daring_uusam_VqHirqu5TJ.zip 1KB Download(0)

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.

projectImage

After the soldering

First test

projectImage
projectImage

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

CODE
#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(". . . . . . . . . . .");
}

The article was first published in hackster, April 29, 2021

cr: https://www.hackster.io/mrnaco/mobile-weather-station-for-your-smartphone-0d796d

author: MrNacho

License
All Rights
Reserved
licensBg
0