Introduction: Magic Hercules - Driver for Digital LEDs
The Magic Hercules module is a converter between the well-known and simple SPI to the NZR protocol. The module inputs have a tolerance of +3.3 V, so you can safely connect any microcontrollers operating at voltage of +3.3 V.
The use of the SPI protocol to control digital LEDs is an innovative approach among current solutions, such as ready-made libraries for Arduino. However, it allows switching to any platform regardless of the microcontroller family (such as ARM: STM / Cypress PSoC, Raspberry Pi, AVR, PIC, Arduino) and regardless of the programming language (e.g. C, Arduino C ++, Python or another that supports SPI protocol). This approach to programming digital LEDs is extremely beginner-friendly as all you need is knowledge of the SPI protocol.
MH module also allows several modes of testing digital LED strips, including testing the color order in the diode (RGB, BGR, RGBW, etc.), testing the entire strips or displays (up to 1024 LEDs).
Step 1: Why Am I Working on the Magic Hercules Module?
I have been working with digital LEDs such as WS2812, WS2815 or SK6812 for a long time, which I usually call Magic LED.
I tested many strips, rings and displays (even my own) based on Magic LED (even with RGBW type). I used Arduino, Nucleo (with STM), Raspberry Pi and my own boards with AVR microcontrollers.
Regardless of the platform, writing a program to control magic LEDs is difficult (due to the need for NZR protocol software), unless you are using ready-made libraries that make it easy, but still not fully optimal in terms of code usage, interrupt responses, or memory utilization, and only work on specific platforms (porting them to e.g. from Raspberry to AVR microcontrollers is impossible).
Due to the fact that I often use various platforms, I had the need for the program code to be as compatible as possible with Arduino, Raspberry Pi, ARM / STM (Nucleo) or AVR - especially when it comes to lighting effects.
I have been working on the youtube channel for a long time and I have prepared more than one guide on programming digital diodes in C language for AVR microcontrollers (but so far only in Polish for now). I often have contact with beginners who struggle with programming magic LEDs. Of course, some, depending on the platform, choose ready libraries for their one-time projects. However, many people look for other solutions or try to learn the secrets of programming and I am one of them.
Step 2: SPI to NZR Conversion
I decided to prepare a module that will do the dirty work for the user using the NZR protocol. The module that will act as SPI to NZR converter and just like SPI, can be used on any platform with ease. The screenshot above shows the conversion of SPI signals to NZR protocol in the Magic Hercules module.
Step 3: Magic Hercules Module As Digital LED Strip Tester
When connecting digital LEDs to different systems, one should remember about the appropriate voltage tolerance for different microcontrollers. Most of the I / O pins of ARM microcontrollers work in the +3.3 V standard, while the AVR microcontrollers work in the TTL standard. Due to this, the input pins of the Magic Hercules module have a tolerance of +3.3 V, so they can be safely connected to eg a Raspberry P or any ARM based microcontroller powered +3.3 V.
As I mentioned before, I often work with different types of digital LEDs. Depending on the manufacturer, individual colors in the LEDs can be in different positions, e.g. RGB, BGR, GRB, RGBW, GRBW, etc. It's not uncommon for the manufacturer's documentation to mention the RGB sequence, but it actually looks different. I have equipped the Hercules module with a color sequence test so that there is no problem with quickly figuring out how to write a program for the correct color order. Several additional functions of the tester allow you to quickly check whether the digital LED strip works at all, whether all the colors in each LED across the strip (up to 1024 LEDs!) Are working correctly (no dead pixels). And all this without connecting a microcontroller and writing any program.
Step 4: Magic Hercules Module - New Universal Solution for Digital LEDs
I don't think there was such a thing yet, to control digital LEDs using a simple and common SPI protocol, which can be operated on any platform or family of microcontrollers.
Of course, there are many ways to control digital LEDs, some are more optimal and others are less optimal. The Magic Hercules module is another option and very practical for me. I think that someone may like this unusual solution. I recently took off on the crowdfunding platform - kickstarter, where I prepared a broader description of the Magic Hercules module in several videos, including how easy it is to work with it on Arduino, Nucleo (STM), Raspberry Pi and on AVR and PIC microcontrollers. If you would like to support the Magic Hercules project, check this out:
My Magic Hercules module project on kickstarter
I prepared a program in C language - a simple stargate effect, which is based on table operations and sequential sending of the buffer in the main loop. Thanks to the Magic Hercules module, I was able to easily transfer the source code to other languages and platforms - check the next steps - source codes.
Step 5: Magic Hercules Module With Atmega32 and C
Video containing a simplified diagram, connection presentation on ATB 1.05a (AVR Atmega32), source code (in Eclipse C/C++ IDE) and the final effect in the form of a stargate light effect.
Step 6: Magic Hercules Module With Arduino and Arduino C++
Video containing a simplified diagram, connection presentation on Arduino 2560 board, source code in Arduino IDE and the final effect in the form of a stargate light effect.
Step 7: Magic Hercules Module With PIC and C
Video containing a simplified diagram, connection presentation on ATB 1.05a with PIC shield (PIC24FJ64GA004 on board), source code in MPLAB and the final effect in the form of a stargate light effect.
Step 8: Magic Hercules Module With Raspberry Pi and Python
Video containing a simplified diagram, connection presentation on Raspberry Pi 4, source code in Python and the final effect in the form of a stargate light effect.
Step 9: Magic Hercules Module With ARM - STM32 Nucleo and C
Video containing a simplified diagram, connection presentation on STM32 Nucleo board, source code in STM32CubeIDE and the final effect in the form of a stargate light effect.
I think MH can be an extremely beginner-friendly module, regardless of the platform and language they use. It is enough to know the well-known SPI protocol, and the possibility to start checking whether the digital LED strip works at all and what color sequence it has is only a plus.
If you want to take part in my project on kickstarter - check this link:
Question 1 year ago
Hello friend, I'm from Brazil and I work with LEDs, I would like to know if you could help me with a project...