UART connection between arduino uno and bolt

Hi, I need help for a project where I need to send an integer data stored in a variable from arduino to bolt and display value in the webpage for graph. I need sample code for the arduino part as well as set up part in bolt cloud and also the code for displaying the data in bolt cloud.

@sanomajhi2002 You can refer to this project to connect Bolt with Arduino using UART.

Arduino to Bolt IoT Integration

To send integer data from an Arduino to the Bolt IoT cloud and display it on a webpage for graphing, you’ll need to follow these steps:

  1. Set Up the Hardware and Connections: Connect your Arduino to the Bolt WiFi module.
  2. Write the Arduino Code: Send data from the Arduino to the Bolt cloud.
  3. Set Up Bolt Cloud: Configure the Bolt cloud to receive and display data.
  4. Write the JavaScript Code for Graphing: Display the data on a webpage.

1. Hardware Setup

  • Components Needed:

    • Arduino board (e.g., Arduino Uno)
    • Bolt IoT WiFi Module
    • Jumper wires
    • USB cable for Arduino
  • Connections:

    • Connect the Bolt WiFi Module to the Arduino as follows:
      • Bolt TX to Arduino RX
      • Bolt RX to Arduino TX
      • Bolt GND to Arduino GND
      • Bolt 3.3V or 5V to Arduino 3.3V or 5V (depending on the module specifications)

2. Arduino Code

#include <SoftwareSerial.h>

SoftwareSerial bolt(10, 11); // RX, TX

int sensorData = 0;

void setup() {
  Serial.begin(9600);
  bolt.begin(9600);
}

void loop() {
  sensorData = analogRead(A0); // Replace with your sensor data reading
  bolt.print("data:");
  bolt.println(sensorData);
  delay(5000); // Send data every 5 seconds
}

3. Set Up Bolt Cloud

  1. Create a Product:

    • Log in to your Bolt Cloud account.
    • Create a new product and select the input device.
  2. Configure Data Collection:

    • In the product configuration, set up the data input as an analog input.
    • Link the Bolt device to this product.
  3. Create a Data Visualization:

    • In the product’s visualization section, add a line graph.
    • Configure it to display the data received from your Arduino.

4. JavaScript Code for Graphing

The Bolt cloud automatically provides the necessary JavaScript and HTML code for visualizing data. You can further customize it if needed.

<!DOCTYPE html>
<html>
<head>
  <title>Arduino Data Graph</title>
  <script type="text/javascript" src="https://cloud.boltiot.com/static/js/boltCommands.js"></script>
</head>
<body>
  <h2>Sensor Data</h2>
  <div id="graph-div"></div>

  <script type="text/javascript">
    setChartLibrary('google-chart');
    setChartTitle('Sensor Data');
    setChartType('lineGraph');
    setAxisName('Time', 'Sensor Value');
    plotChart('data', 'temp', 10); // Replace 'temp' with your data variable name
  </script>
</body>
</html>

Summary

  1. Arduino Code: Reads sensor data and sends it to the Bolt IoT module.
  2. Bolt Cloud Setup: Configures the Bolt Cloud to receive and visualize data.
  3. JavaScript/HTML Code: Displays the data in a graph on a webpage.

Make sure to replace placeholders (like ‘temp’) with your actual variable names and configurations. This setup will allow you to send data from your Arduino to the Bolt Cloud and display it on a webpage.

Thanks, it helped me resolve the issue.

Thanks for detailed explanation, it helped me a lot.

Hello,
I think your Bolt module to the Arduino and use the Bolt IoT Arduino library for communication. Write a simple Arduino sketch to read sensor values or other integers and send them to Bolt Cloud periodically. In Bolt Cloud, set up your device by adding it and noting down the API key and device ID. Create a graph widget on the Bolt Cloud dashboard to visualize the incoming data. Integrate Bolt Cloud’s API into your HTML webpage to fetch and display the data dynamically, ensuring you replace placeholders with your actual API key and device ID.