For some time, the world of SBC systems has experienced extensive changes. These types of systems have become much more powerful than before and are now competing with laptops and PCs in terms of power. I have reviewed the Khadas Vim Pro before, but now we are dealing with a newer and much more powerful generation. In this article, we will review the Khadas VIM4.
The VIM4 SBC is the latest addition to popular Khadas VIM series (Of course, until the time of writing this text). It has a powerful Amlogic A311D2 SoC, featuring a 2.2GHz quad core ARM Cortex-A73, and 2.0GHz quad core Cortex-A53 CPU. HDR10, HDR10+, HLG and PRIME HDR video processing are supported, and TrustZone based security is used for DRM video streaming.
Developers and device manufacturers will love the programmable 32-bit STM32G031K6 MCU, wide 9-20V range of VIN power input, dual MIPI-CSI interfaces for two cameras, real-time clock, wake-on-lan functionality, and 3-axis g-sensor for orientation detection. The MIPI-DSI interface has touch panel functionality, so you can even build touch-sensitive interactive displays for your customers.
It has an onboard micro HDMI input port for smart display & video conferencing applications. Four HDMI display outputs (HDMI, MIPI-DSI, V-by-One & eDP) means you can connect up to 3 displays simultaneously (including touch) without the need of costly adapters and custom boards, however in practice the number of independent displays will be limited by the OS.
If you need more details, be sure to take a look here.
Unboxing PicturesAfter opening the box, at first glance, we are faced with a very small board in the dimensions of a credit card. The arrangement of parts with a very high density shows the extraordinary design and experience of the Khadas design hardware team.
Currently, there are two versions for sale in the Khadas store:
- VIM4 with Active Cooling Kit (It is installed by default)
- VIM4 without Cooling Kit
Personally, I suggest you use the version with a cooling kit.
What's in the Box- VIM4
- Antenna x 2 (Bluetooth and WiFi)
- VIM Heatsink (It is installed by default)
- 3705 Cooling Fan (It is installed by default)
- User Manual
- Quickstart Guide
- SoC: Amlogic A311D2 2.2GHz Quad core ARM Cortex-A73 and 2.0GHz Quad core Cortex-A53 CPU ARM Mali-G52 MP8(8EE) GPU up to 800MHz 8K 24fps decoder & low latency 4K H.264/H2.65 50fps encoder Support multi-video decoder up to 4Kx2K@60fps+1x1080P@60fps HDR10, HDR10+, HLG and PRIME HDR video processing TrustZone based security for DRM video streaming
- SPI Flash: 32MB
- RAM: 8GB LPDDR4X 2016MHz, 64bit
- eMMC 5.1: 32GB
- Wi-Fi: AP6275S Wi-Fi 6 Module 802.11a/b/g/n/ac/ax, 2T2R MIMO with RSDB
- Bluetooth: Bluetooth 5.1
- LAN: 10/100/1000M
- WOL: Wake on Lan
- TF Card: Molex Slot, Spec Version 2.x/3.x/4.x(SDSC/SDHC/SDXC)
- USB HOST: x2 (1500mA & 1300mA Load)
- USB Type-C: USB2.0 OTG & USB PD
- VIN Connector: System Power Input
- Wide Input Voltage: Range from 9V to 20V
- HDMI Output: Type-A Female HDMI2.1, up to 4K2K HDR Video, Dynamic HDR, CEC and HDCP 1.4/2.3
- HDMI Input: Micro HDMI, up to 4Kp60
- DMIC Stereo: Digital Microphones
- V-by-One: 8 lanes Interface, Resolution up to 4096*2160 30 Pin 0.5mm Pitch FPC Connector
- Touch Display: MIPI-DSI and eDP Combo Interface 4 lanes MIPI-DSI Interface, Resolution up to 1920*1200 or 4 lanes eDP Interface, Resolution up to 2560*1600 I2C and GPIO Signals for Touch Panel 40 Pin 0.5mm Pitch FPC Connector
- Camera: Interface: 4 lanes MIPI-CSI x2 Supports Dual Cameras Up to 16 MP ISP 30 Pin & 20 Pin 0.5mm Pitch FPC Connectors
- Sensor: KXTJ3-1057 Tri-axis Digital Accelerometer
- M.2 Socket: PCIe 2.0 (1 lane) M.2 2280 NVMe SSD Supported USB 2.0, I2S, I2C, GPIO, MCU-I/O
- RTC Battery Header: 0.8mm Pitch Header
- Cooling Fan Header: 4-Pins 0.8mm Pitch Header, with PWM Speed Control
- LEDs: White LED x1, Red LED x1
- 40-Pins Header(2.54mm): CPU: USB, I2C, I2S, SPDIF, UART, PWM, ADC, GPIO MCU: SWCLK, SWDIO
- Buttons: x3 (Power / Func / Reset)
- XPWR Pads: For External Power Button
- Mounting Holes: Size M2 x 4
- Board Dimensions: 82.0 x 58.0 x 11.5 mm
- Board Weight: 31g
- Bootloader: U-Boot
In the pictures below, you can see Khadas VIM4 next to other boards. In terms of dimensions and design, khadas VIM4 are very compact.
For initial setup, you will need a USB-C adapter and cable for power supply, HDMI cable, mouse and keyboard and a monitor with HDMI input. Products related to VIM4 can be seen here.
If your SBC repeatedly restarts, or restarts randomly, this is an indication of insufficient or unstable USB-C input power. Change your USB-C power cable and/or use a different power adapter.
Note that you will need internet to install and run the operating system. By default, OOWOW is installed on VIM4.
OOWOWOOWOW is a standalone embedded service for seamless online OS delivery, device maintenance, and much more! OOWOW is developed and maintained by Khadas Team. VIM4 is the first Khadas single board computer to have OOWOW embedded inside.
Make system installation much easier with OOWOW. You can download and install your preferred OS directly from the Cloud. OOWOW will start automatically if the device storage is empty. With OOWOW you will always be in control of your VIM4.
OOWOW provides rapid online OS download and installation, which will improve quality of life for single board computer users - with OOWOW, you can install / reinstall your preferred OS in just 2-3 minutes.
The OOWOW wizard will guide you to install a new OS in just 4 steps, and it automatically starts if your device storage is empty.
- Connect to internet over Wi-Fi or Ethernet
- Display OS images for your device
- Select OS installation image
- Download and install OS into your device
Installing an OS has never been so easy. The operating system is installed by default on eMMC storage.
Using AndroidOn the first try, I installed Android OS. At the time of writing, Android 11 (32-bit and 64-bit) was available, so I chose the 64-bit version. System boot speed is very fast due to eMMC storage. At first glance, there is no Google Play Store (Of course, at the time of writing this text), but don't worry, you can directly install any apk file without any restrictions. Of course Aptoide is also available by default and various App can be installed through it.
One of the important features of Khadas VIM4 is HDMI input. The HDMI input on your VIM4 allows it to function as a home theater receiver. This input is designed to accept a micro HDMI cable, through which audio and video are digitally transferred from the HDMI outputs of other devices, such as a PC, game consoles and A/V receivers.The video below shows how this feature works in Android 11. This feature does not require app installation and is enabled by default in Android.
There is no problem in terms of playing heavy games or movies with 4K quality. In the tests I did, the Call of Duty Mobile game was run easily and without lag with maximum graphics and details on Android.
In this part, perhaps the lack of a IR remote control in the Android operating system was felt, although you can easily add it if needed.
Using UbuntuLike installing Android, we install Ubuntu through OOWOW. Just boot the system from OOWOW, we use hardware buttons for this, Of course, if you have already installed another operating system on VIM4.
Currently, there are two versions of Ubuntu to install:
- Ubuntu 22.04 Server linux 5.4 fenix
- Ubuntu 22.04 Gnome linux 5.4 fenix
I chose Gnome
. After installation, log in with khadas
username and password. Some applications are ready to use by default.
One of the important challenges of electronics makers and lovers is controlling GPIO pins for different projects. The good news is that Khadas VIM4 allows you to control GPIO pins with the help of the powerful WiringPi library in C and Python programming languages. With this library you can use many of the functionalities provided by the GPIO header: digital pins
, SPI
, I2C
, UART
, etc.
To get GPIO information, Run gpio readall
in the Terminal, and it will print a table about the status of all GPIO pins.
GPIO
β> GPIO native numberwPi
β> WiringPi numberMode
β> GPIO Mode,ALT
mean that this pin defined as a special functionV
β> 1: High, 0: LowPU/PD
β> PU: Pull up, PD: Pull down, DSBLD: disabled PU/PD
In this section, we will perform a simple electronic projects. We are going to control a simple traffic light.
WiringThe LEDs were connected to physical pins 25, 26 and 39. Finally, you need a wire to connect to GND pin.
Now, create new file and copy following code into file. My file name is led.c
:
#include <wiringPi.h>
int main(void)
{
int time = 100;
wiringPiSetup();
pinMode(8, OUTPUT);
pinMode(18, OUTPUT);
pinMode(9, OUTPUT);
for(;;)
{
digitalWrite(8, HIGH);
delay(time);
digitalWrite(8, LOW);
digitalWrite(18, HIGH);
delay(time);
digitalWrite(18, LOW);
digitalWrite(9, HIGH);
delay(time);
digitalWrite(9, LOW);
delay(time);
}
}
Compile led.c
file:
gcc -Wall -o led led.c -lwiringPi -lwiringPiDev -lpthread -lrt -lm -lcrypt
Finally, run:
sudo ./led
If everything is correct, it will compile successfully as shown in the image below:
After running the program, the LEDs start blinking.
Example 2 : Get temperature and humidity informationBy connecting an DHT11 module to the khadas, we want to receive temperature and humidity information.
WiringAccording to the picture below, connect the data
pin to physical pin 39. Connect VCC
and GND
to pins 1 and 21.
Now, create new file and copy following code into file. My file name is dht11.c
:
#include <wiringPi.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#define MAXTIMINGS 85
#define DHTPIN 18
int dht11_dat[5] = { 0, 0, 0, 0, 0 };
void read_dht11_dat()
{
uint8_t laststate = HIGH;
uint8_t counter = 0;
uint8_t j = 0, i;
float f; /* fahrenheit */
dht11_dat[0] = dht11_dat[1] = dht11_dat[2] = dht11_dat[3] = dht11_dat[4] = 0;
/* pull pin down for 18 milliseconds */
pinMode( DHTPIN, OUTPUT );
digitalWrite( DHTPIN, LOW );
delay( 18 );
/* then pull it up for 40 microseconds */
digitalWrite( DHTPIN, HIGH );
delayMicroseconds( 40 );
/* prepare to read the pin */
pinMode( DHTPIN, INPUT );
/* detect change and read data */
for ( i = 0; i < MAXTIMINGS; i++ )
{
counter = 0;
while ( digitalRead( DHTPIN ) == laststate )
{
counter++;
delayMicroseconds( 1 );
if ( counter == 255 )
{
break;
}
}
laststate = digitalRead( DHTPIN );
if ( counter == 255 )
break;
/* ignore first 3 transitions */
if ( (i >= 4) && (i % 2 == 0) )
{
/* shove each bit into the storage bytes */
dht11_dat[j / 8] <<= 1;
if ( counter > 16 )
dht11_dat[j / 8] |= 1;
j++;
}
}
/*
* check we read 40 bits (8bit x 5 ) + verify checksum in the last byte
* print it out if data is good
*/
if ( (j >= 40) &&
(dht11_dat[4] == ( (dht11_dat[0] + dht11_dat[1] + dht11_dat[2] + dht11_dat[3]) & 0xFF) ) )
{
f = dht11_dat[2] * 9. / 5. + 32;
printf( "Humidity = %d.%d %% Temperature = %d.%d *C (%.1f *F)\n",
dht11_dat[0], dht11_dat[1], dht11_dat[2], dht11_dat[3], f );
}else {
printf( "Data not good, skip\n" );
}
}
int main( void )
{
printf( "Khadas VIM4 wiringPi DHT11 Temperature test program\n" );
if ( wiringPiSetup() == -1 )
exit( 1 );
while ( 1 )
{
read_dht11_dat();
delay( 1000 ); /* wait 1sec to refresh */
}
return(0);
}
Compile dht11.c
file:
gcc -Wall -o dht11 dht11.c -lwiringPi -lwiringPiDev -lpthread -lrt -lm -lcrypt
Finally, run:
sudo ./dht11
If everything is correct, it will compile successfully as shown in the image below and temperature and humidity information is displayed.
In this section we want to connect an ADXL345
accelerometer module to khadas VIM4 through i2c. Any other i2c module can be used, However, you should use the appropriate codes with it.
First, we need to need to enable I2C with overlays. There are two i2c on the khadas VIM4:
i2cm_a
(PIN25 & PIN26)i2cm_f
(PIN22 & PIN23)
Open the kvim4.dtb.overlay.env
file using nano editor
.
sudo nano /boot/dtb/amlogic/kvim4.dtb.overlay.env
Add one of the following lines to this file and after saving (using CTRL + X):
fdt_overlays=i2cm_a
or
fdt_overlays=i2cm_f
Finally, reboot the device.
WiringConnect the ADXL345
accelerometer module to Khadas according to the instructions below:
- First, connect the
GND
andSD0
pin of the sensor to one of the GNDs pins of the Khadas VIM4. - The device can be powered by a 5v power source, so connect
VCC
andCS
to one of the 5v pins of the VIM4. - SDA (SPI data) connects to SDA (pin 26 on the VIM4).
- SCL (SPI clock) connects to SCL (pin 25 on the VIM4).
With the following command, the i2c module address can be detected on pins 25 and 26, As you can see, the module address is 0x53
.
sudo i2cdetect -r -y 0
Now, create new file and copy following code into file. Remember to replace the module i2c address from the previous section. My file name is ADXL345.c
:
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <wiringPiI2C.h>
#define DEVICE_ID 0x53
#define REG_POWER_CTL 0x2D
#define REG_DATA_X_LOW 0x32
#define REG_DATA_X_HIGH 0x33
#define REG_DATA_Y_LOW 0x34
#define REG_DATA_Y_HIGH 0x35
#define REG_DATA_Z_LOW 0x36
#define REG_DATA_Z_HIGH 0x37
int main (int argc, char **argv)
{
// Setup I2C communication
int fd = wiringPiI2CSetup(DEVICE_ID);
if (fd == -1) {
printf("Failed to init I2C communication.\n");
return -1;
}
printf("I2C communication successfully setup.\n");
// Switch device to measurement mode
wiringPiI2CWriteReg8(fd, REG_POWER_CTL, 0b00001000);
while (1) {
int dataX = wiringPiI2CReadReg16(fd, REG_DATA_X_LOW);
dataX = -(~(int16_t)dataX + 1);
int dataY = wiringPiI2CReadReg16(fd, REG_DATA_Y_LOW);
dataY = -(~(int16_t)dataY + 1);
int dataZ = wiringPiI2CReadReg16(fd, REG_DATA_Z_LOW);
dataZ = -(~(int16_t)dataZ + 1);
printf( "X= %d , Y= %d , Z= %d\n",dataX ,dataY,dataZ);
}
return 0;
}
Compile ADXL345.c
file:
gcc -Wall -o ADXL345 ADXL345.c -lwiringPi -lwiringPiDev -lpthread -lrt -lm -lcrypt
Finally, run:
sudo ./ADXL345
If everything is correct, the output will look like the image below:
You can use the three physical buttons on your device to interact directly with the OOWOW system.
- RESET - reset device
- FUNCTION - multi functions
- POWER - multi functions
- Boot OOWOW - hold FUNCTION and short press RESET then release FUNCTION
- Toggle Easy Wi-Fi - short press POWER button
- Toggle Hotspot - short press FUNCTION button
- Accept Hotspot client - short press POWER button
- Power off - Long press the POWER button until device shuts down
- Enter multifunction mode - press and hold FUNCTION button (loop cycle: Hotspot -> Firewall Allow -> Firewall Block -> Cancel, each mode wait 2 sec), release to activate selected function
In the end, if you are looking for power, efficiency and features, this board is for you. If you are a gamer and you like to experience Android games, I definitely suggest you. Those who are also fond of watching movies, Khadas VIM4 is the best choice for them.
If you are looking for a suitable and small replacement for your desktop computer, you can have the experience of using Ubuntu as an alternative. When you hold the khadas in your hand, you will feel a quality and luxurious material.
Q&AHow to add IR remote support on VIM4?
βΊ https://forum.khadas.com/t/how-to-add-ir-remote-support-on-vim4/
How to use HDMI input on Ubuntu?
βΊ https://forum.khadas.com/t/experience-hdmi-in-under-ubuntu-22-04/
How to use 4G LTE Module?
βΊ https://docs.khadas.com/linux/vim4/lte_module.html
What is the OS boot priority order?
βΊ https://docs.khadas.com/linux/vim4/boot_sequeue.html
How to install OS into SD/USB Media?
βΊ https://docs.khadas.com/linux/vim4/install_os_into_sdusb.html
How to connect touch screen to VIM4?
Comments