LCD Screen & GPS help??

Okay, so I decided to put a small OLED screen, a GPS module, and a thermistor on a circuit board!

Well, I tested it out on my arduino mega, after some tinkering and problem solving got the OLED working - the gps too.

I soldered the gps on the board, and was powering it and communicating with it soldered to the board by the way, so yes no wiring faults (I am almost sure).

I tested the OLED, it works.

I am using an ATMEGA328AU chip I found off of ebay (cheaper)

Well, I loaded the sketch, bam! Not working! I took a step back, and figured out that I can actually use the OLED display and display the temperature through the thermistor and all on the board.

It is only when I add the GPS to the code it all breaks down. I had the GPS on the TX and RX pins but it wasn’t working, so I bootleg soldered to change it over to pins 2 and 3.

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_GPS.h>
#include <SoftwareSerial.h>

// If using software SPI (the default case):
#define OLED_MOSI   6
#define OLED_CLK   5
#define OLED_DC    8
#define OLED_CS    13
#define OLED_RESET 7
Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);

//Uncomment this block to use hardware SPI
//#define OLED_DC     8
//#define OLED_CS     13
//#define OLED_RESET  7
//Adafruit_SSD1306 display(OLED_DC, OLED_RESET, OLED_CS);



#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif

//   Connect the GPS TX (transmit) pin to Digital 3
//   Connect the GPS RX (receive) pin to Digital 2
SoftwareSerial mySerial(2,3);
Adafruit_GPS GPS(&mySerial);
#define BUTTON 9

void setup()   {                
  GPS.begin(9600);
  GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCGGA);
  GPS.sendCommand(PMTK_SET_NMEA_UPDATE_1HZ);
  GPS.sendCommand(PGCMD_ANTENNA);
  // by default, we'll generate the high voltage from the 3.3v line internally! (neat!)
  display.begin(SSD1306_SWITCHCAPVCC);
}
int i = 43;
void loop() {
  change();
}

void change()
{
  display.clearDisplay();
  display.setRotation(90);
  display.setTextSize(2);
  display.setTextColor(WHITE);
  display.setCursor(0,0);
  display.println(Thermistor(analogRead(A0)));
  display.print(i);
  display.display();
  delay(1000);
  i += 3;
}

double Thermistor(int RawADC) {
 double Temp;
 Temp = log(10000.0*((1024.0/RawADC-1))); 
//         =log(10000.0/(1024.0/RawADC-1)) // for pull-up configuration
 Temp = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * Temp * Temp ))* Temp );
 Temp = Temp - 273.15;            // Convert Kelvin to Celcius
 Temp = (Temp * 9.0)/ 5.0 + 32.0; // Convert Celcius to Fahrenheit
 return Temp - 24;
}

Note that the GPS isn’t actually used, I just declared all the proper info (I think, it worked before - I was using Hardware serial though. And, when on the smd atmega, I tried all hardware, serial, etc. before switching the pins from rx & tx to 2 and 3 or what not. )

It doesn’t do anything, the screen is blank, after a few seconds there are random pixels, it does weird things

Any ideas? Help?

Anything would be greatly appreciated. Thanks,

Charles

Have you checked GPS alone. When you use adafruit library you get any response or not.

Yes,

Maybe I didn't explain well enough. I soldered the GPS to my board, but I had pins to connect, so I could apply power and access the TX and RX on the module.

It works perfectly on my mega, including reading the GPS and outputing it to the OLED screen.

It is just the SMD chip... the atmega328au 1437

I am using an ATMEGA328AU chip

...just the chip, eh? No caps? No connectors? No batteries? :smiling_imp:

What I'm trying to say, in a snarky way, is that it's hard to help when you give so little information.

We love schematics, pics, links to parts or specs! Right now, I can't tell if you're using perf board or something you etched. Even knowing the GPS & OLED model can tell us about current requirements. I suspect a power issue, but that's as close as I can get with what you told us.

Cheers, /dev

Okay here are pictures…

One is attached. These other two were too big to attach.

Picture 1
Picture 2

Note it isn’t exactly pretty… It was nicer, until I moved around the wires, etc. Either way, I checked everything for continuity. While it looks ridiculous, wires aren’t touch, everything appears to be wired right.

For the meantime I am powering through my Mega, which is programming the atmega328au. I have however connected it through a 12v powersupply (There is a 5v regulator)

When I do try to run it, with the GPS hooked up… etc. There is nothing that comes up, and then I just found that eventually some of my code does work on the screen but everything is sooo slow… Like 8x slower at least…

The bottom of the board has a thermistor (smaller), and a 10k resistor (larger). Right above the GPS, it is hard to see, there is a 33ohm resistor. The GPS takes from 3.3-4v or around there so I threw a resistor to limit it…

Here is the OLED screen: Screen

and the GPS… GPS

Again, note that everything works separately, and it worked when driven by my arduino Mega. (GPS and screen, working fine together on mega)

Thanks for all your help,
Charles

What is input voltage given to GPS. as per data sheet 3.3v not 5V.

can you these test again.

  1. connect your GPS alone ; upload code GPS code make ensure the data you are getting properly. i have attached GPS code for reference.
    send me screen shot of serial monitor if data recorded

  2. Then connect the OLED screen Upload sample Hello world code. Make ensure it working.

  3. make ensure you connected to proper Tx & Rx lines
    http://www.hobbytronics.co.uk/arduino-atmega328-pinout

main_c.zip (1.78 KB)

Et voilà!

  1. As AMPS-N said, this is a 3.3V GPS module. From the website where you ordered it:

Power Supply | VCC:3.0V to 4.3V;VBACKUP:2.0V to 4.3V

And from the spec, section 2.7 Absolute Maximum Ratings:

The voltage applied for VCC should not exceed 4.3VDC.

You will need a second 3.3V regulator, and level shifters on RX/TX. FETs are an easy way to do that… google for the modules (a few bucks) or schematics. Here’s one.

2). The GPS spec also says:

Operation supply Ripple Voltage: max 50mv p-p

The reason I asked about the board is to find out if there were sufficient bypass capacitors. You have none. These are little reservoirs of juice, usually placed next to each device. They provide “nearby” electrical energy reserves when the device operates. When a device has to do something, that increases the current it needs. I suspect that when the GPS module does some calculations, or you tell the OLED to do something, or you do some serial communications, or almost anything, the voltage near that device drops, or “ripples”. With 3 devices doing that, I suspect VCC is very ummm… ripply. And because the GPS device is being over-driven with 5V, it may be drawing enough current to cause VCC to droop. The GPS module will over-heat and eventually fail.

The first thing I would do is slap on a cap near each device, between .1uF and 2.2uF. In fact, the GPS spec section 4. Reference Design shows a 1uF and a 0.01uF in parallel next to the chip. That helps reduce bigger ripples (i.e., low frequency) and smaller ripples (i.e., high frequency).

You should check the regulator as well. It probably has it’s own input and output bypass cap recommendations. Without them, the regulator can “flake out”, or oscillate. You may not have a good 5V at all. Maybe it works with one device at a time because the current load is smaller?

If the caps get too big, there’s a surge when the device is first connected. Bzzzt through your Mega. Too small, and the voltage will ripple too much during operation.

Thanks for the info, and good luck!
/dev

Wow, okay.. I didn't know about any of that. Of course I am new to electronics. Thanks! I will be sure to revise the design and fix this - I do remember hearing a buzzing sound the first time it didn't work..

My question also is, does this only cause a problem with the tqfp board? When I tested it the modules themselves they were all hooked up to the mega at the same time and working together. It was only when transitioning to the board that it messed up?

-Also, what type of capacitors? Does it matter? A small ceramic? A smd capacitor would be preferable. What are the differences.. I know that resistors have wattages and resistances, etc. Capacitors?

Sorry for not being knowledgable!

Charles

All of You share the nice information...................

does this only cause a problem with the tqfp board? When I tested it the modules themselves they were all hooked up to the mega at the same time and working together

Obviously! :slight_smile:

There are caps on the Mega and a good voltage supply. You mostly lucked out there, IMHO. With a 'scope, you could investigate how noisy the modules were on the Mega and by themselves… but the voltage regulator section on the separate board is enough to keep almost anything else from working, even with bypass caps. I can’t quite make out what regulator your using. Look at the spec to see what they suggest for the total current load you have (i.e., their Reference Design).

Also, what type of capacitors? Does it matter? A small ceramic? A smd capacitor would be preferable. What are the differences… I know that resistors have wattages and resistances, etc. Capacitors?

Very good question. The biggest thing is the max voltage. Pick 25% to 200% higher than what you expect. Most people stay on the high side for power regulation, and just to have a robust design. Stepping up to the next max voltage on a cap is usually not very expensive.

In your case, you’re providing a 12V input to the voltage regulator, so I would select 20V or higher caps on the input side of the regulator. Sometimes the no-load voltage of a wall wart will be 10%-30% higher than when it’s loaded. That is, you might see 15V on the wall wart before it’s plugged into your board. Once the regulator starts doing it’s job, and the other modules start drawing current, the input voltage drifts back to 12V. It may even droop below that if its rating is lower than what your board tries to draw. Like if the GPS module is frying. :wink:

On the output side of the regulator and for the bypass caps, the voltage should always be 5V or less, so I’d grab 10V caps or above. Or you could live on the edge and grab 6V caps.

As far as what kind of capacitors, I think most people would suggest a cheap electrolytic for the larger values (>=1uF), paired with a ceramic for the smaller values (<= 10uF). The characteristics of the electrolytic make its response slower, but cheaper per uF. The ceramic can respond quickly, but they usually come in smaller sizes for the same uF, at a little higher cost. Some folks just use all ceramics, with 10uF near the power supply and .01uF next to each device. Their prices are pretty close now, but the ceramics used to be quite a but more expensive. Mica disc is the old standby (but not SMD like you want). Tantalums are physically smaller for the same uF, but more expensive. Any place you have size contraints, they may be the only choice. Think cell phones and other hand-held devices.

Many manufacturers will put detailed requirements in their specs (hint, hint). I don’t see anything in the GPS spec besides 1uF + 0.01uF, but they probably meant 1uF electrolytic + 0.01uF low ESR ceramic.

Here’s a thread over on AllAboutCircuits.com, which I’ve found to have good tutorials, and even a “textbook” that covers many bases, and has examples and problems to work. That thread has several links with lots more detail. Here’s another good thread on stackexchange.com.

Sorry for not being knowledgable!

No worries! Ignorance can be fixed. Stupid is forever. :smiley:

Cheers,
/dev