Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

45
votes
10answers
236k 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 ...
9
votes
2answers
10k 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 ...
42
votes
10answers
161k 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); ...
20
votes
4answers
79k views

What is Serial.begin(9600)?

I know that this is to print something: Serial.begin(9600); But I want to know what it really means?
15
votes
13answers
51k 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 ...
24
votes
2answers
20k 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?
5
votes
5answers
18k views

AT command is not responding on serial monitor

I am trying to send AT commands to ESP8266. I re-flashed ESP8266 http://imgur.com/a/J8Ueh I followed this tutorial http://remotexy.com/en/help/esp8266-firmware-update/ and I hope it re-flashed ...
13
votes
1answer
5k 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 ...
11
votes
2answers
7k 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, ...
4
votes
2answers
1k 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()....
23
votes
2answers
42k 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 ...
12
votes
4answers
68k 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;...
31
votes
3answers
27k 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 ...
12
votes
6answers
13k 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 ...
5
votes
2answers
4k 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 ...
6
votes
6answers
11k 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 ...
6
votes
2answers
19k 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 ...
0
votes
2answers
3k 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 ...
30
votes
18answers
76k 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 ...
18
votes
4answers
18k 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 ...
23
votes
5answers
42k 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?
11
votes
4answers
14k 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 ...
4
votes
1answer
3k 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. ...
17
votes
2answers
7k 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,...
5
votes
1answer
5k views

Can I use an external power supply and still communicate with my computer over Serial?

I read the following online: If you plug in both USB power (say from a pc) and external power via the 2.1mm jack, the Arduino chooses power source automatically. If the external 2.1mm DC is providing ...
3
votes
5answers
27k 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 ...
2
votes
1answer
792 views

arduino EM408 GPS problem

I have written this little snippet of code to interface with EM408 GPS. #include <SoftwareSerial.h> SoftwareSerial GPS = SoftwareSerial(2,3); //rx,tx void setup() { GPS.begin(4800); Serial....
1
vote
4answers
25k 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 ...
5
votes
1answer
2k views

Serial.write and Serial.println return different values? Cannot use correct ones

I have a text file on an SD card, and I am trying to print the lines to the serial monitor. This Code Works: #include <SPI.h> #include <SD.h> File myFile; void setup() { Serial.begin(...
4
votes
1answer
4k 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 ...
1
vote
1answer
672 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 ...
1
vote
2answers
1k 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 ...
1
vote
4answers
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], ...
1
vote
1answer
542 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 ...
0
votes
0answers
68 views

Empty output with GPS module GTPA010

I've synced my Uno with the Arduino IDE and I'm using the following code to get the GPS coordinates: #include <TinyGPS.h> #include <SoftwareSerial.h> unsigned long fix_age; ...
0
votes
2answers
2k 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 ...
0
votes
1answer
6k 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 ...
-1
votes
1answer
7k 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 ...
32
votes
6answers
14k 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 ...
15
votes
1answer
20k views

Arduino Nano no serial port for MacBook Air 2013

Problem I have an Arduino Nano connected via a USB cable (Type A to Mini Type B) to my MacBook Air (Mid 2013 Model). The PWR LED is on while the arduino is connected. Opening the Arduino software, ...
6
votes
4answers
20k views

How can I communicate from Arduino to MATLAB

I want to use sensors on an Arduino to control values in a MATLAB program. What are my options for communicating? I've used Processing to receive data sent via the serial cable, and that strategy has ...
4
votes
4answers
17k views

Is it possible to connect many arduino uno in one pc?

We have many Arduinos and we will be putting each of them in a cubicle. All of them are connected to only one PC. The PC will stand as a server were you can control your Arduino there.
0
votes
1answer
3k 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 ...
9
votes
1answer
3k views

How can a 5v Uno talk to a 3.3v Due?

I currently have an Uno (which operates at 5v), and I'm looking at buying a Due (which only operates at 3.3v). I'd like to make them communicate via Serial or SPI or similar, but presumably connecting ...
7
votes
2answers
11k views

How does this code line detect if a serial interface is connected?

I am working with some code for remote temperature sensor nodes. They turn the debug interface on and off depending on if anything is conneced to the serial port or not. The code is on Github here. ...
5
votes
3answers
2k views

Make Sure \n is the last character in serial string

I have an Arduino that I've put between a computer and an RS485 device. The job of the Arduino now is just to transmit data but will eventually do data logging and have a small user interface as time ...
3
votes
3answers
2k views

Problem with serial driver for CH340G board

I bought a USB Nano V3.0 ATmega328 16M 5V Micro-controller CH340G board For Arduino and tried it with Arduino 1.6.6 on my MacBook Pro running OS X 10.11.1 The USB serial could not be seen. I searched ...
2
votes
3answers
2k views

Interfacing Arduino through USB or I2C?

I am planning to connect multiple Arduinos to my Raspberry Pi. There are basically two ways I can achieve that: Use an USB hub. Each Arduino will then be available through ordinary serial commands ...
2
votes
2answers
2k 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 ...
1
vote
1answer
7k views

Send JSON via POST on SIM900 shield with AT commands

I'm trying to send a JSON POST in SIM900 shield with AT commands. After I call the AT+HTTPACTION=1 command, it returns a 601 error: +HTTPACTION:1,601,0. I saw here that the error was 601 Network ...