sensors_and_actuators:mysensors:usb_smart_hub

USB Smart HUB

With this MySensors node you can turn on/off 3 USB type A ports; the power state of each USB port can be controlled in two ways:

  • With the dedicated physical push button
  • In a “smart” way through the Home Assistant WebUI

The node is useful in many situations, like charging your smartphone, powering a Raspberry Pi or any other USB devices with the added value to manage or automate the process in your home automation hub.

It is built with the Mini-BT-pcb-328p board (mother board) and the USB-exp pcb (daughter board) all enclosed in a 3d printable case.

The Mini-BT-pcb-328p board supports both radio modules: RFM69 (868 Mhz) and NRF24 (THT and SMD), while The USB-Exp PCB, that feeds also the Mini-BT-pcb-328p board, has two connector for the external power.

  • 1 micro USB port (5V DC)
  • 1 Power jack (5-12V DC)

Visit the dedicated topic in the forum if you want to share your experience with this node.

The motherboard of this node is the Mini-BT-pcb-328p board.

Both versions of the board are suitable.

The schematic and the entire Kicad project are available for download in the dedicated d-diot github repository. You can easily get 10 boards with about 5€ using an online PCB manufacturer like JLCPCB or PCB way.

Click the button below to download the complete set (zip) of gerber files necessary for the manufacturing of the board.

Download Gerber Mini-BT-Pcb-328P v.1.0

Download Gerber Mini-BT-Pcb-328P v.2.0

Or order the PCB directly from PCBWay.

Order your board with PCBWay

The USB-Exp pcb is the other board required for this node and is connected to the motherboard through the MySensors expansion connector (MYSX).

The schematic and the entire Kicad project are available for download in the dedicated d-diot github repository. In the repository you can find the gerber files of the PCB, so you can easily get 10 boards with about 5€ using an online PCB manufacturer like JLCPCB or PCB way.

Click the button below to download the complete set (zip) of gerber files necessary for the manufacturing of the board v.1.0.

Download Gerber USB-Exp v.1.0

Or order the PCB directly from PCBWay.

Order your board with PCBWay

The brain of the node is the well known microcontroller ATMega328P-AU, which is the same MCU used in the Aruino UNO, Arduino Nano and Arduino Pro mini, so the sketches and the libraries of the Arduino platform are fully compatible. The MCU is available in generic e-commerce platforms for 1 - 2 euros.

For the radio module the motherboard support multiple choices. The instructions of this wiki page are for a NRF24L01+ (THT) radio module but you can build the node with your favourite one.

With a RFM69HW radio module, you need also an external antenna that can be a helical antenna like the one in the picture below, but also a piece of solid wire with the length of 8.6 cm should work fine.

Mini BT-Pcb-328P (motherboard)

On the Mini BT-Pcb-328P (motherboard) solder the following components:

References Value Description Footprint Quantity
C12 47uF Electrolytic capacitor 47 uF 5 x 5.4 mm CP_Elec_5x5.4 1
C7- C8- C9- C10- C11 0.1uF Capacitor 0.1 uF – SMD package 0805 C_0805_2012Metric 5
R5 10K Resistor 10 Kohm – SMD package 0805 R_0805_2012Metric 1
R6- R7- R8- R10 330 Resistor 330 Ohm – SMD package 0805 R_0805_2012Metric 4
D3 Y-LED LED – Yellow – SMD package 0805 LED_0805_2012Metric 1
D5 B-LED LED – Blu – SMD package 0805 LED_0805_2012Metric 1
D2 R-LED LED – Red – SMD package 0805 LED_0805_2012Metric 1
D4 G-LED LED – Green – SMD package 0805 LED_0805_2012Metric 1
U5 NRF24L01 Radio Module - NRF24L01+ (THT) NRF24L01 1
U4 ATmega328P-AU Microcontroller - ATmega328P-AU TQFP-32_7x7mm_P0.8mm 1
SW2 Reset Tactile push button – SMD 3x6x2.5 mm SW_1437566-3 1
P1 MYSX_2.6 2 x 11 Male Pin header - SMD - Veritcal pitch 2.54 mm PinHeader_2x11_P2.54mm_Vertical_SMD 1
D1 SS14 Schottky Diode SS14 - SMD DO-214AC SS14 1
C5 22uF-Tantalum Tantalum Capacitor - 22uF CAPPC3528X210N 1
U3 AMS1117-3.3 LDO voltage regulator AMS1117 3.3V SOT-223-3_TabPin2 1
C6 10uF Capacitor 10 uF – SMD package 0805 C_0805_2012Metric 1

The following components are optional.

References Value Description Footprint
U2 ATSHA204A ATSHA204A IC chip SOT-23_Handsoldering
C4 0.1uF Capacitor 0.1 uF – SMD package 0805 C_0805_2012Metric
R2 10K Resistor 10 Kohm – SMD package 0805 R_0805_2012Metric

The ATSHA204A IC, the capacitor C4 and the resistor R2 are necessary only if you need the hardware signing functionality of the MySensors library. Please note that the security and signing features can be enabled also without dedicated hardware using software signing.

USB-Exp (daughter board)

On the Mini USB-Exp (daughter board) solder the following components:

