What is Nostr?
dumb-package
npub1dum…39y0
2024-12-15 15:57:22

Unbricking the Lucky Miner LV06

Disclaimer:

  • This will void your warranty
  • There might be differences between the Bitaxe and the Lucky Miner that might not cause issues or damage immediately, but might manifest long-term
  • Proceed at your own risk

A Different Pickaxe

You live in a place where it’s difficult to get a Bitaxe. You have access to AliExpress. You look around. You find something called the “Lucky Miner LV06”. A Bitaxe clone that uses the same mining chip as the Bitaxe Ultra (BM1366 ASIC). You buy one.

Lucky Miner LV06

You plug it in, you enter your wallet address and other settings, and it starts mining. It works! Great!

But it’s running a customized firmware. It’s not AxeOS. Maybe there’s something shady in the stock firmware. It’s not open-source, after all. Also, AxeOS looks amazing… And that automatic pool fail-over feature is handy.

You think to yourself: “Maybe I can use the Bitaxe firmware on this?”. Guess what? You’re right!

Flashing From Web UI

Web UI flashing buttons

What usually works for me is to:

  • Download the Bitaxe firmware files (esp-miner.bin and www.bin) from GitHub (here). Version 2.4.1 seems to work well, as of this writing.
  • Then from the Lucky Miner web interface, upload the “Website” (www.bin) file.
  • Wait for a minute or two after it’s done uploading.
  • Upload the “Firmware” (esp-miner.bin) file.
  • Wait another minute or two.
  • Unplug the power and plug it back in.
  • Set the “Core Voltage” and “Frequency” to the defaults.
  • Unplug the power and plug it back in again.

If you’re lucky (no pun intended), you’ll have a working Lucky Miner with AxeOS. Update the settings and mine away!

However, often times I’ve been unlucky, like what happened while I was writing this article, ironically. The miner malfunctions for no obvious reason. It keeps rebooting, or it’s not mining (zero/low hashrate), or the web interface is inaccessible. You name it.

The miner has become a “brick”. How do you “unbrick” it?

When you brick a Bitaxe, you can recover it by flashing (uploading) a “Factory Image”. The Bitaxe has a USB port that makes this easy. Follow the guide and it should come back to life again. Unfortunately, the Lucky Miner LV06 doesn’t have a USB port. It has a serial port, though. We’ll have to get our hands a bit dirty.

Flashing Using the Serial Port

We need to connect the serial port of the miner to a computer and run a program to flash (upload) the firmware file on the miner. Any 3.3v UART serial port should be sufficient. Unfortunately, PCs don’t usually come with a UART serial port these days, let alone a 3.3v one. The serial port common in old computers is an RS-232 port, which will most probably fry your miner if you try to connect it directly. Beware.

In my case, as a serial port for my PC, I’m using an Arduino Due I had lying around. We connect it to the PC through USB, and on the other side we connect a few wires to the miner, which gives the PC access to the miner.

WARNING: Make sure your serial port is 3.3v or you will probably kill the miner. Arduino Uno is 5v not 3.3v, for example, and cannot be used for this.

Wiring

First, we need to open the Lucky Miner. Use a small flat screwdriver to gently push the two plastic clips shown in the picture below. Gently pry the top cover away from the bottom cover on the clips side first, then remove the other side. Be careful not to break the display cable.

Plastic Latches

Once the cover is off, you can find the miner’s serial port in the top right corner (J10), as shown in the next picture. We’ll also need the reset button (EN).

Lucky Miner Serial Port

There are three screws holding the PCB and the bottom cover together. If you’re confident in your ability to push the small button on the underside of the PCB with the bottom cover on, then no need to remove these. The following picture shows what we need from that side.

PCB underside

And the next picture shows the pins and USB port we will use from the Arduino.

Where to connect stuff

Now, we need to connect:

  • The USB port on the Arduino labelled “programming” to the PC
  • Pin 18 (TX1) on the Arduino to J10 through-hole pad 5 (blue dot)
  • Pin 19 (RX1) on the Arduino to J10 through-hole pad 3 (green dot)
  • Any GND pin on the Arduino to J10 through-hole pad 4 (yellow dot)

I didn’t need to solder the wires to the pads. Keeping everything stable, perhaps by putting a weight on the wires or a bit of tape, was sufficient in all my attempts.

Setting up the Arduino

To use the Arduino as a serial port for our PC, we’ll have to make it pass-through data back and forth between the USB port and UART1, where we connected the miner.

The following steps are all done on a PC running Debian Linux (Bookworm), in the spirit of freedom and open-source.

First, we start the Arduino IDE. If the package for the Arduino Due board is not already installed, you’ll see a small prompt at the bottom. Click “Install this package”.

Arduino IDE Step 1

Click the “Install” button.

Arduino IDE Step 2

Once the package is installed, click “Close”.

Arduino IDE Step 3

Next, we select the Due board. Click the “Tools” menu, select “Board”, select “Arduino ARM (32-bits) Boards” and click “Arduino Due (Programming Port)”

Arduino IDE Step 4

Next, we select the port. Click the “Tools” menu again, select “Port”, and click the port where the Arduino is connected. In my case it was “/dev/ttyACM0”.

Arduino IDE Step 5

Now we need to upload the following code to the Arduino board. The code is actually the “SerialPassthrough” example from the IDE, but with the serial speed changed to match the miner.

void setup() {
  Serial.begin(115200);
  Serial1.begin(115200);
}

