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
30
votes
12answers
115k 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 ...
12
votes
2answers
23k 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 ...
1
vote
1answer
255 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; ...
62
votes
12answers
377k 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 ...
50
votes
13answers
247k 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); ...
41
votes
4answers
44k 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 ...
26
votes
3answers
121k 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?
5
votes
5answers
37k 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 ...
30
votes
2answers
33k 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?
15
votes
1answer
9k 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 ...
13
votes
2answers
12k 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, ...
11
votes
4answers
46k 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 ...
4
votes
2answers
2k 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()....
0
votes
2answers
1k 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 ? ...
0
votes
1answer
893 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,...
30
votes
2answers
61k 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 ...
16
votes
7answers
117k 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;...
18
votes
4answers
25k 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 ...
13
votes
6answers
16k 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
3answers
6k 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 ...
0
votes
1answer
1k views

Passing HardwareSerial and SoftwareSerial as a Class Property

I wish to know if there is a way to use a single property Serial0 to hold a HardwareSerial or a SoftwareSerial or other class instances supporting basic methods such as available(), read() and write(),...
7
votes
6answers
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 ...
1
vote
2answers
978 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 ...
0
votes
1answer
444 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 ...
0
votes
2answers
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 ...
42
votes
20answers
124k 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 ...
21
votes
4answers
23k 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 ...
35
votes
5answers
109k 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?
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. ...
8
votes
5answers
37k 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 ...
1
vote
1answer
6k 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 ...
21
votes
2answers
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,...
3
votes
1answer
7k 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 ...
2
votes
1answer
832 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....
2
votes
2answers
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 ...
1
vote
4answers
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 ...
7
votes
4answers
14k 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 ...
6
votes
1answer
3k 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(...
2
votes
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
198 views

Problems running Arduino project off a 9V battery

I have been working on an Arduin Uno Rev2 project for a while now. I have been developing using my MacBook, downloading code through the USB jack running it, monitoring the serial output on my MacBook,...
1
vote
2answers
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 ...
1
vote
0answers
220 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; ...
1
vote
1answer
649 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 ...
1
vote
1answer
1k 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
0answers
195 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. ...
0
votes
1answer
12k 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 ...
0
votes
2answers
3k 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 ...
-1
votes
1answer
12k 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 ...
40
votes
6answers
21k 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 ...
16
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, ...