-
Notifications
You must be signed in to change notification settings - Fork 130
01 Hardware
The OMOTE is an ESP32-based open source universal remote. Its capacitive 2.8” touchscreen provides an intuitive and snappy user interface for switching devices and settings. In addition to the touchscreen, there are 24 tactile switches. No hub or docking station is required as the remote itself features infrared, Wi-Fi and Bluetooth connectivity. And with its well-optimized power consumption, the OMOTE can run for months on a charge.
As a DIY project, all hardware parts of the OMOTE are designed to be easy to source and replicate. The main component is a 2-layer circuit board. Together with a screen and battery, this PCB is mounted inside a 3D-printed enclosure. If you want to build your own OMOTE, you will need the following components:
- OMOTE PCB
- 2.8" LCD
- Battery
- 3D-printed enclosure
- M3x5 Screws
All the electronic parts of the remote are located on a single 2-layer circuit board. A grid of 24 tactile buttons sits on the top side of the PCB next to its LCD screen. Together, these components make up the user interface for the remote. On the bottom side, an IR LED, IR receiver and a 2,4GHz chip antenna are located at the front of the device. This enables the remote to control devices via infrared, Wi-Fi and Bluetooth. An accelerometer senses when the remote is picked up, so it only uses power during active use. The brain of the remote is an ESP32-PICO-D4 microcontroller, which can be programmed using a USB-C port. The same port is also used for charging the 3.7V LiPo battery.
The ESP32 is the brain of the OMOTE. It renders the UI, processes user inputs and controls peripherals. To save space and reduce the number of components, this project uses the ESP32-PICO-D4. This is a SOC that includes the ESP32, 40MHz crystal and flash. It is basically a shrunken-down version of the ESP32-WROOM module. The basic specs are:
- Xtensa® dual-core 32-bit LX6 microprocessor
- Up to 240 MHz clock rate
- 4 MB Flash
- 512 kB SRAM
- Wi-Fi 802.11b/g/n
- Bluetooth 4.2
The ESP32 is powered by 3.3V directly as it has very efficient low-power modes. In deep sleep with nothing but the RTC running, the ESP32 draws as little as 10uA and can be woken up by different external sources. In the case of the OMOTE, each button matrix row, as well as the accelerometer interrupt can wake up the ESP32. This feature is configured in software using a bitmask for the ext1 wakeup. But there is one hardware restriction: Only RTC GPIOs can be used to wake up the ESP32.
The ESP32-PICO needs an external antenna for Wi-Fi and Bluetooth to work. On the OMOTE, a small chip antenna is connected to the PICO. Compared to copper trace antennas, chip antennas tend to be more robust against influences like the 3D printed case and the adjacent metallic display frame. The trace line between the ESP32 and the antenna should normally be impedance controlled which is tricky on a 2-layer PCB. This is why the ESP32 is placed very close to the antenna, to keep the trace length short. As a general rule of thumb, 1/10 of the wavelength (12mm for 2.4GHz) is usually the maximum distance where impedance matching is not absolutely necessary. To further improve the antenna performance, the PCB has a continuous ground layer below the trace line and ESP32 with vias placed along the edges. To adjust the impedance matching between the antenna and ESP there are mounting positions for a pi matching network (R36, C18 and C19).
The ESP32 can be programmed and debugged using the USB-C port. There is no need to take the PCB out of the enclosure for programming since the strapping pin IO0 and the reset pin are both wired to the CH340 USB/UART bridge.
Pin | Function | Description |
---|---|---|
IO0 | GPIO0 | Reserved for Boot Mode Strapping |
IO1 | USB_TXD | UART0 TX for Programming and Debugging |
IO2 | USER_LED | User LED Output |
IO3 | USB_RXD | UART0 RX for Programming and Debugging |
IO4 | LCD_BL | LCD Backlight Enable (Active Low) |
IO5 | LCD_CS | LCD CS |
IO9 | LCD_DC | LCD DC |
IO10 | LCD_EN | LCD Enable (Active Low) |
IO12 | SW_5 | Button Matrix Row Output 5 |
IO13 | ACC_INT | Accelerometer Interrupt Input |
IO14 | SW_4 | Button Matrix Row Output 4 |
IO15 | IR_RX | Infrared Receiver Input |
IO18 | LCD_SCK | LCD SCK |
IO19 | SDA | I2C SDA |
IO21 | CRG_STAT | Battery Charger Status Input |
IO22 | SCL | I2C SCL |
IO23 | LCD_MOSI | LCD MOSI |
IO25 | IR_VCC | Infrared Receiver Enable (Active High) |
IO26 | SW_2 | Button Matrix Row Output 2 |
IO27 | SW_3 | Button Matrix Row Output 3 |
IO32 | SW_1 | Button Matrix Row Output 1 |
IO33 | IR_LED | Infrared LED Output (Active Low) |
IO34 | SW_D | Button Matrix Column Input D |
IO35 | SW_E | Button Matrix Column Input E |
SENSOR_VP | ADC_BAT | Battery Voltage ADC Input (Revision 3 Only) |
SENSOR_CAPP | SW_A | Button Matrix Column Input A |
SENSOR_CAPN | SW_B | Button Matrix Column Input B |
SENSOR_VN | SW_C | Button Matrix Column Input C |
The OMOTE uses a USB 2.0 Type C Port. The CC1 and CC2 signals are terminated with 5.1kOhm resistors, signaling that the device is to be supplied by 5V and not using USB PD (power distribution). That way, none of the extra features of USB-C are used and the remote is compatible with any standard USB power supply and computer. The data lines and bus voltage feature ESD protection (using the USBLC6-2). A 500mA resettable fuse protects the PC in case there is a short on the OMOTE PCB. Since the ESP32 has no USB peripheral, a CH340C is implemented as a USB/UART bridge with an AP2112 as its 3.3V supply. The regulator and CH340C are inactive while the device is battery-powered, so their current consumption is not an issue.
The ESP32 can be quite power-hungry, especially when communicating wirelessly. That is why Espressif themselves recommend a regulator with at least 500mA. Since the display with a backlight also draws lots of current, the Torex XC6220 with up to 1A was selected for the OMOTE board. Another important feature of this LDO is its ultra-low quiescent current of 8uA. The combination of high output current and low quiescent current makes this LDO special and relatively expensive. For this reason, it is not also used to supply the CH340C.
A MOSFET and Diode make up a simple power path for automatic switching between battery and USB power. If VBUS is present, the MOSFET Q1 is turned off and the battery will not be drained. On battery power, the Diode D1 stops current from supplying the MOSFET base and USB components. That is why a diode with a low leakage current (MBR0520) was selected for D1.
A fuel gauge IC (MAx17048G) is used to monitor the battery state of charge. It measures the battery's voltage and uses battery-modeling algorithms to calculate how much juice is left in the battery. The IC ignores transient voltage changes (for example due to the ESP32 powering up and down), which would otherwise make the battery percentage jump up and down. The SOC percentage is returned to the ESP32 via its i2c interface.
This feature is only available since board revision 4! Earlier PCBs use one of the ESP32's ADCs for measuring battery voltage which is less accurate.
The DW01A protects the battery against undervoltage, overvoltage and overcurrent. The IC monitors the battery voltage and disconnects the negative battery terminal from the circuit using back-to-back MOSFETs. Not that the DW01A can lock up when unplugging and reinserting the battery. Only after USB is connected, the device will turn on again.
The TP4056 is used as a lithium-ion battery charging IC. Using the resistor R8 it is set to a charging current of ca. 280mA. There are two status outputs for signaling the charging state: CHRG and STDBY. STDBY is connected to an LED. CHRG is connected to the ESP32 to enable USB detection.
Board revisions 3 and earlier use a different charging IC and feature no protection. It is recommended to use batteries with integrated protection (BMS) in any case. LiPo batteries are dangerous, even when they are small!
Because the ESP32 has very few GPIO pins, not every button can simply have its own GPIO pin. Instead, the 24 buttons are laid out in a grid of 5 rows and 5 columns for a total of 10 GPIO pins needed. The row pins (1-5) are outputs and the column pins are inputs. By turning on one row after the other, the ESP32 can recognize when a column pin is high and thus locate every individual key press. During active use, the buttons are scanned continuously. During deep sleep, all rows are turned on and all the column pins are configured as wakeup sources. When any key is pressed, one of the column pins goes high and the remote wakes up. With the ext1 wakeup only a transition from low to high can wake up the ESP32. That is why the entire button grid is configured to be active high with hardware pull-down resistors.
The infrared LED is powered by 3.3V and controlled by the ESP32 via MOSFET. IR LEDs are designed to be very bright for a short time. That is why the current is only limited by a 3.3Ohm resistor. Some Commercial remotes even use their LEDs without any current limiting resistor. Then the battery is the only limiting factor. As long as the IR library is correctly used with OMOTE, the LED will not get damaged. But the LED should not be turned on outside the library or it could get destroyed. Because infrared light is not visible to the human eye, a second LED (D5) is placed nearby on the PCB for visual feedback.
An infrared receiver enables the OMOTE to scan the signals from other remotes. The TSSP77038 is an IC that integrates a photodiode and a demodulator for 38kHz signals. This makes it easy to read IR signals with the ESP32 using a single GPIO. Because the receiver has no low-power mode it is directly powered by a second GPIO of the ESP32.
The LIS3DH is a simple accelerometer that measures the orientation of the OMOTE. It is mainly used to detect if the device is moving or stationary. The accelerometer has two interrupt outputs of which one is connected to the ESP32. Via i2c the interrupt settings can be configured, so the LIS3DH wakes the ESP32 when it detects motion. The IC is connected to 3.3V and always on, but it only consumes a few uA of current.
The display is one component, but it actually consists of three parts: a liquid crystal screen, a touchscreen and an LED backlight. The backlight can be turned on and off by the ESP32 using a MOSFET. Using PWM, the ESP32 can adjust the brightness of the display. Four 10 Ohm resistors limit the current to the backlight LEDs. The touchscreen controller communicates with the ESP32 via i2c. Since the interrupt output is not connected, it needs to be polled continuously. The LCD itself is connected to the ESP32 via SPI.
Both the display and the touchscreen need to be turned off during standby because they draw too much power. This is done by switching their power supply off with a MOSFET controlled by the ESP32. This also turns off the 3.3V supply to the i2c pull-up resistors as they leak some current to the touchscreen controller. The side effect of this is, that all other i2c devices on the board cannot be used while the display is powered off.
The OMOTE is powered by a 3.7V lithium-ion battery. From board revision 4, integrated protection against under- and overvoltage, as well as overcurrent is built in. Nevertheless, it is recommended to use batteries with integrated protection (BMS). From the battery voltage, a low drop regulator creates 3.3V, which is used to supply the accelerometer and ESP32. The IR receiver, display and backlight can be switched on and off by the ESP32 using MOSFETs (or in the case of the IR receiver by directly powering the IC from a GPIO). If a USB cable is inserted and 5V is present, the board will automatically be powered from USB and the battery will be charged. A 500mA resettable PTC fuse protects the USB input against overcurrent.
The ESP32 and the illuminated screen consume up to 240 mA, which means that even a 2000 mAh battery will only last a few hours. To still achieve a long battery life, the OMOTE has to cleverly save power in standby mode. This is achieved through various measures:
- The device is automatically switched off as soon as it is no longer moved.
- A 3.3V LDO with very low quiescent current is used
- Unnecessary consumers can be switched off completely during standby. The display and backlight can be switched off via MOSFETs, while the IR receiver is supplied directly by a GPIO of the ESP32.
With the final software, the board draws around 32uA in sleep mode and 150mA in active mode with the display and ESP32 turned on. Using Wi-Fi adds another 80mA to the active mode consumption. Assuming the remote wakes up once every hour for 10 seconds, the 2000 mAh battery will last around 100 days.
to be done
to be done