ESP-12E (ESP8266) battery powered breadboard design

Have been pulling my hair out trying to wake the esp up with gpio16 ---rest/wdt connected, at wake up time I get a line of garbage in my serial monitor, but no reset happening now I read somewhere it might not work with usb/serial breakout board.

Any of you familiar with this problem? Do I need a resistor between gpio16 and rest? (I have a 4.7k right now, but makes no difference)

When I keep gpio16 connected to rest and turn it on it seems to be hanging in a wdt reset loop, hmm now I think about it maybe something is using pin 16 which causes this.. I'll check this first tomorrow

You cannot use GPIO 16 as an output or input. Im not sure if you are also trying to do that, but if you are, forget about it.

fmms:
Have been pulling my hair out trying to wake the esp up ...
<...>

Wake-up from deep sleep is a Reset, so the uC goes through a full setup (inc. sending the status out the serial port which you are complaining about) and the Arduino start-up code, initialization, etc.

Ref: here

Ray

Qdeathstar:
You cannot use GPIO 16 as an output or input. Im not sure if you are also trying to do that, but if you are, forget about it.

Please do not post incorrect info!

XPD 16 Can be connected to reset to set the ESP8266 into deep sleep mode.

Reference: ESP8266 Thing Hookup Guide - SparkFun Learn

Sorry, i meant that you can you cannot use it for any other purpose, but that. (Eg, driving leds, reading a sensor, ect). SO if you were using pin 16 to read a sensor, and setting it up in setup, that could/would cause a WDT reset.

Hi Ray, the garbage I mean is unreadable, and the sketch isn't restarting after the wake up call.

I know gpio16 isn't usable for other things when connected to reset, I will doublecheck my code today maybe it is still being used somewhere thanks.

I don't uur pin 16 in my code, for the hc-sr04 I use pin 12 & 14.

I will try and upload an empty sketch tonight with deep sleep function only to see if this works without problems.

fmms:
I don't uur pin 16 in my code, for the hc-sr04 I use pin 12 & 14.

I will try and upload an empty sketch tonight with deep sleep function only to see if this works without problems.

You may refer to: ESP8266 forum link
And the Op that posted the wake from sleep test code that I referenced in #22 above indicated that the test worked correctly with the newest ESP8266 Arduino core.

Ray

fmms:
Hi Ray, the garbage I mean is unreadable, and the sketch isn't restarting after the wake up call.

I've seen a bit of "garbage" on serial every time I reset an ESP, but eventually it will start outputting correctly if you have the right baud rate on your console.
Be aware that many have managed to soft-brick their ESPs by attempting to change the baud rate with AT commands, but I'm not sure what happens when using the ESP8266 core.
Default is 115200 and it works very well at that rate.

Thank you everyone for the great replies, will continue working on this tonight :slight_smile:

fmms:
Hi Ray, the garbage I mean is unreadable, and the sketch isn't restarting after the wake up call.
<...>


According to this
, which I have witnessed numerous times, the boot-up BAUD has nothing to do with what your previous "AT" command or Arduino serial sketch indicates. I (personally) have not found a workable solution to this problem; since the WDT reset causes the Arduino sketch to rerun, each invocation results in the boot-up message is spewed at 74,880 BAUD.

Ray

fmms:
I don't uur pin 16 in my code, for the hc-sr04 I use pin 12 & 14.

I will try and upload an empty sketch tonight with deep sleep function only to see if this works without problems.

OK .... down in the lab for you.
I took a new, out of the antistatic NodeMCU by Lolin and used a female-female Dupont jumper to connect Rst with D0 (GPIO16) and ran this sketch:

extern "C" {
#include "user_interface.h"
}

void setup() {
  rst_info *rsti;
  Serial.begin(115200);
  rsti = ESP.getResetInfoPtr();
  Serial.println("\r\nStart...");
  Serial.println(String("ResetInfo.reason = ") + rsti->reason);
}

