Skip to content

Inexpensive, networked, indoor sensors for home automation and monitoring.

License

Notifications You must be signed in to change notification settings

Jachimo/cheap-home-sensors

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Cheap Home Sensors

Inexpensive, networked, indoor sensors for home automation and monitoring.

TempSensor (ESP8266 + BME280)

A wireless indoor air sensor, written using MicroPython for the ESP8266 and the Bosch BME280 I2C temp/humid sensor.

Background Reading

Environment Setup

  1. Install Thonny: pip3 install thonny should work, or alternately they have a one-line installer for most Linux platforms:
    bash <(wget -O - https://thonny.org/installer-for-linux)
    On MacOS, the .pkg installer seems to be more reliable, and brings its own Python 3.10 instance with it.
  2. If needed, install the appropriate USB/Serial adapter chip drivers.

Parts & Supplies

  • ESP8266 Module - I prefer the "D1 Mini" style boards to the older 30-pin "NodeMCU" style ones for this type of application, as they are a bit smaller and tend to be less expensive. If you're buying one in 2024, be sure it's a 4M flash version (unless you are sure you're comfortable with the older 2M version and you're getting them at a really great price).
    • The Adafruit HUZZAH modules look particularly nice if you aren't pinching pennies, but they are about 5x the cost of the generic Chinese ones.
    • The generics are easily found on Amazon (if that link is dead, just search for "ESP8266 D1") for under $3/each in quantities of 10, or slightly more if you prefer to only buy one or two.
    • Of course, AliExpress is your source for the cheapest examples, often under $2/each (as of late 2024) if you are willing to wait on shipping from China; US-warehouse stock seems to be about the same price as Amazon. I have no recommended vendors; just search "ESP8266 D1" and pick one that doesn't seem too good to be true.
  • Bosch BME280 Sensor Module - The BME280 is a very small SMT part, but easily available as a pre-soldered module with decoupling caps and a mounting hole or two. Note that if you want relative humidity, be sure you're ordering the BME and not the BMP part, as the latter lacks it and just outputs zero for RH. They work identically otherwise.
    • The Bosch sensor seems likely to be a target for counterfeiters, due to the number of essentially similar (but typically inferior) parts that exist that could be swapped in for the real thing, and its relatively high cost. Proceed with caution.
    • Currently they seem to be going for a bit over $4/each on Amazon for a 3-pack if you are willing to take on some risk of counterfeits. (At least returns are easy.)
    • As usual, Adafruit has a very high-quality module available at a somewhat premium price.
    • There's also a similarly-nice module from Pimoroni available via Digikey, which is particularly nice if you are already used to buying your parts there.
  • You probably also want some sort of substrate to assemble everything on. The world is your oyster here; use whatever you prefer.
    • A solderless breadboard will work fine for testing, but I prefer to assemble things on cheap little perfboards with wire-wrapped connections.
    • I have found that sensors built on FR4-based perfboard with 30AWG wire-wrap connections have stood up to significant vibration and general abuse, as long as the wires on the board are protected from snags. (Hot glue FTW.) Allegedly, wire-wrap construction was used on some ICBM components, so it can probably deal with being mounted on a fan, air filter, etc. (Although in fairness, the ICBM circuit only had to work once.)
  • Finally, you probably want an enclosure -- although I'm not one to judge, as I've had a bunch of these sensors hanging around in my house, dangling bare-assed from their MicroUSB connectors, for months at a time.
    • If you are buying an enclosure, steer clear of anything that seals the temperature sensor in alongside the ESP module, since the latter generates a non-trivial amount of heat.
    • I've been experimenting with "stack effect" enclosures that have vents at the top and bottom, and with the sensor at the bottom and the ESP at the top. In theory, the heat generated by the ESP should constantly pull in fresh air at the bottom, moving it across the sensor before it has a chance to get warm.
    • A 3-D printed enclosure with the sensor mounted on the outside, like this one which uses the older DHT-11 sensor, could be another option.

Hardware Setup

  • The code assumes that the BME sensor is connected via I2C to pins 4 and 5. Specifically: sda=machine.Pin(4), scl=machine.Pin(5)

About

Inexpensive, networked, indoor sensors for home automation and monitoring.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages