Questions tagged [serial]

Serial communication is the standard USB connection between the Arduino and a computer with a standard USB A to B cable or through the TX/RX pins using a USB to serial converter. It can also refer to the serial library.

Filter by
Sorted by
Tagged with
14 votes
1 answer
28k views

What's the difference between all the Software Serial Libraries? Which one is Arduino Nano compatible?

There are so many Software Serial Libraries, what are the differences between them? And which one I can use with my Arduino Nano? For my Arduino Nano I need one Hardware Serial Port and one Software ...
William Roy's user avatar
2 votes
1 answer
408 views

Wanted to control 2 servos with serial read [closed]

I want to use 2nd servo only when 1st is in up state by asking user whether he wants to fire or not.(code in bold is not working ) #include <Servo.h> Servo myservo; Servo trigervo; ...
Aditya Raj's user avatar
70 votes
12 answers
443k views

How do I split an incoming string?

I am sending a list of servo positions via the serial connection to the arduino in the following format 1:90&2:80&3:180 Which would be parsed as: servoId : Position & servoId : Position ...
ValrikRobot's user avatar
40 votes
12 answers
146k views

Arduino Nano uploading gives error: avrdude: stk500_recv(): programmer is not responding

I have a Arduino Nano (Sainsmart) that I'm trying to upload a sketch to. Under the Arduino IDE, the device selected was Arduino Nano w/ ATmega328. However uploading the sketch gives me the error ...
Nyxynyx's user avatar
  • 1,389
53 votes
12 answers
271k views

How do I print multiple variables in a string?

Say I have some variables that I want to print out to the terminal, what's the easiest way to print them in a string? Currently I do something like this: Serial.print("Var 1:");Serial.println(var1); ...
sachleen's user avatar
  • 7,505
28 votes
3 answers
127k views

What is Serial.begin(9600)?

I know that this is to initialize something: Serial.begin(9600); But I want to know what it really means?
shajib0o's user avatar
  • 531
5 votes
5 answers
46k views

AT command is not responding on serial monitor

I am trying to send AT commands to ESP8266. I re-flashed ESP8266 https://i.stack.imgur.com/z0hoc.jpg I followed this tutorial http://remotexy.com/en/help/esp8266-firmware-update/ and I hope it re-...
N Sharma's user avatar
  • 355
44 votes
4 answers
49k views

Why does starting the serial monitor restart the sketch?

If I upload any sketch that sends serial data, I immediately see the TX/RX LEDs flash once the sketch is uploaded. If I then start the serial monitor, the sketch appears to restart. A bare minimum ...
Cybergibbons's user avatar
  • 5,340
32 votes
2 answers
40k views

How does the Arduino handle serial buffer overflow?

How does the Arduino handle serial buffer overflow? Does it throw away the newest incoming data or the oldest? How many bytes can the buffer hold?
user avatar
19 votes
1 answer
11k views

How does serial communications work on the Arduino?

With reference to the Arduino Uno, Mega2560, Leonardo and similar boards: How does serial communications work? How fast is serial? How do I connect between a sender and receiver? Please note: This ...
Nick Gammon's user avatar
  • 38.1k
14 votes
6 answers
17k views

Sending Large Amounts of Serial Data

So in the fields of robotics sometimes you need multiple boards and or computers linked together to share information or save statistical data. Currently I need to send a few different variables over ...
Steven10172's user avatar
18 votes
4 answers
29k views

How to get weight data from glass electronic bathroom scale sensors?

I am doing a small project with a bathroom scale but I run into some problems. I am using an Arduino Uno V3, HX711 module amp and a scale. Scale: HX711 amplifier: I disassembled the scale to get ...
silent_bob's user avatar
13 votes
5 answers
75k views

How to retrieve the data type of a variable?

I am using Arduino and I would like to know if there is a function that returns the data type of a variable. That is, I would like to run something as like the following: // Note: 'typeof' is a ...
user502052's user avatar
13 votes
2 answers
14k views

Put ATmega328 in very deep sleep and listen to serial?

I have investigated the sleeps options of the ATmega328, and read a few articles about it, and I would like to understand if there are more options. So I would like to get as low current as possible, ...
Curnelious's user avatar
4 votes
2 answers
3k views

Does data coming in on Arduino serial port store for some time?

I am using Arduino Uno and my question is when data is coming on Rx pin and at that time our program is not checking Serial.available() Then after some time the program will check Serial.available()....
Vivekanand Dhakane's user avatar
4 votes
1 answer
1k views

Ubuntu Serial Port Briefly showing on arduino IDE

I am using a NodeMcu with Arduino IDE on Ubuntu. I have managed to upload the blink script and it work. Now, when i plug the nodemcu, the serial port /dev/ttyUSB0 is briefly available in the IDE. ...
Justin Mayer's user avatar
1 vote
1 answer
3k views

Arduino split comma separated serial stream

