Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
hardware:diy_zedmd [2024/04/24 20:02] nadenislamarrehardware:diy_zedmd [2026/01/30 08:13] (current) nadenislamarre
Line 1: Line 1:
-In this article, we will create a custom DMD.+In this article, we will help you create a custom DMD to use with Batocera. We are using ZeDMD as a basis as it's a cost-effective yet powerful solution, and now fully supported on Batocera 40+.
  
-===== The result =====+===== First, the final result =====
 {{:hardware:dmd-diy.jpg?400|}} {{:hardware:dmd-diy.jpg?400|}}
 {{:hardware:dmd-diy-front.jpg?400|}} {{:hardware:dmd-diy-front.jpg?400|}}
  
-===== Step 1 : buy the hardware ===== +{{:hardware:zedmd_result.jpg?400|}} 
-The list : +{{:hardware:zedmd_result_back.jpg?400|}} 
-  * 2 dmd pannels (don't forget to choose of them) [[https://www.aliexpress.us/item/32514844235.html?spm=a2g0o.order_detail.order_detail_item.5.6c97f19cgde0fr&gatewayAdapt=4itemAdapt|DMD Panels]] + 
-  * 1 esp32 and its shield [[https://www.aliexpress.us/item/1005005626482837.html?spm=a2g0o.order_detail.order_detail_item.3.22daf19cMnLRiS&gatewayAdapt=4itemAdapt|ESP32+shield]] +===== Step 1 : purchase the hardware ===== 
-  * 16 male/male 10cm jumpers [[https://www.aliexpress.us/item/4000578173872.html?spm=a2g0o.order_detail.order_detail_item.4.4c49f19cVvTj2x&gatewayAdapt=4itemAdapt|Jumpers]] +The shopping list: 
-  * 1 power supply [[https://www.aliexpress.us/item/1005005896562268.html?spm=a2g0o.order_detail.order_detail_item.3.6d80f19cpzxZFO&gatewayAdapt=4itemAdapt|Power supply]] +  * 2 DMD panels (don't forget to choose two of them) [[https://www.aliexpress.us/item/32514844235.html|DMD Panels]] 
-  * 1 plug [[https://www.aliexpress.us/item/1005005029176614.html?spm=a2g0o.order_detail.order_detail_item.3.4d04f19c5A190Y&gatewayAdapt=4itemAdapt|Plug]]+  * 1 ESP32 and its shield [[https://www.aliexpress.us/item/1005005626482837.html|ESP32+shield]] 
 +  * 16 male/male 10cm jumpers [[https://www.aliexpress.us/item/4000578173872.html|Jumpers]] 
 +  * 1 power supply [[https://www.aliexpress.us/item/1005006189932540.html|Adjustable power supply]] or [[https://www.aliexpress.us/item/1005005896562268.html|Switch-mode power supply]] - **Note**: the power supply is optional if you build a 32x128 DMD (but is required for resolutions 256x64 and above). 
 +  * 1 plug [[https://www.aliexpress.us/item/1005005029176614.html|Plug]] (only if you put a power supply)
  
 You probably already have a plug at home. You probably already have a plug at home.
-Total price including shipping : 39€ (on 2024 april 8).+ 
 +Total cost including shipping: 39€ (on 2024 April 8).
  
 {{:hardware:dmd-diy-order.png?400|}} {{:hardware:dmd-diy-order.png?400|}}
  
  
-===== Step 2 : plug the hardware =====+===== Step 2 : Put the hardware together =====
 === Step 2.0 - external links === === Step 2.0 - external links ===
   * [[https://github.com/PPUC/ZeDMD|ZEDMD project]]   * [[https://github.com/PPUC/ZeDMD|ZEDMD project]]
Line 26: Line 30:
   * [[https://www.youtube.com/watch?v=hgdIUG90M0c|Video tutorial (fr)]]   * [[https://www.youtube.com/watch?v=hgdIUG90M0c|Video tutorial (fr)]]
  
-The original tutorials are not related to batocera.linux, but may be very usefull to get some informations+The original tutorials are not related to batocera.linux, but may be very useful to get some reference information. 
-The hardware part is the same for batoceraJust configuration actions/software at the end changes.+ 
 +The hardware part is the same for BatoceraHowever, the course of action for software configuration at the end is a little bit different. 
 + 
 +=== Step 2.1 - Getting a power supply (for HD matrix) === 
 + 
 +Based on the display being used, some pixels may be too bright (causing glare and artifacts) or too dark (not visible), so it is useful to have a power supply with adjustable voltage. A power supply with universal terminals and an adjustable voltage is preferred, with the ability to use voltages near 5 volts at 2 amps. The more finely you can tune the voltage the better for adjustment. 
 + 
 +{{:hardware:615ewd8d68l._ac_sl1000_.jpg?direct&400|}} 
 +{{:hardware:61w9b_u4ryl._ac_sl1200_.jpg?direct&400|}} 
 + 
 +It's also possible to get a static power supply voltage and then reduce its voltage by use of diodes (be careful of heat if only using a small amount of diodes): https://www.youtube.com/watch?v=x-p5LYgdEu4 
 + 
 +== Cut your own power wire === 
 + 
 +As an alternative to using a wall-wart power supply as pictured above, it is possible to splice a regular high-voltage power cable and connect that to a switch-mode power supply. 
 + 
 +<WRAP center round alert> 
 +Incorrect wiring with power lines up to 240V can result in death by electrocution, exercise caution if choosing to go this route. If you have any concerns, use a universal power supply as specified above. 
 +</WRAP>
  
-=== Step 2.1 - Cut and prepare the power wire === 
 {{:hardware:dmd_power_wire_1.jpg?300|}} {{:hardware:dmd_power_wire_1.jpg?300|}}
 {{:hardware:dmd_power_wire_2.jpg?300|}} {{:hardware:dmd_power_wire_2.jpg?300|}}
 +{{:hardware:screen47.jpg?direct&400|}}
 +{{:hardware:dmd_power_3.jpg?400|}}
  
-=== Step 2.2 - Plug matrices together with data and power wire === +=== Step 2.2 - Plug LED matrices together with data and power wires === 
-The data and power wire for the matrices are delivered with the matrices.+ 
 +The data and power wires for the matrices are usually bundled with the matrices.
 Just plug them. Note that white arrows must go from left to right. Just plug them. Note that white arrows must go from left to right.
  
 {{:hardware:dmd_matrices_1.jpg?300|}} {{:hardware:dmd_matrices_1.jpg?300|}}
 {{:hardware:dmd_matrices_2.jpg?300|}} {{:hardware:dmd_matrices_2.jpg?300|}}
- 
 {{:hardware:dmd_matrices_3.jpg?600|}} {{:hardware:dmd_matrices_3.jpg?600|}}
  
-=== Step 2.2 - Plug the power === +=== Step 2.2 - Plug the AC/DC power converter === 
-Plug the 220V power on the AC. Take care of colors. Phase (brown) Neutral (blue) / Mass (yellow/green).+Plug the 220V power on the AC (if you live in a 110V country, make sure you have the right AC/DC converter, and obviously the right plug)**Be careful** with the polarity of the wires, not all regions will use the same color-coding to indicate their polarityGenerally, the color code of AC wires are Phase (brown)Neutral (blue) and Ground (yellow/green).
  
-Plug the 5V. Take care of colors.+Plug the 5V connector, and make sure you connect the correct polarity.
  
-The orange screw on right can be used to adjust the 5V voltage. It is usefully in case the image is not perfect. +The orange screw on right of the AC/DC converter can be used to adjust the 5V voltage. It is necessary in case the image is not perfect, and the LEDs are "bleeding" a little bitSee the pictures below, in general, adjusting the screw to power down a bit the the voltage makes the image better.
-Too much voltage make the image not perfect.+
  
 {{:hardware:dmd_power_1.jpg?400|}} {{:hardware:dmd_power_1.jpg?400|}}
- 
 {{:hardware:dmd_power_2.jpg?300|}} {{:hardware:dmd_power_2.jpg?300|}}
-{{:hardware:dmd_power_3.jpg?300|}}+{{:hardware:dmd_power_3.jpg?400|}} 
 + 
 +**Note**: If you build a 32x128 DMD (**not** a "DMD HD" with a higher resolution), you can skip the power supply, and use the ESP32 microcontroller to power the LED matrices. It will draw current from the USB connection to the PC, and if the PC provides USB 2.0 or higher, i.e. most PC built in the past 20 years, it should be sufficient to power both the microcontroller and the LED panels connected to it. 
 + 
 +To do so, you need to connect the red power wire from the LCD panel to the VIN pin on the ESP32 (5V) and the black wire to the GND pin (ground).
  
 === Step 2.3 - Microcontroller === === Step 2.3 - Microcontroller ===
 {{:hardware:diy_esp32.jpg?400|}} {{:hardware:diy_esp32.jpg?400|}}
  
-Plug the esp32 in its socket.+Insert the ESP32 in its shield. This will be an easier way to plug the jumpers, as this will be a required part of the setup at a later stage.
  
-Before plugin the esp32 on the computer (ideally under batocera.linux), run the following command :+Before plugging in the ESP32 board into the computer (ideally a computer running under batocera.linux), run the following command:
 <code> <code>
 ls /dev/ttyUSB* ls /dev/ttyUSB*
 </code> </code>
  
-The result can be an error (no such file or directory) or a list of files (/dev/ttyUSB0 or /dev/ttyUSB0 /dev/ttyUSB1 or ...)+The result can be an error (''no such file or directory'') or a list of files (''/dev/ttyUSB0'' or ''/dev/ttyUSB0 /dev/ttyUSB1'' or ...)
  
-Plug it on computer (ideally under batocera.linux) with a usb-c cable.+Now, plug the ESP32 USB-C connecter to a USB port on that computer.
  
-Rerun the command and identify the name the esp32 took.+Run the ''ls'' command again the command, so that you can identify the device name the ESP32 microcontroller takes:
  
 <code> <code>
Line 75: Line 100:
 </code> </code>
  
-in general, you'll get the error "no such filebefore pluginand "/dev/ttyUSB0once plugged. +As a general rule, you would have gotten a ''no such file or directory'' error message before plugging in the ESP32but now you should see a device name like ''/dev/ttyUSB0'' once plugged in. This means that the ESP32 can now be identified as a Unix pseudo-file ''/dev/ttyUSB0''.
-This mean that the esp32 can now be identified as file /dev/ttyUSB0.+
  
-In case you had /dev/ttyUSB0 before plugin, you'll get /dev/ttyUSB0 /dev/ttyUSB1 after. This mean that esp32 can now be identified as file /dev/ttyUSB1.+In case you had a ''/dev/ttyUSB0'' device before pluggin in, you would now get ''/dev/ttyUSB0 /dev/ttyUSB1'' once the ESP32 is connected. This means that the ESP2 can now be identified as a Unix pseudo-file ''/dev/ttyUSB1''.
  
-Execute the following command by adapting ttyUSB0 to ttyUSB1 if necessary.+Execute the following command, and don't forget to replace ''ttyUSB0'' by ''ttyUSB1'' if necessary, based on the previous explanation.
  
 +**For Batocera 42 and later** (ZeDMD version 5.x.x required)
 +<code>
 +wget https://github.com/PPUC/ZeDMD/releases/download/v5.1.7/ZeDMD-128x32.zip
 +unzip ZeDMD-128x32.zip
 +wget https://github.com/espressif/esptool/releases/download/v4.8.1/esptool-v4.8.1-linux-amd64.zip
 +unzip esptool-v4.8.1-linux-amd64.zip
 +chmod a+x ./esptool-linux-amd64/esptool
 +./esptool-linux-amd64/esptool --port /dev/ttyUSB0 --chip esp32 write_flash 0x0 ./ZeDMD.bin
 +</code>
 +
 +**For Batocera 41 and earlier** (ZeDMD version 3.x.x required)
 <code> <code>
 wget https://github.com/PPUC/ZeDMD/releases/download/v3.6.0/ZeDMD-128x32.zip wget https://github.com/PPUC/ZeDMD/releases/download/v3.6.0/ZeDMD-128x32.zip
Line 91: Line 126:
 </code> </code>
  
-The first line downloads the zedmd firmware for 128x32 matrix.+The first line downloads the ZeDMD firmware for 128x32 matrix
 +Note that batocera 42 requires ZeDMD 5.1.5 or over. And previous versions of batocera requires versions before 5.x.
  
-The second line unzip it.+The second line unzips it.
  
-The 3rd line downloads the tool used to flash the firmware.+The 3rd line downloads the tool we are going to use to flash the firmware on the ESP32 board.
  
-The 4th line unzip the tool.+The 4th line unzips that tool.
  
-Th 5th line make the tool executable.+Th 5th line makes the tool executable.
  
-The last line flash the firmware on the device /dev/ttyUSB0.+The last line flashes the firmware on the ESP32 device conencted as ''/dev/ttyUSB0''.
  
 {{:hardware:diy_dmd_flash.png?400|}} {{:hardware:diy_dmd_flash.png?400|}}
  
 === Step 2.4 - Plug the microcontroller === === Step 2.4 - Plug the microcontroller ===
-Check that your esp32 is the 30 pins model (by counting the number of pins).+Check that your ESP32 is the 30-pin model (by counting the number of pins). There are several models, some with another number of pins, but this one seems to be the most common.
  
-Now, you must plug the data wire to the esp32 by respecting the pin codes as in the following images.+Now, you must plug the data wire to the ESP32 by respecting the pin codes as described in the following images.
  
 {{:hardware:diy_dmd_mapping2.png?400|}} {{:hardware:diy_dmd_mapping2.png?400|}}
Line 114: Line 150:
 {{:hardware:diy_dmd_mapping1.png?400|}} {{:hardware:diy_dmd_mapping1.png?400|}}
  
-There are 15 pins to plug.+{{:hardware:zedmd_wiring.jpg?1000|}}
  
-The pin E can be ommited.+There are 15 pins to plug in total.
  
-The pin LAT is the pin STROBE.+The pin E can be omitted.
  
-Example : plug a pin in the data cable on G1. G1 pin corresponds to pin io 26. Thus on the esp32 side, plug it in the io 26.+The pin called LAT is the pin STROBE. 
 + 
 +Example : plug a pin in the data cable on G1. G1 pin corresponds to pin IO26. Thus on the ESP32 side, plug it in the IO26.
  
 {{:hardware:diy_dmd_esp32plug.jpg?800|}} {{:hardware:diy_dmd_esp32plug.jpg?800|}}
 +
 +**Note**: if you don't use a dedicated power supply, plug the red wire from the LCD panel to the VIN pin of the ESP32 (+5V) and the black wire to the GRD pin (ground).
  
 === Step 2.5 - Final assembling === === Step 2.5 - Final assembling ===
Line 131: Line 171:
 === Step 2.5 - First boot === === Step 2.5 - First boot ===
  
-Plug the power. You should see the ZEDMD logo and the version.+Plug your DMD the power wall socket. You should see the ZeDMD logo and the version.
  
-The logo may be not perfect as you can see on this picture+The logo may be not perfectas you can see on this picture, but no panic this is an easy fix: adjust the voltage to a slightly lower value to make it nicer (the orange screw on the power supply as explained at the beginning of this page).
- +
-Adjust the voltage to the lower value to make it nicer (the orange screw on the power supply).+
  
 {{:hardware:diy_dmd_zedmdlogo.jpg?600|}} {{:hardware:diy_dmd_zedmdlogo.jpg?600|}}
  
  
-=== Step 2.6 batocera.linux configuration === +===== Step Batocera.linux software configuration === 
-Plug with the usb c cable to the batocera box.+Plug your DMD with the USB-C cable to the Batocera box.
  
-Go in menu système services and start (or stop/start) the dmd_real service.+Go in **MAIN MENU** -**SYSTEM SETTINGS** -**SERVICES** and start (or stop/start) the ''dmd_real'' service.
  
-Move in the menu (change system or select a game in emulationstation). The images should appear.+Get back to the main menu, and switch to a different systemor select a game in EmulationStation. The images, or the names of the games (in case you don't have the right images) should appear on your DMD.
  
 {{:hardware:diy_dmd_first_image.jpg?600|}} {{:hardware:diy_dmd_first_image.jpg?600|}}
  
-===== Step : finalize the dmd hardware =====+===== Step : finalize the DMD hardware ===== 
 + 
 +Make sure you steadily lock the LED matrices, and if you're handy enough, make a nice case to wrap things up.
  
 {{:hardware:diy_dmd_box1.jpg?600|}} {{:hardware:diy_dmd_box1.jpg?600|}}
 +
 +Create a case as you can.
 +
 +{{:hardware:zedmd_result.jpg?800|}}
 +
 +===== ZeDMD configuration =====
 +If you've ZeDMD 5.x or higher (on batocera 42 or higher), by default, the rendering is not smooth.
 +You need to configure the minimal refresh rate and the USB package size via the command line tool zedmd-client.
 +You may need to configure the RGB order and the brightness.
 +
 +First, shutdown the dmd_real service, then use zedmd-client -i to list your current dmd settings.
 +After configuration, reboot batocera or just restart the dmd_real service
 +
 +A usb package size of 1024 and a refresh rate of 60 is good on my device. Depending on the esp32 hardware, you may adjust values to get smoother animations.
 +
 +<code>
 +# batocera-services stop dmd_real
 +# zedmd-client -i
 +
 +ZeDMD Info
 +=============================================================
 +ID:                         3904
 +firmware version:           5.1.7
 +CPU:                        ESP32
 +libzedmd version:           0.9.7
 +transport:                  0 (USB)
 +device:                     /dev/ttyUSB0
 +USB package size:           32
 +WiFi SSID:                  could only be retrieved via WiFi
 +WiFi port:                  could only be retrieved via WiFi
 +WiFi power:                 could only be retrieved via WiFi
 +WiFi UDP delay:             5
 +panel width:                128
 +panel height:               32
 +panel RGB order:            0
 +panel brightness:           2
 +panel clock phase:          0
 +panel i2s speed:            8
 +panel latch blanking:       2
 +panel minimal refresh rate: 30
 +panel driver:               0
 +Y-offset:                   0
 +
 +# zedmd-client --set-brightness=7
 +# zedmd-client --set-panel-min-refresh-rate=60
 +# zedmd-client --set-usb-package-size=1024
 +
 +# batocera-services start dmd_real
 +</code>
 +
 +Only the most common USB-to-serial chips used in various ESP32 boards supported by the auto-detection. Others are ignored to not break the communication to other devices, for example bluetooth headsets or game controllers.
 +But if your specific ESP32 is not recognized, you can explicitly specify the serial device in the settings.
 +
 +The best performance could be achieved by using an ESP32 S3 N16R8. Beside the fact that this one has more RAM which is actively used for rendering, it provides a native USB port. This native USB port supports much higher data transfer speeds.
 +
 +To increase the compatibility with some USB ports or hubs or low quality cables, the USB package size became configurable. The default value of 32 bytes for the original ESP32 is very low. If you notice stuttering of the DMD frames, try to increase this value.
 +If your hardware supports it, good values are 512 bytes for the original EPS32 and 1024 for the ESP32 S3. If ZeDMD doesn't work with these values, try a different USB port of your computer. In some cases not all of them and their driver chips are of the same quality.
 +
 +===== Issues =====
 +
 +=== Lines issues ===
 +
 +Check the pins. Some bad quality pins may create interference.
 +
 +{{:hardware:zedmd_issue1.jpg?400|}}
 +
 +{{:hardware:zedmd_noise.gif?400|}}
 +
 +=== Pannel driver issue ===
 +Depending on the hardware you bought, some settings on the dmd need to be changed.
 +One user having nothing displayed on the dmd (just the red squares) reported he had to change the panel driver to make it work.
 +(see https://github.com/PPUC/ZeDMD)
 +
 +<code>
 +zedmd-client --set-panel-driver=4
 +</code>
 +
  • hardware/diy_zedmd.1713988960.txt.gz
  • Last modified: 2 years ago
  • by nadenislamarre