NewSoftSerial

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.

Improvements

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
  gps.listen();
  read_gps_data();  // use gps as active device
  // collect temperature data from thermometer
  therm.listen();
  read_thermometer_data(); // now use therm
  // LCD becomes the active device here
  LCD.listen();
  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()
{
  device1.listen();
  if (device1.available() > 0)
  {
    int c = device1.read();
    ...
  }
  device2.listen();
  if (device2.available() > 0)
  {
    int c = device2.read();
    ...
  }
}

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.

Download

The latest version of NewSoftSerial is available here: NewSoftSerial12.zip.  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

Acknowledgements

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
646 Responses → “NewSoftSerial”

  1. Mikal

    10 years ago

    @SebastianUF,

    The UdooQuad is an ARM board and unfortunately, [New]SoftSerial only supports AVR devices at this time.


  2. jinwoo

    9 years ago

    thanks a lot


  3. Mikal

    9 years ago

    If 4 is RX, you need to hook Arduino pin 4 to the pin labeled “TX” on the GPS. That’s my guess.


  4. Bako

    9 years ago

    Hello Mikal iam trying to use two RF modules (CC1101) with two arduinos for sending the value of a potintiometer from one side to control a servo on the other side. the library doesn’t work even if it’s newsoftware or softwareserial . maybe I have some problem with writing the code. Can you help me ?
    Thank you


  5. Mikal

    9 years ago

    @Bako,

    Are your boards sharing a common ground?


  6. Bako

    9 years ago

    that was a problem. I then tried two different boards and it worked thanks Mikal for your help. but still has problem with the code of combining the software serial library code with the code for Knob, check this code out please and feed me back

    #include
    #include
    Servo myservo;
    int potpin=0;
    int val;
    SoftwareSerial mySerial(10, 11); // RX, TX

    void setup()

    {
    myservo.attach(9);
    // Open serial communications and wait for port to open:
    Serial.begin(9600);
    while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
    }

    Serial.println(val);

    // set the data rate for the SoftwareSerial port
    mySerial.begin(9600);
    mySerial.println(val);
    }

    void loop() // run over and over
    {
    val = analogRead(potpin);
    val = map(val, 0, 1023, 0, 179);
    myservo.write(val);
    delay(15);
    if (mySerial.available())
    Serial.write(potpin);
    potpin = mySerial.read();
    if (Serial.available())
    mySerial.write(potpin);
    potpin = Serial.read();
    }


  7. Robin

    9 years ago

    I am using Arduino 1.5.4, but SoftwareSerial seems to use the variant of flush() which was removed from the Arduino libraries such as Stream, Serial etc as from Arduino 1.0. Instead of waiting until any output has been transmitted, it deletes all data which are in the incoming buffer.

    Is this intentional? If not, could it be updated?

    Apart from this, it’s a very nice library!


  8. Mikal

    9 years ago

    Hi Robin–

    Thanks for the note. Flush on output doesn’t make too much sense on SoftwareSerial, because writes are all blocking. Are you suggesting perhaps renaming the flush that flushes the input stream? Removing it?


  9. Robin

    9 years ago

    Hi Mikal,
    In C++, flush() is a standard function for flushing output streams. So it’s really confusing to find a function called flush which flushes input.
    I suggest that the function should have a different name. How about iflush?
    Hopefully this wouldn’t be a big problem for most people, as my guess is that it is not used very much.

    All the best,
    Robin


  10. Core2

    9 years ago

    Mikal,

    First off thanks for sharing your hard work.
    I am not having any luck getting the SoftwareSerial to work with my Fio V3. I am trying to get data from a GP-635T GPS sensor. Every time I use your example “Simple test” I do not receive any data from the sensor when using the Software Serial library on pins 4(RX), and 3(TX). But if I modify the code to use the hardware serial instead, and hook the GPS up to that I do get some data in. Although it is not good data it appears I am not getting a lock. But for now I am focusing on the Software Serial issue. Have you or anyone else had any success using the Arduino Fio V3 and Software Serial? Any suggestions you or anyone else could provide would be great. Thanks for your time.


  11. Martin

    9 years ago

    Hi Mikal:

    Great library, but reading through the code .. the ring buffer is updated from an ISR so shouldn’t all methods that access the ring buffer (like read(), available(), etc.) disable interrupts while processing?

    Regards,

    Martin


  12. Mikal

    9 years ago

    Hi Core2–Since the Fio is based on the 328P, I’m pretty sure it will work the same. Have you got your RX/TX crossed? Remember TX on GPS should be connected to RX on Arduino.


  13. Mikal

    9 years ago

    @Martin–

    I understand your point, but I think I’ve convinced myself that there is no danger of read(), available(), etc., producing an erroneous result, no matter when an interrupt arrives. And I don’t want to delay any incoming interrupt–that’s very important, especially at high speeds.


  14. Giancarlo

    9 years ago

    Its not working anymore, I downloaded it and I compiled its first example and it shows problem.


  15. Faruk

    9 years ago

    Hello.first of all thank you for your all libraries.I’m using tinygps++ in my project.But i’ll ask some different question.I’m using pins 0,1 of Arduino Uno for xbee shield and it receives gps infos from other arduino.At the same time i want to use pins 8,9 of same arduino for gps module and data. Is it possible to gather datas from both device(xbee shield and gps module) in one sketch and one arduino? ( as you know 0,1 are hardware serial pins,SoftwareSerial is used for 8,9 pins)Which way can you tell?can you give some details?If you could reply and help i’d be so happy.from now thank you very much for your help.I look forward to your reply.Kind regards,Faruk


  16. Mikal

    9 years ago

    @Faruk,

    You should be able to receive on both HW and SW serial. BUT you need to make sure that your code processes the incoming stream sufficiently quickly.


  17. xxx

    9 years ago

    How I can get simply work it on Arduino release 1.6
    I all time get this error

    In file included from sketch_nov13a.ino:1:
    C:\Users\user2\Documents\Arduino\libraries\NewSoftSerial/NewSoftSerial.h:33:2: error: #error NewSoftSerial has been moved into the Arduino core as of version 1.0. Use SoftwareSerial instead.
    In file included from sketch_nov13a.ino:1:
    C:\Users\user2\Documents\Arduino\libraries\NewSoftSerial/NewSoftSerial.h:99: error: conflicting return type specified for ‘virtual void NewSoftSerial::write(uint8_t)’
    C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/Print.h:48: error: overriding ‘virtual size_t Print::write(uint8_t)’


  18. Mikal

    9 years ago

    @xxx, you shouldn’t use NewSoftSerial in new versions of Arduino. As the error says, the code is now in the core.


  19. Steve Nussbaum

    9 years ago

    Hello Mikal,
    I am new to the arduino products and was hoping you could look at a small sketch I wrote that I’m having difficulty with. I’m trying to use two softserial ports and the listen() function to select between them. How can I send you this sketch as I have not used this forum before.
    Steve


  20. Steve Nussbaum

    9 years ago

    Mikal, I see my request has already posted.
    I’ve pasted it below. The sketch has two serial devices, a TBI interface that sends three bytes of data every 500ms. The bytes are a long RPM value and the third byte is a a voltage value. The idea is to read from the TBI device then read the EM-506 GPS module data. I am only trying to grab the speed info for now. Im using the “listen()” fcn to activate the TBI then I want to activate the GPS module. The TBI data is properly read only when the GPS.listen() is commented out. Same for the GPS module. I have to comment out the TBI.listen() in order for the GPS data to received and displayed. Any advice would be appreciated.

    #include

    #include
    #include
    #include

    /* This sample code demonstrates the normal use of a TinyGPS object.
    It requires the use of SoftwareSerial, and assumes that you have a
    4800-baud serial GPS device hooked up on pins 2(rx) and 3(tx).
    */
    /* This code is expanded to incorporate the LCD with the GPS sketch Nov 5, 2014 SHN */
    /* It keeps the usb interface as is to display data on serial monitor */
    /* This version works well 11/5/2014 12:42 pm shn */

    /* 11/6/2014 This code has been expanded to read the ThunderBolt Ignition serial output of RPM and Batt volts */
    /* The TBI is being simulated by the PIC Demo Plus board. It sends variable rpm and a fixed batt volts value 14.5 */
    /* The format is a 3 byte packet, (msb)RPM_HI,RPM_LO,Batt_volts */
    // #define BACKLIGHT_PIN 13
    // new code from web site
    // 11/12/2014 Added code to turn one one soft serial at a time. Reads rpm and batt volts ok with occasional scrambled
    // info.

    #define I2C_ADDR 0×27
    #define BACKLIGHT_PIN 3
    #define En_pin 2
    #define Rw_pin 1
    #define Rs_pin 0
    #define D4_pin 4
    #define D5_pin 5
    #define D6_pin 6
    #define D7_pin 7

    #define TBI_RX 4
    #define TBI_TX 5
    #define GPS_RX 2
    #define GPS_TX 3

    LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin,BACKLIGHT_PIN,POSITIVE);
    TinyGPS gps;

    SoftwareSerial TBI(TBI_RX,TBI_TX); // port for ignition module pin 4 (PD4) for RX pin 5 (PD5) for TX 11/6/2014
    SoftwareSerial GPS(GPS_RX, GPS_TX); // modified to 2,3 SHN 11/04/2014
    /* Globals */

    int RPM_HI = 0;
    int RPM_LO = 0;
    long RPM;
    float Batt_Volts = 0;
    float speed_mph ; // calculated from speed_kmph
    float speed_kmph = 30; // from gps module

    /* static void smartdelay(unsigned long ms);
    static void print_float(float val, float invalid, int len, int prec);
    static void print_int(unsigned long val, unsigned long invalid, int len);
    static void print_date(TinyGPS &gps);
    static void print_str(const char *str, int len);
    */
    void setup()
    {
    // For the GPS interface
    pinMode(GPS_RX, INPUT);
    pinMode(GPS_TX, OUTPUT);

    // For the TBI interface pin 4 = rx = input, pin5 = tx = output
    pinMode(TBI_RX, INPUT);
    pinMode(TBI_TX, OUTPUT);
    // for the LCD

    // Switch on the backlight
    pinMode ( BACKLIGHT_PIN, OUTPUT );
    digitalWrite ( BACKLIGHT_PIN, HIGH );
    lcd.begin(16,2); // initialize the lcd

    lcd.home (); // go home
    lcd.print(“Hello, ARDUINO “);
    lcd.setCursor ( 0, 1 ); // go to the next line
    lcd.print (“GPS Data Display “);
    delay ( 1000 );
    lcd.home();
    lcd.print(“RPM: | Vbat:”);
    lcd.setCursor(0,1);
    lcd.print(“MPH: | “);
    // setup done for the lcd

    // Start serial ports
    GPS.begin(4800); // start GPS port, uses listen() to enable
    TBI.begin(4800); // start up the TBI soft uart turns off the ss uart

    delay(50);

    }

    // Main Loop

    void loop()
    {
    // Read TBI data and display to terminal and lcd

    TBI.listen();

    if(TBI.overflow() == 0)
    {
    while(TBI.available()>0)
    {
    Batt_Volts = TBI.read();
    RPM_HI = TBI.read();
    RPM_LO = TBI.read();
    Batt_Volts = Batt_Volts/10; // scale it
    TBI.write(Batt_Volts); // regurgitate it, send out to tx pin 5 back to TBI simulator
    TBI.write(RPM_HI);
    TBI.write(RPM_LO);
    // speed_kmph = speed_kmph + 5;
    }
    }
    // build rpm value
    RPM = RPM_HI; // load in MSB first
    RPM = RPM << 8; // shift msb into position
    RPM = RPM + RPM_LO; // add lower byte

    lcd.setCursor(11,1);
    lcd.print(Batt_Volts);

    lcd.setCursor(4,0);
    lcd.print(RPM);

    // Retreive speed from GPS
    GPS.listen(); // if this is commented out the TBI works, if in it does not and vice versa.
    // delay(100); // not sure how much if any delay is needed
    while(GPS.available())
    {
    speed_kmph = speed_kmph + 5;
    //speed_kmph = gps.f_speed_kmph();
    int c = GPS.read();
    if(gps.encode(c)) //if encode returns a true, new data is available
    {
    speed_kmph = gps.f_speed_kmph();
    }
    }
    // delay(200);
    // speed_kmph = gps.f_speed_kmph();
    // for lcd displaying speed
    // speed_kmph = speed_kmph + 5; // for testing
    speed_mph = speed_kmph/1.6 ;
    lcd.setCursor(4,1);
    lcd.print(speed_mph);

    }


  21. Steve Nussbaum

    9 years ago

    Mikal, I see one problem with the statement “while(GPS.available();”,
    I changed it to “while(GPS.available() > 0);” but still I can only read either the data from the TBI interface or the GPS interface. I have to comment out either the TBI.listen() to read GPS stuff or comment out GPS.listen() to read data from the TBI.
    I’m a little confused over the validity of the pins I’ve selected. Using pin 2 for the GPS RX and pin 4 for the TBI RX pin. That ok?
    Thanks for your critique.
    S


  22. Mikal

    9 years ago

    Steve,

    The pin selection is ok assuming you’re using Uno.

    To read from both devices, the logic you are using should NOT be:

    void loop()
    {
      TBI.listen();
      while (TBI.available())
        ... process TBI data
      GPS.listen();
      while (GPS.available())
        ... process GPS data
    }
    

    This never will accomplish anything because there will never be anything available immediately after you start listening. I would use logic where I listened first to one device and then the other in intervals of, say, 5 seconds:

    void loop()
    {
      TBI.listen();
      for (unsigned long start=millis(); millis() - start < 5000;) // listen for 5 seconds
        if (TBI.available())
          ... process TBI data
      GPS.listen();
      for (unsigned long start=millis(); millis() - start < 5000;) // listen for 5 seconds
        if (GPS.available())
          ... process GPS data
    }
    

    Keep in mind that you begin listening to each device at a random time, so your “process XXX data” code should not make any assumptions about where in the stream the data begins flowing.


  23. Steve

    9 years ago

    Mikal, thanks so much for your guidance. Reading each input for 5 seconds worked fine. I had read your tutorial in the section preceding this forum but I did not fully understand the reasoning behind your explanation of why “this code will not work” when the examples seemed to follow that code. But I get it now. You must test for data availability for a few seconds before data is read into the buffer.
    However, I do need to update the display with RPM and speed much more frequently than at 5 second intervals. Maybe the 2 soft serial port approach is not a good design. Since I’m not using the USB port when this application runs I could use the hard uart for the GPS data and one soft port for the TBI interface.
    Thanks again for you help and great work on the libraries.
    Steve


  24. Steve

    9 years ago

    Mikal,
    I increased the packet rate from 500ms to 250ms from the TBI. Then I changed the “for” loop from 5000ms to 250 ms for both devices. I took it for a drive and everything seems to update fast enough so I will stick with the two soft serial port design for now.
    Here’s the latest version for the sketch. Just another example for folks to see how to use two ports within a program.

    Steve

    void loop()
    {
    // Read TBI data and GPS Speed data to display on lcd

    TBI.listen();
    for(unsigned long start = millis(); millis() – start 0)
    {
    Batt_Volts = TBI.read();
    Batt_Volts = Batt_Volts/10; // scale it
    lcd.setCursor(11,1);
    lcd.print(Batt_Volts);
    RPM_HI = TBI.read();
    RPM_LO = TBI.read();
    // regurge to verify input is being read
    TBI.write(Batt_Volts); // regurgitate it, send out to tx pin 5 back to TBI simulator
    TBI.write(RPM_HI);
    TBI.write(RPM_LO);
    }

    // build rpm value
    RPM = RPM_HI; // load in MSB first
    RPM = RPM < 100 && RPM < 9999)
    {
    lcd.setCursor(5,0);
    lcd.print(RPM);
    }
    }
    }

    // Retreive speed from GPS
    GPS.listen();
    for(unsigned long start=millis(); millis() – start 0)
    {
    int c = GPS.read();
    if(gps.encode(c)) //if encode returns a true, new data is available
    {
    speed_mph = gps.f_speed_mph();
    }
    }
    // speed_mph = speed_kmph/1.6 ;
    lcd.setCursor(4,1);
    lcd.print(speed_mph);
    }

    }


  25. David

    9 years ago

    Mikal,

    I’m wondering if you might be able to help me combine the NewSoftSerial library here with PWM output? I’ve been looking over the code and I’ve tried simply enabling PWM at the correct frequency on the same pin but this unfortunately does not work. Any insight would be great.

    Regards,

    David


  26. Steve

    9 years ago

    Hi Mikal,
    Now that my GPS and TBI soft ports are working I added a microSD shield to the stack. Now I have an Arduino UNO, microSD shield and the GPS shields stacked in this order. I ran the SD example from the web site without issue. After pasting this code into setup section of my GPS sketch it does not work. It seems the line “if(myFile)” always returns a false value. After narrowing things down by process of elimination I found that taking out the line “if(gps.encode(c))” which is down in the main loop, it makes the SD functions work fine. It appears like the SD library functions are not working properly if that line of code is compiled. I made sure that the “ss” pin is set as an output. I’m at a loss for what to do next.
    Any help would be greatly appreciated.
    Steve


  27. Steve

    9 years ago

    Mikal,
    I have this program running now. I needed to hold off declaring the object in the set up section and put it in the main loop as shown.
    All I/o seems to work. I am getting good files on the SD card etc. Now I am trying to save the highest MPH reached between resets. I added a new variable called max_speed. I use this to compare with the latest speed_mph from the gps code. However, adding these lines prevents the sd file from opening. I have no idea why this is happening, any enlightenment would be appreciated.
    If I comment out the “max_speed = speed_mph” in the GPS section, it works.

    #include
    #include
    #include
    #include
    #include
    /* This sample code demonstrates the normal use of a TinyGPS object.
    It requires the use of SoftwareSerial, and assumes that you have a
    4800-baud serial GPS device hooked up on pins 2(rx) and 3(tx).
    */
    /* This code is expanded to incorporate the LCD with the GPS sketch Nov 5, 2014 SHN */
    /* It keeps the usb interface as is to display data on serial monitor */
    /* This version works well 11/5/2014 12:42 pm shn */

    /* 11/6/2014 This code has been expanded to read the ThunderBolt Ignition serial output of RPM and Batt volts */
    /* The TBI is being simulated by the PIC Demo Plus board. It sends variable rpm and a fixed batt volts value 14.5 */
    /* The format is a 3 byte packet, (msb)RPM_HI,RPM_LO,Batt_volts */
    // #define BACKLIGHT_PIN 13
    // new code from web site
    // 11/16/2014 Added code to turn one one soft serial at a time. Reads rpm for 250 ms and gps for 250ms.
    // seems to update at a reasonable rate.
    //
    // This versions adds the micro SD memory card via Arduino shield from Sparkfun
    // This card is 4GB in size. 11/20/2014

    #define I2C_ADDR 0×27
    #define BACKLIGHT_PIN 3
    #define En_pin 2
    #define Rw_pin 1
    #define Rs_pin 0
    #define D4_pin 4
    #define D5_pin 5
    #define D6_pin 6
    #define D7_pin 7

    #define TBI_RX 4
    #define TBI_TX 5
    #define GPS_RX 2
    #define GPS_TX 3
    #define SD_CS 8

    LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin,BACKLIGHT_PIN,POSITIVE);

    SoftwareSerial TBI(TBI_RX,TBI_TX); // port for ignition module pin 4 (PD4) for RX pin 5 (PD5) for TX 11/6/2014
    SoftwareSerial GPS(GPS_RX, GPS_TX); // modified to 2,3 SHN 11/04/2014
    /* Globals */

    int ledPin = 7; // indicator led
    int write_flag = 0; // counts 10 passes thru readings and stores
    int RPM_HI = 0;
    int RPM_LO = 0;
    long RPM;
    float Batt_Volts = 0;
    float Batt_Volts_New = 0;
    float Batt_Volts_Old = 0;
    float Batt_Volts_Diff = 0;
    long Record = 0;

    float speed_mph ; // direct from gps module
    float max_speed;
    int year;
    byte month, day, hour, minute, second, hundredths;
    float latitude, longitude;
    unsigned long date,time,fix_age; // date:ddmmyy time:hhmmsscc

    File myFile; // set up instance

    void setup()
    {

    // For the GPS interface GPS_RX = pin 2, GPS_TX = pin 3
    pinMode(GPS_RX, INPUT);
    pinMode(GPS_TX, OUTPUT);

    // For the TBI interface pin 4 = rx = input, pin5 = tx = output
    pinMode(TBI_RX, INPUT);
    pinMode(TBI_TX, OUTPUT);

    // Serial.begin(115200);
    // Serial.print(“Initializing SD card…”);
    // for the SD card
    pinMode(10, OUTPUT); // per SD install instructions
    pinMode(8, OUTPUT);
    pinMode(7, OUTPUT); // for red led
    digitalWrite(ledPin, HIGH);
    delay(300);
    digitalWrite(ledPin, LOW);
    SD.begin(8);

    // open the file. note that only one file can be open at a time,
    // so you have to close this one before opening another.
    myFile = SD.open(“Firefly.txt”, FILE_WRITE);

    // if the file opened okay, write to it:
    if (myFile)
    {
    myFile.println(“Firefly Data Logger: “);
    // close the file:
    myFile.close();
    }
    else
    {
    myFile.println(“write error in set up”);// if the file didn’t open, print an error:
    }

    // for the LCD

    // Switch on the backlight
    pinMode ( BACKLIGHT_PIN, OUTPUT );
    digitalWrite ( BACKLIGHT_PIN, HIGH );
    lcd.begin(16,2); // initialize the lcd

    lcd.home (); // go home
    lcd.print(“Hello, ARDUINO “);
    lcd.setCursor ( 0, 1 ); // go to the next line
    lcd.print (“GPS Data Display “);
    delay ( 1000 );
    lcd.home();
    lcd.print(“RPM: | Vbat:”);
    lcd.setCursor(0,1);
    lcd.print(“MPH: | “);
    // setup done for the lcd

    // Start serial ports
    GPS.begin(4800); // start GPS port, uses listen() to enable
    TBI.begin(4800); // start up the TBI soft uart turns off the ss uart

    delay(50);

    }

    // Main Loop

    void loop()
    {
    // SD operation
    // open the file. note that only one file can be open at a time,
    // so you have to close this one before opening another.
    if((write_flag >= 500) && (date != 0))
    {
    digitalWrite(ledPin, HIGH);

    myFile = SD.open(“Firefly.txt”, FILE_WRITE);
    if (myFile) // if the file opened okay, write to it:
    {
    myFile.print(“Line:”); // record number
    myFile.print(Record);
    myFile.print(” Date:”);
    myFile.print(date);
    myFile.print(” Time:”);
    myFile.print(time);
    myFile.print(” Lat:”);
    myFile.print(latitude, 5);
    myFile.print(” Lon:”);
    myFile.print(longitude, 5);
    myFile.print(” RPM: “);
    myFile.print(RPM);
    myFile.print(” “);
    myFile.print(“VBat: “);
    myFile.print(Batt_Volts);
    myFile.print(” “);
    myFile.print(“MPH: “);
    myFile.println(speed_mph);
    // close the file:
    myFile.close();
    }
    write_flag = 0; // clear flag
    Record++; // bump record #
    digitalWrite(ledPin, LOW);
    }

    // Read TBI data and GPS to display on lcd
    TBI.listen();
    for(unsigned long start = millis(); millis() – start 0)
    {
    Batt_Volts = TBI.read();
    Batt_Volts = Batt_Volts/10; // scale it
    lcd.setCursor(11,1);
    lcd.print(Batt_Volts);
    RPM_HI = TBI.read();
    RPM_LO = TBI.read();
    // regurge to verify input is being read
    TBI.write(Batt_Volts); // regurgitate it, send out to tx pin 5 back to TBI simulator
    TBI.write(RPM_HI);
    TBI.write(RPM_LO);
    }

    // Battery value filter. Needs new reading to be within 2 volts of the old to post

    Batt_Volts_Old = Batt_Volts_New; // shift data
    Batt_Volts_New = Batt_Volts;
    Batt_Volts_Diff = Batt_Volts_New – Batt_Volts_Old;
    abs(Batt_Volts_Diff);
    if(Batt_Volts_Diff < 2)
    {
    lcd.setCursor(11,1);
    lcd.print(Batt_Volts_New);
    }

    // build rpm value
    RPM = RPM_HI; // load in MSB first
    RPM = RPM < 100 && RPM < 9999)
    {
    lcd.setCursor(5,0);
    lcd.print(RPM);
    write_flag++; // increment write_flag, every 10th time write to SD
    }
    }
    }

    // Retreive speed from GPS
    TinyGPS gps; // moved from the top and it works.
    GPS.listen();

    for(unsigned long start=millis(); millis() – start 0)
    {
    int c = GPS.read();
    if(gps.encode(c)) //if encode returns a true, new data is available
    {
    speed_mph = gps.f_speed_mph();
    gps.f_get_position(&latitude, &longitude);
    gps.get_datetime(&date, &time);
    // gps.crack_datetime(&year, &month, &day, &hour, &minute, &second, &hundredths, &fix_age); //
    }

    }

    if(max_speed < speed_mph)
    {
    // max_speed = speed_mph; // if left uncommented it does not work the SD file will not open.
    }

    lcd.setCursor(4,1);
    lcd.print(speed_mph);
    }

    }


  28. Mikal

    9 years ago

    @Steve, is this on Uno? If so, I don’t think you can put the USB port into “host” mode to connect a GPS device. Maybe use a Mega or Teensy w/ 2 “hard” serial ports?


  29. Mikal

    9 years ago

    @Steve,

    Gee, I don’t know. Are you out of memory perhaps?


  30. Steve

    9 years ago

    Mikal, thanks for your response. This project is using a UNO. After compiling it says Ive used 24K out of 32k of memory so Im assuming Im not out of flash. Ive stayed with a soft serial for the GPS module. Also using a soft serial for the TBI interface. It’s using the I2C for the LCD display and the SPI for the microSD card. All is working unless I try to set another parameter equal to speed_mph. If I do this the SD file will not open. This is my issue now. Initially I had the statement “TinyGPS gps;” up the presetup area and I could not open a file on the SD card. I moved it down into the main loop just prior to the “gps.encode(c)” which occurs after the SD file access and it seems to function. So there appears to be some kind of interaction between the TinyGPS code and the SD code. I have no idea what is actually going on here.


  31. Abhi

    9 years ago

    Hi Steve, even i am trying to do something like what you are doing. interfacing LCD and GPS into Arduino with Edison. Getting errors on softwareserial port hooked to GPS shield.


  32. Mikal

    9 years ago

    @Abhi,

    I doubt if SoftwareSerial can be ported to Edison easily. Can you use the built-in Edison UARTs instead?


  33. John

    9 years ago

    Mikal
    I am new to Arduino and will reread your conversation with Steve many times.
    I am hopeful to build an GPS based NTP server with a YUN. I was able to get the GPS card to work on a UNO card with only a one week learning span. I then moved the GPS to the YUN using the same pins 2&3. After the third day of pounding a call to the vendor of the GPS card recommended that I move to pins 8&9 because 2&3 did not have PCINT. This worked well. I then wanted to learn where this limitation came from. I first tried to read about SoftwareSerial library — not much found, was pointed to NewSoftSerial lib. Then I found that that Lib is now included in the current development product. I am stuck again. Without reading the source, where can I read about SoftwareSerial and the limitations per processor? How does PCINT fit into NewSoftSerial? SoftwareSerial does not work the same on all pins?


  34. Mikal

    9 years ago

    @John,

    http://arduino.cc/en/Reference/softwareSerial

    is about the only “real” documentation I know about. I haven’t played with Yun, so I can’t advise, but if there are pins that don’t support PCINT, I agree that it seems like they should be mentioned on the documentation page.


  35. Jesse

    9 years ago

    Do you have a version that supports config? data, parity, stop bits

    For instance, SERIAL_8E1


  36. Arpan

    9 years ago

    Hi Mikal, thanks for developing the newSoftwareSerial; this made our tasks much simpler to handle. However, when trying to use this with ATmega32+arduino bootloder it fails as ATmega32 doesn’t has the PCINT feature.
    Is there anything in the newSoftwareSerial library that would enable me to use it in polling mode?

    I tried going back to old IDE but that doesn’t has a variant option. and old library doesn’t has functions like readString() too which is quite helpful.


  37. Jinoj

    9 years ago

    Hi,

    Can you please tell me how to enable the flow control in Arduino Uno using the NewSoftserial?
    Can you please provide the code/ library for the same?

    I need to enable it for interfacing with a Sierra HL8 modem.

    Thank you very much for the support,
    ~Jinoj


  38. Mikal

    9 years ago

    @Jesse– sorry, no. That would be a cool addition though.


  39. Mikal

    9 years ago

    @Arpan, ah, too bad. No, I’m afraid it really just doesn’t support polling, and making it do so would be pretty hard. Sorry!


  40. Mikal

    9 years ago

    @Jinoj,

    Regrets: NewSoftSerial doesn’t support flow control, although in theory it wouldn’t be too hard to add new CTS and RTS pins support. Some people have done this in the past with older versions of NewSoftSerial.


  41. Aldo

    8 years ago

    Hi, I am using Arduino MEGA2560 there are some problems about RX & TX?
    Thank you in advance.


  42. ltdat

    8 years ago

    My error
    Arduino: 1.6.4 (Windows 7), Board: “Arduino Uno”

    In file included from sketch_apr24b.ino:2:0:
    C:\Users\ThanhDat\Documents\Arduino\libraries\NewSoftSerial/NewSoftSerial.h:33:2: error: #error NewSoftSerial has been moved into the Arduino core as of version 1.0. Use SoftwareSerial instead.
    #error NewSoftSerial has been moved into the Arduino core as of version 1.0. Use SoftwareSerial instead.
    ^
    In file included from sketch_apr24b.ino:2:0:
    C:\Users\ThanhDat\Documents\Arduino\libraries\NewSoftSerial/NewSoftSerial.h:99:16: error: conflicting return type specified for ‘virtual void NewSoftSerial::write(uint8_t)’
    virtual void write(uint8_t byte);
    ^
    In file included from E:\arduino-nightly\hardware\arduino\avr\cores\arduino/Stream.h:26:0,
    from C:\Users\ThanhDat\Documents\Arduino\libraries\NewSoftSerial/NewSoftSerial.h:40,
    from sketch_apr24b.ino:2:
    E:\arduino-nightly\hardware\arduino\avr\cores\arduino/Print.h:48:20: error: overriding ‘virtual size_t Print::write(uint8_t)’
    virtual size_t write(uint8_t) = 0;
    ^
    Error compiling.

    This report would have more information with
    “Show verbose output during compilation”
    enabled in File > Preferences.


  43. Mikal

    8 years ago

    @Aldo, not all pins on the MEGA support “pin change interrupts”, therefore, not all pins can be used to receive data.


  44. Mikal

    8 years ago

    @ltdat, not sure exactly what you are saying. You shouldn’t use NewSoftSerial in Arduino 1.6.4.


  45. Michael

    8 years ago

    Mikal,
    Greetings and thanks for your work; the site looks nice and has lots of great info. Unfortunately, I was not able to use your code for my project, which is running on a Mega ADK….like Aldo, I was not getting good results, but that is not unusual, as we all tend to learn…eventually.

    To Aldo specifically — the Mega ADK has 4 hardware serial ports, which is great for those of us that have this board. They are supported by the IDE as Serial, Serial1, Serial2 and Serial3 and there is already an interrupt service routine to handle the hardware, so — SoftwareSerial and derivatives are not necessary. If you wire one of these up, you can write a handler to receive your data and move on to using that data.

    I just got my PMB-688 GPS working on Serial1 and will be adding GPS information to my Adafruit CC3000 HTTP server that is live….although still a little ‘crashy’ at this point because — well, just because….

    The Mega ADK was a terrible choice for me for Android development, but it does not share many of the limitations that other Arduino boards have — it has a lot of hardware already built in. I am replacing it with a Galileo soon, however. My intent is to use the Galileo as the HTTP server and connect boards such as the Mega ADK and my Propellers to that as individual data collection stations.

    I will try to document my efforts and results at my site — I have several RSS feeds started there and will create one for this project.


  46. Marius

    8 years ago

    I am communicating with HC-06 on 9600bps toward a BT client.
    If I send data from client to ardu (~5..10 samples/second)
    (24 byte /packet), the data arrives OK on ardu. As long
    I start sending data from ardu to the client the received
    data on ardu start getting garbage. This happen on both
    SofwareSerial / NewSoftwareSerial libraries.


  47. Oscar S.

    8 years ago

    Hi,
    I’m trying to wake up from sleep mode the arduino on received data by software serial. The processor wakes up, but the first received bytes aren’t correct. ¿The first’s bytes after wake up must be correct with software serial?

    Thanks,


  48. Witty

    8 years ago

    Hi Mikal
    Thank you for the support you are providing.
    I have one problem,i have my final year project using GPS module, Emic 2 TTS and Arduino Uno. The problem is that i have managed to use the serial ports by interchanging them but it seems the GPS cant read a new data, it only reapeat the first data read. Please am Very much confused,dont know what to do.Please Help


  49. Mikal

    8 years ago

    @Oscar,

    Yeah, I’m afraid that won’t work with software serial. I’m guessing that initial transition wakes the processor, but does not trigger the pin change interrupt until the second transition.


  50. Mikal

    8 years ago

    @Witty, are you sure the GPS is repeating data? That seems hard to explain.

