FREE HA SERVER SETUP

#61 FREE HOME ASSISTANT SETUP

Since I have been using a ton of ESP8266 and ESP32 devices in my projects I decided to look for a suitable server with a good track record. During my research I singled out Home Assistant coupled with the ESPHOME Add-on as my go to software.

The ESPHOME Add-on is perfect for my projects since it does not require a MQTT broker and supports both the ESP8266 and the ESP32 development chips.

Step 1: Install Home Assistant on a suitable device to act as the server ( in my case it was on a Raspberry Pi 4 B) Link to install instructions here.

Step 2: Setup Port Forwarding/Virtual Server for port 8123 and DMZ Settings + uPnP.

On my D-Link router I had to setup a virtual server for port 8123 using internal static IP 10.0.0.9

I setup 10.0.0.9 to my DMZ host address and enabled it.

I enabled uPnP for my router.

Step 3: Setup Duck DNS for your Home Assistant server.

Go to Duck DNS create an account and setup your domain name then copy your token to paste in HA.

On your HA panel install the DuckDNS Add-on and go to configuration. There paste your token and domain name. Also change the accept_terms to: true.

Using the file editor navigate to /config/configuration.yaml and insert your certificate and key paths.

Step 4: Restart Home assistant.

Go to configuration-> server controls->restart to restart HA.

If you are using LTE with Telkom ( like me in South Africa ) be sure to set your APN to unrestricted …. link to tutorial here.

Once your server is up and running and using HTTPS instead of HTTP you can download the HA APP to your mobile device and insert your DuckDNS domain name into the Home Assistant URL field.

Tap on Enter Address Manually.

Enter your URL.

18B20 TEMPERATURE MODULE

#60 DS18B20 DIGITAL TEMPERATURE MODULE

DS18B20

The DS18B20 is an electronic thermometer which has a high accuracy. Multiple thermometers can be connected on the same wire because every one has it’s own internal address. The DS18B20 digital thermometer provides 9-bit to 12-bit Celsius temperature measurements and has an alarm function with nonvolatile user-programmable upper and lower trigger points.

FEATURES:

  • Temperature range: -55°C to +125°C
  • Designed for : -10°C to +85°C (+- 0.5°C)
  • Unique 1-Wire Interface Requires Only One Port Pin for Communication.
  • Programmable Resolution from 9 Bits to 12 Bits
  • TO-92 Package
  • 3 – 5.5V DC Supply Voltage

My version is a copy from the original Dallas version but it will still work with the Arduino Dallas 1 wire library. ( manufacturer 7Q-TEK )

Read more about the fake, counterfeit or clone DS18B20 sensors here.

…unless you bought the chips directly from Maxim Integrated (or Dallas Semiconductor in the old days), an authorized distributor (DigiKey, RS, Farnell, Mouser, etc.), or a big retailer, or you took exceptionally good care purchasing waterproofed DS18B20 probes. We bought over 1000 “waterproof” probes or bare chips from more than 70 different vendors on ebay, AliExpress, and online stores -big and small- in 2019. All of the probes bought on ebay and AliExpress contained counterfeit DS18B20 sensors, and almost all sensors bought on those two sites were counterfeit.

Author: Chris Petrich, 10 Sep 2020. License: CC BY. Source: https://github.com/cpetrich/counterfeit_DS18B20/
A bit dirty…

USEFUL ANALOG SENSORS

#59 EXAMPLES OF SOME ANALOG SENSORS

Three example sensors.

Recently I have been working on a remote battery monitoring system. Hardware + the software side of things. During my research I played around with a few store bought sensors and some small homemade sensors. Surprisingly it’s quite easy building simple analog sensors with minimal waste and a reliable working order.

The biggest challenge has been fitting all the sensors on a small PCB and picking a MCU development board with minimal trade offs.

After some time I decided to go for the Wemos D1 Mini and an analog multiplexer to handle all the analog signals.

The three sensors I chose are Voltage divider ( homemade ), Current sensor ( store bought ) and a LDR ( homemade ).

In a future post I will show a relatively compact PCB with an MCU, wireless connection and voltage, current, watts, temp, light, onTime, WiFi signal plus send/receive data collection points.

ACS712 Current Sensor.

Link to the ACS712 Current Sensor here.

INCREASE ANALOG SENSORS

#58 ANALOG MUX/DEMUX MC14051B

In some cases you will have a MCU with only one analog pin (A0). For example in my case I have the Wemose D1 mini with only one analog pin (A0) however I would like to increase these pins with the MC14051B Analog Multiplexer/Demultiplexer. This is a cheap easy fix but the downside is that it requires an additional chip (the MC14051B ).

MC14051B pin out.

The MC14051B analog multiplexer is a digitally–controlled analog switch. The MC14051B effectively implements an SP8T solid state switch, the device feature low ON impedance and very low OFF leakage current. Control of analog signals up to the complete supply voltage range can be achieved.

I created a small breakout board to make testing and experimenting a little easier.

Template outline.
Effective soldering and trace separation.
Finished product.

More information about increasing analog pins can be found here.

WEMOS D1 MINI

#57 WEMOS D1 MINI WIFI DEV BOARD

Wemos D1 mini

The Wemos D1 mini is a small WiFi based development board. The board is based off of the ESP-8266EX MCU developed by Espressif . The dimensions are 34.2*25.6 mm which allows this small package to be used effortlessly in large scale applications. Shields are also widely available and add to the ease of use for this board.

Features

  • 11 digital IO, interrupt/pwm/I2C/one-wire supported(except D0)
  • 1 analog input(3.2V max input)
  • a Micro USB connection
  • Compatible with MicroPython, Arduino, nodemcu

Technical specs

  • Operating Voltage 3.3V
  • Digital I/O Pins 11
  • Analog Input Pins 1(3.2V Max)
  • Clock Speed 80/160MHz
  • Flash 4M Bytes
  • Size 34.2*25.6mm
  • Weight 3g

My specific board comes from a company called Farylink. It looks like they make small boards with wifi capabilitys.

According to there website:

Shenzhen Huayulian technology co., LTD is an IOT company that integrates rd, production and sales and is technology-oriented and service-oriented. With a rich background in the IOT industry, it focuses on the research, development and production of IOT communications.

[datasheet]
Size fingers for scale.
Looks like someone rubbed of the programming IC’s serial markings. Or perhaps it was manufactured without any markings? Either way the fact remains its 100% a Chinese copy.

The link to the CH340 driver (which is required to program the Wemos D1 mini over USB) can be found here.