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
54
votes
12answers
302k 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 ...
46
votes
12answers
208k 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); ...
36
votes
20answers
101k 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 ...
35
votes
6answers
17k 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 ...
31
votes
3answers
36k 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 ...
28
votes
5answers
75k 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?
28
votes
2answers
26k 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?
25
votes
2answers
51k 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 ...
22
votes
3answers
102k 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?
20
votes
13answers
86k 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 ...
19
votes
4answers
21k 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 ...
19
votes
2answers
8k 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,...
16
votes
6answers
94k 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
7k 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 ...
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
4answers
20k 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
5answers
18k 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
2answers
9k 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
15k 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 ...
12
votes
3answers
9k 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 ...
12
votes
2answers
2k 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?) ...
11
votes
2answers
18k 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 ...
11
votes
1answer
675 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
5k 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
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
2answers
25k 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 ...
9
votes
1answer
2k 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 &...
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 ...
9
votes
3answers
85k 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 ...
9
votes
1answer
400 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
1answer
12k 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
2answers
30k 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 ...
8
votes
3answers
17k 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
688 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
12k 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
5k 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
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 ...
7
votes
3answers
7k 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 ...
7
votes
5answers
83k 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
2answers
13k 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. ...
7
votes
6answers
21k 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 ...
7
votes
6answers
12k 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
4answers
21k 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 ...
7
votes
5answers
12k views

Programming arduino via bluetooth module issue

I followed a tutorial on how to setup arduino and bluetooth so it can be programmed without usb cables. I didn't use capacitors or resistors asthere doesn't seem to be a need for them. I have the ...
7
votes
1answer
522 views

On Arduino Due webserver, there is a 5 second delay on Windows, only when connected via native port

My Due webserver was working perfectly fine for months when connected to Linux via the native port. But when connected to Windows 10 via the native port, if the Arduino webserver is idle for about 5 ...
6
votes
5answers
33k 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 ...
6
votes
4answers
24k 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.
6
votes
2answers
1k views

Detect if Serial1 and Serial2 are defined, at compile time

I have my library that uses Serial, Serial1 and Serial2 to establish various logging scenarios. Library user would define the config at class constructor, using simple byte constants like 0, 1 and 2. ...
6
votes
3answers
6k views

How do I update the serial monitor without printing a new line each time?

I'm testing out an accelerometer and I want to know if there's a way to make it so that the serial monitor will update the values without printing a new line. Ideally the serial monitor would say ...
6
votes
4answers
3k views

How to connect Android phone to Arduino?

Is it possible to connect an Arduino to an Android Phone and use it for input/output? Are connections possible over USB? Or do I need to have a wifi or Bluetooth shield?

1 2 3 4 5 36