93 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:  http://arduiniana.org/libraries/newsoftserial/ [...]

  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

    [...] http://arduiniana.org/libraries/newsoftserial/ [...]

  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 mitat.tuu.fi

    [...] http://arduiniana.org/libraries/newsoftserial/ http://www.sparkfun.com/commerce/product_info.php?products_id=8950 [...]

  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 http://arduiniana.org/libraries/newsoftserial/ 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:: http://arduiniana.org/libraries/NewSoftSerial/. 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: http://arduiniana.org/libraries/newsoftserial/ [...]

  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 | jarv.org

    [...] 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 NewSoftSerial10c.zip. Des expli­ca­tions et exem­ples plus détail­lés con­cer­nant cette bib­lio­thèque sur cette page (http://arduiniana.org/libraries/newsoftserial/). [...]

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

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

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

    [...] NewSoftSerial Library - http://arduiniana.org/libraries/NewSoftSerial/ [...]

  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 : http://arduiniana.org/libraries/newsoftserial/ [...]

  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 Nolan.ca

    [...] 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

    [...] - http://arduiniana.org/libraries/NewSoftSerial/ 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: http://arduiniana.org/libraries/newsoftserial/ – Eclipse – Android Development Kit (explicitly follow all of Google’s installation [...]

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

    [...] http://arduiniana.org/libraries/newsoftserial/ いいね:いいね 読み込み中… カテゴリー Arduino, [...]

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

    [...] http://arduiniana.org/libraries/newsoftserial/ いいね:いいね 読み込み中… カテゴリー 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: http://arduiniana.org/libraries/TinyGPS and http://arduiniana.org/libraries/newsoftserial/ [...]

  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 http://code.google.com/p/tinkerit/wiki/TrueRandom, NewSoftSerial http://arduiniana.org/libraries/newsoftserial/, and Twitter [...]

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

    [...] NewSoftSerial [...]

  89. Tema 5 – Proyectos Arduino | Aprendiendo Arduino

    [...] NewSoftwareSerial: http://arduiniana.org/libraries/newsoftserial/ [...]

  90. Twitter Poem Box -Arduino for Projects

    [...] Download the TrueRandom http://code.google.com/p/tinkerit/wiki/TrueRandom, NewSoftSerial http://arduiniana.org/libraries/newsoftserial/, and Twitter [...]

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

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

  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 [...]

  93. RFID cat door using Arduino -Use Arduino for Projects

    [...] This project consists of several ‘modules’ that you need to hook up to the Arduino and test in advance. First hook-up the RF reader. You can use the 5v output of the Arduino to power it, and a digital port (I used 2) to get the signal. The RDM630 that I used also has pins for a led that I don’t use. It also has an RX pin to send info back to the RF reader, but I don’t use that either. Hook-up your antenna, get a tag and use the serial monitor of the Arduino to see if it’s detected. Now you can also start working on improving the antenna by trying adding or removing turns, trying different shapes et cetera. Power the Adruino with the 9v power supply, not just USB because at least in my case that didn’t work. You can download the file named ‘rfid3.pde’ to test. The code requires NewSoftSerial.h which can be obtained here [...]

Leave a Reply