getting_started:hub_v3.0:1_huba_build

How to build the Hub A (stand-alone)

The Hub A provides the following functionalities:

  • MySensors RFM69 868 Mhz wifi gateway (ESP8266 module 1)
  • MySensors NRF24 wifi 2.4 Ghz gateway (ESP8266 module 2)
  • Bluetooth low energy (BLE) gateway (ESP32 module)
  • WS2812B RGB LED controller for 4 different strips: 3 external and 1 internal (ESP32 module)
  • Internal temperature and fan control (ESP32 module)
  • Radio traffic LEDs

The hub must be powered with a 5V DC power supply through one of the following connectors:

  • USB type C (J3)
  • Micro USB (J1)
  • 5.5 mm power Jack (J2)

The max current (A) of the power supply depends on the number of LED that you want to drive. For a setup with only the internal led ring, a 2 Ampere power supply is sufficient.

The list of all the components required for the assembly of a full d-diot hub is reported below, divided in categories for better readability.

All the electronic parts are available on the market in generic e-commerce platform (like ebay or amazon) or specialized electronic parts distributor, like LCSC, Digikey, Mouser, etc…

The hub A is built with the d-diot board 4A.

Below the schematics ( pdf format).

You can order the board 4A directly from PCBWay.

Order your board with PCBWay

For the two MySensors gateways (NRF24 and RFM69), two NodeMCU Lolin V3 (ESP8266 IC) board are required. The board is available in generic e-commerce platforms for 2 - 3 euros.

For the first MySensors gateway a NRF24L01 radio module is required.

The radio module is connected to the board through the U3 female pin header, so any radio module is suitable, but my recommendation is to use the E-byte radio module, even if a little more expensive respect to a generic module and requires an external 2.4 Ghz antenna, because it is amplified (PA LNA) and has an external shield that ensure a good signal range, which is optimal for a gateway.

For the second MySensors gateway a RFM69HW (868 Mhz) radio module is required.

With the RFM69HW radio module you need also an external antenna that can be an internal helical antenna soldered in J7, or an external antenna connected to the optional SMA connector J6.

One ESP32 - 30 Pin module is required.

You can find it in generic stores for about 3-4€ (example here)

A 24 WS2812B (Neopixel) led ring like the one in the picture below is used for the integrated lamp. Of course you can use a led ring with a different number of led and size, but you have to adapt the top part of the case and to change the firmware configuration file accordingly.

This kind of led rings can be found in generic e-commerce platforms for around 2-3€ (example here).

This button is available on the market for few cents.

Respect to a mechanical button, it does not generate spurious open/close transitions when pressed and simplify the design of the external case.

The 3d printable caswe has a space to host a 30 mm fan to keep the temperature inside the hub low.

This components is available in generic e-commerce stores for around 1-2€. For example I have used one of this.

Please note that the fan can be turned on/off in the Home Assistant WebUI and it is switched on automatically when the internal temperature reading of the Dallas temperature sensor (U6) is above 45°C (see firmware).

The case has a hole to host a power switch to completely cut off the power.

Any switch compatible with the dimensions reported in the picture above can be used without any modification. For example I have used one of this.

To complete the build you need the following parts:

  • M2.5 self tapping screw
M2.5 self tapping screw
  • Jumper wires
Jumper wires

The list of all the electronics components required for assembly of the d-diot board 4A is reported below:

References Description Value Quantity Vendor Link VPN Manufacturer MPN
C2 Capacitor 10 uF SMD 0805 10uF 1 LCSC view C15850 Samsung Electro-Mechanics CL21A106KAYNNNE
C5 Capacitor 1000 uF SMD 1000uF 1 LCSC view C280406 ROQANG RT1A102M0810
C3- C4 Capacitor 47 uF SMD 47uF 2 LCSC view C3337 Honor Elec RVT1C470M0505
C1 Capacitor 22uF Tantalum SMD 22uF-Tantalum 1 LCSC view C24518 AVX TAJB226M016RNJ
R9 Resistor 4.7K SMD 0805 4.7K 1 LCSC view C26022 UNI-ROYAL(Uniroyal Elec) 0805W8J0472T5E
R11- R13- R15- R17 Resistor 100K SMD 0805 100K 4 LCSC view C57246 UNI-ROYAL(Uniroyal Elec) TC0525F1003T5E
R1- R2- R3- R4- R5- R6- R7 Resistor 300 Ohm SMD 0805 300 7 LCSC view C61685 UNI-ROYAL(Uniroyal Elec) TC0525F3000T5E
R8- R10- R12- R14- R16 Resistor 10K SMD 0805 10K 5 LCSC view C57859 UNI-ROYAL(Uniroyal Elec) TC0550F1002T5E
D2- D5 Red Led SMD 0805 R-LED 2 LCSC view C138549 BrtLed(Bright LED Elec) BL-HUE35A-AV-TRE
D1 Blu Led SMD 0805 B-LED 1 LCSC view C84259 Foshan NationStar Optoelectronics NCD0805B2
D3- D6 Green Led SMD 0805 G-LED 2 LCSC view C84260 Foshan NationStar Optoelectronics NCD0805G1
D4- D7 Yellow Led SMD 0805 Y-LED 2 LCSC view C84261 Foshan NationStar Optoelectronics NCD0805Y1
D8 Schottky Barrier Diodes SMD SMA SS54 1 LCSC view C513478 Slkor(SLKORMICRO Elec.) SS54
U1 AMS1117 3.3V voltage regulator SMD SOT-223 AMS1117-3.3 1 LCSC view C6186 Advanced Monolithic Systems AMS1117-3.3
U3 NRF24L01 connector - female pin header 2×04 p.2.54 NRF24L01 1 LCSC view C124422 Ckmtw(Shenzhen Cankemeng) C124422
U6 Dallas DS18B20 Temperature sensor DS18B20 1 LCSC view C376006 UMW(Youtai Semiconductor Co.- Ltd.) DS18B20
U7 ESP-WROOM-32 module 30 pin ESP32_DevKit_V1_DOIT 1 zhenzhen-i view NA NA NA
U2- U5 NodeMCU Lolin V3 ESP8266 module NodeMCU_1.0_(ESP-12E) 2 zhenzhen-i view NA NA NA
U4 RFM69HW 868 Mhz radio module RFM69HW 1 cayin35 view NA NA NA
U8 Non-Inverting buffer/driver SN74AHCT125DR SN74AHCT125DR 1 LCSC view C155176 Texas Instruments SN74AHCT125DR
F1 Resettable fuse SMD 1210 Polyfuse 1 LCSC view C70190 TECHFUSE SL1210600
SW1- SW2 Push button SMD 3x6x2.5 mm INCL 2 Alphago it view NA NA NA
Q1- Q5- Q8- Q11 P channel mosfet THT TO-220-3 FQP27P06 4 LCSC view C462764 ON Semiconductor FQP27P06
Q2- Q4- Q7- Q10- Q13 N channel mosfet SMD SOT-23 JST2300 5 LCSC view C404846 JESTEK JST2300
Q3- Q6- Q9- Q12 P channel mosfet SMD SOT-23 JST3415C 4 LCSC view C404849 JESTEK JST3415C
J2 5.5 mm DC Power jack Barrel_Jack 1 Mouser view 710-694106301002 Wuerth 694106301002
J1 Micro USB port SMD USB_B_Micro 1 LCSC view C10418 Jing Extension of the Electronic Co. C10418
J4 Screw terminal 2 pin p.5.08 POW 1 LCSC view C474906 Cixi Kefa Elec KF127-5.08-2P
J5 Screw terminal 2 pin p.5.08 MAIN-SW 1 LCSC view C474906 Cixi Kefa Elec KF127-5.08-2P
J6 Coaxial SMA antenna connector ANT-EXT 1 LCSC view C411575 Shenzhen Kinghelm Elec KH-SMA-K513-G
J11 Pin header angled male 1×03 p.2.54 STRIP-1 1 NA NA NA NA NA
J12 Pin header angled male 1×03 p.2.54 STRIP-2 1 NA NA NA NA NA
J13 Pin header angled male 1×03 p.2.54 STRIP-3 1 NA NA NA NA NA
J8 Pin header male 1×03 p.2.54 FAN 1 NA NA NA NA NA
J14 Pin header male 1×03 p.2.54 STRIP-4 1 NA NA NA NA NA
J15 Pin header male 1×03 p.2.54 T-SWITCH 1 NA NA NA NA NA
J9- J10 Pin header male 1×15 p.2.54 Conn_01x15_Male 2 NA NA NA NA NA
J7 868 Mhz helical antenna ANT 1 alimodule view NA NA NA
J3 USB type C port SMD USB-C 1 fastener-kingdom view NA NA NA

The 3d model files and the print instructions of the case are available in thingiverse.

If you don't have access to a 3d printer, you can consider an online 3d printing service.

It is convenient to flash the firmware before installing the modules on the board.

The two ESP8266 requires the MySensors gateway code to run properly.

You can find the code for both modules as PlatformIO projects here and here.

The upload and library management with PlatformIO are easier respect to the standard Arduino IDE, so if you have Platformio you can follow this guide to flash your ESP8266 modules

  • The ESP8266-NRF24-GW code must be flashed on the ESP8266 module installed in U2
  • The ESP8266-RFM69-GW code must be flashed on the ESP8266 module installed in U5

The ESP32 module requires a firmware generated by ESPHome.

The configuration yaml files are provided here and you can follow this guide to see how to install ESPHome and this one to see how to upload the firmware to your device.

