Introduction

FireBeetle is a product series of small development board developed by DFRobot. It contains various chip boards and expansion boards that can be used alone or in combination. The same as Arduino M0, FireBeetle M0 also adopts the high-performance low-power chip ATSAMD21G18 ARM Cortex M0+. With up to 48MHz frequency, it offers 32kb RAM and 256kb Flash, which is 8 times and 16 times of Atmega328 respectively. Designed with 16MB SPI Flash and built-in 12MB flash drive, FireBeetle M0 simplifies the data interaction between the user's desktop system and the board, and supports SPI Flash-based easy flash database. Besides, the built-in SPI Flash-based word model allows users to directly display multi-language words, such as Chinese, British, Japanese and Korean.
FireBeetle M0 adopts a convenient Type-C port and a more comfortable horizontal switch. The onboard WS2812 RGB indicator and FPC make the display much easier to use.

Features

Specification

Board Overview

Board Outline

DFR0652-Board Outline

warning_yellow.png NOTE: NC should be left folating. VCC will output the power source voltage. (Output USB voltage when powered by 5V-USB, and output battery voltage when powered by 3.7V li-ion battery.)

Power & PinOut

DFR0652-Power & PinOut

FireBeetle M0 has rich ports for connecting power source.

Pin Introduction

This is the general purpose I/O pin set for the microcontroller.

~4 Button

We connected pin ~4 to UserButton, and left soldering pads on the bottom. In special cases, you can use them same as common pins after welding, but this will affect the use of the serial port reset function. Please refer to "Tutorial-COM Reset".

FPC Wire Order

We designed FPC connector for connecting with Displays. Parallel part of pins of the mainboard to FPC so you can use the display conveniently. The Pin connection list is as follows.

FPC PINS FireBeetle M0 PINS Description
VCC 3V3 3.3V
BLK(PWM backlight adjustment) 9 Backlight
GND GND GND
SCLK SCK SPI clock
MOSI MOSI Master output, slave input
MISO MISO Master input, slave output
DC 7 Data/Command
RES 6 Reset
CS 5 TFT chip select
SDCS 3 SD card chip select
FCS A4 Font library
TCS A3 Touch
SCL SCL IIC clock
SDA SDA IIC data
INT 2 INT
BUSY-TE 10 Tearproof pin
X1 NC User-defined pin 1
X2 NC User-defined pin 2

warning_yellow.png NOTE: Please do not use a pin repeatedly.

Tutorial

Driver Installation

FireBeetle-M0 has built-in USB communication so it can be used without driver among most devices. If you find the driver is not installed automatically after plugging into the device, you can install it manually. (手动安装软件地址)

Arduino IDE Setup

Open Arduino IDE, click File->Preferences, as show below:

Arduino IDE

Click the icon marked with red below.

Arduino IDE Setup

Copy the address to the newly popped up box: http://download.dfrobot.top/firebeetle/package_firebeetle_index.json

Arduino IDE Setup

Click OK.

Arduino IDE Setup

The board will be automatically updated.

Arduino IDE Setup

Wait for while, then you will find the installed FireBeetle-M0 in the list.

Arduino IDE Setup

Done!

The default LED for FireBeetle M0 board is 13. Open the blink example in Arduino.

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
}

Measuring Battery

Li-ion batteries are "maxed out" at 4.2V and stick around 3.7V for much of the battery life, then slowy sink down to 3.2V or so before the protection circuitry cuts it off. By measuring voltage, you can quickly tell when you're heading below 3.7V. To make this easy, we stuck a double-100k resistor divider on the li-ion port, and connected it to A2. Then you can get the battery electric capacity information.

#define VBATPIN A2
void setup() {
  // put your setup code here, to run once:
}
void loop() {
  float measuredvbat = analogRead(VBATPIN);
  measuredvbat *= 2;    // we divided by 2, so multiply back 
  measuredvbat *= 3.3;  // Multiply by 3.3V, our reference voltage
  measuredvbat /= 1024; // convert to voltage
  Serial.print("VBat: " ); Serial.println(measuredvbat);
}

WS2812

Connect the onboard WS2812 of M0 to P~8 of Arduino. We use open-source FastLED library, and set it to pin 8. You can find the built-in demo in the following:

#include "FastLED.h"            // FastLED library will be used in this example

#define NUM_LEDS 1            //Number of LED 
#define DATA_PIN 8              // Arduino Signal control output pin 
#define LED_TYPE WS2812         // Type of LED
#define COLOR_ORDER GRB         // The order of red, green, blue of RGB LEDs

