Video tutorial
Arduino Analog Style Barometer with WS2812 and BMP085

Arduino Analog Style Barometer with WS2812 and BMP085 © GPL3+

Barometer is a meteorological instrument that measures atmospheric pressure and with its help we can predict the weather changes...

  • 176 views
  • 0 comments
  • 4 respects

Components and supplies

Necessary tools and machines

09507 01
Soldering iron (generic)

About this project

https://www.youtube.com/watch?v=DNE5wbo_N7s

Barometer is a meteorological instrument that measures atmospheric pressure and with its help we can predict the weather changes I made this barometer after a while I could not find something similar to the internet. I have almost no programming experience so the program for this project is certainly not perfect, so if you have more experience, you can add several more options, such as a thermometer or pressure tendency meter.The schematic is extremely simple and contains arduino compatible board, BMP 085 or BMP 180 module, a 10k resistor and a pushbutton.With the button you can choose one of the three modes: dot mode, line mode and test mode.

The colors change gradiently depending on the pressure value, from blue for low pressure, through green for normal pressure, and red for high pressure.

The scheme can be viewed on the video and the sketch is uploaded to the address: https://pastebin.com/snvEn8wJ Thanks for watching

Code

Ws2812 barometerArduino
#include "Wire.h"    // imports the wire library for talking over I2C 
#include "Adafruit_BMP085.h"  // import the Pressure Sensor Library
Adafruit_BMP085 mySensor;  // create sensor object called mySensor
#include <Adafruit_NeoPixel.h>

 int buttonPin = 2;    // momentary push button on pin 0
    int oldButtonVal = 0;

#define NUM_PIXEL 60 
#define PIN 6 
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_PIXEL, PIN, NEO_GRB + NEO_KHZ800); 



float pressure; //Variable for holding pressure reading
 int nPatterns = 3;
    int lightPattern = 1;
int out =0;
int t =0;

void setup() 
{
  Serial.begin(9600); //turn on serial monitor
strip.begin();
clearStrip();
strip.show();
strip.setBrightness(10);
pinMode(buttonPin, INPUT);
    digitalWrite(buttonPin, HIGH);  // button pin is HIGH, so it drops to 0 if pressed


mySensor.begin();   //initialize mySensor
}
void test(){
	for(uint16_t L = 0; L<60; L++) { 
clearStrip();
		strip.setPixelColor(L,wheel(((170+(L*3)) & 255)));//Gradient from blue (cold) to green (ok) to red (warm), first value here 170 = start color, second value here 42 = end color
 strip.show();
delay(100);
}
for(uint16_t L = 59; L>=0; L--) { 
clearStrip();
		strip.setPixelColor(L,wheel(((170+(L*3)) & 255)));//Gradient from blue (cold) to green (ok) to red (warm), first value here 170 = start color, second value here 42 = end color

strip.show();
delay(100);
}
}
void dot() {
 pressure=mySensor.readPressure(); //Read Pressure
  
int t = map(pressure, 90135, 95653, 0, NUM_PIXEL);

for(uint16_t L = 0; L<t; L++) { 
clearStrip();
strip.setPixelColor(L,wheel(((170+(L*3)) & 255))); //Gradient from blue (cold) to green (ok) to red (warm), first value here 170 = start color, second value here 42 = end color
} 
strip.show(); //Output on strip 
Serial.print("The Pressure is: ");
Serial.print(pressure);

delay(3000); 
} 

void line() {
 pressure=mySensor.readPressure(); //Read Pressure
  
int t = map(pressure, 90135, 95653, 0, NUM_PIXEL);
clearStrip();
for(uint16_t L = 0; L<t; L++) { 

strip.setPixelColor(L,wheel(((170+(L*3)) & 255))); //Gradient from blue (cold) to green (ok) to red (warm), first value here 170 = start color, second value here 42 = end color
} 
strip.show(); //Output on strip 
Serial.print("The Pressure is: ");
Serial.print(pressure);

delay(3000); 
} 

void loop() {
  // read that state of the pushbutton value;
  int buttonVal = digitalRead(buttonPin);
  if (buttonVal == LOW && oldButtonVal == HIGH) {// button has just been pressed
    lightPattern = lightPattern + 1;
  }
  if (lightPattern > nPatterns) lightPattern = 1;
  oldButtonVal = buttonVal;
  
  switch(lightPattern) {
    case 1:
      dot();
      break;
    case 2:
   line();
      break;
      case 3:
      test();
      break;
       }
}
//Color wheel ################################################################ 
uint32_t wheel(byte WheelPos) { 
if(WheelPos < 85) { 
return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0); 
} 
else if(WheelPos < 170) { 
WheelPos -= 85; 
return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3); 
} 
else { 
WheelPos -= 170; 
return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3); 
} 
} 
void clearStrip(){ 
for(int i = 0; i < NUM_PIXEL; i++) { 
strip.setPixelColor(i, 0); 
} 
}

Schematics

Arduino nano WS2812 barometer
Img 20180407 145605 0pwuul8bma

Comments

Similar projects you might like

The Companion IC

Project tutorial by Srijal Poojari

  • 5,057 views
  • 11 comments
  • 27 respects

An Isolated Analog Input for Arduino

Project tutorial by Giovanni Carrera

  • 5,123 views
  • 10 comments
  • 3 respects

Pressure Airflow Measure Device with Analog Sensor

Project tutorial by ItMightBeWorse

  • 2,146 views
  • 2 comments
  • 11 respects

Doggo Water Bowl Refill Monitor/Indicator - Part 1

Project tutorial by Heathen_Hacks-v2

  • 685 views
  • 2 comments
  • 3 respects

Analog Clock with LED Matrix and Arduino

Project tutorial by LAGSILVA

  • 12,268 views
  • 8 comments
  • 39 respects

Weather Station for Drones

Project tutorial by Giuseppe Caccavale

  • 11,534 views
  • 4 comments
  • 35 respects
Add projectSign up / Login