Who here builds their own sensors (CHAT)

(B K) #21

Nice job with your sensor display (I take it you designed your own Habpanel widget for this?). For the lightning detectors, check out Blitzortung - I haven’t taken a plunge on buying their kit yet, but have been thinking about building one myself. I think my wife would kill me if I did what you suggested, though :smile:

To add to the discussion, here’s my DIY sensor design, based on NodeMCU/ESP8266. It measures temp/humidity(DHT22) and motion (HC-SR501 PIR) and displays it all on a local OLED screen as well as publishing it to MQTT/OH. I have too much on my plate right now, but in the future, I’ll be adding support for analog sensors (e.g. differential pressure to monitor my HVAC blower) and luminosity sensors, as well as possibly adding servo control (HVAC register adjustment).

(Aaron) #22


I have already watched your video on YouTube :wink:

(Aaron) #23

Now that I’m running on a RPI I have a mqtt server built into openhabian so I’m going too be watching these sort of videos again

(tcgerhard) #24

I have two variations – in my furnace room, I have an ESP8266 with a DS18B20 temp sensor to report ambient temperature in the room. The ESP8266 is a dev board that has a 5V option, so I run it from a phone charger plugged into a nearby outlet. There’s no case; it literally hangs by the power supply line from the condensate drain. The ESP8266 sketch (I use the Arduino dev tools) posts readings via MQTT.

My other is an RPi in the garage whose main purpose is to host the alarmdecoder interface to our alarm system. I added a DB18B20 to it for an ambient reading from the garage; a simple shell script reads the sensor and posts it via MQTT.

My two upcoming projects are a low water sensor for my fish pond (ESP8266, float valve, battery powered, MQTT) and a refrigerator monitor. In addition to temperature sensors, I want to put current taps on the compressors (one each for the refrigerator and freezer) and lights. The unit is built-in, and there’s mains power available inside the cabinet, so this one will be mains powered. In addition to temperature alarms, I want to monitor the duty cycle of the compressors to try to predict when it’s time to vacuum the condensor coils (before the unit’s alarm triggers when it’s really overdue). Both of these projects are currently stuck in the “getting a round TUIT” stage.
I’m also thinking about adding temp sensors to the supply ducts for the furnaces (2) to get a sense of how they run, especially during air conditioning season.

(Rich Koshak) #25
  1. It depends. My garage doors use an RPi 3 gpio wired to reed sensors and gpio to relays. I chose an RPi largely because it was my first project and keep it as an RPi because I also run a camera on it. My other door sensors are wired to an RPi 0w gpio. These are also just reed sensors and I’ve not taken the time to move to an esp8266. I’ve also three NodeMCUs running ESP Easy with DHT22s and photoresistors in a few rooms of the house. Originally these were Arduinos wired to an RFM69HW network but there is too much interference I’m my neighborhood on that frequency to get the range I need. Eventually I’ll probably replace the RPi 0w with a NodeMCU. Everything is wall powered.

  2. Now pretty much exclusively MQTT.

  3. If I’m not in a hurry I can build a new sensor for $10-20 (slow boat from China shipping). Though I expect prices to go up in the near term thanks to recent politics).

  4. The RPis too some python coding but I’ve posted that to GitHub so you wouldn’t have to. Easy ESP requires no coding. If you use it plan to use Sonoff, you can also use Tasmota on the NodeMCU to standardize. Both are equally as easy in my experience.

  5. Wired reed sensors for the doors. DHT22s for temp and humidity. Analog photoresistors for light sensing (does not give values in a measurable units like lux, but it’s good enough to control some lamps). I’ve played with other sensors but there’s are the only ones I’m actively using.

  6. Not at the moment but if I remember I’ll send something. I tend to put them in found cases so they look like more like art d’objet than an appliance.

(B K) #26

Rich, what is that you’re using for the charts, is that Grafana? Looks real nice!

(Rich Koshak) #27

Yep, just Grafana with InfluxDB for persistence and using the light theme. I’m really happy with it for charts.

(Rich Koshak) #28

Here are a couple of my sensors.

The second one is in my son’s room so he got to decorate it.

The garage.

(bojan) #29

Where can I find plastic case for temperature sensor.

(Markus) #30

How did you manage to get these battery times? Which Type of arduinos are you using?

(Michael Andresen) #31

