Serial Monitor and Control with the Arduino

              Before we make a digital thermometer, we will learn how to use the Serial Monitor as a tool to see whether the sensors produce data that is true or not. The point is this, when we use a sensor to retrieve the data, the sensor will transmit the data to be processed by a microcontroller. To ensure that the data from these sensors is the correct data, then we can see it through the Serial Monitor. How it works is this:

  1. The microcontroller will read the data from the sensor
  2. Then the microcontroller will make a serial connection to the computer
  3. Furthermore, the microcontroller will send data to the computer via the serial communication
  4. Then we can see the data received by the computer using the serial monitor, hyperterminal, or similar application such as CoolTerm and PuTTY5.

              Serial monitor can be used to debug in software. If no serial monitor, we can not do debug applications that we created so as to find a solution, It is to debug on the hardware side. For example when there is an error, we will try with LED or increase / decrease the circuit.

              But if using the serial monitor, we'll know his error through the data transmitted by the Arduino. For example when the LED flame too long or too slow, we can immediately check the value (number) that is used to delay and all the contents of the variables in the program that we have created. So that we can trace the program logic and algorithms based on the data submitted earlier.

              Note the arduino board, pin 0 and 1 no writing RX and TX. Pin's function is to receive and send data via serial communication from the Arduino to the computer via USB cable. To use serial communication, we do not need to add additional components to the Arduino because the board is already provided. We simply connect the Arduino to the computer, and we can immediately create a program. Let's start with the Sketch below

Sketch 1 Serial Communications

// Free Tutorial Arduino

void setup () {
   Serial.begin (9600);
   Serial.println ("With");

int number = 0;
void loop () {
   Serial.print ("IOI SALMAN");
   Serial.println (number ++);
   delay (1000);

              Before we look at the results, let's discuss a little program on Sketch 1.


              In row 6, command Seril.begin (9600); means we will make a connection with the serial baud rate 9600. Simply put, baud relates to the number of bits transferred per second. Baud rate depends on the microcontroller clock. Arduino Uno itself uses a 16 MHz clock. If the lower its clock, the baud rate should we subtract. For example, if we use a microcontroller clocked at 1 MHz, then the baud rate matching is 1 MHz clock 4800. If we use 9600 baud rate, then the data is sent to the computer will not read. On the Arduino IDE, the baud rate of defaults on Serial Monitor is 9600. Please you try to change the value according to the existing selection.

              In line 7, the first Arduino will send the message "With" when first Arduino start. After that, the Arduino will send a message "IOI SALMAN" and continued with the numbers 0, 1, 2, 3, and so on. Serial Monitor If we close and we go back, then Arduino as if the reset program. Arduino will once again sends the message "With" and the numbers back to 0 again.

              On line 12 and 13, we find a different print orders, ie print () and println (). If we use print, then we just send the data without having followed the end of the line (the command to replace the line, or ENTER). If we use System.out.println (), then the writing will be followed by a command to move the line.

Icon Serial Monitor

Icon Serial Monitor

              We return to the Arduino board. Once the program is uploaded to the Arduino Sketch 1. Note the Arduino board, the LED labeled TX blinks. Each TX LED flashes, it means that the Arduino is sending data. Open Serial Monitor by clicking the icon Serial Monitor. If you are using a version of the Arduino IDE in addition to version 1.63, it may be a different location.

              Before the message "Uploading Done", then the Serial Monitor can not be opened. After Serial Monitor is opened, then at least you'll see a message in the serial monitor

Subscribe to receive free email updates:

0 Response to "Serial Monitor and Control with the Arduino"

Post a Comment