Blog

Arduino Water Sensor for Houseplants

This is just a very minimal example on how to use these kind of sensors. I just read a value from an analog pin every 2 seconds and print it out to serial.

These sensors are available very cheap online and are easy to use... So, now my plants go online... :)

Arduino Water Sensor For Houseplants

My code:

const int analogIn = A0;

int sensorValue = 0;

void setup() {
  Serial.begin(9600);
}

void loop() {
  sensorValue = analogRead(analogIn);
  Serial.print("Sensor: ");
  Serial.println(sensorValue);
  delay(2000);
}

And now to something completely... Need to learn how to add a ground plane in Eagle... ;)

Permalink: https://hanez.org/2015/10/11/arduino-water-sensor-for-houseplants/

Arduino 3.3V BMP180 I²C Pressure Sensor

I got a BMP180 pressure sensor today and gave it try. It was very easy to get it running using some free libraries from the web.

Arduino 3.3V BMP180 I2C Pressure Sensor

Don't wonder about the fat green socket where the BMP180 is inserted. I use this normally for attaching IC's to my breadboard and making them easily removeable without breaking stuff. IC's could sometimes be hard to remove from a breadboard, especially when the breadboard is unused... ;)

Since the BMP180 is an I²C device it ist very easy to connect it to the Arduino. Just be sure to add pull-up resistors to SCL and SDA. I am using 1K resistors and everything works fine.

Also be sure what kind of breakout board you have. I am using a very cheap model without voltage regulation so mine needs to be driven by a 3.3 Volt Arduino. If you want to drive this with a 5 Volt Arduino you will need to make use of a logic level converter. There are very nice breakout boards available with voltage regulation on-board! Take a look at the link below.

My code:

#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP085_U.h>

Adafruit_BMP085_Unified bmp = Adafruit_BMP085_Unified(10085);

void setup(void) {
  Serial.begin(9600);
  Serial.println("Arduino BMP180 Pressure Sensor");
  Serial.println("");
  bmp.begin();
}

void loop(void) {
  sensors_event_t event;
  bmp.getEvent(&event);
  if (event.pressure)
  {
    Serial.print("Pressure: ");
    Serial.print(event.pressure);
    Serial.println(" hPa");
  }
  else
  {
    Serial.println("Sensor error");
  }
  delay(1000);
}

Links:

Permalink: https://hanez.org/2015/09/25/arduino-3-3v-bmp180-i2c-pressure-sensor/

Pages

Page generated at: Apr 15, 2024 (CEST) using Jekyll & xw3 on GNU/Linux
NULL
Powered by: NULL