Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Divoom Proxy for ESP32

License

NotificationsYou must be signed in to change notification settings

d03n3rfr1tz3/esp32-divoom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Compile ProjectGitHub Release

Divoom Proxy for ESP32

Allows you to send commands to your Divoom device through various protocols. It works as a companion for myHome Assistant integration,but you can also use it as standalone communicator for your Divoom devices. Currently the following input protocols are implemented. You can find more information in the documentation below.

  • Serial
  • TCP
  • MQTT

Table of Contents

Requirements

This firmware obviously needs an ESP32. Other then that, not much is needed, as the ESP32 already brings WiFi and Bluetooth with it.

Installation

Easy Installation

In the future I might useESP Web Tools for an easier installation process. For now, you have to go for the manual installation.

Manual Installation

This firmware is a PlatformIO project. Until I can find and prepare a more easy way for you to get started, you have to just download the source code and build and upload it to an ESP32 via VS Code yourself.

  • Download the repository. If you know git, a clone is fine. If not, just downloadhttps://github.com/d03n3rfr1tz3/esp32-divoom/archive/main.zip to get the most recent code in a ZIP file.
  • Copy the corresponding content of the ZIP file into a directory of your choice
  • Open the directory with PlatformIO via VS Code
  • Connect your ESP32 with a working USB Data Cable
  • PressUpload in the PlatformIO Project Tasks
  • ...
  • Profit

Configuration

Easy Configuration

Well again, currently there is no easy way, but that might change in the future.

Manual Configuration

Currently you need to configure the firmware directly in your ownconfig_local.h before flashing. This might change in the future.

The default configurationconfig.h has a lot of empty values you very likely want to fill. To not run into problems with later updates,I recommend you to create aconfig_local.h with your own values. Here is an example:

#ifndef _CONFIG_LOCAL_H    #define _CONFIG_LOCAL_H        #undef WIFISSID1    #undef WIFIPASS1    #define WIFISSID1        "My WiFi 1"    #define WIFIPASS1        "MySuperSecretPassword1"    #undef WIFISSID2    #undef WIFIPASS2    #define WIFISSID2        "My WiFi 2"    #define WIFIPASS2        "MySuperSecretPassword2"    #undef MQTT_HOST    #undef MQTT_USER    #undef MQTT_PASS    #define MQTT_HOST        "192.168.0.2"    #define MQTT_USER        "mqtt"    #define MQTT_PASS        "MySecretPassword"#endif

Notice the undefining of each value before defining it with my own value. That way you don't get ugly warnings from the compiler later. 😉

Usage

Serial

You can control your Divoom devices via Serial. Obviously this is more for debugging purposes, but might also be helpful for a quick test. If you pressMonitor in the PlatformIO Project Tasks, you cansend some commands directly to your ESP32. Just prepare them in Notepad and then copy them into the Terminal (you will not see what you typed/copied) and press Enter. Depending on the actual command,the ESP32 will then send commands to your Divoom device and also give you some information or received packets back. Here are some examples:

This command connects to your Divoom device with the MAC address01:12:23:45:56:67 and on port1.

CONNECT 01:12:23:45:56:67 1

This command sends raw bytes to your connected Divoom device. The raw bytes represent thebrightness command. The first one sets the brightness to 50% and the second one to 100%.

SEND 01 04 00 74 32 AA 00 02SEND 01 04 00 74 64 DC 00 02

This command disconnect from your Divoom device.

DISCONNECT 01:12:23:45:56:67

This command sets the brightness to 100% of your connected Divoom device. As you can see, this is a more human readable format. You can find a full list of MODE commands here:MODE commands

MODE brightness 100

TCP

You can also control your Divoom devices via TCP. Obviously that is not really meant for user interaction, but for actual communication one a lower level. The most used case for TCP is my ownHome Assistant integration, which uses this ESP32 firmware as a Bluetooth Proxy. But maybe you want to develop your own application based on this,so here are some examples:

This connects to your Divoom device with the MAC address01:12:23:45:56:67 and on port1. The packet starts with a single byte0x69 hinting this is a connect packet, followedby the MAC address also in raw bytes as well as the optional port number.

690112233445566701

This sends raw bytes to your connected Divoom device. The raw bytes represent thebrightness command. Typical for the Divoom protocol, the packet starts with0x01 and ends with0x02.The first packet sets the brightness to 50% and the second one to 100%.

0104007432AA00020104007464DC0002

This disconnect from your Divoom device. The packet starts with a single byte0x96 hinting this is a disconnect packet, followed by the MAC address also in raw bytes.

960112233445566701

MQTT