References Description Value Quantity Vendor Link VPN Manufacturer MPN
R1- R2- R3 Resistor 10 KOhm SMD 0805 10K 3 LCSC view C57859 UNI-ROYAL(Uniroyal Elec) TC0550F1002T5E
R7- R8- R9 Resistor 100 KOhm SMD 0805 100K 3 LCSC view C57246 UNI-ROYAL(Uniroyal Elec) TC0525F1003T5E
R4- R5- R6 Resistor 300 Ohm SMD 0805 300 3 LCSC view C61685 UNI-ROYAL(Uniroyal Elec) TC0525F3000T5E
D1- D2- D3 Blu Led SMD 0805 BLU-LED 3 LCSC view C84259 Foshan NationStar Optoelectronics NCD0805B2
SW1- SW2- SW3 Push button SMD 3x6x2.5 mm SW_Push 3 Alphago it view NA NA NA
Q1- Q2- Q3 N channel mosfet SMD SOT-23 Q_NMOS_GSD 3 LCSC view C404846 JESTEK JST2300
Q4- Q5- Q6 P channel mosfet SMD SOT-23 Q_PMOS_GSD 3 LCSC view C404849 JESTEK JST3415C
J7 Male 2.54 mm pin header THT 1×06 FTDI 1 LCSC view C190819 nextron(Nextronics Engineering) Z-211-0611-0021-001
J6 Male 2.54 mm pin header THT 2×03 ICSP 1 LCSC view C65114 BOOMELE(Boom Precision Elec) C65114
J1 Micro USB port SMD USB_B_Micro 1 LCSC view C10418 Jing Extension of the Electronic Co. C10418
J3- J4- J5 USB type A female connector SMD USB-A-S-X-X-SM2-R 3 LCSC view C8328 Jing Extension of the Electronic Co. YJ-USB-AF-SMT-01
P1 Female 2.54 mm pin header THT 2×11 MYSX_2.6 1 LCSC view C132126 CONNFLY Elec DS1023-2*11SF11

The following components are optional. Solder them only if you need to power the board through the DC Barrel jack with a voltage different from 5V DC

References Description Value Quantity Vendor
U1 DC adjustable buck converter mini 360 MH-MINI-360 1 NA view NA NA Mini-360
JP1 Male 2.54 mm pin header THT 1×03 V select 1 LCSC view C49257 BOOMELE(Boom Precision Elec) C49257
J2 5.5 mm DC Power jack Barrel_Jack 1 Mouser view 710-694106301002 Wuerth 694106301002

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.

To complete the build you need the following parts:

  • 4 x M2.5 self tapping screw
M2.5 self tapping screw
  • 1 x Jumper caps 2.54 mm
Jumper caps 2.54 mm

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.

Motherboard Mini-BT-Pcb-328P

Some components are THT, while some other are SMD, but generally with a 0805 package that is not so difficult to handle. The tools required for soldering the components of this board are the same of the d-diot board. See this to know what tools you need.

Use the interactive BOM tool to see where to place each component

The soldering process is divided in two parts for precaution; in fact if your programmer and FTDI adapter used for flashing the bootloader and the firmware does not have a voltage selector or if you don't select the 3.3V by mistake, you could damage the radio module that in most cases will not survive to a Vcc voltage above 3.3V.

The MCU works fine at 5V, so the flash of the bootloader and the firmware upload steps have been anticipated prior to the soldering of sensitive components.

Soldering - part 1

Solder the following components on the board:

  • ATmega328P MCU (U4)
  • MYSX Connector (P1)
  • Capacitors C7, C8, C9, C10 and C11
  • Resistor R5
  • Reset push button (SW2)
Burn the 1 Mhz MySensorsBootloader

With all the components of step above in place, you can proceed with the flashing of the “ATMega328p with MYSBootloader 1.3.0” which is necessary to the proper functionality of the node.

Connect the MISO, MOSI, SCK, RST, VCC, GND PIN of your programmer (USBasp) to the corresponding pin of the MYSX connector (PI) of the board and proceed according to this guide.

Upload the firmware

Connect the pin of your FTDI programmer to the MYSX connector (PI) of the board according to this scheme:

  • FTDI DTR → MYSX DTR
  • FTDI RX → MYSX TX0
  • FTDI TX → MYSX RX0
  • FTDI VCC → MYSX VCC
  • FTDI CTS → Unconnected or bridge with GND
  • FTDI GND → MYSX GND

Proceed according to this guide.

Soldering - part 2

Solder all the remaining components. The assembled motherboard should look like this.

Daughter board USB-exp

Use the interactive BOM tool to see where to place each component

With all the components soldered, including the optional ones, the USB-Exp daughter board should look like this.

Mini-BT-Pcb-328P (motherboard)

See the schematic if you want to know more about this jumpers.

  • JP1: open
  • J3 : open
  • JP2: open
  • JP3: bridge the two pad with solder
  • JP4: open
  • JP5 (board v.2.0 only): open

USB-exp (daughter board)

See the schematic if you want to know more about this jumpers.

When the node is powered through the micro USB port

  • JP1: open

When the node is powered through the barrel jack:

  • Bridge V+ and Reg Pin to enable the buck converter U1
  • Bridge V+ and Dir Pin to bypass the buck converter U1
  • Place the USB-exp daughter board inside the top part of the 3d printable case and fix it with two M2.5 self tapping screws.
  • Connect the Mini BT-Pcb-328P motherboard to the daughter board through the MYSX connector
  • Fix the bottom part of the case to the top part with two M2.5 self tapping screws.

The USB-Exp-firmware is available as a PlatformIO project in the d-diot github repo.

Follow the firmware upload guide to know how to flash your board with PlatformIO directly from your d-diot hub.

The configuration of the firmware is in the following files:

For each parameter, see the comments in the files.

  • sensors_and_actuators/mysensors/usb_smart_hub.txt
  • Last modified: 2020/11/08 09:41
  • by franzunix