A New Software Serial Library for Arduino

News: NewSoftSerial is in the core!  Starting with Arduino 1.0 (December, 2011), NewSoftSerial has replaced the old SoftwareSerial library as the officially supported software serial library.  This means that if you have 1.0 or later, you should not download this library.  To port your code to 1.0, simply change all NewSoftSerial references to SoftwareSerial.

NewSoftSerial is the latest of three Arduino libraries providing “soft” serial port support. It’s the direct descendant of ladyada’s AFSoftSerial, which introduced interrupt-driven receives – a dramatic improvement over the polling required by the native SoftwareSerial.

Without interrupts, your program’s design is considerably restricted, as it must continually poll the serial port at very short, regular intervals. This makes it nearly impossible, for example, to use SoftwareSerial to receive GPS data and parse it into a usable form. Your program is too busy trying to keep up with NMEA characters as they arrive to actually spend time assembling them into something meaningful. This is where AFSoftSerial’s (and NewSoftSerial‘s) interrupt architecture is a godsend. Using interrupt-driven RX, your program fills its buffer behind the scenes while processing previously received data.


NewSoftSerial offers a number of improvements over SoftwareSerial:

  1. It inherits from built-in class Print, eliminating some 4-600 bytes of duplicate code
  2. It implements circular buffering scheme to make RX processing more efficient
  3. It extends support to all Arduino pins 0-19 (0-21 on Arduino Mini), not just 0-13
  4. It supports multiple simultaneous soft serial devices.*
  5. It supports a much wider range of baud rates.**
  6. It provides a boolean overflow() method to detect buffer overflow.
  7. Higher baud rates have been tuned for better accuracy.
  8. It supports the ATMega328 and 168.
  9. It supports 8MHz processors.
  10. It uses direct port I/O for faster and more precise operation.
  11. (New with version 10).  It supports software signal inversion.
  12. (New) It supports 20MHz processors.
  13. (New) It runs on the Teensy and Teensy++.
  14. (New) It supports an end() method as a complement to begin().

*But see below for an important caveat on multiple instances.
**Be circumspect about using 300 and 1200 baud though. The interrupt handler at these rate becomes so lengthy that timer tick interrupts can be starved, causing millis() to stop working during receives.

Using Multiple Instances

There has been considerable support for an library that would allow multiple soft serial devices. However, handling asynchronously received data from two, three, or four or more serial devices turns out to be an extremely difficult, if not intractable problem. Imagine four serial devices connected to an Arduino, each transmitting at 38,400 baud. As bits arrive, Arduino’s poor little processor must sample and process each of 4 incoming bits within 26 microseconds or else lose them forever. Yikes!

It occurred to me, though, that multiple instances could still be possible if the library user were willing to make a small concession. NewSoftSerial is written on the principle that you can have as many devices connected as resource constraints allow, as long as you only use one of them at a time. If you can organize your program code around this constraint, then NewSoftSerial may work for you.

What does this mean, exactly? Well, you have to use your serial devices serially, like this:

#include <NewSoftSerial.h>

// Here's a GPS device connect to pins 3 and 4
NewSoftSerial gps(4,3);

// A serial thermometer connected to 5 and 6
NewSoftSerial therm(6,5);

// An LCD connected to 7 and 8
NewSoftSerial LCD(8,7); // serial LCD

void loop()
  // collect data from the GPS unit for a few seconds
  read_gps_data();  // use gps as active device
  // collect temperature data from thermometer
  read_thermometer_data(); // now use therm
  // LCD becomes the active device here
  LCD.print("Data gathered...");

In this example, we assume that read_gps_data() uses the gps object and read_thermometer_data() uses the therm object. Any time you call the listen() method, it becomes the “active” object, and the previously active object is deactivated and its RX buffer discarded. An important point here is that object.available() always returns 0 unless object is already active. This means that you can’t write code like this:

void loop()
  if (device1.available() > 0)
    int c =;
  if (device2.available() > 0)
    int c =;

This code will never do anything but activate one device after the other.

Signal Inversion

“Normal” TTL serial signaling defines a start bit as a transition from “high” to “low” logic.  Logical 1 is “high”, 0 is “low”.  But some serial devices turn this logic upside down, using what we call “inverted signaling”.  As of version 10, NewSoftSerial supports these devices natively with a third parameter in the constructor.

NewSoftSerial myInvertedConn(7, 5, true); // this device uses inverted signaling
NewSoftSerial myGPS(3, 2); // this one doesn't

Library Version

You can retrieve the version of the NewSoftSerial library by calling the static member library_version().

int ver = NewSoftSerial::library_version();

Resource Consumption

Linking the NewSoftSerial library to your application adds approximately 2000 bytes to its size.


The latest version of NewSoftSerial is available here:  Note: don’t download this if you have Arduino 1.0 or later.  As of 1.0, NewSoftSerial is included in the Arduino core (named SoftwareSerial).

Change Log

  1. initial version
  2. ported to Arduino 0013, included example sketch in package
  3. several important improvements: (a) support for 300, 1200, 14400, and 28800 baud (see caveats), (b) added bool overflow() method to test whether an RX buffer overflow has occurred, and (c) tuned RX and TX for greater accuracy at high baud rates 38.4K, 57.6K, and 115.2K.
  4. minor bug fixes — add .o file and objdump.txt to zip file for diagnostics.
  5. etracer’s inline assembler fix to OSX avr-gcc 4.3.0 interrupt handler bug added.
  6. ladyada’s new example sketch, fix to interrupt name, support for 328p.
  7. etracer’s workaround is now conditionally compiled only when avr-gcc’s version is less than 4.3.2.
  8. 8 MHz support and flush() and enable_timer0()  methods added
  9. digitalread/write scrapped in favor of direct port I/O.  Revised routines now get perfect RX up to 57.6K on 16MHz processors and 31.25K on 8MHz processors.
  10. inverted TTL signalling supported.  20MHz processors supported.  Teensy and Teensy++ supported.  New end() method and destructor added to clean up.
  11. added listen() method to explicitly activate ports.
  12. warn users about 1.0 conflict