I am using ESP8266 with Arduino on for my sensors and switches. Easy to have them log directly on wifi, and communicate over mqtt.

(GuyCo) #32

I started with z-wave, but was not satisfied with the reliability and responsiveness. I ended up implementing everything by myself.
I use arduinos as both sensors and actuators + use Ethernet or esp8266 bound to the Arduino if I need WiFi to connect to openhab. But the network is never a point of failure and local operations (wall switches) can function with the network being down, as long as the arduinos are alive.
I implemented light switches, dimmers, roller shutter, ventilation, IR emitter and more.
Most of my code is in GitHub if anyone is interested.
I got a lot of inspiration from SuperHouseTV (Google it), but took things much further.

(Kees Van Gelder) #33

I have built all my sensors from scratch. So from reed switches, ds18b20’s, coils, DHT’s, Hall etc.
I even turned a bucket into a Leyden Jar with some alu foil, just to sense if it was full or not.

Made sensors to sense if there was any current going through a wire

I have another diy sensor to measure the clarity of my pond water. It is basically 2 glass tubes -one with an LED, the other with a light sensor, sticking through a piece of floating material.

I am using Arduino, ESP8266, Raspi
certainly cost effective, also, some specific sensors are hard to find, if they even exist
coding hardly an issue, once you have code for one temperature (or other) sensor, easy to transport to similar other node. Examples galore

I will snap a pic when I tidy the pool:-)

(Michael Stjerna) #34

Esp8266 and easyesp
Check out www.flex-iot.com

(Stuart Brown) #35

Hi GuyCo,
I’ve been trying to make my own dimmers that work over MQTT and I am having an issue with low level blinking. I am interested to see your code please. I also like SuperHouseTV - it’s a pity Jonathan has gone a bit quiet lately.

(Henk V74) #36

I use esp8266, 3.3V power module, relais, sensors and my own 3D printer.

I started with sonoff dual for my shutterwindow but those are way to big to put in the wall and have very limited available pins.

Then I started to make my own. First with relay modules but those where too big also, than relais and some diodes on my own soldered pcb. When I had figured out that it all was working as desired I designed a pcb in fritzing and ordered pcb’s in china.

Material cost per window are about 5€. (esp 2.5€, powermodule 0.80€, diodes and resistors (some cents), pcb 0,70€, relais 0,50€, fillament 1€ ).

It took me some months to get to this level. But hey, thats the fun :).

Edit: oh yes, as it is over wifi, I use mqtt with openhab but also a simple http interface to be able to do other things (setup etc) in the browser.

(Doc) #37

I use a photoelectric sensor connected to a wemos D1 Mini (or any esp8266 chip) as a front door detector. When anyone walks up to the front door, the sensor is triggered and push notification using Prowl or pushover sends me the alert.

(Vincent Regaud) #38

(Vincent Regaud) #39

My sensors use 2AA batteries (Good ones…)
I use: Arduino Pro Mini 3.3V 8Mhz
It’s a custom bootloader for low power consumption:
And the sketch goes to sleep most of the time
The hum and temp sensors wake every 5 minutes and report
The door and window sensors wake up on interrupt and once every 24h for the battery status

All the info is in:

(GuyCo) #40

Hi GuyCo,
I’ve been trying to make my own dimmers that work over MQTT and I am having an issue with low level blinking. I am interested to see your code please. I also like SuperHouseTV - it’s a pity Jonathan has gone a bit quiet lately.

The dimmer module is located here: https://github.com/guyco75/dimmer2

button.h - handles the up/down buttons (a short click on the up button will softly turn the lights up to 100%, a long press will gradually increase the light as long as the button is pressed - and same for the down button).

dimmer.h - handles the dimming - it senses the AC zero-cross and then turns on a triac module for part of the AC phase. I’m using a triac module from a company call Krida :http://www.inmojo.com/store/krida-electronics/item/4-channel-ac-light-dimmer-arduino--v2/

serial_parse.h - is used to get commands from the serial (an esp8266 is connected to the arduino and bridges between mqtt to serial) - and also report back the status back to the HAB.

and finally dimmer2.ino is instantiating everything.

the esp code that i use for my kitchen lights (single dimmer circuit) is located here: https://github.com/guyco75/kitchen

Of course that I will be happy to get comments/contribution to my implementation…