What did you build/automated today (with pictures)?

Awesome ! Thanks a lot :smiley:

I built and automated something today! :slight_smile:

image

IT professionals certainly do!
Mine has a cover but I sometimes forget to close it.

And, I have another problem with regards to the webcam… My workstation is by a wall, so my ceiling lights are all behind me.

That means my head looks like a dark blob, unless I turn on the four bright lights in front of me on the shelf.

So, what if I could automate things so that the lights come on automatically any time the webcam is on?

I’ve been looking for a way to detect programmatically if the webcam is on for a while. The only way I know is by looking up the device ID in device manager, and searching for it in Process Explorer. That shows what process is using it (if active) but it’s really a “search” – CPU intensive and slow. Not good for continuous monitoring.

Finally, a couple of days ago, I realized there’s another way to solve it. Why not just measure the power consumption of the webcam? Surely it uses more power when it’s active?

Time to get to work!

That’s an ESP8266 microcontroller (with wifi) and a ACS712 current sensor board.

Then, after some software magic:

com-video-to-gif(1)

Success! Lights turn on automatically whenever the webcam is on. So, now people can see me, and there’s no need to cover the webcam anymore – if it’s on, I’ll know!

Updane: I had to make some revisions. At first, I was powering the ACS712 and the ESP8266 (NodeMCU) from the same USB 5V source as the webcam (before the current sensor, obviously). However the webcam caused enough of a current draw for the value to read negative when the webcam was activated. I modified the design to take power from a separate USB connection, so that the webcam no longer affects the power supply of the circuit, and now it works much better. I’m also now reporting the actual power consumption in milliamps too.

Man I love this stuff. :slight_smile:

9 Likes

Very cool! I often think about activating some things based on pc activity (video editing, gaming etc…)
I wish there would be a tasker for pc (i think there is something, but i never got to it…)

1 Like

Depends on what operating system you are working on of course. With windows, you can use Windows’ Task Scheduler. It can start a task on a certain trigger. That trigger may be a certain time, but also for example startup or shutdown of the computer or other events.

You just gotta love everything that is possible with the esp8266 based boards and the myriad of sensors available for them. Do you do the logic on the wemos side or do you transmit the raw data to openhab and do the conversion to a switch item based on some threshold in rules there? Nice work.
Johannes

I don’t have pictures but I do have a tutorial in progress. Remote Access: pfSense + HAProxy + LetsEncrypt

As I say in the tutorial, I don’t necessarily recommend this unless you really know how to assess and mitigate the risks of exposing parts of your home network to the internet, even if it is through a reverse proxy.

This all got started because the Nextcloud people are very strict in how they set up their security. Even though my phone is always connected to my LAN over VPN, I can’t use the Nextcloud app unless I set up an HTTPS reverse proxy and I have to use a trusted cert meaning I’d have to add my self signed CA cert to all my devices. So Nextcloud’s strictness is forcing me to go down a less secure route and expose the HTTP/HTTPS ports to the internet. “Isn’t it ironic, don’t ya think?”

Anyway, it took some research and experimentation but I got it to work. :smiley:

There is, it’s called “EventGhost”. Funny, I’ve known about eventghost for years and I’ve been looking for an equivalent for Android for just about that long… Yet I only just found out about Tasker the other day, on this forum.

The logic is on the MCU, the data enters openHAB as an MQTT Homie Boolean: Webcam active (true or false).

I have been thinking for a while how to reliably detect when we cook and the fan needs to be set to extraction mode. So it is a continuation of the fan ir remote I build a few weeks back. I found the solution in the mlx90614 infrared temperature sensors. I connected this to a wemos d1 mini and put it in a 4x4 cm wooden box. Although it is made for close range measurement it is enough to detect a noticeable difference to the ambient temperature when pointed in the general direction of the stove from about 50cm away.


Johannes

3 Likes

Box may need some work but I LOVE the idea! That’s really cool.

I was just about to ask “why didn’t you just hide it in the fan housing”, and then remembered just how well my own ceiling fan metal housings blocked the WiFi signal…

Actually, come to think of it, now that I’m learning how useful the ESP8266 is, I’m realizing I’m going to be running into this problem more and more often.