I'm trying to read serial data into Arduino. I usually use a Serial to USB cable to connect to the hardware and is sending data like 33,Z,35.0,F,1073741.824,I,0.0,0x68 33,Z,35.0,F,1073741.824,I,0.0,...
Andrea's user avatar
  • 13
0 votes
2 answers
2k views

String compare when using Serial

I try to detect commands given by user in Serial Monitor, but strcmp fails to flag as identical. What do I do wrong ? Is there a better way not reading as String and convert to char for comparison ? ...
guyd's user avatar
  • 1,033
30 votes
2 answers
66k views

Arduino as USB HID

Is it possible to build a HID device (like a keyboard) using an Arduino uno? At the time being, I have button inputs on the Arduino giving outputs on the serial line. So, how can I transform my ...
Stuyvenstein's user avatar
17 votes
7 answers
131k views

How do I know the sampling frequency?

I am beginning to get a bit confused about sampling rates and baudrates etc. I have this Arduino code: #include <eHealth.h> extern volatile unsigned long timer0_overflow_count; float fanalog0;...
hawkar's user avatar
  • 543
7 votes
5 answers
14k views

Is it possible to press a button from Arduino and my computer will get a key event?

My idea seems easy: I connect a button with arduino, then write some code and upload it to arduino. Then I open the notepad(or any other editor) on my computer. When I press the button, there will ...
Freewind's user avatar
  • 183
5 votes
3 answers
8k views

Arduino serial port reset in Serial monitor & Python

So am I using an Arduino with a shield to gain some voltage values for an ECG. I am then plotting that data in Python. However whenever I "observe" the serial port, be that through the Arduino serial ...
hawkar's user avatar
  • 543
2 votes
1 answer
15k views

Simple Multiple RX/TX SoftwareSerial?

In this project I will be using multiple ESP8266 WiFi modules (4) connected by software serial to an Arduino Leonardo Micro (1 UART). I plan to rotate between all 4 (starting with 2): Open port, write,...
WaffleFPV's user avatar
1 vote
2 answers
1k views

SoftwareSerial problems

Hi we are using an Arduino Micro and working with a Bluetooth device and a Rfid Scanner from Sparkfun(ID-20 LA). For that we implemented 2 SoftwareSerial objects and the Serial port for the Serial ...
Robin's user avatar
  • 133
0 votes
1 answer
923 views

SoftwareSerial data being corrupted - looking for suggestions

I'm having problems running a serial communication between a NodeMCU ESP8266 and an Arduino Uno. I'm using the "standard" SUART setup, i.e. pins D1&D2 on the ESP are hooked up with GPIOs 2&3 ...
veveve's user avatar
  • 3
0 votes
2 answers
5k views

I'm looking for a way to serially communicate with a multi mesh Arduino slave network

I have one PC running Visual Studio and a program that will be sending commands to Arduinos via serial COM Ports. So, in 11 Nano MCUs, I will have motor drivers L293D/L298N ICs, while in other Nanos I ...
Frank's user avatar
  • 51
48 votes
21 answers
141k views

Serial data plotting programs

I need to plot serial data from Arduino. I require support for: Various data formats (e.g. signed, unsigned, 8 bits, 16 bits); Plots several data on the same axes; Exports / Imports file data. As ...
akellyirl's user avatar
  • 2,136
45 votes
5 answers
156k views

What is the difference between Serial.write and Serial.print? And when are they used?

What is the difference between Serial.write and Serial.print? And when are they used? Both have been used to print on serial monitor, what are their actual differences?
shadab's user avatar
  • 569
23 votes
4 answers
24k views

Communication Protocol Best Practices and Patterns

Every time I design a serial protocol to be used between two arduinos, I feel a bit like I'm reinventing a wheel. I wonder if there are any best practices or patterns people follow. This question is ...
Jeremy Gillick's user avatar
22 votes
2 answers
9k views

Why can't I upload a sketch while other components/devices are connected to my Uno?

I wanted to make a fairly simple circuit which would flash a series of LEDs in sequence, using my Arduino Uno (more specifically, a SainSmart clone). I wrote my sketch and it compiled fine. After that,...
Peter Bloomfield's user avatar
8 votes
5 answers
41k views

Arduino Pro Micro, get data out of Tx pin?

I have a Sparkfun Arduino Pro Micro with an ATmega32u4 on it and a Roving Networks RN32 Bluetooth Module Theoretically, I should be able to solder the Rx of the Bluetooth to the Tx on the arduino and ...
user3320919's user avatar
7 votes
4 answers
16k views

Watchdog timer stuck in restart loop? (green led flashing)

I am trying to set up a way to reboot arduino on command. The code below should do that but it seems like my arduino just get's stuck in some sort of a loop where I cant upload or get any serial ...
DominicM's user avatar
  • 597
4 votes
1 answer
4k views

XBee+Arduino communication problem

I tried testing the system and I’m not sure if the problem is with the XBee’s, the transmitting code, or the receiving code. Before I post my code, I will explain what we are doing with the signals. ...
user734's user avatar
  • 91
3 votes
2 answers
4k views

if(Serial) not working correctly on micro or pro micro

I have an arduino micro and several clone "pro micro"'s both of which are based on the 32u4, i'm trying to make my project have a debug mode which is only active when the serial port is open, the ...
James Kent's user avatar
3 votes
1 answer
8k views

WiFiEsp not working on Software Serial, working fine on Hardware Serial

What I want to achieve I want to connect to my wifi network using Arduino UNO and ESP8266 using WiFiEsp.h library over `SofwareSerial, since UNO doesn't have additional H/W serial. What I am able to ...
Salim Shamim's user avatar
2 votes
2 answers
3k views

Is supplying 5V from both external 5V and USB harmful?

I have an arduino nano which is powered through unregulated 5V (pin 27). For debugging purpose, I'd like to connect the USB port to my computer in order to use the Serial.Print function. The external ...
Masure's user avatar
  • 23
2 votes
2 answers
256 views

How can I reduce the redundancy of this code, so one function can perform the task of printing on Serial and Softserial?

void Multi_print (String str) { Serial.print(str); mySerial.print(str); } void Multi_println (String str) { Serial.println(str); mySerial.println(str); } void Multi_parse_int (int value) { ...
user335292's user avatar
2 votes
2 answers
2k views

NRF24L01+ (TMRH20 library): Receiver gets blank data

I am working on sample Arduino project for communication over NRF24L01+ (TMRH20 library), everything is working fine with my example except one issue my Receiver gets message but that message is blank....
Akshay's user avatar
  • 193
2 votes
4 answers
2k views

Send Processing color data into Arduino

I am trying to send color() data from Processing to Arduino. Here is my code from Processing: import processing.serial.*; Serial myPort; void setup(){ myPort = new Serial(this, Serial.list()[7], ...
orionlogic's user avatar
1 vote
1 answer
2k views

Writing and reading multiple values through serial

I am currently busy with a project that requires me to use an Arduino and 3 potentiometers (to change background in RGB format) to write values through the serial port and read and separate them in ...
Dewan's user avatar
  • 43
1 vote
2 answers
2k views

How can I get a unique address for all my Arduino boards while in RS485?

My attempt is to know how to identify the board I'll be sending parameters to in a serial connection like rs485. I'm asking because I will have about 11 or so mcu's as "Rx slaves" while my pc is the ...
Frank's user avatar
  • 51
1 vote
4 answers
27k views

ESP8266 + Arduino Uno: Can't send AT Commands

I'm trying to get the ESP8266 up and running without a FTDI chip, just my Arduino Uno. But it seems really difficult. What I did: attach the ESPs VCC directly to Arduino Uno 3.3V; RX->TX; TX->RX ...
niclas's user avatar
  • 111
1 vote
2 answers
4k views

To know the state of USB (Serial) connection (connected or not connected)

if (Serial.available()) { digitalWrite(7, HIGH); } else { digitalWrite(7, LOW); } It doesn't seem to be so simple. My testing LED turns on when the USB connection with another program ...
Leo Ervin's user avatar
  • 117
1 vote
1 answer
695 views

How to add Ultrasonic Sensor to the board?

I am making an RC car , have combined the Arduino UNO R3 with the AR 293d, and pluged in the HC-SR04 sensor to the SRO4 hole at the left top corner in the below graph. However, besides one sensor I ...
user782104's user avatar
1 vote
1 answer
254 views

Unexpected character added to char buffer array in serial monitor only when SD card initialized

I'm getting an unexpected extra character added to the serial monitor print line only when I initialize an SD card in the code. Normal The code below gives me this expected result in the serial ...
Dashiell Rose Bark-Huss's user avatar
1 vote
0 answers
604 views

Read from Blynk terminal number to arduino

I have a problem in sending numbers from blynk terminal to arduino serial monitor. When I send any number from blynk terminal the arduino always getting 1. How can I get any number please help me. ...
Time Gold's user avatar
  • 103
1 vote
1 answer
7k views

How to connect Arduino device to Linux?

I wrote Arduino sketch and it works. It waits for a command and answers text on response. Simultaneously, I can't get any response with command line tools. For example, I have the following code to ...
Dims's user avatar
  • 169
0 votes
1 answer
14k views

Pyserial serial.write() doesn't work

I need to communicate with an Arduino. When I use serial.readline() to read what Arduino has to say it works fine. But when I useserial.write('something') doesn't seem to do anything. Interesting ...
Leo Ervin's user avatar
  • 117
-1 votes
1 answer
14k views

Serial.readString() - how does it work exactly?

Someone posted a solution for a problem I had which used Serial.read() .Why doesn't readString() seem to work though? From the docs it seems it reads the data as a String object which would make ...
Leo Ervin's user avatar
  • 117
43 votes
5 answers
23k views

Serial.begin(): Why not always use 28800?

In a lot of the sample code online people add the line Serial.begin(9600) in the setup block. When I look up what Serial.begin() is on the official documentation, it says that it controls the bit per ...
Fraïssé's user avatar
  • 895