Skip to main content

ESP GPIO pins...

The ESP8266 can easily be programmed with the Arduino IDE and the main benefit using it, is the WiFi interface that reduces your communication wiring to zero.

A $5 Raspberry Pi Zero W with a $5 micro SD Card becomes your Access Point, DHCP Server, Gateway to the Internet, and will also run applications like JMRI and MQTT.

But, now that you have a well connected $3 ESP-xx device, what pins are available to do what? We are not counting the Rx and Tx pins, you could reassign those for your own purpose, but the boot loader is going to talk at startup and updating your firmware might need these pins, so think ahead.

There is some information here, but when you are writing the "Arduino" code for the ESP8266, you need a little more guidance...

The ESP-01 has 2 GPIO pins, so you can do a 3 color signal, 2 relays, 2 digital sensors, or use them for i2c to a port expander and the rest is easy.

The ESP-05 has none, only the RST, RXD and TXD pins...good WiFi shield, if you have a UART on your side.

The ESP-WROOM-02 seems to have 8 or 9 useful GPIO pins (depending if IO16 is used for the deep sleep).

The ESP-WROOM-32 has about 23  useful GPIO pins (and 16 ADC pins, 2 DACs, 10 touch inputs). Expect to see a lot more about this ESP32!

The ESP-12 has 11 GPIO pins, with one ADC capable.

So on to the reason for this post, what are the pin numbers to use, if you do have 11 GPIOs, so first the code that printed these numbers to see where D0 through D10 might lead:
void setup( ) {
  Serial.begin( 115200 );
  delay( 10 );

  String printPinStr;
  printPinStr += String(D0);  printPinStr += ",";
  printPinStr += String(D1);  printPinStr += ",";
  printPinStr += String(D2);  printPinStr += ",";
  printPinStr += String(D3);  printPinStr += ",";
  printPinStr += String(D4);  printPinStr += ",";
  printPinStr += String(D5);  printPinStr += ",";
  printPinStr += String(D6);  printPinStr += ",";
  printPinStr += String(D7);  printPinStr += ",";
  printPinStr += String(D8);  printPinStr += ",";
  printPinStr += String(D9);  printPinStr += ",";
  printPinStr += String(D10); //  printPinStr += ",";
  //printPinStr += String(D12);  // ...:44: error: 
  // 'D12' was not declared in this scope
  printPinStr += ";";
  Serial.println( printPinStr ); 
} // setup( )
And the result:
16,5,4,0,2,14,12,13,15,3,1;
And this tells that D0 is connected to GPIO16 and D1 is connected to GPIO05.

More to come shortly!

For some comparisons, take a look at the bottom of this Edwin Robotics page.

Popular posts from this blog

Pi Pico, we smell competition in the land of the RRRduino! 

Pi Pico on an N-scale gondola Pi Pico, we smell competition in the land of the ‘duino!  Our very favorite low cost microcontroller system is seeing some fresh competition.  Everyone by now has heard about the Raspberry Pi, some fruity company in the United Kingdom, making single board computers!  They run Raspbian (or other flavors of Linux and are capable of some Windows versions) for as little money as $10 for the Pi Zero W.  The more popular Model 4, with 2 GB of RAM, retails for about $29.  Add a $5  micro SD card and you have a real computer with which you can surf the internet, write code and even program Arduinos.  It also runs our other favorite, JMRI.  Of course, plug it into a small or big screen television with an HDMI cable and you can even stream Netflix.  If you want a really cool computer built into a keyboard, also check out the brand new, Raspberry Pi 400 , you might just think you own a ZX Spectrum again. These are all “comp...

Signal Masts in JMRI 4.14, for beginners...

Here are all the notes and files from the Plano Train Show Clinic. You need to have an internal sensor ( IMCOMPORT ) with the port in the value like COM10 or /dev/ttyUSB0 , whatever Device Manager (or /dev/ttyUSBx) shows for the connected Arduino. If you have Panels -> Script Output open, you will see the message:  !!! Please add IMCOMPORT with the port in the value!!! The basic idea here is to use the Comment in the Signal Head field to define the position of the Pixel in the string commented to the Arduino, as well as the RGB colors to show for Clear, Approach and Stop (00:00 FF 00: BBAA 00: FF 0000). With all the Heads in the Table, run the python script and now you can update the colors in the Comment "live", keeping in mind that a message is only sent when a Head changes color. We then put the Heads in Masts and use the Signal Mast Logic to do the magic. I like the original Panel Editor more and it works fine as long as you keep using Mast pairs, which require...

Roll-up Doors with a State Machine

Roll-up a door please!  (with a State Machine in code, part 1) MHO Junction’s Molson Brewery in a 3D Layout View ( all photos and drawings by Lloyd Henchey, Ontario, Canada) We all know we can open and close close something with an Arduino and a Servo, but what if we want to a little bit more operating fun with some lights and sounds, all after a manager gives approval to open or close the door to the beer brewery before your engine is allowed to pick up or deliver a car? Control Panel at the brewery   Six doors under construction at the Molson brewery on the MHO Junction  Engine pulls up to the red light, shift manager (operator) grants permission, door raises up with alarms and a flashing red light, door goes all the way up, light turns green , engine or car can proceed! Same flashing red light going down and maybe different door squeaking noises. All good articles start with a YouTube video: youtube.com/watch?v=-8EnpUgTqR4 ! This article will introduce you to a “Fi...