Realtime fun with HackerBox 65

HackerBox 65 Contents

I did it! After blogging about HackerBox 64 just a few days ago, I finally looked at the current HackerBox. HackerBox 65 is called Realtime. The project revolves around learning about RealTime Operating System (RTOS), using a real-time RTC shield with an ESP32, and creating a functioning clock with an LED matrix. This was a well-packed little kit.

Testing the ESP-WROOM-32 Development Kit

It is always essential to test microcontrollers before using them in a project. HackerBox 65 came with an ESP-WROOM-32 Development Kit. This is a nice little piece of hardware that I often like to use in projects. I usually combine the blink and WiFi scan example sketches to test the hardware.

Sometimes when working with the ESP32 boards, there can be timeouts or other issues when programming them from the Arduino IDE in Windows. This time around, the only problem I had was the board would not be assigned a COM port in Windows. I swapped cables and tried different USB ports. Each time I would plug the board in, I would hear that Windows found a USB device, but it wouldn’t show up. Finally, I swapped the USB extension cable I use. That fixed the problem. Before and after this, I’ve used that same USB extension cable to program microcontrollers. I don’t know if the USB extension cable is too long for communication this board, but at least I got it working.

The picture below shows how the device shows up on my Windows 10 box after I got it working successfully.

Here is the script I ran. This will blink the onboard LED (the blue one in the video below) and scan for wireless networks.

#include "WiFi.h"

void setup()
{
    Serial.begin(115200);
    pinMode(LED_BUILTIN, OUTPUT);

    // Set WiFi to station mode and disconnect from an AP if it was previously connected
    WiFi.mode(WIFI_STA);
    WiFi.disconnect();
    delay(100);

    Serial.println("Setup done");
}

void loop()
{
    digitalWrite(LED_BUILTIN, LOW);
    delay(2000);
    digitalWrite(LED_BUILTIN, HIGH);
    Serial.println("scan start");

    // WiFi.scanNetworks will return the number of networks found
    int n = WiFi.scanNetworks();
    Serial.println("scan done");
    if (n == 0) {
        Serial.println("no networks found");
    } else {
        Serial.print(n);
        Serial.println(" networks found");
        for (int i = 0; i < n; ++i) {
            // Print SSID and RSSI for each network found
            Serial.print(i + 1);
            Serial.print(": ");
            Serial.print(WiFi.SSID(i));
            Serial.print(" (");
            Serial.print(WiFi.RSSI(i));
            Serial.print(")");
            Serial.println((WiFi.encryptionType(i) == WIFI_AUTH_OPEN)?" ":"*");
            delay(10);
        }
    }
    Serial.println("");

    // Wait a bit before scanning again
    delay(3000);
}

Here is a modified script I used to shoot the video below. In this case, I changed the names of the wireless networks with a simple listing of “Wireless Network”. I didn’t figure I should publish mine or my neighbors SSID.

#include "WiFi.h"

void setup()
{
    Serial.begin(115200);
    pinMode(LED_BUILTIN, OUTPUT);

    // Set WiFi to station mode and disconnect from an AP if it was previously connected
    WiFi.mode(WIFI_STA);
    WiFi.disconnect();
    delay(100);

    Serial.println("Setup done");
}

void loop()
{
    digitalWrite(LED_BUILTIN, LOW);
    delay(2000);
    digitalWrite(LED_BUILTIN, HIGH);
    Serial.println("scan start");

    // WiFi.scanNetworks will return the number of networks found
    int n = WiFi.scanNetworks();
    Serial.println("scan done");
    if (n == 0) {
        Serial.println("no networks found");
    } else {
        Serial.print(n);
        Serial.println(" networks found");
        for (int i = 0; i < n; ++i) {
            // Print SSID and RSSI for each network found
            Serial.print(i + 1);
            Serial.print(": Wireless Network (");
            Serial.print(WiFi.RSSI(i));
            Serial.print(")");
            Serial.println((WiFi.encryptionType(i) == WIFI_AUTH_OPEN)?" ":"*");
            delay(10);
        }
    }
    Serial.println("");

    // Wait a bit before scanning again
    delay(3000);
}
Video of BlinkWiFiScan on the ESP-WROOM-32 Development Kit