// the loop function runs over and over again forever
void loop() {
  Serial.println("going to sleep now...");
  system_deep_sleep_set_option(0);
  system_deep_sleep(10000000);            // deep sleep for 10 seconds
  delay(1000);
}
// See more at: http://www.esp8266.com/viewtopic.php?f=32&t=8411&start=4#p42013

and I got this output with the monitor on 115200 BAUD

{ll��|�d�|�d�c<���e�{�csd$ܟ<�l�<�l�c|����r�#�c��'o�do'���cp��dsdrd8�g��lĜb'�|$����c��o'�l��d`�eo'l`ao;Ǜ�'��ala{��o��$��g�
Start...
ResetInfo.reason = 5
going to sleep now...
;ld��|�$�|�$�c|ǃ�e�{�c�c��og�lno���bx��l;l{lp�n��d��cg�|lČ��c��'o�$��l`�e'o
> fmms:
> I don't uur pin 16 in my code, for the hc-sr04 I use pin 12 & 14.
> 
> I will try and upload an empty sketch tonight with deep sleep function only to see if this works without problems.

OK .... down in the lab for you.
I took a new, out of the antistatic NodeMCU by Lolin and used a female-female Dupont jumper to connect Rst with D0 (GPIO16) and ran this sketch:

```
extern "C" {
#include "user_interface.h"
}

void setup() {
  rst_info *rsti;
  Serial.begin(115200);
  rsti = ESP.getResetInfoPtr();
  Serial.println("\r\nStart...");
  Serial.println(String("ResetInfo.reason = ") + rsti->reason);
}

// the loop function runs over and over again forever
void loop() {
  Serial.println("going to sleep now...");
  system_deep_sleep_set_option(0);
  system_deep_sleep(10000000);            // deep sleep for 10 seconds
  delay(1000);
}
// See more at: http://www.esp8266.com/viewtopic.php?f=32&t=8411&start=4#p42013
```

and I got this output with the monitor on 115200 BAUD

g{���o��lr��' ��al��n�
Start...
ResetInfo.reason = 5
going to sleep now...
;ld��|�$�| �$�c|���e�{�c�c��g'�lng��� bx��l;l{lx�n� � d ��  #g�|d��#��no�$��l �eno

fmms:
I don't uur pin 16 in my code, for the hc-sr04 I use pin 12 & 14.

I will try and upload an empty sketch tonight with deep sleep function only to see if this works without problems.

OK .... down in the lab for you.
I took a new, out of the antistatic NodeMCU by Lolin and used a female-female Dupont jumper to connect Rst with D0 (GPIO16) and ran this sketch:

extern "C" {
#include "user_interface.h"
}

void setup() {
  rst_info *rsti;
  Serial.begin(115200);
  rsti = ESP.getResetInfoPtr();
  Serial.println("\r\nStart...");
  Serial.println(String("ResetInfo.reason = ") + rsti->reason);
}

// the loop function runs over and over again forever
void loop() {
  Serial.println("going to sleep now...");
  system_deep_sleep_set_option(0);
  system_deep_sleep(10000000);            // deep sleep for 10 seconds
  delay(1000);
}
// See more at: http://www.esp8266.com/viewtopic.php?f=32&t=8411&start=4#p42013

and I got this output with the monitor on 115200 BAUD

'{���g��las��'��ad��n�
Start...
ResetInfo.reason = 5
going to sleep now...
sd$ܟ|�l�<�l�c|����r�#�c��go�dog���cpćdsdrl8�o��$��b'�|d����b��og�l��l`�ogl ao;���g��ala{ۓo��$��o�
Start...
ResetInfo.reason = 5
going to sleep now...
{ll��|�d�|�d�c<ǃ�e�{�c�b��og�l'o���#x��${l{$p�'��l��co�|l��Ǐc��'o�d��
> fmms:
> I don't uur pin 16 in my code, for the hc-sr04 I use pin 12 & 14.
> 
> I will try and upload an empty sketch tonight with deep sleep function only to see if this works without problems.

OK .... down in the lab for you.
I took a new, out of the antistatic NodeMCU by Lolin and used a female-female Dupont jumper to connect Rst with D0 (GPIO16) and ran this sketch:

```
extern "C" {
#include "user_interface.h"
}

void setup() {
  rst_info *rsti;
  Serial.begin(115200);
  rsti = ESP.getResetInfoPtr();
  Serial.println("\r\nStart...");
  Serial.println(String("ResetInfo.reason = ") + rsti->reason);
}

// the loop function runs over and over again forever
void loop() {
  Serial.println("going to sleep now...");
  system_deep_sleep_set_option(0);
  system_deep_sleep(10000000);            // deep sleep for 10 seconds
  delay(1000);
}
// See more at: http://www.esp8266.com/viewtopic.php?f=32&t=8411&start=4#p42013
```

and I got this output with the monitor on 115200 BAUD

�ee'o d`gs���o ��$r��g ��al��'�
Start...
ResetInfo.reason = 5
going to sleep now...
{ll��|�d�| � d� b<���e�s�c� #��og�lgo��� #p��${ls$p�'� �l�� co�<l��Ǐc��gn�d��

fmms:
I don't uur pin 16 in my code, for the hc-sr04 I use pin 12 & 14.

I will try and upload an empty sketch tonight with deep sleep function only to see if this works without problems.

OK .... down in the lab for you.
I took a new, out of the antistatic NodeMCU by Lolin and used a female-female Dupont jumper to connect Rst with D0 (GPIO16) and ran this sketch:

extern "C" {
#include "user_interface.h"
}

void setup() {
  rst_info *rsti;
  Serial.begin(115200);
  rsti = ESP.getResetInfoPtr();
  Serial.println("\r\nStart...");
  Serial.println(String("ResetInfo.reason = ") + rsti->reason);
}

// the loop function runs over and over again forever
void loop() {
  Serial.println("going to sleep now...");
  system_deep_sleep_set_option(0);
  system_deep_sleep(10000000);            // deep sleep for 10 seconds
  delay(1000);
}
// See more at: http://www.esp8266.com/viewtopic.php?f=32&t=8411&start=4#p42013

and I got this output with the monitor on 115200 BAUD

�egod`ags�ۓo��$;��g��al��'�
Start...
ResetInfo.reason = 5
going to sleep now...
;ld��|�$�|�$�c|ǃ�e�{�c�c��o'�lno���bx��l;l{lx�n��d��cg�|lČ��#��no�$��l �eno
> fmms:
> I don't uur pin 16 in my code, for the hc-sr04 I use pin 12 & 14.
> 
> I will try and upload an empty sketch tonight with deep sleep function only to see if this works without problems.

OK .... down in the lab for you.
I took a new, out of the antistatic NodeMCU by Lolin and used a female-female Dupont jumper to connect Rst with D0 (GPIO16) and ran this sketch:

```
extern "C" {
#include "user_interface.h"
}

void setup() {
  rst_info *rsti;
  Serial.begin(115200);
  rsti = ESP.getResetInfoPtr();
  Serial.println("\r\nStart...");
  Serial.println(String("ResetInfo.reason = ") + rsti->reason);
}

// the loop function runs over and over again forever
void loop() {
  Serial.println("going to sleep now...");
  system_deep_sleep_set_option(0);
  system_deep_sleep(10000000);            // deep sleep for 10 seconds
  delay(1000);
}
// See more at: http://www.esp8266.com/viewtopic.php?f=32&t=8411&start=4#p42013
```

and I got this output with the monitor on 115200 BAUD

'{���o��las��' ��ad��n�
Start...
ResetInfo.reason = 5
going to sleep now...
{ll��|�d�| � d� b<���e�s�c� #��og�lgo��� #p��${ls$p�'� �l�� co�<l��Ǐc��gn�d��

fmms:
I don't uur pin 16 in my code, for the hc-sr04 I use pin 12 & 14.

I will try and upload an empty sketch tonight with deep sleep function only to see if this works without problems.

OK .... down in the lab for you.
I took a new, out of the antistatic NodeMCU by Lolin and used a female-female Dupont jumper to connect Rst with D0 (GPIO16) and ran this sketch:

extern "C" {
#include "user_interface.h"
}

void setup() {
  rst_info *rsti;
  Serial.begin(115200);
  rsti = ESP.getResetInfoPtr();
  Serial.println("\r\nStart...");
  Serial.println(String("ResetInfo.reason = ") + rsti->reason);
}

// the loop function runs over and over again forever
void loop() {
  Serial.println("going to sleep now...");
  system_deep_sleep_set_option(0);
  system_deep_sleep(10000000);            // deep sleep for 10 seconds
  delay(1000);
}
// See more at: http://www.esp8266.com/viewtopic.php?f=32&t=8411&start=4#p42013

and I got this output with the monitor on 115200 BAUD

�egod`ags�ۓo��$;��g��al��'�
Start...
ResetInfo.reason = 5
going to sleep now...
{ll��|�d�|�d�b|���e�s�c�#��ng�lgn���cp��${$sdp�g��l��co�<l��Ǐc��gn�d��d`�egnd`ags�ۓn��d;��gĜal��g�
Start...
ResetInfo.reason = 5
going to sleep now...
rd$��|�l�|�l�c|����;�c�c��gn�dog���c8��lrd;lx�o��$��#g�|d����b��og�l��l`�eogl n{���g��alasۓn��d��o�
Start...
ResetInfo.reason = 5
going to sleep now...
rld��|�l�|�$�c|����;�c�c��g'�log���cx��l;l;lx�o��d��#g�|dČ��#��ng�l��l �engl`'{���gĜlas��n��ad��o�
Start...
ResetInfo.reason = 5
going to sleep now...
sd$ܟ<�l�<�l�c|����r�#�c��'o�do'���cp��dsdrl8�o��$��b'�|$����c��og�l��l`�eogl ao;Ǜ�'��ala{ۓo��$��o�
Start...
ResetInfo.reason = 5
going to sleep now...
{ll��|�d�|�d�b|���e�s�c�#��ng�lgn���cp��${$sdp�'��l��co�<l��Ǐc��gn�d��
> fmms:
> I don't uur pin 16 in my code, for the hc-sr04 I use pin 12 & 14.
> 
> I will try and upload an empty sketch tonight with deep sleep function only to see if this works without problems.

OK .... down in the lab for you.
I took a new, out of the antistatic NodeMCU by Lolin and used a female-female Dupont jumper to connect Rst with D0 (GPIO16) and ran this sketch:

```
extern "C" {
#include "user_interface.h"
}

void setup() {
  rst_info *rsti;
  Serial.begin(115200);
  rsti = ESP.getResetInfoPtr();
  Serial.println("\r\nStart...");
  Serial.println(String("ResetInfo.reason = ") + rsti->reason);
}

// the loop function runs over and over again forever
void loop() {
  Serial.println("going to sleep now...");
  system_deep_sleep_set_option(0);
  system_deep_sleep(10000000);            // deep sleep for 10 seconds
  delay(1000);
}
// See more at: http://www.esp8266.com/viewtopic.php?f=32&t=8411&start=4#p42013
```

and I got this output with the monitor on 115200 BAUD

�egn dags�ۓn ��d;��g Ĝal��g� Start... ResetInfo.reason = 5 going to sleep now... sdlܟ<�l�<  �l� #|����s�#�c��'o�dg'���cp��dsdrd8�g� �l Ĝ c n�|$����c��o'�l��d�eo'laorǛ�' ��ada{��o ��$��g� Start... ResetInfo.reason = 5 going to sleep now... {$l��|�d�|  � d� b|���e�s�c� #��ng�$gn���cp��${$sdp�g� �l�� co�<l�ć�c��gn�d��d�egn dags�ۓn ��ad;��g Ĝl��g� Start... ResetInfo.reason = 5 going to sleep now... rdd��|�l�| �l�c|����;�c�c��gn�dog���c8��lrd;lx�o� � $ ��  # g�|d����#��og�l��l�eogl n{���g ��alasۓn ��ad��o�
Start...
ResetInfo.reason = 5
going to sleep now...
;ld��|�$�| � d�c|ǃ�e�{�c� c��og�l'o��� bx��l;l{lp�n� � d�� cg�|lČ��c��'o�$��l`�e'o

fmms:
I don't uur pin 16 in my code, for the hc-sr04 I use pin 12 & 14.

I will try and upload an empty sketch tonight with deep sleep function only to see if this works without problems.

OK .... down in the lab for you.
I took a new, out of the antistatic NodeMCU by Lolin and used a female-female Dupont jumper to connect Rst with D0 (GPIO16) and ran this sketch:

extern "C" {
#include "user_interface.h"
}

void setup() {
  rst_info *rsti;
  Serial.begin(115200);
  rsti = ESP.getResetInfoPtr();
  Serial.println("\r\nStart...");
  Serial.println(String("ResetInfo.reason = ") + rsti->reason);
}

// the loop function runs over and over again forever
void loop() {
  Serial.println("going to sleep now...");
  system_deep_sleep_set_option(0);
  system_deep_sleep(10000000);            // deep sleep for 10 seconds
  delay(1000);
}
// See more at: http://www.esp8266.com/viewtopic.php?f=32&t=8411&start=4#p42013

and I got this output with the monitor on 115200 BAUD

g{���o��lr��'��al��n�
Start...
ResetInfo.reason = 5
going to sleep now...
{$l��|�d�|�l�#|���e�s�b�#��no�$gn���cp��d{$sdp�g��l��co�|l�ć�c��gn�dćd`�egnd`aos���n��ad;��gĜl��g�
Start...
ResetInfo.reason = 5
going to sleep now...
sd$ܟ<�l�<�l�c|����r�#�c��'o�do'���cp��dsdrl8�o��$��b'�|$����b��og�l��l`�eogl ao;Ǜ�'��ala{ۓo��$��o�
Start...
ResetInfo.reason = 5
going to sleep now...
;ld��|�$�|�$�c|ǃ�e�{�c�c��o'�lno���bx��l;l{lx�n��d��cg�|lČ��c��'o�$��l �eno
> fmms:
> I don't uur pin 16 in my code, for the hc-sr04 I use pin 12 & 14.
> 
> I will try and upload an empty sketch tonight with deep sleep function only to see if this works without problems.

OK .... down in the lab for you.
I took a new, out of the antistatic NodeMCU by Lolin and used a female-female Dupont jumper to connect Rst with D0 (GPIO16) and ran this sketch:

```
extern "C" {
#include "user_interface.h"
}

void setup() {
  rst_info *rsti;
  Serial.begin(115200);
  rsti = ESP.getResetInfoPtr();
  Serial.println("\r\nStart...");
  Serial.println(String("ResetInfo.reason = ") + rsti->reason);
}

// the loop function runs over and over again forever
void loop() {
  Serial.println("going to sleep now...");
  system_deep_sleep_set_option(0);
  system_deep_sleep(10000000);            // deep sleep for 10 seconds
  delay(1000);
}
// See more at: http://www.esp8266.com/viewtopic.php?f=32&t=8411&start=4#p42013
```

and I got this output with the monitor on 115200 BAUD

'{���o��ls��' ��ad��n�
Start...
ResetInfo.reason = 5
going to sleep now...
;ld��|�$�| � d�c|ǃ�e�{�c� b��og�l'o��� #x��l;l{lp�n� � d�� co�|l����c��'o�$��l`�e'o

fmms:
I don't uur pin 16 in my code, for the hc-sr04 I use pin 12 & 14.

I will try and upload an empty sketch tonight with deep sleep function only to see if this works without problems.

OK .... down in the lab for you.
I took a new, out of the antistatic NodeMCU by Lolin and used a female-female Dupont jumper to connect Rst with D0 (GPIO16) and ran this sketch:

extern "C" {
#include "user_interface.h"
}

void setup() {
  rst_info *rsti;
  Serial.begin(115200);
  rsti = ESP.getResetInfoPtr();
  Serial.println("\r\nStart...");
  Serial.println(String("ResetInfo.reason = ") + rsti->reason);
}

// the loop function runs over and over again forever
void loop() {
  Serial.println("going to sleep now...");
  system_deep_sleep_set_option(0);
  system_deep_sleep(10000000);            // deep sleep for 10 seconds
  delay(1000);
}
// See more at: http://www.esp8266.com/viewtopic.php?f=32&t=8411&start=4#p42013

and I got this output with the monitor on 115200 BAUD

g{���o��$r��'��al��n�
Start...
ResetInfo.reason = 5
going to sleep now...
;ld��|�$�|�$�c|���e�{�c�c��g'�lng���bx��l;l{lx�o��d��#g�|d��#��no�$��l �eno
> fmms:
> I don't uur pin 16 in my code, for the hc-sr04 I use pin 12 & 14.
> 
> I will try and upload an empty sketch tonight with deep sleep function only to see if this works without problems.

OK .... down in the lab for you.
I took a new, out of the antistatic NodeMCU by Lolin and used a female-female Dupont jumper to connect Rst with D0 (GPIO16) and ran this sketch:

```
extern "C" {
#include "user_interface.h"
}

void setup() {
  rst_info *rsti;
  Serial.begin(115200);
  rsti = ESP.getResetInfoPtr();
  Serial.println("\r\nStart...");
  Serial.println(String("ResetInfo.reason = ") + rsti->reason);
}

// the loop function runs over and over again forever
void loop() {
  Serial.println("going to sleep now...");
  system_deep_sleep_set_option(0);
  system_deep_sleep(10000000);            // deep sleep for 10 seconds
  delay(1000);
}
// See more at: http://www.esp8266.com/viewtopic.php?f=32&t=8411&start=4#p42013
```

and I got this output with the monitor on 115200 BAUD

'{���g Ĝlas��' ��ad��n�
Start...
ResetInfo.reason = 5
going to sleep now...

I'm using ESP.deepsleep(10000) is this the same?

The breadboard cables make debugging a pain, I have a breakout board where the esp is soldered on, but sometimes I need to fiddle with the cables to get it to start, I think I'm going to solder them directly onto the board to take this variable out of the equation

Thanks a lot mrburnette, I got your code running, and it's working! :slight_smile:

And I found the culprit in my code :expressionless: it was using BUILTIN_LED constant from my arduino uno setup, which is pin16 :open_mouth: It's mostly simple things like this that take up most of my time.. thanks a lot for helping me out, at least I have a decent setup now, when I get the prototype ready I'll post my board, maybe you can check if I didnt miss anything :slight_smile:

Thanks again

This is an everyone post:

When faced with a perplexing programming problem, always find a small, simple (as simple as possible) example sketch to exercise only the single area where you are having a problem.

If the example sketch is known to work and it does not on your installation ... figure out why not. Then move forward.

It is perfectly OK to post the example sketch here and ask that someone else attempt to duplicate your results. BUT, be certain to include such environmental things as Arduino version, OS, how the device is powered, measured values, etc.

Even we old, seasoned posters need to reread Forum Stickies from time to time.

Ray

Qdeathstar:
You cannot use GPIO 16 as an output or input. Im not sure if you are also trying to do that, but if you are, forget about it.

@Qdeathstar:

Just wanted to extend an apology to you: I misread the meaning of your statement. As this issue has been resolved, you were indeed correct; the Op had a LED on GPIO16 but was unaware of it... so many configurations of ESP8266 boards.

To restate your statement for the forum:
...if you intend on using the WDT to wake (via reset) the ESP8266 from deep sleep then GPIO16 needs to be connected to Reset (RST) and GPIO16 must not be referenced/used anywhere in your Arduino sketch and must not be connected to external components such as LED.

Regards,

Ray

Well I didn't have a led on the board, but it was still being configured in the code as a constant (that's why I overlooked it in the first place, I was looking for the number 16, but it was a nodemcu constant BUILTIN_LED wich = 16..

I have continued working on the prototype setup on my breadboard, I will order the dcdc stepdown and level shifter as linked by you mrburnette, but since the local suplier didn't have them I am currently using this for my prototype:

  • ESP2866-12E

  • HC-SR04 ultrasonic sensor

  • 4-channel I2C-safe Bi-directional Logic Level Converter - BSS138

  • LM2596S DC-DC adjustable output step-down module (It's a bulky thing but will do for the prototype)

  • I have added a 470uF capacitor at the beginning of the power input

  • I added a 0.1uF cheramic capacitor between the vcc and gnd of the hc-sr04

  • I added a 470uF capacitor at the power input before the ESP12E and the LLC

I now have a working setup.

When using my arduino uno as a power source (the 5v is pushed in on the lef top side, where the HC-SR04 is getting it's power from, the 5v is being stepped down to 3.3v with the LM2596S.

I have tested it with 3 eneloop batteries too, everything worked like a charm, even though the output voltage was on the low side (4v, HC-SR04 expects minimum of 4.5v, but it seems to work fine)

I'm planning on soldering a perfboard setup tomorrow, just need to think about how I am going to place everything as efficiently as possible, because I don't have much room on the perfboard, or at the location where this will be tested.

A few questions I have:

Do I need to add a diode between the batteries to keep them from receiving any power coming back over the line?

Should I add more 0.1uF or other capacitors?
Are there any important things I need to keep in mind?

here is my current setup:

I'm guessing 4 batteries would be even better, since I then have more capacity and a better voltage, I think I'll just test with 3 and let it run continually, and then try with 4 batteries, to measure the difference..

Thanks for bearing with me.

fmms:
<...>

A few questions I have:

Do I need to add a diode between the batteries to keep them from receiving any power coming back over the line?

Should I add more 0.1uF or other capacitors?
Are there any important things I need to keep in mind?
<...>
I'm guessing 4 batteries would be even better, since I then have more capacity and a better voltage, I think I'll just test with 3 and let it run continually, and then try with 4 batteries, to measure the difference..

Thanks for bearing with me.

@fmms: it is a pleasure to work with Ops who are putting out a sincere effort to learn.

So, one can rarely have too many bypass capicators, but in reality you really need them where stray power fluxuations can cause havoc with your uC. Usually, that would be on runs carrying DC power - both sides of the wires. Long wires pick up stray electricial signals, so we want the bypass caps to "short" that noise to ground. I/O lines that run off ghe uC board some distance may require bypass caps to minimize noise (transmission & reception.) Care needs to be used for analog snd high-speed signaling because these signals have a transient component that makes capactiance act as a load. Such topics are well understood by EE's, but not often discussed in novice discussions or forum posts.

Yes, use a diode between the battery supply and the uC board (if uC board does not already have one); but if you are using a switch between the battery and the DC-DC module, no diode is required since ghe DC-DC bulk incorporates a diode bridge at the output.

The 3/4 battery decision must be made based on run time but also note that the more "bulk" effort of the DC-DC, the higher the power loss of the conversion since the % efficiency is applied to an increasing voltage difference. Buck giveth and Buck taketh away.

Good work on getting this far,

Ray