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
- Compatible with DFRobot FireBeetle V2 Series
- High performance with low power consumption
- SPI Flash-based built-in U-disk, word model, database
- Onboard FPC for easy connection with screen
- Small in size, convenient to install
Specification
- Input Voltage: 3.3V~5.5V
- Low Power Consumption: 10uA
- Max Discharging Current: 600mA@3.3V LDO
- Max Charging Current: 500mA
- Support for USB charging
- Processor: ATSAMD21G18
- Frequency: 48MHz
- SRAM: 32KB
- Flash: built-in 256KB, onboard 16MB SPI Flash
- GPIO: 25 (PWM available for all ports)
- 12-bit ADC x6
- 10-bit DAC x1
- SPI: 1
- I2C: 1
- UART: 2
- RGB LED: WS2812 (connect to Pin ~8)
- Connector: compatible with FireBeetle V2 series
- Operating Temperature: -40℃~+85℃
- Dimension: 25.4 x 60(mm)/1.0×2.36”
- Mounting Hole Size: M2, inner diameter 2mm
Board Overview
Board Outline
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
FireBeetle M0 has rich ports for connecting power source.
- GND---Common ground for all power and logic
- VIN---Positive voltage input by USB/Lipoly Battery (Output USB voltage when powered by 5V-USB, and output battery voltage when powered by 3.7V li-ion battery.)
- EN---3.3V regulator's enable pin. It is pulled up, so connect to ground to disable the 3.3V regulator
- 3V3---Output from the 3.3V regulator, it can provide 500mA peak.
Pin Introduction
This is the general purpose I/O pin set for the microcontroller.
All logic is 3.3V.
Nearly all pins can do PWM output.
All Pins can be interrupt inputs.
~0 / RX1 -GPIO 0,also receive (input) pin for Serial1 (hardware UART), also can be analog input
~1 / TX1 -GPIO#1, also transmit (output) pin for Serial1, also can be analog input
~2 -GPIO 2
~3 -GPIO 3
~5 -GPIO 5
~6 -GPIO 6
~7 -GPIO 7
~9 -GPIO 9
~10 -GPIO 10
~11 -GPIO 11
~12 -GPIO 12
~13 -GPIO 13, and is connected to the red LED next to the USB jack
A0- This pin is analog input A0 but is also an analog output due to having a DAC (digital-to-analog converter). You can set the raw voltage to anything from 0 to 3.3V, unlike PWM outputs this is a true analog output.
A1 to A5- These are each analog input as well as digital I/O pins.
SDA -I2C (line) data pin
SCL -I2C (line) clock pin
SCK / MOSI / MISO- These are the hardware SPI pins, you can use them as everyday GPIO pins (but recommend keeping them free as they are best used for hardware SPI connections for high speed.
RX can receive the pin(input) of Serial 2(hardware UART)
TX can be used as transmit pin(output) of Serial 2
NC, empty pin, not connected to the chip.
~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 |
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
- Add URL to Ardudino IDE
Open Arduino IDE, click File->Preferences, as show below:
Click the icon marked with red below.
Copy the address to the newly popped up box: https://downloadcd.dfrobot.com.cn/boards/package_DFRobot_index.json
Click OK.
- Update board. Open Tools->Board->Boards Manager.
The board will be automatically updated.
Wait for while, then you will find the installed FireBeetle-M0 in the list.
Done!
Blink
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
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?
- Burn font. Find the font demo as shown in the picture.
- Use font. Find serial analog to display demo.
CSV Library
To simply the data interaction, FireBeetle has transplanted CSV library, and you can find the demo as shown in the picture below.
Dimension Diagram
- Pin pitch: 2.54mm
- Mounting hole pitch: 24mm/53mm
- Mounting hole size: 3.1mm
- Mainboard size: 29.00mm×58.00mm
- Thickness: 1.6mm
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.
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.
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