Assembling the HUB75 Blaster

The HackerBox 65 instructable does an excellent job of explaining how to assemble the HUB75 Blaster. The HUB75 Blaster is a board to interface The ESP32 with an RTC/DataLogger Shield and a LED matrix. Because of the good instructions, I won’t go into details on the Blaster’s assembly. I will, however, highlight a couple of decisions I made that differ from the instructions.

The SMD capacitor that goes on the board almost sounds optional in the instructions. I, however, find it to be pretty helpful with the ESP32. True, I usually don’t have problems with timeouts programming the ESP32. But when I have, it has been a pain in the arse. This tiny capacitor is there to help prevent that. Anything that will contain a considerable headache later is well worth the time now.

For the ESP32 module, I chose to solder directly to the board; I decided to solder the RTC Data Logger Shield into headers. I did this for two reasons. Doing this offsets the two boards, making it easier to access the microSD card slot. Second, I might want to use the RTC module in another project if I do something with the HUB75 that doesn’t require an RTC or microSD card. I have plenty of ESP32 boards, so leaving this one soldered to control the LED matrix was a no-brainer to me.

To power the HUB75, I chose to use a cable I had sitting around my desk (possibly from a previous HackerBox). This cable has a red and white wire. Both wires had a fork connection on one end. The other end of both wires goes into a DC jack. I then use a 5VDC/2.5A wall wort to power the HUB75.

Programming the Kit

I put an old 8GB microSD card in the shield. Before using it, I did format it using SDFormatter. I could write and read from the card with no problems using the code from the instructable.

I did make two changes to the Arduino programming for the time sketch included with the instructable. First, I wouldn’t say I liked that the instructions had us change a library for this one use. I’ve run into problems doing that before. Yes, that would fix the problem. But in the future, if I have to use that library for a different project, it could cause huge issues.

So, I put the library back to its original state. I then added the following line at the beginning of Void Setup.

  Wire.begin(14, 13);

This allowed communication with the RCT and left the library in its original state.

I also made a change for syncing the time. When I would upload the clock sketch from the instructable, it would not update the time. I had to add these two lines right after the line I added above:

  rtc.begin();
  rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));

That allowed the time to be grabbed from the local computer when the code was compiled and uploaded to the ESP32. Hat tip to TimGTech for this tip in the comment section of the instructable.

Case for the kit

There are some excellent STLs on Thingiverse to print a case for this setup. I chose to design a case that goes behind the matrix and covers the electronics. This case allows me to keep the matrix at my desk without worrying about knocking into it and unseating the card from the back of the matrix. My case design can be found on Thangs.

Here is a look at the case mounted to the matrix and the electronics hooked up. I ran the power through the hole in the back cover.

Electronics mounted.

Here is a view with the back cover screwed on. The connector I used to supply power via a wall wart can be seen in this picture. (The roughness around the outside is because I accidentally had brim turned on, and this print didn’t need that).

Back View.

Completed project

Below is a picture of the completed project. I think I will leave this as a clock for a few weeks just to see how well the RTC does. But long term I plan to use this to create animations for a Ghostbusters project I have in mind.

This was printed using light blue PLA+ from GST3D. I did 20% infill and a speed of 80mms. Some of my recent prints can be seen surrounding the case.

Completed project.

Final thoughts on HackerBox 65

This was a fun little box. The instructable also included some information about RTOS and links to DigiKey’s YouTube series. I’ve been following this series and highly recommend it to anyone wanting to learn the basics of RTOS in general and FreeRTOS being used on the ESP32 specifically.

There was also some good info on NTP. That is a subject I have a lot of experience from my Network Engineer days. So I didn’t spend any time looking into that.

Overall I felt I got good value out of this box. As I noted earlier, I will be using this kit in a Ghostbusters project. I will be using RTP to ensure the timing is perfect for some animations I have in mind.

Timelapse of the day

Below is a timelapse of the Leonardo Tiki designed by Hex3D. It is being printed on my Ender3 Pro with Teal PLA from Push Plastic. You can see the picture of this model in my upcoming post about the April 2021 MakerBox.

Leave a Reply