This is an old revision of the document!
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.
To implement the 1-Wire bus on the JetHome JetHub D1 controller, use the 1-Wire controller DS2483S-100, 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 |
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 |
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. To protect against electrostatic interference, a specialized TVS diode DS9503 is installed on the 1-Wire bus.
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, you need to execute the following commands (by default, in JetHome Armbian, the 1-Wire bus is configured at system boot and no additional configuration is required):
# sudo modprobe ds2482 # sudo sh -c "echo ds2482 0x18 > /sys/bus/i2c/devices/i2c-0/new_device"
After that, the 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 модуль ZB3CX v.1 (CC2538+CC2592) or JetHome Zigbee модуль 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 Прошивка модулей и стиков TI CC2538/CC2652 с помощью утилиты cc2538-bsl
See ПО модулей, основанных на чипе TI CC2538 or ПО стиков и модулей, основанных на чипе TI CC2652P1 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
На лицевой панели контроллера установлено два светодиода: один для индикации наличия напряжения питания, второй - пользовательский двухцветный светодиод.
Номера GPIO в Linux, к которым подключены пользовательские светодиоды:
Светодиод | Вывод процессора | Номер GPIO в Linux | Номер в gpiolib | Active Low |
---|---|---|---|---|
Красный | GPIOA_0 | 452 | 26 | 1 (YES) |
Зеленый | GPIOA_1 | 453 | 27 | 1 (YES) |
Светодиоды включаются низким логическим уровнем на выводе процессора.
Пример инициализации и управления красным светодиодом.
Инициализация GPIO (по-умолчанию в JetHome Armbian выводы GPIO конфигурируются при загрузке системы и дополнительной настройки не требуется):
# cd /sys/class/gpio # echo 452 > export # echo out > gpio452/direction # echo 1 > gpio452/active_low
Включение и выключение светодиода (0 - выключить светодиод, 1 - включить светодиод):
# echo 1 > gpio452/value # echo 0 > gpio452/value
Настройка и управление зеленым светодиодом производится аналогичным образом.
На лицевой панели контроллера установлена одна пользовательская кнопка.
Номер GPIO в Linux, к которому подключена кнопка:
Кнопка | Вывод процессора | Номер GPIO в Linux | Номер в gpiolib |
---|---|---|---|
Пользовательская | GPIOZ_10 | 436 | 10 |
Состояние вывода GPIO и кнопки:
Состояние кнопки | Состояние вывода процессора |
---|---|
Не нажата | 1 |
Нажата | 0 |
Пример инициализации и чтения состояния пользовательской кнопки.
Инициализация GPIO (по-умолчанию в JetHome Armbian выводы GPIO конфигурируются при загрузке системы и дополнительной настройки не требуется):
# cd /sys/class/gpio # echo 436 > export # echo in > gpio436/direction # echo 1 > gpio436/active_low
Чтение состояния кнопки:
# cat gpio436/value 0
Вывод команды в случае, если вход сконфигурирован как “active_low” (по-умолчанию в системе JetHome Armbian): 0 - кнопка не нажата, 1 - кнопка нажата.
В качестве часов реального времени (RTC) используется микросхема PCF8563, подключенная к внутренней шине I2C процессорного модуля A113 (шина I2C_B процессора).
Для питания RTC на процессорном модуле установлен литиевый элемент питания с напряжением 3 В типоразмера CR1220.
Чтение информации из RTC:
# hwclock -r 2020-09-01 15:36:17.381590+03:00
или
# timedatectl Local time: Вт 2020-09-01 15:35:48 MSK Universal time: Вт 2020-09-01 12:35:48 UTC RTC time: Вт 2020-09-01 12:35:49 Time zone: Europe/Moscow (MSK, +0300) System clock synchronized: yes NTP service: active RTC in local TZ: no
ВНИМАНИЕ! На новом контроллере информация о времени и дате может быть еще не сохранена в микросхеме RTC. Поэтому при попытке чтения данных из нее будет выводится сообщение об ошибке. Для устранения данной ошибки необходимо записать информацию о дате и времени в микросхему RTC.
Запись в RTC информации о текущих системных дате и времени выполняется командой:
# hwclock --systohc
Предварительно системное время должно быть правильно установлено. Контроллер настроен на синхронизацию времени через Интернет по протоколу NTP. Если у контроллера есть доступ в Интернет и установлен верный часовой пояс, то настраивать ничего не нужно.
Если контроллер не имеет доступ в Интернет, то установить часовой пояс можно командой:
# timedatectl set-timezone Europe/Moscow
(список доступныых часовых поясов можно посмотреть командой “timedatectl list-timezones”), а дату и время командой:
# timedatectl set-time '2020-09-01 15:35:48'
В качестве разъема расширения используестя штырьевой разъем с шагом контактов 1.27мм, количество контактов 40.
Сигналы, выведенные на разъём расширения:
Вывод разъема | Назначение вывода разъема | Вывод/периферия микропроцессора | Функция контроллера |
---|---|---|---|
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 + |
UART-консоль выведена на 3-х контактный штырьевой разъем, расположенный на периферийной плате контроллера и отмеченный как “CONSOLE”. Назначение контактов разъема также нанесено на плату контроллера.
Для доступа к разъему необходимо открыть крышку контроллера. Для подключения к компьютеру можно использовать любой преобразователь интерфейсов USB-UART:
Конфигурация порта:
Для прошивки образа ПО можно использовать программу Amlogic Burning Tool (см. Инструкцию по использованию Burning Tool).
Последнюю прошивку JetHome Armbian можно скачать по адресу http://update.jethome.ru/armbian/
Для контроллера JetHub D1 необходим вариант прошивки Armbian с суффиксом “j100”
Прошивка контроллера выполняется в следующем порядке:
Для прошивки из Linux можно воспользоваться утилитой burn-tool из репозитария https://github.com/khadas/utils
Документация по использованию утилиты https://docs.khadas.com/vim1/UpgradeViaUSBCable.html#Upgrade-On-Ubuntu
Для установки утилиты выполните команды:
$ git clone https://github.com/khadas/utils khadas-utils $ cd khadas-utils $ ./INSTALL
Для прошивки контроллера переведите его в режим загрузчика способом, описанным выше. Далее выполните команду:
burn-tool -i <FIRMWARE_IMAGE_FILE>
где <FIRMWARE_IMAGE_FILE> - файл прошивки
Примерный вывод программы:
$ 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] Writing boot partition [OK] Writing rootfs partition [OK] Resetting board [OK] Time elapsed: 9 minute(s). Done!
Программа USB Burning Tool не определяет подключенный контроллер.
Настройка контроллера при его первом запуске или после его перепрошивки может осуществляться следующими способами:
Для настройки нонтроллера по сети Ethernet подключите контроллер к локальной сети с настроенным и работающим сервером DHCP. Определите новый IP-адрес контроллера (MAC-адрес контроллера указан на нижней части корпуса контроллера). Например, в маршрутизаторах Mikrotik это можно сделать в меню IP → DHCP Server → Leases. Далее подключитесь к контроллеру с помощью любого ssh-клиента, например, Putty под ОС Windows.
Для подключения через UART-консоль подключите контроллер к компьютеру с помощью любого преобразователя USB-UART (см. п. “UART консоль”).
По-умолчанию пароль для пользователя “root” - “1234”.
При первом запуске будет предложено: