Introduction
I’ve been looking into UWB modules for a while now and saw this board on Aliexpress. Since my Qorvo DWM3000EVB shields have just arrived, I decided to also get NodeMCU BU01 (by Ai-Thinker) and check it out. Thinking about comparing capabilities but will get back to this thought later on.
At the time of writing this post, the device was priced at 34 USD. Compared to the DWM3000EVB, which is at 21 EUR, is a bit expensive. On top of this, NodeMCU BU01 (also known as BU01-DB) is based on the DW1000 platform which can be considered as “old” at this point.
Another difference is that the DWM3000EVB will interact with ATmega328P (assuming that you attach it to an Arduino UNO board) whereas NodeMCU-BU01 has an onboard STM32F103C8T6 chip. Of course, one is a shield board whereas the other one is a finished product so got to keep this in mind when making a comparison.
The features of this board can be seen in the list below (taken directly from Ai-Thinker Documents Website):
- 35mm * 55mm board 50 pin leads to facilitate peripheral function development Micro power interface, convenient for various power supply equipment access
- STM32F103 main control, rich chip resources
- Acceleration sensor, phase measurement, accurate position status information
- Temperature and humidity sensor, measure current temperature and humidity information, no need to connect other temperature and humidity sensors
- Independent buttons and LEDs meet application logic control and status indication
How to Use
The device itself comes as pre-programmed with the Ai-Thinker software however there were no instruction manual or any kind of info on how to use it. Also, since I’ve overwritten it before actually writing this blog, I’ll leave the original firmware download link below:
NodeMCU-BU01 development board factory firmware
After checking out the docs (which there is hardly anything to look at) I’ve found a link to a Chinese blog site. On this page, there are screenshots with commands visible.
The number below in the screenshot, 115200, hints to being a baud-rate and communication over UART by extent. There are “AT” commands that can be used however only ones that I could’ve find was on the same blog post. The link to the command list on Ai-Thinker website was not working. The aforementioned list can be seen as:
- AT
- test command
- AT+switchdis=1
- start ranging
- AT+interval=5
- Ranging interval (5-20)
- AT+version?
- query version
- AT+RST
- reset
- AT+tem_hum
- Temperature and humidity test
- AT+xyz
- Triaxial acceleration test
- AT+anchor_tag=0
- Role setting, 1 is base station, 0 is label
How to Program
Below, you can find a simple Arduino sketch to blink the LED that is on the board. LED_BUILTIN works for this board and easiest way to test if the process works or not. To upload this sketch, there are a few extra steps that need to be followed.
void setup() { pinMode(LED_BUILTIN, OUTPUT); Serial.begin(9600); Serial.println("Starting board..."); // Testing some clock/scaling stuff // Serial.println(F_CPU); // Serial.println(BOARD_RCC_PLLMUL); // Serial.println(RCC_PLLSRC_HSE); // Serial.println(RCC_PLLSRC_HSI_DIV_2); // Serial.println(RCC_PRESCALER_USB); } void loop() { digitalWrite(LED_BUILTIN, HIGH); delay (1000); digitalWrite(LED_BUILTIN, LOW); delay(1000); }
Firstly, Arduino_STM32 library is necessary to interact with the board. This library also supports a few variations for both STM32F1 and STM32F4 boards so might also come in handy in the future, if you acquire different boards. You can find the download link below:
Arduino STM32 Installation Steps
Next up, you’ll need a TTL converter so you can interact with your board through USB. Unfortunately, I couldn’t get my computer to recognize the board via default USB connection. Tried all boot modes but no luck, also saw a line in the documentation mentioning something like “USB powered device” and initially thought that USB was power-only but datasheet shows connected D+ and D- pairs. 🙂
The wiring for firmware uploading to the flash memory is indicated in the image above. Waveshare USB to TTL device has a voltage selector (not that it matters here) and because of that I’ve adjusted the voltage for the V3.3 pin (V5 also works). You need to cross data lines in UART connections so RXD connects to U1TX and TXD connects to U1RX. Next up, we need to adjust jumpers so that bootloader will go into ISP mode which in turn will allow us to directly write to flash memory on board.
The correct jumper positions for firmware uploading can be seen above. BOOT0 is set to high and BOOT1 is set to low. There are 2 other configurations, namely FLASH and SRAM. Didn’t test SRAM yet but FLASH mode just directly boots from the firmware in the flash memory. Table below is taken from the documentation:
BOOT0 | BOOT1 | MODE |
---|---|---|
0 | X | FLASH |
1 | 1 | SRAM |
1 | 0 | ISP |
Finally, after setting up the Arduino STM32 library and connecting the TTL converter to your computer, you can upload the sketch. The correct board settings are outlined in the list below. If you selected the correct port for your USB device, everything should just work.
- Board: Generic STM32F103C6/fake STM32F103C8
- Upload method: Serial
- CPU Speed(Mhz): 48Mhz (Slow – with USB)
- Optimize: Smallest (default)
- Port: <ADJUST THIS>
After flashing the sketch, you should see an output on Arduino IDE similar to the one below:
The only caveat I’ve seen is that pre-defined clock speed coefficients for this STM32 MCU seems to be not accurate. Either somehow the board runs on a different frequency or there is the issue of “fake/relabelled” chip usage. Because of this, delay() calls are not accurate (executed much faster compared to the real time). Also if you upload the sketch on 48Mhz, UART baudrate is doubled. Meaning that if you selected 4800 for Serial.begin(), you need to choose 9600 on the IDE serial monitor baudrate.
Flashing Original Firmware
TBD
Interesting : I made some search about the AT commands of the factory software => unable to find the AT command list !
I tried to read and use the software from AI-Thinker (same ref as yours) ; it’s seems to be an RTOS based software using CMSIS and implementing TWR algorithm. But you have to recompile it with STM32 Cube IDE … some adaptation to do, I think.
Hard to use it !