Many thanks to David Mellis, who wrote the original SoftwareSerial, and to the multi-talented ladyada, whose work with AFSoftSerial is seminal.  Ladyada also provided the “Goodnight, moon” example sketch, fixed a problem with the interrupt naming (see v6) and tested NSS with the 328p.

Thanks also to rogermm and several other forum users who have tested NewSoftSerial and given useful feedback.

The diligent analysis of forum user etracer yielded the root cause of a tricky problem with NSS on OSX.  A bug in avr-gcc 4.3.0 causes the compiler to fail to generate the proper entry and exit sequences for certain interrupt handlers.  etracer identified the problem and provided an inline workaround.  etracer’s fix is in NSS 5.

User jin contributed a large body of work based on NSS and identified a potential problem that could result in data loss (fixed in NSS 5).  jin also made a variant of NSS that supports 4-pin serial, with the additional pins providing a very nice RTS/CTS flow control.  We may see this in NSS in the near future.

Thanks to Garret Mace, who contributed the delay tables for 20MHz processors and claims that he can send and receive at 115K baud.  Cool!

Thanks to Paul Stoffregen, both for his fine work with Teensy and Teensy++, and for contributing some useful suggestions that help NewSoftSerial run on them without modification.

I appreciate any and all input.

Mikal Hart

