Is it possible to code a DPDT switch?

The batteries I have are 3.7 v 2500mAh I have multiple but not sure how many I will need.

The arduinos are nanos, which if I recall need 5v to run.

I have multiple sensors each with their own arduino and sd card board

Adafruit Ultimate gps
Adafruit htu21d-f temperature and humidity sensor
Adafruit mma8451 3 axis accelerometer
Adafruit amg8833 thermal camera sensor

The solar panel I am using right now is ~6v 1W ~160mA

It has been awhile but I thought voltage is the same on parallel branches and had different currents.
I have tested this setup with just the sensors (no batteries) and everything ran fine.

I'm not sure the best way to plan out the schematic attached is a picture of what I was thinking but not sure about it.