You can also control your Divoom devices via MQTT as well as getting a few states. This is variant you probably will use, when you are going for the standalone mode. The actual commands are similar to the Serial input. Additionally the general state will be published toMQTT_TOPIC/proxy, the bluetooth connection state toMQTT_TOPIC/bluetooth and advertise bluetooth devices toMQTT_TOPIC/advertise/[MAC] while[MAC] stands for the actual MAC address like01:12:23:45:56:67.

Commands should be sent to the topicMQTT_TOPIC/command. For theMQTT_TOPIC part, you have to look into yourconfig_local.h. Default isdivoom/, which makes the command topicdivoom/command.

This command connects to your Divoom device with the MAC address01:12:23:45:56:67 and on port1.

CONNECT 01:12:23:45:56:67 1

This command sends raw bytes to your connected Divoom device. The raw bytes represent thebrightness command. The first one sets the brightness to 50% and the second one to 100%.

SEND 01 04 00 74 32 AA 00 02SEND 01 04 00 74 64 DC 00 02

This command disconnect from your Divoom device.

DISCONNECT 01:12:23:45:56:67

This command sets the brightness to 100% of your connected Divoom device. As you can see, this is a more human readable format. You can find a full list of MODE commands here:MODE commands

MODE brightness 100

MODE Commands

Here you can find a full list of MODE commands that are supported as well as some descriptions and examples. If you are coming from myHome Assistant integration, you probably will notice a few similarities.

MODE alarm

Sets an alarm. You might have to experiment with the options your Divoom device supports and what it actually changes. Unsupported values will be ignored or if possible directly zeroed by this component, to prevent strange behavior.

MODE alarm [number] [time] [weekdays] [alarmmode] [triggermode] [frequency] [volume]

ParameterDescription
numberThe concrete slot for the alarm. For the actual amount of slots you might have to look into the phone app.
timeThe concrete time for when the alarm should happen in the formatmm:ss.
weekdaysThe list of0 and1 for each weekday starting with sunday. Example:1000001 for weekend only alarm.
alarmmodeThe alarm mode. Look into your phone app for what is supported by your Divoom device.
triggermodeThe trigger mode. Look into your phone app for what is supported by your Divoom device.
frequencyThe radio frequency to set.
volumeThe volume of the alarm.
MODE alarm 1 07:30 0111110 0 0 85.1 100

MODE brightness

Sets the brightness.

MODE brightness [value]

ParameterDescription
valueThe brightness value between 0 and 100.
MODE brightness 100

MODE clock

Shows the clock channel.

MODE clock [clock] [twentyfour] [weather] [temp] [calendar] [color] [hot]

ParameterDescription
clockThe style of the clock. Accepts a number between 0 and 9.
0 = Fullscreen,1 = Rainbow,2 = Boxed,3 = Analog square,
4 = Fullscreen negative,5 = Analog round,6 = Widescreen
twentyfourChanges between 12h or 24h format.
0 = 12h,1 = 24h. Defaults to 24h. Doesn't actually change the current time.
weatherActives or deactivates showing the weather with0 or1.
tempActives or deactivates showing the temperature with0 or1.
calendarActives or deactivates showing the calendar date with0 or1.
colorThe color of the clock in the typical RGB HEX format. Example:FF0000 for red.
hotActives or deactivates showing the slideshow of the best images with0 or1, which is right next to the other boolean-like buttons in the app, but a completely separate command in the protocol
MODE clock 1 1 1 1 1 FF0000 1

MODE countdown

Shows the countdown tool.

MODE countdown [value] [countdown]

ParameterDescription
valueControls the start/stop state.
0 = stop,1 = start
countdownThe concrete countdown in the formatmm:ss.
MODE countdown 1 02:30

MODE datetime

Sets the datetime.

MODE datetime [date] [time]

ParameterDescription
dateThe date in typical ISO format.
timeThe time in typical ISO format.
MODE datetime 2020-12-24 20:15:00

MODE design

Shows the design channel.

MODE design [value]

ParameterDescription
valueThe number of the concrete design. Ranging from 0-2 you can specify the design 1-3.
MODE design 0

MODE effects

Shows the effects channel.

MODE effects [value]

ParameterDescription
valueThe number of the concrete effect. Might differ for some Divoom devices. Look into your phone app and count them.
MODE effects 1

MODE game

Shows a game. It is theoretically possible to open games, that are not shown in your phone app, but they might not work very well.

MODE game [value]

ParameterDescription
valueThe number of the concrete game. Depending on your device you may have different amount of games. Look into your phone app and count them.
MODE game 1

MODE gamecontrol

Sends controlling commands to the currently open game.

MODE gamecontrol [value]

ParameterDescription
value0 orgo = go,
1 orleft = left,
2 orright = right,
3 orup = up,
4 orbottom = bottom,
5 orok = ok
MODE gamecontrol 0

MODE keyboard

Controls the keyboard LEDs specifically on the Ditoo.

MODE keyboard [value]