uint8_t max_bright = 128;       // LED brightness control variable, available value 0 ~ 255. The larger the value, the brighter the LED strip.  

CRGB leds[NUM_LEDS];            // Create leds strip

void setup() { 
  LEDS.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS);  // Init leds strip
  FastLED.setBrightness(max_bright);                            // Set leds strip brightness
}

void loop() { 
  leds[0] = CRGB::Red;          // Set the first LED of the LED strip to red, leds[0] is the first LED, leds[1] is the second LED 
  FastLED.show();                // Update LED color 
  delay(50);                     // Wait 500ms 
}

U-disk

DFR0652-U-disk

How to simply the data interaction between the mainboard and PC?

FireBeetle M0 has built-in SPI Flash U-disk, connect it with a PC, double-click RST to enter U-disk mode, then the LED will keep on in green.

EF Database

FireBeetle M0 has built-in EasyFlash library, and the related demo can be found in the following.

/*!
 * @file delValue.ino
 * @brief Set a key-value pair and delete it by key 
 * @n Experiment phenomenon: serial print the length of value the key corresponds 
 *
 * @copyright   Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
 * @licence     The MIT License (MIT)
 * @author [LiYue](Yue.Li@dfrobot.com)
 * @version  V1.0
 * @date  2019-12-23
 * @get from https://www.dfrobot.com
 * @url https://github.com/cdjq/DFRobot_EasyFlash
 */

#include <DFRobot_EasyFlash.h>
DFRobot_EasyFlash easyflash;

char key[] = "key";               
char value[] = "value";
char valueRec[20];
size_t valueLen;
size_t getLen;
String data;
void setup()
{
  Serial.begin(115200);
  while(!Serial);
  easyflash.begin();
  easyflash.setValue(key,value);
  data = easyflash.getValue(key);
  getLen = easyflash.getValue(key,valueRec,20,valueLen);   //getValue() return the length of the obtained key. valueLen records the real length of the value. (Since the obtained length is smaller than/equal to the buffer length, it may smaller than the real length)
  Serial.print("The length of the value is :");Serial.println(getLen);
  Serial.println(data);
  easyflash.delValue(key);                        //Delete key-value pair according to key
  getLen = easyflash.getValue(key,valueRec,20,valueLen);  //getValue() return the real length obtained. Note that if the value has been deleted, valueLen cannot get the actual length of the value, so the value of valueLen will not change. It should be the exactly the same as the value passed in.
  Serial.print("After delete the key&value.The length of the value is :");Serial.println(getLen);
}

void loop() {

}

Built-in Font Library

M0 has built-in font library that can easily display all kinds of language. How to display built-in font?

CSV Library

To simply the data interaction, FireBeetle has transplanted CSV library, and you can find the demo as shown in the picture below.

CSV Library

Dimension Diagram

Dimension

FAQ

COM Port Reset

Program goes wrong and the COM port lost? No need to worry, We designed Blink Reset Function for you. Reset program to RGB Blink then you can find the COM port.

Serial Reset

Press down the button ~4 and click the RST to enter ready state, wait for 2 seconds, then ~8RGB LED will light up in red, at the same time ~13LED will keep on.

Serial reset

When the LED lights up in red, click the button ~4 to burn RGB blink program. The RGB will light up in blue when burning. Since the burning state is very fast so the blue light usually flashes across. When the burning is completed, the RGB light will emit red, green and blue in turn. At this time, the COM port will pop up normally when the board is connected to the computer.

Pin Output and Pull-up

The normal way to take pull-up pin as input is to use:

pinMode(pin, INPUT)

The way above is accpectable because the pull-up selection register on the 8-bit AVR chip is the same as the output selection register. But you can't do this again for M0! You need to use:

pinMode(pin, INPUT_PULLUP)

The code written in this way still has the advantage of backward compatibility with AVR. You do not need a separate version for different board types.

Serial USB and Serial

Most of the Arduino examples are debugging and providing output via Serial.print, but the USB port of the official Arduino M0 kernel is changed to SerialUSB.

We have fixed this problem so you can use USB for debugging when using Serial and SerialUSB. TX1, RX1 and TX, RX are set to Serial1 and Serial2 respectively.

For any questions, advice or cool ideas to share, please visit the DFRobot Forum

More Documents

DFshopping_car1.png Get Firebeetle Board-M0(V1.0) from DFRobot Store or DFRobot Distributor.

Turn to the Top