Featured: DFRobot Bluno M3

DFRobot Bluno M3

Last time I featured DFRobot’s Bluno M0, an Arduino-compatible board with embedded Bluetooth chip. Now, I will write about the Bluno M3, an STM32-powered board that strikingly looks similar to the M0. Is it the same board or does it offer more?

Bluno M3 Overview

To start, here’s the Bluno M3 compared to the Bluno M0 and the Arduino UNO:

 

Specs

Bluno M3

Bluno M0

Arduino UNO

Microcontroller

STM32F103RET6

ARM Cortex M0 Nuvoton NUC123ZD4AN0

ATMega328P

No. of I/O Pins

50 (11 analog)

31

21 (6 PWM, 6 analog)

I/O Pin Voltage

3.3V

5V

5V

Flash (Program) Memory

512 kB

68 kB

32 kB

PWM Pins

16

6 (2 soft PWM)

6

Clock Speed

72 MHz

72 MHz

16 MHz

Other Features

SPI, I2C, Bluetooth 4.0

SPI, I2C, I2S, dual USB ports, Bluetooth 4.0

SPI, I2C

The program memory of the Bluno M3 has the same memory size as the Arduino Due albeit a slower clock speed. But arguably the most striking feature is the number of I/O pins. You have 39 digital and 11 analog pins! That’s more than twice that of the Arduino UNO at the same board size.

Having an STM32 as a microcontroller means all those I/O pins have a 3.3V operating voltage which could be a problem, considering most sensors operate at 5V.

Here’s the board layout:

As mentioned, the Bluno M3 is Arduino-compatible so it comes with the same female header arrangement. The extra I/O pins are placed as two-row male headers on the right side. There are other male headers for debugging the Bluetooth CC2540 and the STM32.

 

Getting Started

To be able to use the Arduino IDE for programming the Bluno M3, we must install the development environment first. Open the IDE and go to File > Preferences. Under the Additional Boards Manager field, paste this:

https://raw.githubusercontent.com/DFRobot/DFRobotDuinoBoard/master/package_dfrobot_m3_index.json

Click OK to close the dialog box.

Next, go to Tools > Board > Board Manager. On the search field, type Bluno M3. One entry should pop out. Click install:

After that, the Bluno M3 should appear on Tools > Board:

If your PC detected the Bluno M3 when you plugged in the micro USB cable then good for you. If not, download the zip file.

Extract the contents of the zip file in a convenient location on your PC. Then open the drivers folder and locate the file Bluno M3.inf. Right-click on this file and choose install. The driver should install and the board should now be detected.

If you are encountering the “The third-party INF does not contain digital signature information” error, hold the shift key and click restart. Then on the next screen, select Troubleshoot then Advanced Options then Startup Settings. Click the Restart button. After your computer restarts, select (7) Disable driver signature enforcement. Try to install the Bluno M3.inf file again and choose Install when a pop-up box appears. That’s it!

Bluno M3 Peculiars

Besides support for the same Arduino programming environment, the Bluno M3 has its own commands.

ADC

First is the inclusion of functions adcMode() and adcRead(). The adcMode() function allows you to set the number of bits for the ADC.

void adcMode(uint32_t ulPin, uint8_t Mode)

This is the same as the analogReadSolution() for the Arduino Due, Zero and MKR boards. Here are the possible modes:

  • ADC_8_BIT
  • ADC_10_BIT
  • ADC_12_BIT

The ulPin is any of the analog pins (A0 to A5).

The adcRead() function is the same as the analogRead() function only that it follows what mode is set through adcMode().

uint32_t adcRead(uint32_t ulPin)

In short, if you used adcMode() besides 10-bit, you must use adcRead().

Here’s an example sketch using both functions:

int sensorPin = 0;    // select the input pin for the potentiometer        
int sensorValue = 0;  // variable to store the value coming from the sensor        

void setup() {          
   Serial1.begin(9600);    
   adcMode(sensorPin, ADC_12_BIT);  
}       

void loop() {                  
           
   sensorValue = adcRead(sensorPin);
   Serial1.println((int)sensorValue);        
   delay(1000);               
}

PWM

The other unique feature of the Bluno M3 is how it implements PWM. It contains two functions, pwmMode() and pwmWrite().

pwmMode() allows you to specify the PWM frequency and resolution:

void pwmMode(uint32_t ulPin, uint32_t pwmFre, uint32_t pwmMode)

ulPin can be any pin with the ~ symbol on the board. The range of frequency values is determined by the chosen mode:

  • MODE_8_BIT
  • MODE_12_BIT

In 8-bit mode, the possible frequency range is 4 Hz to 281250 Hz. In 12-bit mode, the frequency range is 1 Hz to 17578 Hz.

The pwmWrite() function outputs a 1kHz PWM signal to any PWM pin assigned to ulPin:

void pwmWrite(uint32_t ulPin, uint32_t ulValue)

The ulValue is the duty cycle value from 0 to 255. The actual duty cycle is calculated using the formula

DC = ulValue/255 * 100

Here’s an example sketch that uses both function:

#include <Arduino.h> 
int pwmPin = 0;    // PWM connected to digital pin 0
int flag = 1;  
void setup() {
    //initializing the pwmPin,  setting the period to 3000 Hz at 8-bit mode. 
    pwmMode(pwmPin, 3000, PWM_8_BIT);
}

void loop() {
                         
    // generate a 50% duty cycle PWM signal.  
    pwmWrite(pwmPin, 128); 
    while (1);
                       
}

USART

The Bluno M3 boasts of 5 USARTs with the on-board Bluetooth module using one of those USARTs (USART1)

  • Serial1 at pins 0(Rx1) & 1(Tx1)
  • Serial2 at pins 22(Rx2) & 21(Tx2)
  • Serial3 at pins 30(Rx3) & 29(Tx3)
  • Serial4 at pins 8(Rx4) & 9(Tx4)
  • Serial5 at pins 25(Rx5) & 23(Tx5)

Using these terminals is very much like how you would use it with the Arduino UNO.

There are other examples found on Examples >DFRobotBlunoM3 some of which are the same with the default Arduino example while others are a bit complex but useful.

I was expecting they’d have an example that uses the on-board BLE. And by BLE I mean the real features of BLE and not wireless serial port BLE. Anyway, I’ll be looking deeper into this and will make a post about it ASAP.

Leave a Reply

Your email address will not be published. Required fields are marked *