A4a LoRa ESP-12E/F PCB
This board is designed to support the ESP-12 processor module, specifically the ESP-12E and ESP-12F (which apparently only differ in the on-board WiFi antenna layout), but it can also be configured with the ESP‑12S processor module, with the associated limited functionality.
While there now appear to be several sources, the ESP-12 module was originally produced by AI-Thinker Technology and is based on the Espressif ESP8266 MCU.
ESP-12F MCU
Board Layout
The various elements are identified in the board schematic and laid out as illustrated below:
Top | Bottom |
---|---|
A4a LoRa ESP-12 [v3.3] PCB
See here for CAD and CAM files.
Configuration
Basic Configuration
While many of the components on this board are optional, those that need to be included for basic operation are:
- ESP-12 processor
- ESP-12 programmer header
- A4a 'Sandwich' interface header (Power & Sensors)
- Reset button
- Flash button
- Pull-up resistors on the RST and EN pins
- Pull-down resistor on GPIO15
- If the [optional] voltage regulator is not configured, bridge solder jumper SJ1
Processor
- ESP-12F [Espressif ESP8266] SMD-22 MCU (U1)
ESP-12 MCU
This board can be configured with any physically compatible ESP-12 processor—I have used ESP-12E, ESP-12F and ESP-12S variants. The E & F variants apparently only differ in the configuration of their antennae, but the S variant does not break out the six pins found along the side opposite the antenna. As such, the ESP-12S does not provide access to GPIO10 and thus cannot be used with the analog multiplexor described below.
Serial Adaptor/Programmer
- 2×4 Pin Straight Male Header (J1)
ESP-12 Serial Adaptor/Programmer Interface
The Programmer Interface comprises a 2×4 male header that mates with the female header on an ESP-01 programmer.
ESP01 Programmer [Male Header] Interface Configuration
Note that there are several different serial interface modules available on the market. Some, like the serial interface on the Arduino Pro Mini, use a 6-pin header and others, typically ESP8266 processor modules, the ESP-01 programmer 2×4 pin header.
Serial Adaptors
Because I had done some earlier work with an ESP-01 processor, I had a couple of ESP-01 programmer modules, so that seemed a logical choice. In the event, these did not turn out to be universally compatible with the range of processor modules I was using.
I would probably have gone back and redesigned the present board to use the 6-pin configuration, but when it became apparent that the ESP-12 was probably going to be one of the least flexible configurations, and that I would probably not be making extensive use of this processor, I didn't bother. For now, the interface is at least compatible with other ESP8266 module serial interfaces.
A4a LoRa ESP-12 with ESP-01 Serial Adaptor
Note that some ESP-01 adaptors come with a switch that allows them to be easily toggled between program and boot modes. Many people, as did I originally, add a switch to the module that is not supplied with one, but it's much easier to start with the switched version in the first place—I just didn't know they existed when I made my first purchase.
ALF4all Sandwich Interface Header
- 2×7 Pin Straight Male Header(J3)
ALF4all Sandwich Interface [Male Header]
All of the A4a processor modules are designed to plug into one of the A4a base boards (8558-BCS-A4a or 10068-BCS-A4a). When configured with one of these power supply/base boards, the processor draws its power from, and connects to relevant sensors through, the base board. These processor modules can, nonetheless, operate independently if they are powered through the auxiliary power connector.
Rather than confuse matters by presenting different versions of the A4a Sandwich interface pin configuration that are mirror images of each other, the configuration of the female header on the A4a base boards (e.g. 10068-BCS-A4a) is illustrated below. The configuration of the mating, male header on processor boards is the mirror image of this.
ALF4all Sandwich Interface [Base Board – Female Header] Configuration
When using the A4a Sandwich Interface to supply power, solder jumper SJ4 must also be bridged unless the auxiliary power connector and associated Schottky diode are also being configured.
Reset Button
- 2P Momentary Switch (S2)
- 0.1µF 0805 Capacitor (C1)
Reset Button
Pressing the Reset Button on its own initiates a processor reboot. If pressed while the Flash Button is also pressed, the processor enters programming mode.
The capacitor is configured to dampen voltage spikes that may occur when the Reset Button is pressed.
Flash/Program Button
- 2P Momentary Switch (S3)
Flash/Program Button
The Flash Button is used to facilitate programming of the ESP-12 processor. To enter programming mode, hold down the Flash Button and press the Reset Button. Both buttons can then be released and code can be downloaded to the processor through the Programmer Interface.
Pull-up/Pull-down Resistors
Several pins on the ESP-12 processor must be in a specific state during the boot cycle. The following table lists the pins in our configuration that need to be in a specific state when the processor boots.
Boot-time Pin States
Pin | State |
---|---|
EN | High |
RST | High |
GPIO0 | High |
GPIO2 | High |
GPIO15 | Low |
This article from Random Nerd Tutorials provides an excellent overview of ESP-12 pins and functions.
Note that in the present configuration, GPIO0 is used for the I2C SCL signal but this does not interfere with the role of GPIO0 at boot time.
The five resistors that need to be configured in the present context are as follows:
.- 10kΩ 0805 Resistor (R2)
EN Pull-up Resistor
- 10kΩ 0805 Resistor (R3)
RST Pull-up Resistor
- 10kΩ 0805 Resistor (R5)
GPIO0 Pull-up Resistor
- 10kΩ 0805 Resistor (R4)
GPIO2 Pull-up Resistor
- 10kΩ 0805 Resistor (R6)
GPIO15 Pull-down Resistor
Optional Elements
While the A4a LoRa ESP-12 board can operate with only the above components, the following can also be configured for added functionality.
Analog-to-Digital Converter (ADC) Voltage Divider
- 220kΩ 0805 Resistor (R7)
- 100kΩ 0805 Resistor (R8)
ADC Voltage Divider
If the ESP-12 ADC is to be used, the voltage divider must be configured.
As the [10 bit—0..1023] ESP-12 ADC only measures signals up to 1V, the values of the resistors used need to bring the normal signal levels, nominally 3.3V in our case, back to something in the range 0–1V. The 220kΩ/100kΩ configuration recommended is the same as that used on the NodeMCU development board, providing a level of compatibility between the two ESP8266-based processor boards I have used.
EEPROM
- AT24Cxx (02–64KB) SOP-8 EEPROM (U2)
EEPROM
As it stands, ESP8266 modules don't have genuine onboard EEPROM memory, although this function can be emulated in part (512 bytes) of the module's flash memory.
Regardless, all of the A4a LoRa processor boards include support for an I2C EEPROM, providing a level of consistency with how any processor or node information that needs to survive a power cycle can be managed.
At the moment, the only common inforation stored in EEPROM is a number, the Sequence Number, that is used to keep track of the sequence of LoRa transmissions. The 'weather station' application also uses the EEPROM to store rainfall data. Nonetheless, this data storage option exists for any future application that may need it.
Note that pull-up resistors are generally required on the [SCL/SDA] control lines for the I2C interface used to access the EEPROM.
Pull-up Resistors
- 10kΩ 0805 Resistor (R4)
- 10kΩ 0805 Resistor (R5)
I2C Pull-up Resistors
Some devices seem to be more sensitive than others with regard to the need for I2C pull-up resistors—they may work fine by themselves, but not when another device is added to the bus, or vice versa. I have not encountered any problems when pull-up resistors are configured, but I have when they're not, so I would always configure them.
Note that since GPIO0, which is used in the present configuration for the I2C SCL line but also has a special role in the boot cycle, must be high at boot time, its pull-up resistor (R5) must always be configured.
Auxiliary Power Connector
- 2P PH2.0 Right Angle JST Connector (J4)
- 1N5819 SOD-123 Schottky Diode (D1)
Auxiliary Power Connector
The ESP-12 processor operates on a supply voltage of 2.7 – 3.6V, a nominal 3.3V. As such, if the auxiliary power PH2.0 connector is used for anything that delivers more than 3.6V, like even just a Li Ion or LiPo battery (3.2V–4.2V), the voltage regulator should also be configured. I have run processors on higher voltages, usually by accident, without damage, but this is never recommended.
If the A4a Sandwich Interface is configured, and it usually will be, the Zener diode (D1) should also be configured and the solder jumper SJ4 left open, to protect any power source connected through this interface.
Voltage Regulator
- MCP1700T-3302E SOT-23-3 3.3V Voltage Regulator (U3)
- 1µF 0805 Capacitor (C2)
- 1µF 0805 Capacitor (C3)
Voltage Regulator
In the present environment, where power will usually be supplied through one of the BCS-A4a base boards, this voltage regulator is not required. It is really only needed when power supplied though the Auxiliary Power Connector needs to be regulated, for example when using a LiPo battery, which has the potential to provide more than the 3.6V maximum rated voltage for the ESP-12 module.
If the external power source is something like a LiFePO4 battery (2.5V–3.65V), and the regulator is not configured, the regulator bypass solder jumper (SJ1) must be bridged.
Analog Multiplexor
- 74HC4051 SOP-16 8-Channel Analog Multiplexer (U4)
- 2P2T SMD Switch (S4)
- 0.1µF 0805 Capacitor (C5)
- 10kΩ 0805 Resistor (R9)
Analog Multiplexor
Note: The use of an analog mux here was largely an academic exercise—if more than one ADC input is required, it would probably be more practical to use a processor that supports the required number itself.
Since the ESP-12 processor includes only a single ADC, the analog multiplexor can be used to switch between two separate analog sources. An 8-channel multiplexor has been used simply because it was the most economical solution, even if only two channels are being used.
In this configuration, two processor pins are required: the ADC pin (the A4a A0 pin) and a digital pin (the A4a A2 pin, GPIO10 on the ESP-12) to set the mux address (0 or 7). If two analog sources are not required, the Mux Bypass Switch provides the ability to switch the mux out of the circuit so that the [digital] address line (A4a A2) can be used for other purposes.
The enable pin must be pulled low (R9) to switch on the mux and the capacitor (C5) is included to avoid spikes on the power supply line.
If the mux and Bypass Switch are not configured, and GPIO10 and/or the ADC are to be used, the respective solder jumpers SJ2 and/or SJ3 must be bridged.
There is much discussion in various quarters about whether or not it is appropriate to be using GPIO9 or GPIO10 on the ESP-12E/F processors, as they have specific and, in some cases, exclusive internal functions. For my own part, in my testing, I have had no success using GPIO9 for external functions, but no problem using GPIO10.
LoRa-Pi Header
- 2×7 Pin Straight Male Header (J2)
LoRa-Pi Header
For my prototyping work, I have used my LoRa-Pi Hat to interface with the RFM95W radio that is used with processors—Espressif or Arduino (Atmel)—that do not include an onboard radio. The simple reason is that this allowed me to create many configuration variations without having to use an individual radio module for every one, rather just swapping the Hat between configurations. The configuration of the RFM95W pins on the LoRa-Pi interface is simply that which allows direct connection to a Raspberry Pi [male] header—the LoRa-Pi Hat, itself, thus has a female header—using the Hallard pin configuration. The LoRa-Pi interface header on the A4a processor boards is thus also a male header, configured as illustrated below.
LoRa-Pi Interface [Processor Board – Male Header] Configuration
Refer to the LoRa-Pi Hat page for the full details of its hardware configuration.
Power Conditioning Capacitor
- 220µF 3528-21 Tantalum Capacitor (C4)
Power Conditioning Capacitor
At one point, I encountered a problem with the RFM95W radio when coming out of deep sleep (on both this and the NodeMCU board, which also uses an ESP-12 processor). It was never entirely clear what the problem was, but one of the suggestions I found was that it might be the result of power supply instability. Whether or not this was the problem I was experiencing, I have not had any further trouble since configuring a capacitor across the supply lines as illustrated.
Wake on Interrupt
- 1P SMD DIP Switch (S1)
Wake on Interrupt Switch
The ESP-12 will wake itself up on deep sleep timer expiration if RST is connected to GPIO16. This connection should only be made, however, after the relevant software has been loaded into the processor. The Wake switch is included to support this option but must, therefore, if configured, be turned off when loading software.