In the repository you will find 3 configuration yaml files:

  • ESP32-LED-BLE-GW.yaml: is the most complete and provides the Bluetooth low energy (BLE) gateway, RGB led controller, fan controller and temperature sensor functionalities. Since the resources of the ESP32 are limited, in some situation the module may become unstable with some self reboots.
  • ESP32-LED-CTL.yaml: provides the RGB controller, fan controller and temperature sensor functionalities without the BLE gateway. Stable
  • ESP32-BLE-GW: provides the BLE gateway, fan controller and temperature sensor functionalities without the RGB controller. Stable

Well, this is the most time consuming part of the building, but once you have started the print job, you don't have too much to do except watching your 3d printer at work, so you can proceed with the other steps.

The model files are here.

You need to print the following models (file name):

  • 1 x base.stl
  • 1 x top-fan+light.stl
  • 1 x board-4A-body.stl
  • 1 x front-led-cover.stl
  • 1 x top-led-cover.stl
  • 4 x supports.stl

Some components are THT, while some other are SMD, but generally with a package that is not so difficult to handle. See this to know what tools you need.

Use the interactive BOM tool to see where to place each component for the d-diot board 4A

This is how the board should looks with all the component soldered

The typical jumper configuration is reported below. See the ( schematics) to know more about what each jumper does.

  • JP1: Closed, the two pad must be bridged with solder iron. Leave it open if you want to disable the power led
  • JP2: Open, the two pad must not be bridged. Close the jumper if you want to bypass the main power switch.
  • JP3: Open, the two pad must not be bridged. Close the jumper if you want to connect the IRQ Pin of the NRF24 radio module with the D1 Pin of the ESP8266 module U2.
  • JP4: Open, the three pad must not be bridged. Close the jumper if you want to connect the reset Pin of the RFM69 radio module with GND or D2 Pin of the ESP8266 module U5.
  • Install the two ESP8266 modules, the ESP32 module and the NRF24 radio module
  • Place the board into the base of the case and fix it with 4 M2.5 screws
  • Solder two pieces of wire to the main power switch and place the switch inside the hole in the board-4A-body part of th3e case and install the front led cover.
  • Install the board-4A-body, fix it to the base with two M2.5 screws and connect the two wires of the main switch to the screw terminal J5.
  • Connect the capacitive touch button to the J15 header with three female jumper wires and place the switch inside the hole in the case.
  • Install the fan and the led ring on the top-fan+light part of the case and fix with glue the top led cover.
  • Connect the Led ring wires to the J4 header and the fan wires to the J8 header.
  • Fix the top-fan+light part of the case to the board-4A-body part with 2 M2.5 screws,install the antenna of the NRF24 radio module and, if you have soldered the optional J6 connector, install the antenna of the RFM69 radio module. Fix the supports to the base with 4 M2.5 screws and you are done.

To integrate the two MySensors gateways in Home Assistant add the following lines to your configuration.yaml file, changing the IP address in the device section according to the IP address of your ESP8266 modules

configuration.yaml
# Mysensors
mysensors:
  gateways:
    - device: "192.168.1.135"
      persistence_file: "/config/mysensors-rfm69.json"
      tcp_port: 5003
    - device: "192.168.1.133"
      persistence_file: "/config/mysensors-nrf24.json"
      tcp_port: 5003
  optimistic: false
  persistence: true
  version: "2.3"

ESPHome is well integrated in Home Assistant (see here), so adding your device is easy and it explained here.

Below how the Hub A entities looks like in the Home Assistant WebUI

Connect a +5V DC power source to one of the following connectors:

  • J2: barrel jack
  • J1: micro USB
  • J3: USB typoe C

Turn the main switch on and, if all is configured correctly, the entities of the ESP32 module (ESPHome firmware) should show up in Home Assistant.

Your MySensors nodes should also be visible in Home Assistant, if not reboot each node so that each node can presents itself to the controller.

The on-board lamp (led ring) can be controlled with the Home Assistant WebUI or with the capacitive touch switch located behind the round circular depression in front of the case:

  • Single button press: turn lamp on and off
  • Long button press: increase the brightness. To decrease the brightness release the button, press it again and hold within 2 seconds

If you want to drive other WS2812B LED strips (max 3) with Home Assistant connect them to the J11, J13 or J14 connectors on the rear panel.

The internal temperature readings and the wifi signal strength are visible in the Home Assistant WebUI and also the fan be controlled in Home Assistant, but if the temperature is above 45°C the fan is turned on automatically and turned off again when the temperature goes below 45°C.

Read this guide to know how to add a Bluetooth Low Energy (BLE) device to the BLE gateway

  • getting_started/hub_v3.0/1_huba_build.txt
  • Last modified: 2021/02/28 11:24
  • by franzunix