User:Shardan/Roomsensor

From Let's Control It
Jump to navigation Jump to search

Universal Room Sensor

There are many different roomsensors on the market, one might say too many.
Different looks, sometimes overloaded with features but the one you need still missing.

The goal of this project was to create an universal room sensor.
It should have same size as a wall switch.
It should be possible to simply plug the sensors you need into it.
If needed it should be possible to put an extra display and external temperature sensors to the circuit.

Prerequisites

The circuit needs an external 5V power supply.
Do not use a cheap power supply. It should give a reliable power of 0.6 … 1 A at least.

I used SMD parts to keep sizes small. Even using the 1206-size (3.2 x 1.6 mm²) this needs
calm hands and a fine soldering iron (pencil tip type) to solder these tiny parts.

All capacitors are ceramic types from the X5R and X7R range.
Do not use film capacitors or electrolytic/tantal capacitors. They are not suitable here.

Schematics

User-Shardan-Roomsensor Schematic Pic.jpg
Due to using I²C sensors the circuit is quite simple.
U1 (LF-33 CDT) and C1/C2 provide the 3.3V power for the ESP-12E/F and the sensors.

The resistors R6/7/8/9 are a special thing.
Please read this before soldering one of these resistors!
With some of the SSD1306 OLED displays I ran into problems. They stopped the whole circuit from working.
Some searching in my shelf showed that there are displays with different pinouts in the market: Vcc and GND are swapped on some displays!
To keep the pcb as universal as possible I use two zero ohm resistors as wire bridge to supply Vcc and ground to the correct display pins.
If the outer pin on your display is Vcc, place R6 and R8 on the pcb.
If the outer pin of your display is GND place R7 and R9 on the pcb.
Do NOT place all four resistors – it will short circuit your power supply!
The display itself is the usual 4-pin I²C OLED with SSD1306 chip from ebay, Amazon or Aliexpress.
Do not use the displays with more then four pins as they usually provide a SPI interface as default and do not fit to the pcb.

SW2 is a single DIP switch to set the circuit into programming mode (flashing)
The pushbutton SW1 resets the ESP-12E/F.

The resistor R3 gives power to the DS18B20.

All other resistors are just the standard pull-resistors the ESP needs for working.

P1 provides power from the external 5V power supply.

P2 connects to one or more external DS18B20, for example if you want to check temperature of heating flow or a fish tank for example.

I’ve used PSS254 types for P1 and P2. They are flat and protected against reversing polarity.

P3 is the connector for connecting your flashing adapter.

P4 and P5 are single pin lead-outs for additional GPIO pins. Place the pins if you want to connect additional devices as a relay board for example.
For sensors I used the small sized (“thumb nail size”) breakoutboards available all over the market.

The 5-pin header takes a TLS2651 or BH1750 luminosity sensor.

The two 4-pin headers can take sensors like BME-280, BMP180, SH7021 or any other small sensor with I²C interface and same pinout.

The LED is just a “power on” indicator. If the light is disturbing, for example in a sleeping room, it can be omitted. As all sensors and the display the LED is fully optional.  

PCB

This pcb is kept as simple as possible. It is just single sided, it should be possible to make it by DIY.

User-Shardan-Roomsensor Layout.jpg


A 1:1 layout is provided in the PDFs. You may use it for your pcb manufacturer or for etching your own one. If your manufacturer provides solder resist mask a mask print out is provided in the PDFs too.

 Please note:
 The photos shown represent a slightly older version of the pcb where the GPIO pins are missing.

PCB empty:
User-Shardan-Roomsensor Empty PCB.jpg
PCB, solder side.
Note the zero ohm resistor pair – do NOT solder all four resistors!
User-Shardan-Roomsensor Soldered PCB.jpg
Component side – no sensors placed.
User-Shardan-Roomsensor Soldered PCB Front.jpg

A (more then) full populated sensor pcb.
A TSL2561 luminosity sensor, a BME280 and a BMP180. This is obviously an example as the BME280 covers all values the BMP180 gives.
The DS18B20 is set on “long legs”, we’ll see later why.
User-Shardan-Roomsensor with sensors.jpg

Case

The case used is available at some dealers here in Germany.
Empty sensor case:
User-Shardan-Roomsensor EmptyCase.jpg
For example see here: [[1]]  

Building the circuit

Building is not too difficult.
You need a very fine soldering iron and calm hands to fit the SMD parts.

Place resistors first, then capacitors and the other SMD parts.

Be very carefull with soldering the ESP-12.

The solder tends to creep under the ESP-chip short circuiting some pins.
I recommend to solder one single pin of the ESP and then check:

 - Is it correctly aligned to the pcb?
 - Is it really flat on the pcb or is there some “air” between pcb and chip?

If you solder just one pin first, these things are correctable.
A completely soldered ESP-12 is fixed. It is somewhat difficult to de-solder it, often the pcb and/or the chip get damaged.
Place all the pin headers and solder.

Flashing

 - Connect your programming adapter to the “serial” pins.
 - Set the Prog-switch SW2 to “on” (flashmode).
 - Start flashing in your flash tool and press the SW1 (Reset) button for a short moment.
 - Wait until flashing succeded.
 - Switch off the device.
 - Disconnect the adapter.
 - Set SW2 to off

Done, that’s it.

ESPEasy Settings

These are my settings for a room sensor with display, DS18B20, TSL2561 and BME280.
You will have to adapt them to your sensors and configuration.
Display settings:
User-Shardan-Roomsensor Settings Display.jpg
DS18B20 settings
User-Shardan-Roomsensor Settings DS18B20.jpg
TLS2561 settings
User-Shardan-Roomsensor Settings Lux.jpg
BME-280 settings:
User-Shardan-Roomsensor Settings BME280.jpg

If your settings are done, the device list should show similar to this:
User-Shardan-Roomsensor DeviceList.jpg

Mounting into Case

Of course you will have to cut out your case for your configuration.
The display should be visible (obviously…) and the luminosity sensors should have a hole in the case too.

My first samples showed a somewhat too high temperature from the internal sensors. This is caused by the ESP-12 and the voltage regulator, they produce some warmth inside the case.
So I decided to place an additional DS18B20 on the pcb. A small hole was drilled into the case and the DS18B20 was bend
so it shows out of the case at the down side so it gets the temperature of the room.

User-Shardan-Roomsensor MountedCase.jpg
You can see the DS18B20 looking out of the case in the mid of the cases down side.

Have fun!

Files

File:User-Shardan RoomSensor-Documentation withPCB.pdf
File:User-Shardan-Roomsensor Schematic.pdf
File:User-Shardan-Roomsensor PCB.pdf