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
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); ...
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 ...
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 ...
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 ...
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?
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 ...
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 ...
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?
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?
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 ...
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,...
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 ...
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;...
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, ...
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
5answers
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 ...
13
votes
1answer
1k 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 ...
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, ...
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 ...
13
votes
3answers
12k 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 ...
13
votes
2answers
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?) ...
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 ...
12
votes
3answers
95k 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 ...
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 ...
11
votes
1answer
701 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 ...
11
votes
3answers
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, ...
11
votes
1answer
10k 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 ...
11
votes
2answers
37k 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 ...
11
votes
2answers
1k 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 ...
10
votes
1answer
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 &...
10
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 ...
9
votes
1answer
520 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 ?
9
votes
2answers
15k 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 ...
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 ...
8
votes
3answers
10k 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 ...
8
votes
2answers
15k 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. ...
8
votes
6answers
24k 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 ...
8
votes
3answers
19k 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"
8
votes
4answers
754 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 ...
8
votes
4answers
15k 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 ...
8
votes
1answer
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, ...
8
votes
1answer
11k 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 ...
8
votes
3answers
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 ...
8
votes
3answers
7k 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 ...
7
votes
2answers
2k views

Can you use Serial Port as a variable?

I am doing a project where, for troubleshooting reasons, I find myself often swapping components to different serial ports. Maybe one time it's in Serial, then in Serial1, maybe I need to try if ...
7
votes
5answers
94k views

Clear existing array when getting new serial command

I'm starting to build my first Arduino project but I'm running into some problems with serial communication. I get serial data from the console and store it in a char array called "data". Then, when ...
7
votes
4answers
29k 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.
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 ...
7
votes
1answer
20k 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);

1
2 3 4 5
42