Show Posts
Pages: [1]
1  Using Arduino / Networking, Protocols, and Devices / Re: [solved]Problem with Serial Communication on Leonardo on: November 01, 2013, 10:14:06 am
PaulS-
Your post:
Quote
There are two serial ports on the Leonardo, Serial and Serial1. The Serial instance is via the onboard USB-to-serial conversion process. Serial1 is via the RX and TX pins.
Is this also true on the Arduino Micro? I don't know why I never noticed this on any description, but it could solve all my problems!
2  Using Arduino / Networking, Protocols, and Devices / Re: Help in GPS coding on: October 30, 2013, 09:51:58 am
Be sure to set the baud rate in the Serial Monitor to 9600 to match the baud rate of Serial.begin(9600).
3  Using Arduino / Networking, Protocols, and Devices / Re: Help in GPS coding on: October 30, 2013, 08:21:16 am
I'm having this exact same problem (if that makes you feel any better). It seems to me the problem is with the SoftwareSerial library, because I found I could remove the SoftwareSerial class and listen to the GPS output on pin 0 using the Serial class and the demo sketches worked fine. Try this code with the GPS tx pin hooked to pin 0 on your arduino (remember you have to unplug this wire while you upload the sketch to the board because the usb connection receives through this pin. After the sketch is done uploading then plug the wire back into pin 0). Your demo sketch modified for no SoftwareSerial:
Code:
// #include <SoftwareSerial.h>

#include <TinyGPS.h>

/* 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 4(rx) and 3(tx).
*/

TinyGPS gps;
// SoftwareSerial ss(4, 3);

void setup()
{
  Serial.begin(9600);
//  ss.begin(9600);
 
  Serial.print("Simple TinyGPS library v. "); Serial.println(TinyGPS::library_version());
  Serial.println("by Mikal Hart");
  Serial.println();
}

void loop()
{
  bool newData = false;
  unsigned long chars;
  unsigned short sentences, failed;

  // For one second we parse GPS data and report some key values
  for (unsigned long start = millis(); millis() - start < 1000;)
  {
    while (Serial.available())
    {
      char c = Serial.read();
      // Serial.write(c); // uncomment this line if you want to see the GPS data flowing
      if (gps.encode(c)) // Did a new valid sentence come in?
        newData = true;
    }
  }

  if (newData)
  {
    float flat, flon;
    unsigned long age;
    gps.f_get_position(&flat, &flon, &age);
    Serial.print("LAT=");
    Serial.print(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flat, 6);
    Serial.print(" LON=");
    Serial.print(flon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6);
    Serial.print(" SAT=");
    Serial.print(gps.satellites() == TinyGPS::GPS_INVALID_SATELLITES ? 0 : gps.satellites());
    Serial.print(" PREC=");
    Serial.print(gps.hdop() == TinyGPS::GPS_INVALID_HDOP ? 0 : gps.hdop());
  }
 
  gps.stats(&chars, &sentences, &failed);
  Serial.print(" CHARS=");
  Serial.print(chars);
  Serial.print(" SENTENCES=");
  Serial.print(sentences);
  Serial.print(" CSUM ERR=");
  Serial.println(failed);
  if (chars == 0)
    Serial.println("** No characters received from GPS: check wiring **");
}

This should at least show you if your GPS module is working. I have NOT found a solution to this yet. If you do let me know. I'll keep watching your thread.
4  Using Arduino / Programming Questions / Re: Simple delay() debounce failure mode? on: October 29, 2013, 12:37:14 pm
If you want to try the other route, here's a link to a great tutorial for hardware debouncing. It uses very inexpensive components and is pretty trivial to design and wire together:
http://www.jeremyblum.com/2011/03/07/arduino-tutorial-10-interrupts-and-hardware-debouncing/
5  Using Arduino / Programming Questions / Re: Software Serial inconsistent with Hardware Serial on: October 29, 2013, 09:55:18 am
I have this exact problem! I posted a question a question about it this morning, but I haven't solved it yet. There were some posts on the Sparkfun site where I bought my GPS module (a Locosys LS20031) about increasing the receive buffer size in the SoftwareSerial.h header.
Quote
In NewSoftSerial.h: NewSS_MAX_RX_BUFF 64 to NewSS_MAX_RX_BUFF 256
Here's the link to that post, it's at the bottom in the customer comments:
https://www.sparkfun.com/products/8975
This did NOT fix the problem for me, unless I did something wrong modifying the Library (I learned some things about OSX while trying to find where those library files were hidden!) But it seems like a possibility for you.

Let me know if you solve this!
6  Using Arduino / Networking, Protocols, and Devices / SoftwareSerial with TinyGPS problems on: October 29, 2013, 07:38:22 am
Hello,
I'm having lots of trouble using SoftwareSerial to communicate with my GPS module (Locosys LS20031). I'm running the example script from the Arduiniana TinyGPS site:
Code:
#include <TinyGPS.h>

#include <SoftwareSerial.h>

TinyGPS gps;
SoftwareSerial mySerial(4,5); // RX, TX
long lat, lon;
unsigned long fix_age, time, date, speed, course;

void setup()
{
  Serial.begin(57600);
   
    mySerial.begin(57600);
}

 

void loop()
{
  while (mySerial.available())
  {
    int c = mySerial.read();
    if (gps.encode(c))
    {
     
      // process new gps info here
      // retrieves +/- lat/long in 100000ths of a degree
      gps.get_position(&lat, &lon, &fix_age);
      // course in 100ths of a degree
      course = gps.course();

      //Output info via USB
      Serial.print("Latitude=");
      Serial.println(lat);
     
      Serial.print("Longitude=");
      Serial.println(lon);
     
      Serial.print("Age=");
      Serial.println(fix_age);

      Serial.print("Course=");
      Serial.println(course);

    }
 
  }
}

The Serial monitor shows blank. The gps.encode() never returns true meaning I'm not getting good sentences. However if I remove the SoftwareSerial class and just listen to the GPS on pin 0 and print with the Serial class it works fine:
Code:
#include <TinyGPS.h>

//#include <SoftwareSerial.h>

TinyGPS gps;
//SoftwareSerial mySerial(4,5); // RX, TX
long lat, lon;
unsigned long fix_age, time, date, speed, course;

void setup()
{
  Serial.begin(57600);
   
   // mySerial.begin(57600);
}

 

void loop()
{
  while (Serial.available())
  {
    int c = Serial.read();
    if (gps.encode(c))
    {
     
      // process new gps info here
      // retrieves +/- lat/long in 100000ths of a degree
      gps.get_position(&lat, &lon, &fix_age);
      // course in 100ths of a degree
      course = gps.course();

      //Output info via USB
      Serial.print("Latitude=");
      Serial.println(lat);
     
      Serial.print("Longitude=");
      Serial.println(lon);
     
      Serial.print("Age=");
      Serial.println(fix_age);

      Serial.print("Course=");
      Serial.println(course);

    }
 
  }
}
Before this project is complete I'm going to want to send some control bits back to the GPS, so I can't get by without SoftwareSerial or some other solution. Does anyone have suggestions?
7  Using Arduino / Programming Questions / Accessing Standard Libraries code on: October 16, 2012, 02:36:38 pm
Hello,
I'm trying to work out a bug communicating with a GPS module (LS20031 module). The Sparkfun blog showed others with a similar problem that they solved by increasing a buffer size in the NewSoftSerial library. I'm using Arduino 1.0.1, so the NewSoftSerial library is now a standard library renamed SoftwareSerial. I don't know how to get to the source file for it to try to modify it. I'm developing on a Mac OSX 10.7.4. Any advice where to access this?
8  Using Arduino / Project Guidance / Re: Pet Feeder with RFID on: September 06, 2012, 03:57:57 pm
Maybe this will help with your timer question (from Arduino Playground):
http://arduino.cc/playground/Code/DelaySeconds

I used this to create a "Meal Time" device for our dog because she has a way of convincing you that she's hungry even though someone else in the house just fed her 10 minutes ago, (or everyone assumes that someone else gave her breakfast, and her meal might get skipped).  It's a box with a red LED for "hungry" and a green LED for "happy" and a de-bounced button to push when you feed her.  I set the delay for 8 hours.  When you feed the dog you push the button and it lights up green "Happy" until the timer runs out, then it lights red "Hungry".  Now everyone knows if she needs feeding or not. We've been using it for months.
9  Using Arduino / Project Guidance / Check engine light on: September 04, 2012, 09:54:31 am
Does anyone have any info on hacking a reader to get the error code from the Check Engine light on my dashboard?
10  Using Arduino / Project Guidance / Going beyond breadboard on: February 28, 2012, 09:57:08 am
Hello,
I've assembled a weather observing station and have it gathering data. Now I'd like to assemble a few more to use in other locations, or for other geek friends to use.  I have NO experience in laying out or making a PCB.  Can anyone recommend a reference or how-to book for building a more permanent circuit?
11  Using Arduino / Displays / Re: Problem with LCD and Motor on: January 23, 2012, 11:12:29 pm
I'm having the same symptoms when using a 5v relay to switch current from a 12v supply to a solenoid. I put a 2n4004 diode across the coils of the relay and the solenoid to short the back EMF, but no joy.  It works OK with just the relay clicking on and off, but one or two cycles of the 12v solenoid takes out the LCD.  Should I try the capacitor across either or both DC supplies?
Pages: [1]