I’m looking to create an all-in-one sensor module. I purchased a 5pk of Wemos D1 Minis which I was hoping to use for the main board but also have a couple ESP8266 (esp-12) laying around as well.
On this board I want to power a BME680, TEMT6000 Lux Sensor, HC-SR501 Motion sensor and a SSD1306 display to show the BME680 info. I also want to power this via ESPHome within HA to configure into automations and dashboards.
I currently have a D1 Mini and ESP280 running fine with ESPHome but I wasn’t sure if I could plug multiple sensors into the same D1/D2 ports or if they have to be independent. Also, can all of these safely be powered via the 3.3v port or would that cause a power draw issue?
If anyone could help with a wiring diagram on how this should be configured I would be grateful.
I have some programming experience but i’m just getting into small electronic components and trying to self learn. I’ve seen diagrams with just one sensor, but not multiple to one board.
In theory, you should have no problem connecting this lot up, but it won’t be all to D1/D2. Check out the ESPHome docs linked above, and this excellent article for choosing pins.
So it seems BME680 and SSD1306 can utilize D1 and D2, TEMT6000 out should be to A0 and the HC-SR501 can be plugged into D3 using 5v instead of 3.3v for VCC. Is that correct?
Next I just have to figure out how to utilize the screen to display what I’m looking for - I guess I should dig more into the site.
I got my TEMT6000 wired in today, but for some reason it doesn’t seem to be calculating lx correctly.
I used the formula from the link provided, but in complete darkness it’s returning: (5v):
[22:32:03][D][adc:058]: ‘Office Illuminance’: Got voltage=2.94V
[22:32:03][D][sensor:117]: ‘Office Illuminance’: Sending state 587.30469 lx with 2 decimals of accuracy
in a decently lit up room it’s returning (5v):
[22:32:13][D][adc:058]: ‘Office Illuminance’: Got voltage=3.95V
[22:32:13][D][sensor:117]: ‘Office Illuminance’: Sending state 789.06250 lx with 2 decimals of accuracy
3v side dark is:
[22:34:09][D][adc:058]: ‘Office BME Voltage’: Got voltage=2.95V
[22:34:09][D][sensor:117]: ‘Office BME Voltage’: Sending state 2.95312 V with 2 decimals of accuracy
3v Light is:
[22:34:33][D][adc:058]: ‘Office Illuminance’: Got voltage=3.52V
[22:34:33][D][sensor:117]: ‘Office Illuminance’: Sending state 704.29688 lx with 2 decimals of accuracy
If I unplug the sensor completely, it still returns 2.95v
How have you wired it up? Did you read the note on the ESPHome TEMT6000 page? D1 Mini is an ESP8266 device, so can only accept 0–1V on the A0 pin.
You’ll need some sort of voltage divider (two resistors in series, with the TEMT output at the “top”, ground at the “bottom” and A0 connected to the “middle”). The value of the resistors will determine the division — for example, if you wanted to divide it by five, you’d need the top resistor to be four times the value of the bottom one.
If you’re not short on space, the easiest method would be to get a pack of e.g. 4.7k resistors, and use two in series for the “top” (9.4k) and two in parallel for the “bottom” (2.35k).
Oh, good catch. I run many D1 Minis but haven’t used the analogue input yet.
In that case, so long as you connect Vcc on the TEMT6000 to 3.3V not 5V, you can connect SIG straight to A0. If you’re seeing voltages over 3.3V, you’re powering it from 5V and might let the magic smoke out.
Thank you for the replies, i’m very new to small electronics I’m still struggling understanding when things like resistors and capacitors are needed.
That said, I have it currently hooked up with VCC to the 3.3v port, Ground to Ground and SIG to the A0 port - but i’m getting the same results as above. No less than 2.95v and a max of 3.5v which based on the lambda equation only converts to a minimum of 588 lux and a max of 704 lux.
Try removing the BME voltage platform: adc block. The docs say not to use that at the same time as the analogue input:
For example, on the ESP8266, you can measure the value of an analog pin (A0 on ESP8266) or VCC (see below) but NOT both simultaneously. Using both at the same time will result in incorrect sensor values.
That seems to be working better - I’m getting 200 lx and when I put my hand over the sensor, it drops to 100 lx. Reading the article it seems it maxes out at 200 lx with the 8266 - I assume there isn’t a way around that?
Also, I’m planning on powering this with a battery, if I have to remove the voltage block do you have a recommendation on how I can monitor the battery level?
I did explain that a few posts back, but you don’t need to with the D1 Mini, as pointed out above. It has this potential divider built in, and should work with the full range of the sensor.
You ought to be able to read from 0lx to the maximum.
If you can manage another sensor on the I²C bus and don’t get any joy with the TEMT600, I use a BH1750 with good results.