ParameterDescription
value0 = toggle keyboard light on/off,1 = switch to next effect,-1 = switch to previous effect
MODE keyboard 0

MODE light

Shows the light channel.

MODE light [brightness] [color] [power]

ParameterDescription
brightnessThe brightness value between 0 and 100.
colorThe color of the clock in the typical RGB HEX format. Example:FF0000 for red.
powerActivates or deactivates powering the LED panel.
MODE light 100 FF0000 1

MODE lyrics

Shows the lyrics channel. Might not be supported by every Divoom device.

MODE lyrics

ParameterDescription
MODE lyrics

MODE memorial

Sets a memorial (reminder).

MODE memorial [number] [date] [time] [text]

ParameterDescription
numberThe concrete slot for the memorial. For the actual amount of slots you might have to look into the phone app.
dateThe date in typical ISO format. The year will be ignored.
timeThe time in typical ISO format. The seconds will be ignored.
textSpecifies the name of your memorial, as it will appear in the phone app (default: ESP32). Limited to 16 characters.
MODE memorial 1 2020-12-31 59:59:59 Happy New Year!

MODE noise

Shows the noise meter.

MODE noise [value]

ParameterDescription
valueControls the start/stop state.
0 = stop,1 = start
MODE noise 1

MODE playstate

Sets the playstate for the currently played music. Only supported by Divoom devices with audio features.

MODE playstate [value]

ParameterDescription
value0 = pause,1 = play
MODE playstate 0

MODE radio

Shows and plays the radio channel. Only supported by Divoom devices with the radio feature.

MODE radio [value] [frequency]

ParameterDescription
valueControls the on/off state.
0 = off,1 = on
frequencyThe radio frequency to set.
MODE radio 1 85.1

MODE scoreboard

Shows the scoreboard channel or tool.

MODE scoreboard [version] [player1] [player2]

ParameterDescription
versionThe version to use. Depending on the age of your Divoom device, you might have to use0 or1. If you used0 and it opens the lyrics channel, you need to use1.
0 = Opens the scoreboard channel.1 = Opens the scoreboard tool.
player1The score of player one to show.
player2The score of player two to show.
MODE scoreboard 0 1 2

MODE sleep

Shows the sleep mode, which plays soothing sounds, optionally with a timer and light.

ParameterDescription
valueControls the start/stop state.
0 = stop,1 = start
timeThe time in minutes after which to stop the sleep mode.
sleepmodeThe sound effect to play. Check in the app how many options are available. Accepts a number.
frequencyThe radio frequency to set.
volumeThe volume value between 0 and 100.
colorThe color of the display in the typical RGB HEX format. Example:FF0000 for red.
brightnessThe brightness value between 0 and 100.
MODE sleep 1 30 4 85.1 100 FF0000 100

MODE timer

Shows the timer tool.

MODE timer [value]

ParameterDescription
valueControls the start/stop state.
0 = stop,1 = start
MODE timer 1

MODE visualization

Shows the visualization channel.

MODE visualization [value]

ParameterDescription
valueThe number of the concrete visualization. Might differ for some Divoom devices. Look into your phone app and count them.
MODE visualization 1

MODE volume

Sets the volume. Only supported by Divoom devices with audio features.

MODE volume [value]

ParameterDescription
valueThe volume value between 0 and 100.
MODE volume 100

MODE weather

Sets the weather.

MODE weather [temperature] [weather]

ParameterDescription
temperatureThe temperature in degree including the temperature type for celsius or fahrenheit.
weather1 = clear,3 = cloudy sky,5 = thunderstorm,6 = rain,8 = snow,9 = fog
MODE weather 25°C 1

Troubleshooting

Cannot connect

Make sure, that your Phone is not currently connected to your Divoom device, because some don't allow that many connections.

If it seems to connect, but looses connection the moment you use any mode, you might have chosen the wrong port. On Pixoo and other non-audiodevices, it's typically port1. But on audio devices, like the Tivoo or Ditoo, it might be port2.

GIF does not work

The most common problem is, that the GIF does not have the correct size or format. The Divoom devices (and to some extend my code) are nitpicky in that case. Strangly enough the Divoom app lets you download GIFs, but these are typically in the size of 320x320 and not fitting your device.Your GIF needs to be exactly the size of your Divoom screen (16x16 in case of a Pixoo or similar sized device),non-interlaced and with aglobal color palette.

I can recommend resizing and converting your GIFs with GIMP. Of course other software might also work, depending on the export/format options. When resizing a GIF downloaded from the Divoom app with GIMP, you better choose no interpolation to not blur your GIF. When exporting with GIMP, make sure to mark the animation checkbox and don't mark the interlace checkbox. For a few more details and an example look into the following comment:d03n3rfr1tz3/hass-divoom#19 (comment)


[8]ページ先頭

©2009-2025 Movatter.jp