Introducing the BT Lab "Live Chart": Real-Time Data Monitoring for Arduino
We are excited to introduce the newest feature in the BT Lab app: the Live Chart. This tool is designed to help you monitor and analyze real-time data sent from hardware like Arduino or Node-MCU via Bluetooth (typically using the HC-05 or HC-06 Bluetooth modules).
Imagine you are building a DIY Weather Station. You need to see a report of parameters like temperature, wind speed, and lightning strikes. Instead of just looking at raw numbers, you can send that data to the BT Lab Live Chart to visualize trends and analyze performance instantly.
The Live Chart Ecosystem
Think of the Live Chart as a 5-channel oscilloscope. You can draw five different data streams (channels) simultaneously on a single screen. This allows you to compare different sensor readings (like comparing humidity vs. temperature) in one view.
How to Format Your Data
To display data correctly, your Arduino must send information using a specific data structure. If the structure is incorrect, the BT Lab app will ignore the data.
The Data Format: <Channel ID, X value, Y value>
Channel ID: An Integer between 1 and 5.
X and Y Values: Float (decimal) numbers.
Syntax: Use commas to separate values and wrap everything in angle brackets < >.
Examples:
<1, 1, 45>(Sends data to Channel 1)<2, 10.5, -65.2>(Sends data to Channel 2)
Customization Options
The BT Lab Live Chart is highly flexible. You can tailor the look of your data to fit your specific project:
Line Width: Adjust the thickness of your data lines for better visibility.
Line Styles: Choose from different visual styles:
- Straight: For standard point-to-point plotting.
- Stepped: Perfect for digital signals or binary states.
- Smooth: For flowing analog data.
Settings Menu: Easily toggle these settings and manage how each line appears on your screen.
Interactive Function Buttons
If you are building an interactive project—like a weather station that needs a manual reset or a remote trigger—you can use the 5 Function Buttons.
These buttons allow for two-way communication. While the chart receives data, you can tap a button to send a specific command back to your Arduino. In the Live Chart settings, you can fully customize what data each button sends when clicked.
Arduino Code Example: Using Live Chart with Function Buttons
Below is a code example demonstrating how to use the Live Chart alongside its Function Buttons.
When any of the five function buttons are clicked in the BT Lab app, a signal is sent to the Arduino. The Arduino then returns 100 random values to the corresponding channel in the Live Chart. Try this code sample with your Arduino and an HC-05 or HC-06 Bluetooth module to better understand how to utilize the Live Chart feature.
void setup() {
// Initialize serial communication at 9600 bits per second
Serial.begin(9600);
}
String data = "";
void loop() {
// Check if data is available from the Bluetooth module
if(Serial.available()){
char val = Serial.read();
// Check for the newline character to identify the end of a command
if(val == '\n'){
getAction(data);
data = ""; // Clear the string for the next command
} else {
data = data + val; // Append incoming characters to the string
}
}
}
// Logic to determine which function button was pressed
void getAction(String data){
if(data == "fun1"){
simulate(1);
} else if(data == "fun2"){
simulate(2);
} else if(data == "fun3"){
simulate(3);
} else if(data == "fun4"){
simulate(4);
} else if(data == "fun5"){
simulate(5);
}
}
// Function to send 100 random data points to the specified channel
void simulate(int channelId){
for(int x = 0; x < 100; x++){
// Send data in the required format:
Serial.println("<" + String(channelId) + "," + String(x) + "," + String(random(0, 100)) + ">");
delay(10); // Small delay to prevent serial buffer overflow
}
} Get Started Today!
The Live Chart feature makes the BT Lab app one of the most powerful tools on the Google Play Store for electronics enthusiasts. Whether you are debugging a robot or logging environmental data, our Live Chart gives you the visual edge you need. Note: Make sure your Bluetooth module is correctly wired and paired with your phone before you start streaming data!