Page last updated on July 3, 2013 at 7:37 pm
645 Responses → “NewSoftSerial”

  1. tol

    7 years ago

    hello guys!

    can i ask a help from you, i am designing a wireless meter, i am using arduino with gsm module, the problem is the gsm module cannot communicate correctly to the arduino, i cant do program that suitable to the module and arduino and it will works, anyone can help me?

  2. Simon

    7 years ago


    I need to use newsoftserial with a device that requires 7E1.
    Are you going to implement it?


  3. Mikal

    7 years ago

    Hi Simon,

    I don’t think it would be too hard, but no, I’m afraid I don’t currently have any plan to implement E71. Anyone like to give it a try? The main difficulty would be making sure that the changes don’t disrupt the bit timings.


  4. Gabriel Leen

    7 years ago

    Hi Mikal,
    Thanks for NewSoftSerial!
    Just a question as I’m getting an unexpected compile error.
    I’ve a Touchshield Slide which connects to a Duemilanove. The native Hardware Serial port on the Duemilanove is used to communicate with the Touchshield Slide. I’ve tried to use NewSoftSerialand I’m just getting compile errors: ‘`digital_pin_to_port_PGM’ and ’port_to_input_PGM’. Can you help ?
    A) the IDE is the Antipasto branch of the Arduino IDE, version: 0018-Antipasto-0043
    B) I put the .h & .ccp in: Antipasto/hardware/arduino/cores/touchscreen/src/components/board, is this the correct directory?

    Here is a link to where I posted the error (in more detail) and have received no reply yet. (,57456.0.html)
    Thanks for your help!!!!

  5. eazry

    7 years ago

    this my first time use newsoftserial…
    anybody can help me to teach how to install the newsoftserial…???
    thanks a lot…

  6. Joe Foley

    7 years ago

    Hi there. I’ve been enjoying using your NewSoftSerial 10 for a project I’m working on, to get good iRobot Create control out of an UNO on nonUSART pins. Problem is that the receive buffer seems to loose it at 56K after about 5 bytes. I see a buffer of 64, so I would assume that is the limit. Am I missing something?

  7. guillaume

    7 years ago


    I tried using the NewSoftSerial library, but I am unshure about two points:

    is it
    NewSoftSerial mySerial(softRx, softTx); or
    NewSoftSerial mySerial(softTx, softRx); ?

    Also I suppose that it is not necessary to declare the pins softTx and softRx as OUTPUT and INPUT in the setup() function. Am I right? Maybe it is even forbidden?

    Maybe you can add these points to the documentation while I try to succeed with try and error…

    Best regards,

  8. Mikal

    7 years ago

    @Joe, there are two reasons you might experience data corruption. The first is that you are not retrieving the data fast enough and the buffer is overflowing. The second is that you are using a high baud rate and the timer tunings are not quite working out for your clock. 56K is quite a high rate for Arduino soft serial, so either is conceivable. One way to tell is to check nss.overflow(). If that returns true you know you’re experiencing buffer overflow. Unfortunately, at 56K, it’s also possible that the deserializer simply can’t keep up. Is there any way to slow down the device you are communicating with?

  9. Mikal

    7 years ago


    The general convention is RX first, then TX, but you are quite right that this could be made more clear in the documentation. Thanks.

    As far as declaring the pins before using the library, my thinking is that any decently-written library should handle all the pinMode settings for you. Once you “give” those pins to the library, you shouldn’t touch them. That is the case here. Although it doesn’t hurt to declare them as INPUT/OUTPUT, in the interest of avoiding confusion I recommend leaving the pinMode definitions out.

    By the way, I enjoy your poetry. It’s good to see that you’re still around! :)

  10. Tim

    7 years ago

    Maybe you should point out this doesnt coexist very well with the Servo library.

  11. Mikal

    7 years ago

    Quite right. The new (>= 0016) Servo library doesn’t coexist well with software serial. The former requires interrupts and the latter requires interrupts to be disabled. Whenever I need to drive servos with NewSoftSerial, that is, all the time, I use the old Servo library, which I’ve reposted on this site as PWMServo.


  12. Doug

    7 years ago

    I am only using RX to receive external data with no need for Ack and want to use just a single pin. Is there an option for not assigning a TX pin?

    NewSoftSerial mySerial(softRx, NULL);

  13. Mikal

    7 years ago

    Doug, you almost have it right. Do this instead:

    NewSoftSerial mySerial(softRX, -1);


  14. Wyatt

    7 years ago

    I have a question that might seem rather easy but I am integrating 5 devices. A BMA 180 triple-axis accelerometer, ITG 3200 triple-axis gyroscope, HMC5843 triple axis magnometer, BMP085 barometric pressure sensor, and the Venus 09133 gps unit. The problem I am having is I can get the data from all the devices except the gps. I am only use the Analog pins 4 and 5 to talk to these devices. It runs smoothly. Now I tested the gps and I can get this to run perfectly by itself from the digital pin 0 and 1 by using your library. Now my question is when I connect the gps to the Arduino I can’t get any data from the devices. Do I have to use seperate pins for each device and call them in whatever order I think the most important? Is there anyway to just use pins 4 and 5 for the first four devices and use 0 and 1 for the gps at the same time?

  15. Wyatt

    7 years ago

    Well after sometime going over the library again I realized the problem and it was a very simple fix. I am able to grab all the data from those five devices and route them to the processing to get a 3D simulation of the whole perf board that I created. It was a great feeling. I want to thank you for having such good libraries. Now all I have to do is fix my EKF to get a better simulation of the device!

  16. Mik

    7 years ago

    Can you tell us where the documentation for this is? Is there a javadocs api? All I could find was a download for a work of documentation in progress.
    Thanks, and great work on the newsoftserial library!

  17. Mikal

    7 years ago

    This is it, Mik. :)

  18. Stephen G.

    7 years ago

    Here’s a interesting twist.. the same digital pin for serial in & out, but with a need to send a solid 300ms sync pulse 1st, and a 2nd digital pin to act as a PTT switch. I’m looking at the Parallax 433Mhz RF transceivers, and these operate like walkie-talkies when used. they use the same pin for serial in & out, a RX/TX pin to handle which mode, and a signal detected pin to tell if a carrier is detected. I’m trying to make a rudimentary link between an arduino connected to the computer as a host transceiver, and the arduino on a mobile robot as it’s own transceiver. protocol to talk between the two, would be similar to the old (showing my age) X-Modem protocol, but with a variable length packet up to 256 bytes at a time., with a attention byte, length byte, the string of data, and a 16-bit CRC. to which the receiver would acknowledge if the data CRC matches, to either Okay, or corrupt.(and resend request.) Both would talk back & forth in this method. Could the NewSoftSerial library be adapted to handle this?

  19. Aof

    7 years ago

    Hello, Mikal.

    From your example,


    // Here’s a GPS device connect to pins 3 and 4
    NewSoftSerial gps(4,3);

    // A serial thermometer connected to 5 and 6
    NewSoftSerial therm(6,5);

    // An LCD connected to 7 and 8
    NewSoftSerial LCD(8,7); // serial LCD

    If I typed gps.println(“Hello World”), I would like to where would the output show out?? If it possible to make it print on the serial monitor or HyperTerminal.

    Thx for your answer.

  20. Mikal

    7 years ago

    @Stephen G,

    Interesting. I think you could use NewSoftSerial in this case like this. (I haven’t tried it but it ought to work.)
    if (need_to_transmit)
    NewSoftSerial nss(-1, 6); // transmit on pin 6

    else // receive mode
    NewSoftSerial nss(6, -1); rx only
    // read here

  21. Mikal

    7 years ago


    If you do gps.println(“Hello, world”) the data is sent to the GPS device which is probably not what you want. If you want to send data to the serial monitor, use

    Serial.println(“Hello, world”);

  22. Aof

    7 years ago

    But if we use some libraries which cannot use with “Serial”, how can I receive the data from serial monitor or hyperterminal??

  23. Jordan

    6 years ago

    Very specifically, where is the documentation for NewSoftSerial??

  24. Mikal

    6 years ago

    Jordan, I need to write some formal documentation, but I haven’t yet. This is it.


  25. Roger

    6 years ago

    So I am new to this. Does this NewSoftSerial download work with:

    Serial Enabled 16×2 LCD – White on Black 5V.


  26. Rick

    6 years ago

    I’d like to use this library to communicate to a device with a single wire.

    Currently, I’m using the library like this:
    NewSoftSerial mySerial(2, 2); (same pin for rx and tx)

    This works (with version 9) if I use:
    mySerial.setTX(2); and mySerial.setRX(2) before printing and reading

    However, when I remove the setTx/setRx functions it no longer works.

    If the Rx and Tx pins are the same, why would I need to set them with the setTX/setRX function?

    I’d like to use version 10 – but can’t figure out how to support a 1 wire communication with it yet.

  27. Mikal

    6 years ago


    Yep, it should!

  28. Mikal

    6 years ago


    Hmm… interesting question.

    I think I would create temporary NewSoftSerial objects, something like this:

    if (time_to_print)
    NewSoftSerial mySerial(-1, 2);
    mySerial.print("Hello, world");
    NewSoftSerial mySerial(2, -1);
    // do some RX here


  29. Douglas

    6 years ago

    OK, I think I need help with this. Making a box, but I’m having very slow GPS pickup (or none at all) and I’m trying to debug. So I figured I’d look at the GPS lines using:

    in setup( )
    /* establish a debug session with a host computer */

    // Establish communication with the GPS

    in loop( )

    Serial.print(, BYTE);

    hoping to get what I saw on this YouTube video ( – that is, a bunch of lines with interpretable $GP… type statements on the serial monitor.

    but what I see is this:




    [AND SO ON]

    ??? I don't know what to make of it. Some of the $GP lines are there, but what else is going on???

    Any ideas?

  30. Mikal

    6 years ago


    Yep, I know exactly what’s going on. You are trying to read from the nss port before the data has arrived. (That umlauted y character is ASCII for 255. read() returns -1 (255) when no character is available.) You need to check nss.available() > 0 before calling


  31. Douglas

    6 years ago

    @Mikal, awesome, thanks. Got it. Now I’ll try to figure out what’s going on…

  32. Alex Forencich

    6 years ago

    Is there any particular reason the write function is private? Some people need to work in binary mode from time to time…..

  33. Sebastian

    6 years ago

    Hi, how can i communicate two arduinos with this Library, i need to send a float.

  34. MAPGPS

    6 years ago

    How can I use NewSoftSerial to make half-duplex communication over one Pin?

    I tried:
    NewSoftSerial test(2,2);

    But it does not work.

    Or should I use:
    NewSoftSerial test(2,3);
    And combine Pin 2 and Pin 3?

  35. Mikal

    6 years ago

    @Alex, in the beta 11 version (elsewhere on this site) the write function is no longer private.

  36. Mikal

    6 years ago


    The best way to accomplish that is to create a new temporary NewSoftSerial object that communicates in one direction, then destroy it and create another one for the other direction. For example

    if (transmit)
    NewSoftSerial(-1, 2);
    ... transmit on pin 2
    NewSoftSerial(2, -1);
    ... receive on pin 2

  37. Stephen

    6 years ago

    How would I go about using this library at 8600 baud? It works great at 9600 however the piece of equipment I’m using is fixed at this odd baud rate.

    I assume that it would be as simple as inserting another row into the look up table. However I don’t know how to calculate the values. I’m using the Uno. Thanks!

    { 9600, 114, 236, 236, 233, },
    { 8600, ? , ? , ? , ? , },
    { 4800, 233, 474, 474, 471, },

  38. Mikal

    6 years ago

    8600? Weird. You are correct that inserting a new row in the table should be all you need to support the new baud rate.

    As a very rough guess at the delay numbers for a new rate, you can do an arithmetic interpolation to get 9600*114=1094400 and 1094400/8600=127. Similarly, 9600*236=2265600 and 2265600/8600=263. Using this technique you get

    { 9600, 114, 236, 236, 233, },
    { 8600, 127, 263, 263, 260 },
    { 4800, 233, 474, 474, 471, },

    These aren’t exactly right, but at these low baud rates I wouldn’t expect it to matter.


  39. Stephen

    6 years ago

    Thanks! Those values work perfectly.

  40. Sigurd

    6 years ago

    Hi Mikal,

    Great Library, but I have a problem.

    I have a gps and cell shield connected to the arduino. When I try to communicate with one of them – it works fine, but when I try to communicate with both of them – I dont get anything back.

    Do you see what the problem could be?

    Kind Regards

    /////////////////////////THE CODE/////////////////////////////////

    TinyGPS gps;
    NewSoftSerial nss(4, 5), cell(2, 3);

    bool feedgps();
    void gpsdump(TinyGPS &gps);

    void setup(){
    Serial.println(“Ready to receive!”);

    void loop(){

    //Do something.
    //If I remove this if statement – I can read the GPS data, but when I include this if statement – I get nothing.

    bool feedgps(){
    while (nss.available()){
    if (gps.encode(
    return true;
    return false;

    void gpsdump(TinyGPS &gps){
    float latitude, longitude;
    gps.f_get_position(&latitude, &longitude);
    Serial.print(“Latitude: “); Serial.println(latitude, 5);
    Serial.print(“longitude: “); Serial.println(longitude, 5);

  41. JeffOB

    6 years ago

    I needed a way to time out if no gps was available.
    do you see any problem with using newsoftserial as i do in the code below.
    specifically i’m curious what state the pins are left in after i call nss.end()
    I’m trying to track down an electrical noise issue that i see randomly after a gps fix. wondering if the pins are being left in a state that could contribute to a noise problem.

    Thanks Jeff

    code below

    // FeedGPS()
    boolean FeedGPS()
    while (nss.available())
    if (gps.encode( return true;
    return false;

    // GPS_Available(unsigned long ulTimeOutMS)
    int GPS_Available(unsigned long ulTimeOutMS) {
    bool newdata = false;
    unsigned long feedstart = 0;
    unsigned long theTime = 0;

    Serial.print(“Begin GPS_Available…\r”);

    msCounter = 0;
    while (msCounter < ulTimeOutMS) {
    feedstart = msCounter;
    while (msCounter – feedstart < 2000)
    if (FeedGPS()) newdata = true;

    if (newdata)
    theTime = msCounter;
    Serial.print("GPS_Avail. took ");
    Serial.print(" ms.\r");
    gps.get_position(&lat, &lon, &age);
    gps.crack_datetime(&year, &month, &day, &hour, &minute, &second, &hundredths, &age);
    return SUCCESS;


    Serial.println("Error: GPS Timed Out\r");
    return FAILURE;

  42. Dave

    6 years ago

    Greetings Mikal,
    Thank you for your hard work on NewSoftSerial. It has been invaluable for me to get debugging output while working with XBee modules and other testing.

    I need to add more serial devices to a Arduino Uno and I want to determine if I understand what you wrote in “Using Multiple Instances”.
    I will be using a GPS, XBee, RFID reader, and a debugging output.

    Can I do the following so that I do not lose any serial input to Arduino from any device?
    NewSoftSerial debug(-1, 6); // transmit debug messages on pin 6
    NewSoftSerial gps(3, 4);
    // XBee connected to Arduino UART pins 1 & 2
    NewSoftSerial rfid(5, -1); // receive only

    void loop()

    gps.begin(38400); // select GPS module for use with NSS
    if (gps.available())
    // process;
    // use gps.end(); ???
    rfid.begin(9600); // select RFID reader for use with NSS
    if (rfid.available())
    // process;
    // Check if XBee has valid data


    Is this the correct way to switch between serial inputs?
    I’m assuming that I’m at risk of loosing GPS serial data that is received at the same time as the RFID reader is selected and is in the process of outputting data, correct?
    Or am I going about this the wrong way?

    Thank you for any assistance you can offer!

  43. Mikal

    6 years ago


    You can’t listen to two devices at the same time over soft serial. Read elsewhere in this blog for details, but what you need to do is work with one and then the other serially.


  44. Mikal

    6 years ago


    The timeout code seems relatively good to me, although take note that encode() returns true when it has parsed any legal NMEA sentence, NOT just when it successfully gotten a GPS fix. On my puzzle boxes this routine would never reach the “if (newdata)” line, even inside the basement of a tall building, because my GPS is always generating legal NMEA at least once per second.

    If that’s not what you want, you might try looping on age == GPS_INVALID_AGE and/or newdata as well.


  45. Mikal

    6 years ago


    I’m sorry to say that there is no way to “not lose any serial input to Arduino [Uno] from any device”. This example won’t work because while the “gps” port is active, the “rfid” port will be missing incoming data and vice-versa. The only hope really is to make, say, the RFID reader the active listening device, and then only switch to the GPS device once you’ve completely processed an RFID “transaction”–whatever that means. Something like

    void loop()
      bool finished_with_RFID = false;
      bool finished_with_GPD = false;
      while (!finished_with_RFID)
        // process XBee data from Serial port
        // process RFID data from RFID port
        // if RFID complete, set finished_with_RFID=true
      while (!finished_with_GPS)
        // process XBee data from Serial port
        // process GPS data from GPS port
        // if GPS complete, set finished_with_GPS=true


  46. JeffOB

    6 years ago

    Hi Mikal,
    Thanks for your response. can you comment on my repeated use of nss.begin(4800) and nss.end()
    the gps is constantly sending data but i am not listening until i call nss.begin() and once i’m done i stop listening with nss.end() eventually the board powers off the gps and goes to sleep for 10 minutes before waking up to get another fix.

    are there any issues with this strategy? i didn’t want my main code being bogged down with the interrupts from the gps strings when i wasn’t needing gps. but i didn’t want to power off the gps either to avoid the longer waits of a cold start. so i used nss.begin() and nss.end() to sort of listen only when i needed to. does this make sense?

    thanks again


  47. Mikal

    6 years ago

    @Jeff, I implemented nss.end() for exactly the scenario you describe–to turn off interrupts during the time where the input device is not interesting.

    Your project seems interesting. Can you share a bit about it?


  48. Henry

    6 years ago


    I’m trying to use TinyGPS, newsofserial and to send the data via I2C, however, when it read the GPS and trting to send data via I2C, the arduino stops working few seconds.

    I don’t know how to solve this, could you please advice

    Many Thanks

  49. JeffOB

    6 years ago

    Hi Mikal,
    Thanks again for your response. Could you also comment on what state the rx and tx pins are left in after calling nss.end(). Input/Output? Pulled up or floating? etc.

    also I was under the impression that gps.encode() would return when it got a legal string that had and “a” for active. what causes fix age to change from invalid to some amount of milliseconds.

    The system uses gps to make decisions on when to sample some environmental data.


  50. Mike

    6 years ago

    Help, Iam using newSoftSerial to drive a GSM modem and everything is fine until I call “an0 = analogRead(A0);”.

    After that, I get no received characters at all.

    With the serial port hooked upto gtkterm, I can see output i.e. (the Arduino issuing AT+CSQ in this test case).

    If I comment out the analogRead call, it works fine.

    I’ve tried re-initialising the newSoftSerial in the loop(), but to no avail. Any ideas?


92 Trackbacks For This Post
  1. NewSoftSerial 5 « Arduino

    [...] NewSoftSerial version 5 is available. A lot of people have been using this library — thanks! — but I really need to recognize the exceptional work of two contributors. [...]

  2. NewSoftSerial 6 « Arduiniana

    [...] I posted the new library. [...]

  3. เริ่มต้นสร้าง GPS จอสีกับอาดูอี้โน่ | Ayarafun Factory

    [...] ในรอบนี้ผมได้ใช้ newSoftwareSerial3 จะได้ลองด้วยว่า มีปัญหาไหม

  4. Unlogic » USB Storage and Arduino

    [...] of the first things to do is download NewSoftSerial

  5. The Hired Gun » GPS project: the Bluetooth saga

    [...] to the task at hand, which happened to be adding 3 lines of code: declaration of an instance of NewSoftSerial, calling the instance constructor with a baud rate, and a single call to pass the char from the [...]

  6. layer8 » Controlling A Roomba with an Arduino

    [...] and the XBee module has a serial interface.  So how does this really solve my problem?  Enter NewSoftSerial, an updated version of the Arduino software serial library, which basically lets you drive a serial [...]

  7. This and That » Blog Archive » Arduiniana - What else would it be?

    [...] is probably the coolest gift idea I’ve seen.  Mikal, you rock.  And also, thank you for NewSoftSerial.  [...]

  8. Interfacing the Arduino with the DS1616

    [...] way.  Let’s move onto the software.  Communication with the DS1616 is established using the NewSoftSerial library.  Getting data is essentially a case of lots of bit banging.  The DS1616 library [...]

  9. Serial Multiplexing « Interactive Environments Minor 2009-2010

    [...] So we started looking for a solution to overcome this tiny inconvenience. First we looked into a software serial but this didn’t work out, it was a bit too much for the arduino’s little processor to [...]

  10. Atmega/Arduino (Soft-) Serial Ports | Jochen Toppe's Blog

    [...] software serial port. I briefly thought about writing one, but then I found this great libary, the New SoftSerial. It is as simple to use as the original library, but unfortunately once I connect the RF receiver, [...]

  11. The Frustromantic Box, Part 4: Software « New Bright Idea

    [...] developers for the great libraries, and to Mikal Hart in particular for his work on the TinyGPS and NewSoftSerial [...]

  12. side2 » Bimeji Client for Arduino

    [...] このソースでは、PS2ライブラリとNewSoftSerialライブラリを利用しています。 コンパイルするには、これらのライブラリを有効にしておく必要があります。 [...]

  13. Live Twitter Table using New Bluetooth Shield | Club45

    [...] as a well. The shield can be wired to any of the pins on the Arduino. Right now we’re using NewSoftSerial on pins 4 and 5. It can be attached to the hardware RX and TX pins, but interferes with [...]

  14. tokyo->kobe->osaka << Motoi Ishibashi

    [...] 急遽、Arduinoでシリアル通信をふたつやる必要が発生してホテルで開発。といっても手元にハードがないので、ほとんど勘でプログラムしているようなもの。 次の日現場で試すも、予想通り動かない。そりゃそうだ。 NewSoftwareSerialなんていう便利なものがあるのを後で知った。 [...]

  15. VDIP1 USB Host Controller « Arduino Fun

    [...] chose the NewSoftSerial library to give access to the VDIP1.  The first attempt was to use the AFSoftLibrary and it just [...]

  16. Project Lab

    [...] software running on the Arduino ATMEGA328 chip utilizes the wonderfully robust NewSoftSerial library for communicating with the EM-406a GPS module and the very convenient TinyGPS library for [...]

  17. Box Round 2 « Stromberg Labs

    [...] is available here. I borrowed from a couple of people’s Arduino libraries to get this done, notably NewSoftSerial from Arduiniana and the GPS Parsing code from the Arduino website for parsing the NMEA strings. [...]

  18. Grok Think » Blog Archive » I got Arduino sending temp to the computer using xbee wireless.

    [...] I had to use this library to communicate with the xbee from the arduino: [...]

  19. GPS – Welcher Chip? | Ranzow im Umbau

    [...] wird über die Serielle Schnittstelle angesteuert. Die werde ich wahrscheinlich über die NewSoftSerial Library [...]

  20. GPS – Welcher Chip? | Ranzow im Umbau

    [...] GPS Modul wird über die Serielle Schnittstelle angesteuert. Die werde ich wahrscheinlich über die NewSoftSerial Library [...]

  21. Cititor RFID 125KHz « Tehnorama

    [...] metoda de a afla codul cartelei este de a utiliza biblioteca NewSoftSerial, disponibila gratuit aici. Fisierul zip se dezarhiveaza si se copiaza in folderul libraries al distributiei [...]

  22. Lightweight software UART -> custom serial « Robotics / Electronics / Physical Computing

    [...] updated the NewSoftSerial library from Arduiniana (thanks Mikal !) so that it takes 2 extra [...]

  23. Control Camera with Arduino | SenSorApp

    [...] [...]

  24. GPS testing with LCD Character Display

    [...] the TinyGPS library from Arduiniana downloaded and installed for it to work. They suggest using NewSoftSerial, but I couldn’t get that to work, so I scrapped that portion. Here’s my [...]

  25. #Rallylog Fusebits

    [...] it as a fail and moved on, however last night when I set about writing the RFID read function using NewSoftSerial on the RFID I was getting nothing reported back back on the AVR, not a thing coming back from the [...]

  26. 433 MHz receiver and NewSoftSerial at

    [...] [...]

  27. Moving Forward with Arduino – Chapter 17 – GPS « t r o n i x s t u f f

    [...] devices. At this point you will need to install two libraries into the Arduino software – NewSoftSerial and TinyGPS. Extract the folders into the libraries folder within your arduino-001x [...]

  28. Moving Forward with Arduino – Chapter 17 – GPS « Hey it’s my blog…

    [...] this point you will need to install two libraries into the Arduino software – NewSoftSerial and TinyGPS. Extract the folders into the librariesfolder within [...]

  29. Sonar | Starter Kit

    [...] there is one more library – “NewSoftSerial”, which is free of these defects and, in addidion, handles inverted serial [...]

  30. Advanced RFID with Arduino and Python! | App Delegate Inc

    [...] NewSoftSerial [...]

  31. RFID Door Opener – Update 3 – LCD Woes - Sommineer

    [...] one on some other pins.  Per the suggestion of some people on the Arduino forums, I decided to use NewSoftSerial to do the communication.  Being interrupt driven, it was much more efficient than the older [...]

  32. keyHelper final project

    [...] the code you will need a very useful NewSoftSerial library, that, among other things, allows you to assign TX and RX on other pins then 0 and 1 and that way [...]

  33. Step-by-Step Guide on using the Bluetooth Bee, Bees Shield & Arduino to communicate via bluetooth | Michael Chuah

    [...] up would be to try and use the awesome NewSoftSerial library by Mikal Hart to communicate with the Bluetooth Bee by emulating the UART [...]

  34. Tutorial: Arduino and GSM Cellular – Part One « t r o n i x s t u f f

    [...] a software perspective we will need the NewSoftSerial Arduino library, so please download and install that before moving [...]

  35. Interfacing Arduino to GSM shield | Embedded projects from around the web

    [...] goes step by step how to connect Cellular shield to Arduino mega and communicate to it by using newsoftserial Arduino library. Whole process steps are monitored in terminal window, so it is easy to follow [...]

  36. Fully functional Arduino GPS logger « Liudr's Blog

    [...] NewSoftSerial library [...]

  37. LCD117 Controller Library - Jack Kern

    [...] also need the NewSoftSerial library installed in your Arduino sketchbook’s library [...]

  38. Touch game for the offspring | NinjaTool inc.

    [...] GLCD that I bought (without knowing ANYTHING about it beforehand I might add). The code uses the NewSoftSerial library which apparently does wonders, but as of yet has not been validated as the code assumes a 9V [...]

  39. Arduino GSM and GPRS shield | Open Electronics

    [...] the pin 4 and 5 there aren’t problems to upload the sketch but the maximum baudrate for NewSoftSerial (the serial library) is 57600. We performed a GSM library to controll easly the module. The GSM [...]

  40. Moving Forward with Arduino – Chapter 19 – GPS part II « t r o n i x s t u f f

    [...] forget the 10k ohm pull-down resistor). You will need to install the SdFAT library, NewSoftSerial library, TinyGPS library and the SdFat library if not already [...]

  41. Blog What I Made » YAHMS: Base Station

    [...] of just the standard Serial interface, see the links below for that too. You’ll also need NewSoftSerial of course and the Flash library which I’ve used to decrease memory usage. Follow the [...]

  42. Infovore » Nikon D-Series Intervalometer

    [...] a single wire, which again, keeps the number of wires from the Arduino down. I’m using the NewSoftSerial library to talk to it, which makes life [...]

  43. Arduino Experiments

    [...] you can use multiple serial “ports”, that are actually digital I/O lines, by using the NewSoftSerial library. This works exactly like the Serial library, but you can read from multiple pins, as long as you [...]

  44. EasyTransfer Arduino Library « The Mind of Bill Porter

    [...] it’s easier to pick which Serial port to use; Serial, Serial1, etc. AND support for the NewSoftSerial library for creating software serial ports on any pin. Inside the download zip file are two versions of the [...]

  45. Research: RFID, XBee and Arduino « Beyond the keyboard

    [...] neat thing is the NewSoftSerial library for Adruino, allowing you to turn any set of pins into additional RX/TX pins with free to set baud [...]

  46. jomuoru weblog » Blog Archive » Esto es Camus Party

    [...] de instalar la librería NewSoftSerial pude compilar e instalar el Arduino Firmware en mi placa. A continuación necesitaba descargarme [...]

  47. Update: Design review « Appiphania

    [...] a bit of this code at the end of this journal entry. The “NewSoftSerial” library was extremely easy to get working (code example [...]

  48. Anonymous

    [...] Modul per Software-UART? Bitte einen Link oder Hinweis wo ich nachlesen kann. danke Schaust du hier __________________ FHZ1300 | 2x JeeLink | AVR-NETIO | FS20 | 1-Wire | 2x XBEE Pro | 4x XBEE 2.5 [...]

  49. Using A Second (Software) Serial USB To Debug Your Arduino | Utopia Mechanicus

    [...] actually really easy, using some code called NewSoftSerial (available from this site, at the ‘Download’ subheading). This software is much like your Serial device you use on the Arduino, but it’s in software [...]

  50. Kemper LED / Arduino Interface » Powerhouse Electronics

    [...] provided by the software library “NewSoftSerial”. The library can be downloaded from:: Since the communications port is created using software any of the Arduino port pins can be used. [...]

  51. Android talks to Arduino | ★ Elmindo Blog ★

    [...] NewSoftSerial library from Mikal Hart: [...]

  52. Utilizando a Bees Shield em uma Arduino Mega « A arte do hardware

    [...] via jumper na própria shield. Para comunicação com essa Bee, é necessário o uso da biblioteca NewSoftwareSerial, permitindo fazer que dois pinos digitais se tornem mais uma [...]

  53. Arduino camera and geotagger |

    [...] NewSoftSerial lib was used for communicating over serial using an IO [...]

  54. Bluetooth + Arduino + Android – 1 : Transmettre des données d’un capteur branché sur une carte Arduino vers un Smartphone Android via bluetooth

    [...] 1– télécharger la bib­lio­thèque New­Soft­Se­r­ial pour Arduino Des expli­ca­tions et exem­ples plus détail­lés con­cer­nant cette bib­lio­thèque sur cette page ( [...]

  55. Arduino + fon + OpenWRT + ser2net + NewSoftSerial « sea side she side

    [...] そのためソフトウェアシリアルを再現させたライブラリがありますのでそれを利用します。とはいっても標準ライブラリのSoftwareSerialは利用しません。高機能で速度もでるようになったNewSoftSerialを利用します。 [...]

  56. David C. Dean Arduino GPS – On the Cheap

    [...] NewSoftSerial Library - [...]

  57. Telemetry Using Xbee Modules | Anacortes RC Sailors

    [...] arduino remotely can be found here. For communication over XBee the Arduino appears to need the NewSoftSerial library. LD_AddCustomAttr("AdOpt", "1"); LD_AddCustomAttr("Origin", "other"); [...]

  58. NewSoftSerial, Attachinterupt() and Pins 2,3 | Anacortes RC Sailors

    [...] for attacheinterupt() are 2 and 3. The GPS shield uses digital 2 and 3 for GPS communication using NewSoftSerial. So I tried moving the GPS to other pins, 8 and 9 worked. Now pins 2 and 3 are free for my [...]

  59. Telemetry Using Xbee Modules | Anacortes RC Sailors

    [...] arduino remotely can be found here. For communication over XBee the Arduino appears to need the NewSoftSerial library. [...]

  60. [Arduino] Lecteur RFID à écran lcd, avec stockage du tag “valide” en EEPROM externe I2C « Skyduino – Le DIY à la française

    [...] Dans ce projet vous pouvez remarquer que je suis obligé d’utiliser deux port série, un à 9600 bauds pour l’écran lcd, et un autre à 2400 bauds pour le lectuer RFID. Normalement il me faudrait une mega (qui possède 3 port série) pour faire ce projet en hardware, mais il existe aussi des librairies Serial software ! C’est pourquoi je vais utiliser la librairie NewSoftSerial disponible ici : [...]

  61. An Idiot and an Arduino: Pretty WiFly for a White Guy « ~jmoskie

    [...] went through each error, and tried to resolve it myself. Some were easy. The "NewSoftSerial" libraries were incorporated into the core libraries, and they replaced the default SoftwareSerial [...]

  62. Arduino vs Arduino Mega – Which To Use? | Utopia Mechanicus

    [...] speed if you need a second or third (or fourth) port. On the Uno, you can do similarly using the NewSoftSerial library; however, software is slower, and if your program is pushing the limits, you may find a hardware [...]

  63. I can solder! 7-Segment Serial Display & Nunchucky operational « I Am Chris

    [...] already.  I found this wall of text which I managed to digest down into this gist (and updated it thanks to these notes) which you can see running in the above [...]

  64. S2 » Android + Bluetooth + Arduino

    [...] そして、シリアル通信のテストに利用したArduinoのソースです。 NewSoftSerial(Arduinoライブラリ)を利用しています。 [...]

  65. Getting started with DroneCell and Arduino.

    [...] DroneCell and the GPS simultaneously. I stumbled upon this interesting behavior in NewSoftSerial. NewSoftSerial*|*Arduiniana. I seem to at least have something to go on… Using Multiple Instances There has been [...]

  66. Emular pines Serial de Arduino con la librería NewSoftSerial » Blog Archive » el blog de giltesa

    [...] eso es lo que es capaz de hacer la librería NewSoftSerial (más documentación aquí). Usándola podremos emplear el resto de pines como puertos serial, ya [...]

  67. Time - He's waiting in the wings - Cuyahoga

    [...] in the download is TimeGPS.pde, but it’s a touch outdated now that Mikal Hart’s NewSoftSerial library has been rolled up into the core (since 1.0) and renamed SoftwareSerial. The problem I had [...]

  68. Arduino的通讯扩展板介绍 | 爱板网

    [...] GPS模块与Arduino的通讯程序 [...]

  69. Giving Arduino a second UART over I2C by stacking another Arduino on top « CyclicRedundancy

    [...] tried using the SoftSerial (or the NewSoftSerial) library but ran into data corruptions even at the low speeds, so I decided to look for ways to get another [...]

  70. RFID Reader #1 « Tesla UIs

    [...] the example code. There some issues on the Arduino library SoftwareSerial, which changed to the NewSoftSerial once in a while. Share this:TwitterFacebookLike this:LikeBe the first to like this. Categories [...]

  71. Resources for the VCNL4000 IR Proximity Sensor | Sciencearium

    [...] - Share this: This entry was posted in AT Physics Class and tagged arduino, IR, proximity [...]

  72. Serial LCD do-it-yourself(DIY) kit | BUILD CIRCUIT

    [...] NewSoftSerial Library - Required for the example sketches. Sets up a second (third, fourth,…) serial port on the Arduino. [...]

  73. How to assemble serial LCD kit | BUILD CIRCUIT

    [...] NewSoftSerial Library - Required for the example sketches. Sets up a second (third, fourth,…) serial port on the Arduino. [...]

  74. Android talks to Arduino board - Arduino for ProjectsArduino for Projects

    [...] from this project (bluetooth_chat_LCD.pde attached below) – NewSoftSerial library from Mikal Hart: – Eclipse – Android Development Kit (explicitly follow all of Google’s installation [...]

  75. Burn Arduino Bootloader on an ATtiny45 for SoftwareSerial | No bread? Make it!

    [...] いいね:いいね 読み込み中… カテゴリー Arduino, [...]

  76. Burn Arduino Bootloader on an ATtiny for SoftwareSerial | No bread? Make it!

    [...] いいね:いいね 読み込み中… カテゴリー Arduino, [...]

  77. Please wait your turn! Stratoballoon GPS Sensor Sketch « Mark Gilbert's Blog

    [...] to the GPS receiver, I’d be writing to the data logger serially.  I found information here about running multiple devices serially – the short answer is that you have to access the serial [...]

  78. Going to Arduino from C#, Java, … string trouble | Hydroinformatix the Gaul

    [...] kB). I used this method and solved my intermitting (and making me crazy…) problems 2) Using PString library, added by NewSoftSerial and put in official version of Arduino. It is very handy: it hands you a [...]

  79. The Frustromantic Box, Part 4: Software | New Bright Idea

    [...] developers for the great libraries, and to Mikal Hart in particular for his work on the TinyGPS and NewSoftSerial [...]

  80. Le Dan-TECH » 2ème Partie : Reconnaissance vocale avec Arduino

    [...] , les ports 12 & 13 de l’arduino sont utilisés (liaison arduino-module via la classe newSoftSerial) et ne permettent pas l’emploi du shield Ethernet sur une platine « arduino [...]

  81. on the trail of the elusive Power Cost Monitor signal | We Saw a Chicken …

    [...] I rewrote the logger to use the Arduino’s internal UART, since — lovely though NewSoftSerial may be — it causes millis() to report wildly inaccurate times at low bit rates. I recorded a [...]

  82. 86duino

    [...] require that protocol. The version of SoftwareSerial included in 1.0 and later is based on the NewSoftSerial library by Mikal [...]

  83. 86duino

    [...] This requires the TinyGPS and NewSoftSerial libraries from Mikal Hart: and [...]

  84. Kerry D. Wong » Blog Archive » RF Data Link Using Si4021 And Si4311

    [...] BT1 pin settings (which are done in hardware), the receiver is totally configuration free. I used NewSoftSerial library in the code below. The main loop simply print out the incoming bit stream. You may also use [...]

  85. how to set up arduino + pololu mini maestro (for an 18 servo hexapod) | orange narwhals

    [...] newsoftserial should be downloaded from the internet and the folder inside the zip put in (path to where you [...]

  86. Starter Kit Sonar » Starter Kit

    [...] szczęście jest jeszcze jedna biblioteka „NewSoftSerial”, która jest pozbawiona tych wad i na dodatek obsługuje zanegowany sygnał [...]

  87. Twitter Poem Box -Use Arduino for Projects

    [...] Download the TrueRandom, NewSoftSerial, and Twitter [...]

  88. Подключение GPS L30 модуля используя GPS Шилд от SparkFun » Arduino Market

    [...] NewSoftSerial [...]

  89. Tema 5 – Proyectos Arduino | Aprendiendo Arduino

    [...] NewSoftwareSerial: [...]

  90. Twitter Poem Box -Arduino for Projects

    [...] Download the TrueRandom, NewSoftSerial, and Twitter [...]

  91. 아두이노의 통신 방법, 핀 정리 (Serial, UART, Software Serial, SPI, I2C) | Hard Copy Arduino

    [...] NewSoftSerial (Arduino IDE 1.0 이후 버전만 지원) – Serial 모듈별로 인스턴스를 생성해서 여러개를 사용할 수 있지만 한번에 하나의 인스턴스만 전송/수신 할 수 있습니다. 다른 라이브러리와의 충돌 가능성도 약간 있는 듯 합니다. [...]

  92. Please wait your turn! Stratoballoon GPS Sensor Sketch « Mark Gilbert's Blog

    [...] to the GPS receiver, I’d be writing to the data logger serially.  I found information here about running multiple devices serially – the short answer is that you have to access the serial [...]

Leave a Reply