I want to create a device with only 1 plug in (usb-c in nano) and I want to charge a battery with the nano power and use the same battery to power the nano once it's disconnected from power. I know that I could use a relay to stop the battery from outputting power if it has an input voltage, but then the battery would never output a voltage to the arduino. Am I being stupid? I've drawn a (very) rough sketch of my idea. Could I use a relay each on both input and output? Is there any way my dumb idea is possible?
I cannot answer the question, information is missing. What battery are we talking about, what type is it, what voltage etc? Most batteries do not supply the voltages you show.
I think the more typical solution would be to power a lithium charger module from USB, and then have the battery output go through a boost converter to get 5V for the Nano. Like this:
But that doesn't give you the USB data lines into the Nano. Do you need them?
I should also say that if you use a 3.3V 8MHz Pro Mini instead of a Nano, you wouldn't need the boost regulator, or any regulator at all. But that might not work if you have sensors or other modules that require a more regulated voltage.
I’m trying to minimise the use of cables as I have multiple DS18B20 sensors on a ~12m cable and a float switch on a ~12m cable. I was trying to figure out if it was possible, as it would make use of the device much easier, even if it makes designing it a pain. I’ll try and find a way to use the nano USB, thank you for your help!
It’s not a matter of the voltages etc, it’s more just a general question if I can find a way to use 1 cable for the whole device I’m creating.
I could design a PCB with the controllers, voltage regulators and more necessary, I’m just trying to figure out if it is possible for the use of one cable.
What battery chemistry are you looking at?
I have a nimh battery pack, although, I’ll buy any type of battery.
You might want to consider designing around the Adafruit Feather RP2040. It has an integrated 3.7V LIPO battery charger. It's a 3.3V system. The Feather platform is available with a variety of options.
I already have a program coded for the device in the Arduino IDE. It’s over 500 lines of code and I’m not sure if it would be compatible with the raspberry pi
Will you be transmitting data on the USB cable, or just using it for power?
I’ll mainly be using it for power, but I’ll also have to use the data sometimes for serial data. I’m 3D printing the housing for the vero board and components, and as I’m using a lot of cables already and I want to optimise the use of the device, it would be much easier in the long run to be able to use one cable for both data and power.
I’m thinking- for the plug in for the device, The connection could be split into two: connected to the arduino USB and a battery. I’m pretty sure you are a lot more knowledgeable on Arduino than me, so I’m not 100% sure if it would work, so any feedback would be helpful
Edit: I’m pretty sure what I said sounded a little confusing as I don’t think I worded it correctly. I’ll post a quick drawing of it soon if that would help
The Feather RP2040 programs in C/C++ using the Arduino IDE just like the Nano. You wouldn't notice much difference once the drivers are installed.
PWM pin assignments requires some thought and no EEPROM. 133Mhz speed, 8M of flash and 256k of RAM runs circles around the Nano. Plus a built-in battery charger that doesn't overcharge your battery. You can try to reinvent the wheel, or buy a wheel off the shelf.
This has become my go-to tool of choice.
Assuming you have a Nano clone with a CH340 chip on the bottom, there would be a way to modify the Nano to permit inserting the circuit I described in post #3. Here's a schematic for the Nano clone:
http://actrl.cz/blog/wp-content/uploads/nano_ch340_schematics-rev1.pdf
Basically, you would remove the schottky diode from the USB power trace, then solder a wire from where the diode anode used to be to the charger external circuit. Then the output of the boost converter of the external circuit would connect back to the Nano's 5V pin. You would probably want to remove the existing 5V linear regulator too since it would no longer be used.
But keep in mind that you would need USB to provide enough current to power the circuit AND charge the battery at the same time. If you aren't using USB-C, that might be a problem. Generally people use something like an AC-powered USB charger, 2A or so, for battery charging. But of course that would be a second cable to an AC socket.
I will order a few tomorrow, the storage capability on the nano has made me have to minimise nearly everything on the device I’m creating, and it has more hardware capabilities than the nano too. Plus, I’m using an SD card breakout, so I wouldn’t need any on-board EEPROM if I’m correct anyway.
I'm just looking at the feather right now and I'm wondering what board to choose on the Arduino IDE?
Start reading here
You will install the Earle Philhower core when you get to this point
Once you follow and complete the Adafruit instructions, you will have various RP2040 boards available. Select the Adafruit Feather RP2040.
Just follow the instructions
If I Remember Correctly, Do Not connect the RP2040 to your computer until the core and libraries have been installed.
The first few times you program it you will need to hold down the BOOTSEL button, quickly press Reset while holding down BOOT. Hold BOOT until File Manager pops up. At this point click Upload. After a few uploads it knows what you want and you no longer have to go through the BOOT sequence.
The computer sees the RP2040 as an external storage drive. Each time I upload it prompts me asking if I want to scan the drive for viruses. I click no.
I've been trying to use some hardware with the rp2040, but it's proved to be a lot more difficult than it seems.
I can't get my DS3231 or SD card module working at all, the LCD 2004 I have works. Half the programs made for the feather RP2040 don't even compile and, when they finally do, the program stops running at specific code e.g. I'm using a DS18B20 temperature sensor and when I try and request the temperature from it, the code just stops.
Edit: any dallas temperature code I try use (sensors.begin, sensors.requestTemperatures etc) stops the code completely. the DS18B20 is wired correctly, using the correct pins and everything, but the code won't work. If I want to use this feather RP2040, it looks like I'll need to code the whole thing in circuit python.

