This page is not fully translated, yet. Please help completing the translation.
(remove this paragraph once the translation is finished)
The JetHome JetHub D1 controller is designed to build home automation and monitoring systems: polling sensors, using it as a data collection and transmission device, performing PLC functions in smart home systems, direct load control. JetHome JetHub D1 can be used as a central controller in a “smart home” in conjunction with wireless (Wi-Fi, ZigBee) and wired (RS-485) devices from other manufacturers. Execution in a DIN-rail housing allows you to conveniently place the controller in the electrical panel at home.
Equipment options:
The controller can be powered from a DC source with a voltage of 9 to 56 V. The power consumption of the controller itself is not more than 5W (excluding external consumers connected to the USB port and the output voltage terminal 5V).
It is possible to power the controller via the Ethernet connector using Passive PoE technology with a nominal voltage of up to 48V. Power is transmitted over unused pairs of the Ethernet cable: pair 4-5 (blue, white-blue) and pair 7-8 (brown, white-brown). The polarity of the connection does not matter. There is no galvanic isolation of power supply circuits in the controller.
To power the controller, it is recommended to use a stabilized DC source with a nominal voltage of 12V to 48V and a power of at least 10W.
During flashing, the controller must be powered from an external USB port. This power supply option is intended only for the firmware mode, regular operation of the controller when power is supplied via the USB port is impossible and may lead to controller failure. When powered by USB, the RS485 ports will not be available.
The controller can power external low-power devices (sensors) with a supply voltage of 5V. The 5V output is connected to the controller terminal. The maximum current given to the external load is 0.5A.
JetHome Armbian operating system with the ability to install a large number of additional packages from the Ubuntu 20.04 repository, as well as other third-party applications. It is possible to install such popular systems for home automation as Home Assistant, openHAB, etc.
The latest JetHome Armbian firmware can be downloaded at http://update.jethome.ru/armbian/ (see section “Controller firmware”). JetHub D1 controller requires Armbian firmware variant with “j100” suffix
Images of the Home Assistant Operating System (HassOS) operating system are also available for the controller: http://wiki.jethome.ru/hassos
The controller is not designed to perform high-load tasks in 24/7 mode, such as video processing.
The controller can be installed in an electrical cabinet or other location where the controller must be protected from moisture, dirt, foreign objects, and vibration. For better cooling of the internal elements of the controller, the controller case must be installed in a vertical position.
To install the controller:
To remove the controller from the DIN rail:
To ensure the reliability of electrical connections, it is recommended to use copper stranded cables. Cable ends should be stripped and then tinned or cable lugs should be used. Cable cores should be stripped so that their bare ends, after connecting to the controller, do not protrude beyond the terminal block.
General requirements for connection lines:
The controller is available in a design for mounting on a DIN rail (35 mm) or on a wall.
Appearance and elements of the controller:
On the top side of the controller are:
On the front side of the controller there are indication and control elements:
On the underside of the controller are:
The JetHome JetHub D1 controller has 4 discrete inputs for connecting “dry” contacts with the closure of the input to the common power wire of the controller (GND).
The maximum switching frequency of the discrete input state is 400Hz.
Amlogic A113X processor GPIOs used for discrete inputs in the JetHome JetHub D1 controller:
Discrete input | Processor output |
---|---|
1 | GPIOA_20 |
2 | GPIOA_19 |
3 | GPIOA_18 |
4 | GPIOA_17 |
A digital input can be in one of two states:
State | Logic level |
---|---|
Input open (not connected) | 0 |
The input is shorted to ground (GND) | 1 |
ATTENTION! Discrete inputs are not designed to supply voltage to them and may fail if the voltage on them is more than 12V. Be careful during installation work.
JetHome Armbian Linux GPIO numbers used for discrete inputs on the JetHome JetHub D1 controller:
Discrete input | Linux GPIO number | gpiolib number |
---|---|---|
1 | 472 | 46 |
2 | 471 | 45 |
3 | 470 | 44 |
4 | 469 | 43 |
Example of initializing and reading “Digital input 1” in JetHome Armbian Linux:
GPIO initialization “Discrete input 1” (by default in JetHome Armbian GPIO pins are configured at system boot and no additional configuration is required):
# cd /sys/class/gpio # echo 472 > export # echo in > gpio472/direction
Reading the state of “Digital input 1”:
# cat gpio472/value
It will output “0” if the input is open and “1” if the input is closed. Reading the status of other digital inputs is done in a similar way.
The JetHome JetHub D1 controller has 3 independent relay outputs with contact type “1A” (make contact). The maximum switched AC current for resistive loads is 5A at voltages up to 250V. The mechanical resource of the relay is 10,000,000 switchings.
Amlogic A113X processor GPIOs used for relay outputs in the JetHome JetHub D1 controller:
Relay number | Microprocessor pin |
---|---|
1 | GPIOA_4 |
2 | GPIOA_3 |
3 | GPIOA_2 |
GPIO numbers in JetHome Armbian Linux used to control relays:
Relay number | GPIO number in Linux | Number in gpiolib |
---|---|---|
1 | 456 | 30 |
2 | 455 | 29 |
3 | 454 | 28 |
An example of GPIO initialization and “Relay 1” control for the JetHome JetHub D1 controller (by default, in JetHome Armbian, GPIO pins are configured at system boot and no additional configuration is required).
Initialize GPIO “Relay 1”:
# cd /sys/class/gpio # echo 456 > export # echo out > gpio456/direction
Switching on “Relay 1”:
# echo 1 > gpio456/value
Switching off “Relay 1”:
# echo 0 > gpio456/value
Other relays are controlled in a similar way.
The JetHome JetHub D1 controller has one 10/100 Mbps Ethernet port, and the Ethernet physical layer controller uses an IC-Plus IP10GR chip that supports IEEE 802.3/802.3u standards. The Ethernet physical layer controller is installed on the A113 processor module, an Ethernet matching transformer and an external RJ45 connector with an indication of the connection and activity of the Ethernet network are installed on the peripheral board. To connect to the processor module A113, the following pins of the module expansion connector are used (see Description of the expansion connector of the processor module A113):
Expansion connector pin | Purpose |
---|---|
5 | ETH_TXN |
6 | ETH_TXP |
7 | ETH_RXN |
8 | ETH_RXP |
9 | ETH_LED3 |
10 | ETH_LED0 |
The JetHome JetHub D1 controller has one external USB 2.0 port for connecting peripherals.
The controller's external USB port can operate in two modes:
The operating mode of the external USB port is set when the controller is turned on and depends on what source the controller was powered on. When the controller is powered from an external power terminal or when the controller is powered via Ethernet (using passive PoE technology), the main mode of operation of the USB port is set. When the controller is powered from USB, the controller firmware mode is set.
The maximum current consumed by a peripheral device connected to the external USB port of the controller must not exceed 0.5A. To protect the controller from exceeding the current consumed by an external device, a resettable fuse is installed in the USB power circuit, which limits the current in the USB power circuit at a level of 0.5A.
Due to the current limit of 0.5A in the USB power circuit, it is not recommended to power the controller from an external USB port except for flashing it.
Starting from revision 1.5 of the controller, a 3-pin terminal with a pitch of 3.5mm is used to connect the 1-Wire bus. Purpose of the 1-Wire terminal pins:
Pin number | Purpose | Description |
---|---|---|
1 | +5V | +5V power output (for powering external 1-Wire devices) |
2 | data | Data bus 1-Wire |
3 | GND | Common wire |
For reliable operation of 1-Wire devices, it is recommended to connect them to the controller using a three-wire circuit (with power from +5V output).
In controller revisions up to 1.5, the 1-Wire bus is routed to an external RJ22 connector (4P4C). RJ22 1-Wire connector pin assignment:
Pin number | Purpose | Description |
---|---|---|
1 | +5V | +5V power output (for powering external 1-Wire devices) |
2 | GND | Common power wire |
3 | 1-Wire Data | Data bus 1-Wire |
4 | 1-Wire GND | Common wire 1-Wire |
When connecting passively powered 1-Wire devices, use pins 3 and 4 of this connector.
Starting with revision 1.8 of the JetHome JetHub D1 controller, GPIOA_14 of the Amlogic A113X processor is used to implement the 1-Wire bus.
In revisions of the JetHome JetHub D1 controller up to 1.8, a 1-Wire chip DS2483S-100 is used to implement the 1-Wire bus, connected to the I2C bus of the processor module (in Linux - i2c-0 bus). I2C controller address 1-Wire 0x18.
Expansion connector pins used to connect to the 1-Wire controller (see A113 Processor Module Expansion Connector Description):
Expansion connector pin | Purpose | Processor port |
---|---|---|
17 | I2C_SCK | GPIOAO_10/I2C_SCK_AO |
18 | I2C_SDA | GPIOAO_11/I2C_SDA_AO |
A description of working with 1-wire devices in Linux can be found, for example, here.
To initialize the 1-Wire DS2482 driver (on the controller of revision up to 1.8), you must execute the following commands (by default, in JetHome Armbian, the 1-Wire bus is configured at system boot and this operation is not required):
# sudo modprobe ds2482 # sudo sh -c "echo ds2482 0x18 > /sys/bus/i2c/devices/i2c-0/new_device"
1-wire devices connected to the bus will be available in the /sys/bus/w1/devices/ directory. For instance:
# ls /sys/bus/w1/devices/ 28-000007430c40 w1_bus_master1
In this example, one temperature sensor DS18B20 (28-000007430c40) is connected to the bus. Reading data from a temperature sensor:
# cat /sys/bus/w1/devices/28-000007430c40/w1_slave 8f 01 4b 46 7f ff 01 10 14 : crc=14 YES 8f 01 4b 46 7f ff 01 10 14 t=24937
The JetHome JetHub D1 controller has two RS-485 ports implemented using Silicon Labs CP2104 USB-UART interface converter chips. In the operating system, these devices appear as /dev/ttyUSB0 and /dev/ttyUSB1.
The ends of the RS-485 bus must be terminated with 120 ohm resistors at both ends. To simplify installation, the controller has built-in terminators connected to the RS-485 lines using jumpers (jumpers) located next to the RS-485 terminals.
To work with devices via the Modbus protocol, you can use the console python utility modbus-cli.
Installing the utility:
# sudo apt install python3-pip # sudo pip3 install modbus_cli
An example of working with a voltage and current sensor PZEM-016. Reading the register (Input Register) 0 containing the current value of the AC voltage (speed 9600 bps, device address 7):
# modbus -b 9600 -s 7 -v /dev/ttyUSB0 i@0 07 04 00 00 00 01 31 ac Read 1 registers: [2235] 0:2235 0x8bb
The JetHome JetHub D1 controller has a Zigbee wireless communication module based on the TI CC2538 + CC2592 or TI CC2652P1 chip. See module description: JetHome Zigbee module ZB3CX v.1 (CC2538+CC2592) or JetHome Zigbee module ZB6C v.1 (CC2652P1)
The module is connected to the UARTAO_B port of the processor (the device is displayed in the system as /dev/ttyAML2, in some cases as /dev/ttyAML1), hardware receive/transmit control (RTS and CTS lines) is not used. It is possible to control the hardware reset of the wireless module (RESET line) and control its boot mode (BOOT line) using the GPIO processor.
Connecting the Zigbee module to the processor (see Description of the expansion connector of the processor module A113):
Expansion connector pin | Zigbee module pin | Purpose |
---|---|---|
15 | RESET | Module hardware reset control line |
16 | Rx | Data line from processor to module |
17 | TX | Data line from module to processor |
20 | BOOT | Module loading mode switching line |
Amlogic A113X GPIOs used to control the Zigbee module:
Zigbee module output | Microprocessor output |
---|---|
RESET | GPIOA_15 |
BOOT | GPIOA_10 |
To flash the module, a two-row 10-pin connector (2×5) with a pin pitch of 1.27mm (WM DBG) is installed on the board, designed for debugging and flashing the wireless module using the JTAG interface:
Connecting the pins of the “WM DBG” connector to the wireless module:
Connector Pin | Purpose | Module Pin | Description |
---|---|---|---|
1 | +3.3V | 13 | +3.3V power bus of the wireless module of the module |
2 | TMS/SWDIO | 2 | JTAG TMS |
3 | GND | 9.14 | GND |
4 | TCK/SWCLK | 1 | JTAG TCK |
5 | GND | 9.14 | GND |
6 | TDO/SWO | 3 | JTAG TDO |
7 | N.C. | Not used | |
8 | TDI | 4 | JTAG TDI |
9 | GND | 9.14 | GND |
10 | RESET | 15 | RESET |
CPU GPIOs used to control Zigbee module in Linux:
Output of Zigbee module | Processor output | GPIO number in Linux | Number in gpiolib |
---|---|---|---|
RESET | GPIOA_15 | 467 | 41 |
BOOT | GPIOA_10 | 462 | 36 |
Initialization and control of the RESET pin
GPIO initialization (by default, in JetHome Armbian, GPIO pins are configured at system boot and no additional configuration is required):
# cd /sys/class/gpio # echo 467 > export # echo out > gpio467/direction
A hardware reset of the wireless module is done by writing logic level 1 to GPIO 467:
# echo 1 > gpio467/value
Return to operating mode is carried out by writing logic level 0 to GPIO 467:
# echo 0 > gpio467/value
Initialization and control of the BOOT pin
GPIO initialization (by default, in JetHome Armbian, GPIO pins are configured at system boot and no additional configuration is required):
# cd /sys/class/gpio # echo 462 > export # echo out > gpio462/direction
Boot mode is controlled by writing 0 or 1 to GPIO 462. For the Zigbee JetHome CC2538 wireless module, bootloader mode is entered at logic level 0 on the BOOT pin:
# echo 0 > gpio462/value
and the operating mode is set at logic level 1 on the BOOT pin:
# echo 1 > gpio462/value
Switching modes occurs when the module is turned on or hardware reset. Therefore, after changing the logic level at the BOOT pin of the module, it is necessary to perform a hardware reset of the module (see above p. “Initialization and control of the RESET pin”).
To flash the ZigBee CC2538 module, you can use the python utility cc2538-bsl. See manual Flashing TI CC2538/CC2652 modules and sticks using the cc2538-bsl utility
See Software for modules based on TI CC2538 chip or Software for sticks and modules based on TI CC2652P1 chip for recommended firmware
Procedure for firmware:
Switch the module to SBL (serial bootloader) mode:
# echo 0 > /sys/class/gpio/gpio462/value # echo 1 > /sys/class/gpio/gpio467/value # echo 0 > /sys/class/gpio/gpio467/value
Example command for firmware:
# python3 cc2538-bsl/cc2538-bsl.py -p /dev/ttyAML2 -e -w JH_2538_2592_ZNP_UART_20201010.bin
Reload the module into “working” mode:
# echo 1 > /sys/class/gpio/gpio462/value # echo 1 > /sys/class/gpio/gpio467/value # echo 0 > /sys/class/gpio/gpio467/value
There are two LEDs on the front panel of the controller: one to indicate the presence of supply voltage, the second is a custom two-color LED.
Linux GPIO numbers to which custom LEDs are connected:
LED | Processor pin | GPIO number in Linux | Number in gpiolib | Active Low |
---|---|---|---|---|
Red | GPIOA_0 | 452 | 26 | 1 (YES) |
Green | GPIOA_1 | 453 | 27 | 1 (YES) |
The LEDs are turned on by a low logic level on the processor pin.
An example of initialization and control of the red LED.
GPIO initialization (by default, in JetHome Armbian, GPIO pins are configured at system boot and no additional configuration is required):
# cd /sys/class/gpio # echo 452 > export # echo out > gpio452/direction # echo 1 > gpio452/active_low
Turning the LED on and off (0 - turn off the LED, 1 - turn on the LED):
# echo 1 > gpio452/value # echo 0 > gpio452/value
The green LED is configured and controlled in the same way.
There is one user button on the front panel of the controller.
GPIO number in Linux to which the button is connected:
Button | Processor pin | GPIO number in Linux | Number in gpiolib |
---|---|---|---|
Custom | GPIOZ_10 | 436 | 10 |
GPIO pin and button status:
Button state | Processor pin state |
---|---|
Not pressed | 1 |
Pressed | 0 |
An example of initializing and reading the state of a custom button.
GPIO initialization (by default, in JetHome Armbian, GPIO pins are configured at system boot and no additional configuration is required):
# cd /sys/class/gpio # echo 436 > export # echo in > gpio436/direction # echo 1 > gpio436/active_low
Reading button state:
# cat gpio436/value 0
Command output in case the input is configured as “active_low” (by default in the JetHome Armbian system): 0 - the button is not pressed, 1 - the button is pressed.
The PCF8563 chip connected to the internal I2C bus of the A113 processor module (I2C_B bus of the processor ).
To power the RTC, a 3 V lithium battery of CR1220 standard size is installed on the processor module.
Reading information from RTC:
# hwclock -r 2020-09-01 15:36:17.381590+03:00
or
#timedatectl Local time: Tue 2020-09-01 15:35:48 MSK Universal time: Tue 2020-09-01 12:35:48 UTC RTC time: Tue 2020-09-01 12:35:49 Time zone: Europe/Moscow (MSK, +0300) System clock synchronized: yes NTP service: active RTC in local TZ: no
ATTENTION! On a new controller, the time and date information may not yet be stored in the RTC chip. Therefore, when trying to read data from it, an error message will be displayed. To fix this error, you need to write the date and time information to the RTC chip.
Writing information about the current system date and time to the RTC is performed by the command:
# hwclock --systohc
The system time must be set correctly beforehand. The controller is configured to synchronize time over the Internet using the NTP protocol. If the controller has Internet access and the correct time zone is set, then nothing needs to be configured.
If the controller does not have Internet access, then you can set the time zone with the command:
# timedatectl set-timezone Europe/Moscow
(the list of available time zones can be viewed with the “timedatectl list-timezones” command), and the date and time with the command:
# timedatectl set-time '2020-09-01 15:35:48'
As an expansion connector, a pin connector with a pin pitch of 1.27mm, the number of pins is 40.
Signals output to the expansion connector:
Connector pin | Connector pin assignment | Microprocessor pin/peripheral | Controller function |
---|---|---|---|
1 | +5.0V | ||
2 | +5.0V | ||
3 | GND | ||
4 | GND | ||
5 | ETH_TXN | ||
6 | ETH_TXP | ||
7 | ETH_RXN | ||
8 | ETH_RXP | ||
9 | ETH_LED3 | ||
10 | ETH_LED0 | ||
11 | GND | ||
12 | SPI_MOSI | GPIOX_17/SPI_MOSI_B | |
13 | SPI_CS | GPIOX_16/SPI_SS0_B | |
14 | SPI_MISO | GPIOX_18/SPI_MISO_B | |
15 | SPI_CLK | GPIOX_19/SPI_CLK_B | |
16 | GND | ||
17 | I2C_SCK | GPIOAO_10/I2C_SCK_AO | |
18 | I2C_SDA | GPIOAO_11/I2C_SDA_AO | |
19 | GND | ||
20 | UART1_RX | GPIOAO_1/UART_RX_AO_A | Linux_console RX |
21 | UART1_TX | GPIOAO_0/UART_TX_AO_A | Linux_console TX |
22 | UART2_TX | GPIOAO_4/UART_TX_AO_B | |
23 | UART2_RX | GPIOAO_5/UART_RX_AO_B | |
24 | GND | ||
25 | GPIO1 | GPIOA_14 | |
26 | GPIO2 | GPIOA_16 | |
27 | GND | ||
28 | GPIO3 | GPIOA_19 | Discrete input 2 |
29 | GPIO4 | GPIOA_18 | Discrete input 3 |
30 | GPIO5 | GPIOA_20 | Discrete input 1 |
31 | GPIO6 | GPIOA_15 | Zigbee module reset |
32 | GPIO7 | GPIOA_17 | Discrete input 4 |
33 | GPIO8 | GPIOA_3 | relay 2 |
34 | GPIO9 | GPIOA_4 | Relay 1 |
35 | GPIO10 | GPIOA_10 | Zigbee module boot |
36 | GPIO11 | GPIOA_2 | Relay 3 |
37 | CPU_RESET | ||
38 | GND | ||
39 | USB_DN | USB_DN | USB data - |
40 | USB_DP | USB_DP | USB data + |
The UART console is routed to a 3-pin male connector located on the controller's peripheral board and labeled “CONSOLE”. The pin assignment of the connector is also printed on the controller board.
The controller cover must be opened to access the connector. To connect to a computer, you can use any USB-UART interface converter:
Port configuration:
To flash the software image, you can use the Amlogic Burning Tool program (see Instructions for using the Burning Tool).
The latest JetHome Armbian firmware can be downloaded at http://update.jethome.ru/armbian/
JetHub D1 controller requires Armbian firmware variant with «j100» suffix
The controller firmware is performed in the following order:
For flashing from Linux, you can use the burn-tool utility from the repository https://github.com/khadas/utils
Documentation for using the utility https://docs.khadas.com/vim1/UpgradeViaUSBCable.html#Upgrade-On-Ubuntu
To install the utility, run the following commands:
$ git clone https://github.com/khadas/utils khadas-utils $ cd khadas-utils $ ./INSTALL
To flash the controller, put it into bootloader mode using the method described above. Next, run the command:
burn tool -i <FIRMWARE_IMAGE_FILE>
where <FIRMWARE_IMAGE_FILE> is the firmware file
Sample program output:
$ burn-tool -i ~/firmware/D1/JetHome_1.0.14_Armbian_20.08_Arm-64_focal_current_5.7.16_j100.img Try to burn Amlogic image... Burning image '/home/ak/firmware/D1/JetHome_1.0.14_Armbian_20.08_Arm-64_focal_current_5.7.16_j100.img' for 'VIM1/VIM2' to eMMC... Unpacking image [OK] Initializing ddr ........[OK] Running u-boot........[OK] Create partitions [OK] Writing device tree [OK] Writing bootloader [OK] Wiping data partition [OK] Wiping cache partition [OK] Write boot partition [OK] Writing rootfs partition [OK] Resetting board [OK] Time elapsed: 9 minute(s). Done!
The USB Burning Tool does not detect the connected controller.
Setting up the controller at its first start or after flashing it can be done in the following ways:
To configure the controller over Ethernet, connect the controller to a local area network with a configured and running DHCP server. Determine the new IP address of the controller (the MAC address of the controller is located on the bottom of the controller case). For example, in Mikrotik routers, this can be done in the menu IP → DHCP Server → Leases. Next, connect to the controller using any ssh client, for example, Putty under Windows OS.
To connect via the UART console, connect the controller to the computer using any USB-UART converter (see p. “UART console”).
The default password for the “root” user is “1234”.
On first launch, you will be prompted for: