Mobile Station for Weather Exploration With AtTiny85 & BME280 for Your Smartphone

by MrNacho in Circuits > Microcontrollers

2643 Views, 13 Favorites, 0 Comments

Mobile Station for Weather Exploration With AtTiny85 & BME280 for Your Smartphone

Screenshot 2021-04-28 230959.jpg
ezgif-4-699e4fc2a869.gif

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.

All you need is:

Supplies

Building the Circuit

20210428_143231.jpg
ezgif-4-6c9e62a89fce.gif
ezgif-4-d9a30bef3abb.gif

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.

Creating a Case With a 3D Printer

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

The Interesting Part: Coding

arduino_prog_thumb.jpg

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.

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

Closing Up the Case and First Field Test

ezgif-4-699e4fc2a869.gif
20210428_225522.jpg

After inserting the PCB into the case, connect the Micro USB adapter to the two open wires and glue the cover with the case to protect the system from external influences.

Now I was able to plug in my mobile weather station into my smartphone and could readout the sensor data.

Have fun building one for yourself!