What do you think about this one?

I feel like a little wifi antenna sticking out isn’t going to matter, and then I can hide the MCU inside a metal enclosure.

Cant put it in the fan housing as the fan is on the opposit wall of the stove and the mxl90614s only measure anything I can use when less than 50cm from the stoves surface as they are made for accurately measuring in the 2-3cm range. the box looks rougher on the pictures so close up than in reality :see_no_evil: but Im definitely no professional wood worker.

1 Like

Well, as long as your significant other is happy :smiley:

1 Like

If you use the external antenna, I believe you also need to move the resistor on the wemos board.

1 Like

I automated my air conditioning today!

The entire project obviously took way more than a day (it’s a learning process) but I deployed it today.

@JGKK how do you like that screen cutout. I filed it very, very carefully while thinking of your fan controller. :grin:



It’s a Wemos D1 ESP8266 with an IR emitter (transistor powered), 200x200 pixel SPI display, and a 433 MHz remote receiver, running purpose-built software and talks to openHAB as an MQTT/Homie 3.0.1 device.

The display shows the setpoint. Yes, the setpoint currently is really 28 degrees celsius (82 F). Living in a tropical climate it makes no sense for the indoor temperature to differ too much from outdoor. I’ve found myself chasing the outdoor temperature 4-5 times a day, which meant walking to the bedroom (central air, controls the whole house) and using an infrared remote.

No more! It’s now automatic, based on an offset from the outdoor temperature, with formulas/rules that I am sure I will be tweaking for a while.
Next step is to take the astro binding local sun elevation/azimuth into account so that I can make it ignore the exterior temperature sensor when it gets hit by the sun for about an hour around 5:30 PM.

Those 200x200 SPI displays are painfully slow, it takes almost a whole second to update the entire screen, and there doesn’t seem to be any fill commands and no way to optimize things, you really have to write pixel values… ugh. But, for this purpose it works. At least I don’t have to rewrite the screen to control the brightness, I connected the backlight control pin directly to a PWM pin. :slight_smile: The display shows the current setpoint, nothing more.

I have a separate temperature formula for sleep mode, and that means I can now finally tie things like exterior lights to sleep mode as well. Before, when “sleep mode” was just a toggle switch in openHAB, of course I never remembered… but there’s no way I’m forgetting to change the air conditioning temperature. Seeing my new A/C controller on the wall (instead of the original remote) will certainly be enough of a reminder to press the sleep mode button! which is an aeotec wallmote next to the bed.

The 433 MHz remote receiver does not have a purpose yet but I’m sure I will find a reason to put up a 433 MHz wall remote for something else now that I have a receiver in the bedroom.

6 Likes

Cudos. Well done. Would you be able to share the code base for the ESP? Having an ESP with IR as an MQTT device gives a lot room for other interesting applications.

1 Like

EDIT: It’s DONE.

Sure! It’ll take some cleanup, and then some setup work to build (i use Sloeber, not the arduino IDE) but it’s definitely possible.

My code base has a few nice features as standard: HTTP server (for control and status info), Telnet server (for direct debug output), OTA update, and MQTT/Homie.

It does not have any kind of runtime configuration, though. Everything is hardcoded, even SSID. I will always be a programmer, so it’s not worth it for me to spend the time making anything runtime configurable – it’s actually easier for me to just re-compile and re-upload.

The display does look a little bit crooked :sweat_smile:. Because of that slow refresh im playing around with small oleds right now.
Good work.
Johannes

1 Like

Very nice, and practical project @leif

I also started with astro binding, but at the end solved similar problem with two temperature sensors, both are intentionally placed to be exposed to the sun, one on the east and other on the west side of the building. Then I can use lowest temperature of those two as ambient air temperature, and I can use highest temperature as reference of how it “feels” outside on the sun, and I can use the difference to tell how “strong” the sun is, as we have a lot of rain (and controll blinds etc).

5 Likes

Thanks. Much appreciated. We all have been in that situation ,-). If the code is available others will fill in the gaps. I certainly will have a look into it. You want setting up a repo on gitlab/hub?

:rofl: