GPS Module with backup battery

Hello,

I want to create a GPS+Bluetooth (Neo-6m and HC-05) device that works on LiPo battery (charged using TP4056), but that can also work while battery is charging (from USB power).

I added a FTDI module so that i can charge and program the device while connected to PC.

For switching between USB power (via FTDI) and battery power i used schematic found here:
https://forum.arduino.cc/index.php?topic=496727.0

Here is a schematic of what I'm trying to do, i would appreciate if someone can point out anything wrong with it. (probably a lot of stuff, first time try to create a schematic for something)

Also, since both FTDI and GPS modules will be using hardware Serial, i added a switch to disconnect GPS module if i want to upload a sketch. Is there a way to do this automatically somehow?

Regarding the NEO-6M I use Software Serial, not the hardware serial. Would You like the code I used?

Any particular reason for using SoftwareSerial over Serial? I have no problem flipping a switch when i want to upload a sketch.

Serial should be superior in all aspects, especially since i want to to upgrade to a 10hz module later, and do a lot of processing of the data.

I use NeoGPS by the way.

Using SoftwareSerial releases You from one problem. Use it if You like.
The code is too large for code tags so I attache the file. Search for the GPS lines of code from my GPS based speedometer.

GPS_LCD_190529_auto_summer_time.ino (12.5 KB)

Tnx for sharing

No reason. I'm a newbie here in spite of 45 years of programming in other environments.

For me, using a software serial port allows me to not only upload code without a switch but also use serial prints to serial monitor for monitoring the program and troubleshooting. Serial prints are about the only debugging tool you have.

@groundFungus
You have my full support for that! Debug printings gave me success during many, many, years.

Software serial should handle 10Hz updates. What software serial will not do is work, reliably, at over 38400 baud.

debugging works fine for me with gps connected to Serial, at least with the code that im using (NeoGPS library)

An since i have 2 UART devices, using 2 SoftwareSerial instances doesnt really work.

Software part isnt a problem, i just wanted to verify if my schematic is correct, if i connected everything correctly, etc.

If Your project works well, drop the case. It wouldn't work if wiring was bad.

Nothing is connected except GPS yet, waiting for parts. Ill let you know if anything explodes when i connect everything :smiley:

To disconnect the GPS from the Arduino while uploading a sketch --

What about wiring the GPS's GND thru the switch that you are using to "switch input voltage from LiPo to FTDI"? If the GPS's GND or VCC is disconnected will this give the same effect as breaking its TX connection?

Is that switch electronic?

John.

Switching GND is mostly bad. Things might get roasted.

thank, railroader, i'll make a point of not doing that.

Note one thing. A GPS module needs quite some start up time upon being powered on after resting. It's not instant, can take minutes. Figure out the baalance between charging and discharging time. How to cut down pwr the best I can't tell. I don't have enough overwiev of the project.