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
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
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
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
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
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
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
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
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
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
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
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
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
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
16 votes
1 answer
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, ...
Mecha's user avatar
  • 391
15 votes
3 answers
99k views

Use all pins As digital I/O

Increase the number of digital pins There are many post that explain how to use more than just the standard pins on the various arduinos but none of them explain the limitations and the proplems ...
cocco's user avatar
  • 431
15 votes
2 answers
51k views

Difference between /dev/ttyACM0 and /dev/ttyS0 (Arduino IDE ports under Linux)

I use the Arduino IDE to upload sketches to my Arduino Uno. My OS is Linux Ubuntu 14.04 LTS. The Arduino IDE has two ports by default for communication with the Arduino Uno: /dev/ttyACM0 /dev/ttyS0 ...
martin_0004's user avatar
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
14 votes
3 answers
13k views

Serial data showing up weird

I have a simple sketch that prints out "Hello World" to the serial, but I'm getting a bunch of gibberish instead. void setup() { Serial.begin(9600); } void loop() { Serial.println("Hello ...
sachleen's user avatar
  • 7,505
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
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
5 answers
20k views

Reducing lag between the arduino and a processing sketch on my computer

I'm currently on project #14 of the Arduino project book. I'm trying to control a processing sketch on my laptop using my Arduino. This is accomplished by using a potentiometer to control the ...
Kenneth .J's user avatar
13 votes
1 answer
2k views

Cannot program two arduinos at the same time because they both use the same COM port

I am not able to program my second arduino because they both use the same com port. In other words this picture says it all: In order to upload my sketch I have to disconnect one arduino. How can I ...
Tono Nam's user avatar
  • 938
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
13 votes
2 answers
3k views

Making analog telephone calls?

How can we make the Arduino board interact with old, analog telephone, and to make phone calls? I guess it involves connecting the board to the telephone with some specific cable (how it's called?) ...
Reflection's user avatar
12 votes
3 answers
6k views

High precision timing on Arduino for serial communication

I am using an Arduino Uno to send time and voltage information over the serial port to Python to plot. However the interval timings between successive time stamps appears to be increasing over time, ...
hawkar's user avatar
  • 543
11 votes
1 answer
716 views

How can I communicate Raspberry Pi and Arduino (in both ways) using a 10-15m distance wires?

I am starting a personal project of home automation and I have a raspberry pi and an arduino Uno board. I want communicate raspberry pi and my arduino where my raspberry should be able to write and ...
thiagoh's user avatar
  • 211
11 votes
1 answer
5k views

Is it OK to Serial.print(message), when the USB cable is not connected to a host PC?

Often I put a bunch of Serial.print( F("debugging messages") ) in my Arduino sketch. Normally those messages go up a USB cable to a host PC so those messages can be seen on the serial monitor. I ...
David Cary's user avatar
  • 1,112
11 votes
1 answer
12k views

Use Unix terminal instead of the Monitor on Arduino IDE

I want to make a shell or C script that interprets the Arduino serial input to run commands. For that, I will need to make that script be the Serial monitor for my arduino. Another reason I want to ...
John K's user avatar
  • 225
11 votes
2 answers
2k views

Cheap Wired Multipoint Mesh Network

I'm looking to make a 15 x 15 grid of load sensors and RGB LEDs for an interactive dance floor. Each node will be driven by an arduino and the entire floor will be managed by a RaspberryPi. I'm trying ...
Jeremy Gillick's user avatar
10 votes
2 answers
19k 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. ...
Cybergibbons's user avatar
  • 5,340
10 votes
5 answers
43k views

formatting strings in Arduino for output

I wander what is the best option for formatting strings in Arduino for output. I mean what's a preferable way in the point of view of performance, memory usage – things like that. I see, people ...
zhekaus's user avatar
  • 439
10 votes
1 answer
34k views

What does the line "while (! Serial);" do in an Arduino program?

I'm new to Arduino, and I am trying a couple of tutorials. What does this line do in a program? while (! Serial);
user avatar
10 votes
1 answer
20k views

Arduino Convert std:string to String

I'm working on BLE project with espressif library. And It returns me founded BLE device. std::string getManufacturerData(); std::string getName(); int getRSSI(); BLEScan* getScan(); When ...
BK52's user avatar
  • 203
10 votes
1 answer
3k views

How to reset Arduino from software

As you know, the Arduino IDE resets the Arduino when the Serial Monitor is opened. I want also my program to do it. But I don't know how. I examined the source code of the Arduino IDE (Serial.java &...
Bhoke's user avatar
  • 321
10 votes
1 answer
6k views

Writing First Library - Serial Stream Object

I have done quite a few projects with Arduino, but have never done more than a "Hello World" in C. I am writing my first library, and a lot of the object oriented stuff is going over my head. Anyway, ...
ahalekelly's user avatar
10 votes
3 answers
1k views

Custom Arduino board beeps and process freezes while I'm uploading a sketch to it. Why?

The strangest thing is happening to a standalone Arduino board that I designed and built. The board (whose schematics are below) has the following features: It has a ATmega328P with a 5V voltage ...
Ricardo's user avatar
  • 3,360
9 votes
3 answers
78k views

Only 2 decimal places in printed float

There was a similar thread before but it didn't solve my problem. I had an issue with sending GPS data, which is float, and I couldn't receive the float with the same amount of significant figures as ...
Anthropomorphous Dodecahedron's user avatar
9 votes
3 answers
12k views

Can I make the Arduino ignore serial print

I like having serial communication for debugging and testing purposes but after a while it takes away too much speed from the sketch. Is it possible to have the Arduino ignore serial.print and ...
Kevin Kroon's user avatar
9 votes
1 answer
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 ...
Peter Bloomfield's user avatar
9 votes
1 answer
644 views

Can you query the current serial port's speed?

Is there some code I can use to find out what the a chosen serial port's speed is running at ?
Hayden Thring's user avatar
9 votes
2 answers
18k views

What is the maximum wire length for serial communication between two Arduinos?

I am building a project in which two Arduinos will be linked by three wires: TX an RX for serial communication and a common GND. What would be the maximum length of the wires here before communication ...
hobie's user avatar
  • 487
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
8 votes
6 answers
27k views

Two Arduinos Send data via Analog Pin?

What I want to do is allow Arduino A to send some constant value to Arduino B. I sense something inherently wrong with my approach, but I cant figure out what it is. So in the diagram below you will ...
lucidgold's user avatar
  • 233
8 votes
3 answers
23k views

Serial Print, String And Variable On Same Line

How can I print to the serial monitor a string or just single character followed by a variable like "L 55"
Root0x's user avatar
  • 205
8 votes
4 answers
18k views

Is SoftwareSerial left out for the ATTiny85/84?

I want to use SoftwareSerial with my ATTiny85 and when I google it several projects claim that they are using it... I downloaded the hardware from https://code.google.com/p/arduino-tiny/, but when I ...
Jason94's user avatar
  • 293
8 votes
4 answers
806 views

For which type of serial communication is Arduino Severino designed?

Arduino has become quite costly where I come from (2/3 of the price of Raspberry PI) so I have created an Arduino Severino clone. I had used the device with the RS-232 Usb-Serial converter. But after ...
Tomáš Zato's user avatar
8 votes
4 answers
22k 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 ...
Bill Nace's user avatar
  • 224
8 votes
3 answers
8k views

Make an Arduino board act as both a usb storage device and a keyboard?

I am making an interface project that, when plugged into a computer, shows up as both usb flash storage and can type like a keyboard when some physical buttons on the board are pressed. I have seen ...
teasub's user avatar
  • 81

1
2 3 4 5
43