void loop() {
  if (Serial.available()) {      // If anything comes in Serial (USB),
    Serial1.write(Serial.read());   // read it and send it out Serial1
  }

  if (Serial1.available()) {     // If anything comes in Serial1
    Serial.write(Serial1.read());   // read it and send it out Serial (USB)
  }
}

Copy/paste the code into the IDE and click upload. You’ll see “Done uploading” at the bottom.

Arduino IDE Step 6

Next we’ll test if we’re receiving data from the miner. We start by opening the “Serial Monitor” from the “Tools” menu in the IDE. Then we change the baudrate to 115200.

Arduino IDE Step 7

Set the Arduino and the miner in a comfortable position, make sure the wires are held in place and got a good contact on both sides, and the power is plugged in.

Now we’ll put the miner in “download” mode. Press and hold the button on the underside (K1), press and release the reset button (EN), then release the other button (K1).

You should see some text from the miner in the serial monitor window, like in the picture below.

Arduino IDE Step 8

Congratulations! We know we’re able to receive data from the miner now. We’re not sure transmit is working, but we’ll find out when we try to flash.

Flashing Using the Serial Port, for Real

To flash the Lucky Miner we’ll need a software tool named esptool and the factory image firmware file.

I usually use “esp-miner-factory-205-v2.1.8.bin” for the factory image (this one) as a base, and then flash the version I want from the Web UI, using the steps I mentioned earlier.

For esptool, the documentation (here) shows us how to install it. To make things a little easier on our Debian Linux system, we’ll use pipx instead of pip. The instructions below are adapted for that.

First we make sure pipx is installed. Run this command in a terminal and follow the instructions:

sudo apt-get install pipx

Then we install esptool using pipx. Run the following in a terminal:

pipx install esptool

The output will be something like this:

user@pc:~$ pipx install esptool
  installed package esptool 4.8.1, installed using Python 3.11.2
  These apps are now globally available
    - esp_rfc2217_server.py
    - espefuse.py
    - espsecure.py
    - esptool.py
⚠️  Note: '/home/user/.local/bin' is not on your PATH environment variable. These apps will not be globally accessible until your PATH is
    updated. Run `pipx ensurepath` to automatically add it, or manually modify your PATH in your shell's config file (i.e. ~/.bashrc).
done! ✨ 🌟 ✨

We can see pipx telling us we won’t be able to run our tool because the folder where it was installed is not in the PATH variable. To fix that, we can follow pipx instructions and run:

pipx ensurepath

And we’ll see something like this:

user@pc:~$ pipx ensurepath
Success! Added /home/user/.local/bin to the PATH environment variable.

Consider adding shell completions for pipx. Run 'pipx completions' for instructions.

You will need to open a new terminal or re-login for the PATH changes to take effect.

Otherwise pipx is ready to go! ✨ 🌟 ✨

Now, close the terminal and re-open it so that esptool becomes available.

Finally, to actually flash the miner, put the miner in download mode, then in the following command change the port (“/dev/ttyACM0”) to your serial port, as we’ve seen earlier, and the file path to where your firmware file is, and run it:

esptool.py -p /dev/ttyACM0 --baud 115200 write_flash --erase-all 0x0 ~/Downloads/esp-miner-factory-205-v2.1.8.bin

If everything went fine, the tool will take a few minutes to flash the firmware to the miner. You’ll see something like this in the output:

user@pc:~$ esptool.py -p /dev/ttyACM0 --baud 115200 write_flash --erase-all 0x0 ~/Downloads/esp-miner-factory-205-v2.1.8.bin
esptool.py v4.8.1
Serial port /dev/ttyACM0
Connecting.....
Detecting chip type... ESP32-S3
Chip is ESP32-S3 (QFN56) (revision v0.2)
Features: WiFi, BLE, Embedded PSRAM 8MB (AP_3v3)
Crystal is 40MHz
MAC: 3c:84:27:ba:be:01
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Erasing flash (this may take a while)...
Chip erase completed successfully in 9.5s
Compressed 15802368 bytes to 1320190...
Wrote 15802368 bytes (1320190 compressed) at 0x00000000 in 152.1 seconds (effective 831.2 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

And we’re done! Hopefully the miner will be recovered now.

Hope this helps!

Stay humble,
dumb-package

A Warning About Beta Versions of AxeOS

For reasons unknown to me, while I was writing this article I wanted to try the testing version of AxeOS, which was v2.4.1b (beta). Flashing from Web UI went smooth, but the miner stopped mining. I flashed back to v2.1.8 using the serial port, a known good version for me, but it wouldn’t mine, still.

Thankfully, v2.4.1 was released recently, and flashing it from the Web UI magically revived my miner. So, be warned.

Bonus: File Hashes

For convenience, these are the SHA256 hashes of the files I used in this article:

da24fceb246f3b8b4dd94e5143f17bd38e46e5285e807ebd51627cb08f665c0a  ESP-Miner-v2.4.1/esp-miner.bin
16c5c671391f0e3e88a3e79ce33fad3b0ec232b8572fad5e1e0d1ad3251ab394  ESP-Miner-v2.4.1/www.bin

d5182a15b6fa21d7b9b31bff2026d30afed9d769781a48db914730a5751e20c6  esp-miner-factory-205-v2.1.8.bin
Author Public Key
npub1dum8pkgs8sdwuax6mpgkc8ny6a5jwrsajz30z7p8qzez2qlsgqmqua39y0