Quantcast
Channel: SparkFun Tutorials
Viewing all articles
Browse latest Browse all 1123

MicroMod WiFi Function Board - ESP32 Hookup Guide

$
0
0

MicroMod WiFi Function Board - ESP32 Hookup Guide a learn.sparkfun.com tutorial

Available online at: http://sfe.io/t1998

Introduction

The SparkFun MicroMod ESP32 Function Board adds additional wireless options to MicroMod Processor Boards that do not have that capability. This special function board acts as a coprocessor that takes advantage of Espressif's ESP32 WROOM to add WiFi and Bluetooth® to your applications.

SparkFun MicroMod WiFi Function Board - ESP32

SparkFun MicroMod WiFi Function Board - ESP32

WRL-18430
$14.95

Required Materials

To follow along with this tutorial, you will need the following materials at a minimum. You may not need everything though depending on what you have. Add it to your cart, read through the guide, and adjust the cart as necessary.

Reversible USB A to C Cable - 2m

Reversible USB A to C Cable - 2m

CAB-15424
$7.95
SparkFun MicroMod Artemis Processor

SparkFun MicroMod Artemis Processor

DEV-16401
$14.95
SparkFun MicroMod WiFi Function Board - ESP32

SparkFun MicroMod WiFi Function Board - ESP32

WRL-18430
$14.95
SparkFun MicroMod Main Board - Single

SparkFun MicroMod Main Board - Single

DEV-18575
$14.95

MicroMod Main Board

To hold the processor board and function board, you will need one Main board. Depending on your application, you may choose to have one or two additional function boards.

SparkFun MicroMod Main Board - Single

SparkFun MicroMod Main Board - Single

DEV-18575
$14.95
SparkFun MicroMod Main Board - Double

SparkFun MicroMod Main Board - Double

DEV-18576
$17.95

MicroMod Processor Board

There are a variety of MicroMod Processor Boards available to choose from. You will probably want to avoid having the same Processor and Function Board since there is an ESP32 on both types of boards.

SparkFun MicroMod Artemis Processor

SparkFun MicroMod Artemis Processor

DEV-16401
$14.95
SparkFun MicroMod Teensy Processor

SparkFun MicroMod Teensy Processor

DEV-16402
$19.95
2
SparkFun MicroMod STM32 Processor

SparkFun MicroMod STM32 Processor

DEV-17713
$14.95
SparkFun MicroMod RP2040 Processor

SparkFun MicroMod RP2040 Processor

DEV-17720
$11.95

MicroMod Function Board

To add additional functionality to your Processor Board, you'll want to include one or two function boards when connecting them to the Main Board.

SparkFun MicroMod WiFi Function Board - ESP32

SparkFun MicroMod WiFi Function Board - ESP32

WRL-18430
$14.95
SparkFun MicroMod Environmental Function Board

SparkFun MicroMod Environmental Function Board

SEN-18632
$149.95

Tools

You will need a screw driver to secure the Processor and Function boards.

SparkFun Mini Screwdriver

SparkFun Mini Screwdriver

TOL-09146
$0.95
3

Suggested Reading

If you aren't familiar with the MicroMod ecosystem, we recommend reading here for an overview.

MicroMod Logo
MicroMod Ecosystem

If you aren’t familiar with the following concepts, we also recommend checking out a few of these tutorials before continuing. Make sure to check the respective hookup guides for your processor board and function board to ensure that you are installing the correct USB-to-serial converter. You may also need to follow additional instructions that are not outlined in this tutorial to install the appropriate software.

What is an Arduino?

What is this 'Arduino' thing anyway? This tutorials dives into what an Arduino is and along with Arduino projects and widgets.

Installing Arduino IDE

A step-by-step guide to installing and testing the Arduino software on Windows, Mac, and Linux.

How to Install CH340 Drivers

How to install CH340 drivers (if you need them) on Windows, Mac OS X, and Linux.

Getting Started with MicroMod

Dive into the world of MicroMod - a compact interface to connect a microcontroller to various peripherals via the M.2 Connector!

Hardware Overview

ESP32

The MicroMod WiFi Function Board includes the ESP32-WROOM module with AT command firmware. The module can be accessed through the serial UART pins.

ESP32 WROOM Module

USB

The board includes a USB Type C connector on the board to update ESP32's firmware. You will need a Main Board and a second USB cable to update the firmware.

USB C Connector

Power

To power the board, you will need to apply power to a SparkFun Main Board. Power applied will connect to the Function Board's VIN pin, which will be regulated down for the rest of the board with the AP2112 3.3V/600mA voltage regulator. Users can control the 3.3V voltage regulator using a Processor Board's I/O pin. For more information, check out the MicroMod Main Board Examples to toggle the pin.

Voltage Regulator

CP2102

The board is populated with the CP2102 USB-to-Serial converter to update firmware on the ESP32 through its USB Type C connector. This allows the board to show up as a device on the serial (or COM) port of the computer. You will need a Main Board and a second USB cable to update the firmware.

USB-to-Serial Converter

Reset and Boot Buttons

The reset button allows users to reset the program running on the ESP32 module without unplugging the board. To boot button allows users to manually flash new firmware to the ESP32.

Reset and Boot Buttons

Transistor

The IC next to the USB-to-Serial converter includes two transistors. This is used by the USB-to-Serial Converter to auto-reset the ESP32 when updating its firmware.

Transistors

EEPROM

The board includes an I2C EEPROM. Unfortunately, this is not available for the user and was meant to hold board specific information.

EEPROM

LED

There is only one LED available which is the PWR LED. The LED lights up to indicate when available for the ESP32 and CP2102 from the 3.3V voltage regulator. You can disable it by cutting the jumper on the back of the board.

PWR LED

Jumpers

The following jumpers are included to configure the board.

  • PWR - By default, the jumper with the label PWR is closed. This jumper connects the 3.3V line and LED. Cutting this jumper will disable the LED.
  • I2C Pull-up Resistors - By default, this three way jumper labeled I2C is closed and connects two pull-up resistors to the I2C data lines. If you have many devices on your I2C data lines, then you may consider cutting these two jumpers.
I2C Pull-up Resistor JumperPWR LED Jumper
I2C Pull-up Resistor JumpersPWR LED Jumper

Hardware Pinout

Depending on your window size, you may need to use the horizontal scroll bar at the bottom of the table to view the additional pin functions. Note that the M.2 connector pins on opposing sides are offset from each other as indicated by the bottom pins where it says (Not Connected)*. There is no connection to pins that have a "-" under the primary function.

AUDIOUARTGPIO/BUSI2CSDIOSPI0Dedicated
FunctionBottom
Pin
   Top   
Pin
Function
(Not Connected)75GND
3.3V7473G5 / BUS5
RTC_3V_BATT7271G6 / BUS6
SPI_CS1#SDIO_DATA3 (I/O)7069G7 / BUS7
SDIO_DATA2 (I/O)6867G8
SDIO_DATA1 (I/O)6665G9ADC_D- CAM_HSYNC
SPI_CIPO1SDIO_DATA0 (I/O)6463G10ADC_D+CAM_VSYNC
SPI COPI1SDIO_CMD (I/O)6261SPI_CIPO (I)
SPI SCK1SDIO_SCK (O)6059SPI_COPI (O)LED_DAT
AUD_MCLK (O)5857SPI_SCK (O)LED_CLK
CAM_MCLKPCM_OUTI2S_OUTAUD_OUT5655SPI_CS#
CAM_PCLKPCM_INI2S_INAUD_IN5453I2C_SCL1 (I/O)
PDM_DATAPCM_SYNCI2S_WSAUD_LRCLK5251I2C_SDA1 (I/O)
PDM_CLKPCM_CLKI2S_SCKAUD_BCLK5049BATT_VIN / 3 (I - ADC) (0 to 3.3V)
G4 / BUS44847PWM1
G3 / BUS34645GND
G2 / BUS24443CAN_TX
G1 / BUS14241CAN_RX
G0 / BUS04039GND
A13837USBHOST_D-
GND3635USBHOST_D+
A03433GND
PWM03231Module Key
Module Key3029Module Key
Module Key2827Module Key
Module Key2625Module Key
Module Key2423SWDIO
UART_TX2 (O)2221SWDCK
UART_RX2 (I)2019UART_RX1 (I)
CAM_TRIGD11817UART_TX1 (0)
I2C_INT#1615UART_CTS1 (I)
I2C_SCL (I/0)1413UART_RTS1 (O)
I2C_SDA (I/0)1211BOOT (I - Open Drain)
D0109USB_VIN
SWOG1187GND
RESET# (I - Open Drain)65USB_D-
3.3V_EN43USB_D+
3.3V21GND
Alternative
Function
Primary FunctionBottom
Pin
   Top   
Pin
Primary FunctionAlternative Function
(Not Connected)75GND
VIN74733.3V
VIN7271Power EN
-7069-
-6665-
-6463-
-6261-
-6059-
-5857-
-5655-
-5453-
-5251-
-5049-
-4847-
-4645GND
-4443-
-4241-
-4039GND
-3837-
EEPROM_A03635-
EEPROM_A13433GND
EEPROM_A23231Module Key
Module Key3029Module Key
Module Key2827Module Key
Module Key2625Module Key
Module Key2423-
-2221I2C_SCL
-2019I2C_SDA
-1817-
-1615UART_RX
-1413UART_TX
-1211-
-109-
-87-
-65-
-43-
-21GND
Signal GroupSignalI/ODescriptionVoltage
Power3.3VI3.3V Source3.3V
GNDReturn current path0V
USB_VINIUSB VIN compliant to USB 2.0 specification. Connect to pins on processor board that require 5V for USB functionality4.8-5.2V
RTC_3V_BATTI3V provided by external coin cell or mini battery. Max draw=100μA. Connect to pins maintaining an RTC during power loss. Can be left NC.3V
3.3V_ENOControls the carrier board's main voltage regulator. Voltage above 1V will enable 3.3V power path.3.3V
BATT_VIN/3ICarrier board raw voltage over 3. 1/3 resistor divider is implemented on carrier board. Amplify the analog signal as needed for full 0-3.3V range3.3V
ResetResetIInput to processor. Open drain with pullup on processor board. Pulling low resets processor.3.3V
BootIInput to processor. Open drain with pullup on processor board. Pulling low puts processor into special boot mode. Can be left NC.3.3V
USBUSB_D±I/OUSB Data ±. Differential serial data interface compliant to USB 2.0 specification. If UART is required for programming, USB± must be routed to a USB-to-serial conversion IC on the processor board.
USB HostUSBHOST_D±I/OFor processors that support USB Host Mode. USB Data±. Differential serial data interface compliant to USB 2.0 specification. Can be left NC.
CANCAN_RXICAN Bus receive data.3.3V
CAN_TXO CAN Bus transmit data.3.3V
UARTUART_RX1IUART receive data.3.3V
UART_TX1OUART transmit data.3.3V
UART_RTS1OUART ready to send.3.3V
UART_CTS1IUART clear to send.3.3V
UART_RX2I2nd UART receive data.3.3V
UART_TX2O2nd UART transmit data.3.3V
I2CI2C_SCLI/OI2C clock. Open drain with pullup on carrier board.3.3V
I2C_SDAI/OI2C data. Open drain with pullup on carrier board3.3V
I2C_INT#IInterrupt notification from carrier board to processor. Open drain with pullup on carrier board. Active LOW3.3V
I2C_SCL1I/O2nd I2C clock. Open drain with pullup on carrier board.3.3V
I2C_SDA1I/O2nd I2C data. Open drain with pullup on carrier board.3.3V
SPISPI_COPIOSPI Controller Output/Peripheral Input.3.3V
SPI_CIPOISPI Controller Input/Peripheral Output.3.3V
SPI_SCKOSPI Clock.3.3V
SPI_CS#OSPI Chip Select. Active LOW. Can be routed to GPIO if hardware CS is unused.3.3V
SPI/SDIOSPI_SCK1/SDIO_CLKO2nd SPI Clock. Secondary use is SDIO Clock.3.3V
SPI_COPI1/SDIO_CMDI/O2nd SPI Controller Output/Peripheral Input. Secondary use is SDIO command interface.3.3V
SPI_CIPO1/SDIO_DATA0I/O2nd SPI Peripheral Input/Controller Output. Secondary use is SDIO data exchange bit 0.3.3V
SDIO_DATA1I/OSDIO data exchange bit 1.3.3V
SDIO_DATA2I/OSDIO data exchange bit 2.3.3V
SPI_CS1/SDIO_DATA3I/O2nd SPI Chip Select. Secondary use is SDIO data exchange bit 3.3.3V
AudioAUD_MCLKOAudio master clock.3.3V
AUD_OUT/PCM_OUT/I2S_OUT/CAM_MCLKOAudio data output. PCM synchronous data output. I2S serial data out. Camera master clock.3.3V
AUD_IN/PCM_IN/I2S_IN/CAM_PCLKIAudio data input. PCM syncrhonous data input. I2S serial data in. Camera periphperal clock.3.3V
AUD_LRCLK/PCM_SYNC/I2S_WS/PDM_DATAI/OAudio left/right clock. PCM syncrhonous data SYNC. I2S word select. PDM data.3.3V
AUD_BCLK/PCM_CLK/I2S_CLK/PDM_CLKOAudio bit clock. PCM clock. I2S continuous serial clock. PDM clock.3.3V
SWDSWDIOI/OSerial Wire Debug I/O. Connect if processor board supports SWD. Can be left NC.3.3V
SWDCKISerial Wire Debug clock. Connect if processor board supports SWD. Can be left NC.3.3V
ADCA0IAnalog to digital converter 0. Amplify the analog signal as needed to enable full 0-3.3V range.3.3V
A1IAnalog to digital converter 1. Amplify the analog signal as needed to enable full 0-3.3V range.3.3V
PWMPWM0OPulse width modulated output 0.3.3V
PWM1OPulse width modulated output 1.3.3V
DigitalD0I/O General digital input/output pin.3.3V
D1/CAM_TRIGI/OGeneral digital input/output pin. Camera trigger.3.3V
General/BusG0/BUS0I/OGeneral purpose pins. Any unused processor pins should be assigned to Gx with ADC + PWM capable pins given priority (0, 1, 2, etc.) positions. The intent is to guarantee PWM, ADC and Digital Pin functionality on respective ADC/PWM/Digital pins. Gx pins do not guarantee ADC/PWM function. Alternative use is pins can support a fast read/write 8-bit or 4-bit wide bus.3.3V
G1/BUS1I/O3.3V
G2/BUS2I/O3.3V
G3/BUS3I/O3.3V
G4/BUS4I/O3.3V
G5/BUS5I/O3.3V
G6/BUS6I/O3.3V
G7/BUS7I/O3.3V
G8I/OGeneral purpose pin3.3V
G9/ADC_D-/CAM_HSYNCI/ODifferential ADC input if available. Camera horizontal sync.3.3V
G10/ADC_D+/CAM_VSYNCI/ODifferential ADC input if available. Camera vertical sync.3.3V
G11/SWOI/OGeneral purpose pin. Serial Wire Output3.3V

Board Dimensions

The board uses the standard MicroMod Function Board size which measures about 1.50"x2.56".

Board Dimensions

Hardware Hookup

If you have not already, make sure to check out the Getting Started with MicroMod: Hardware Hookup for information on inserting your Processor and Function Boards to the Main Board.

Getting Started with MicroMod

October 21, 2020

Dive into the world of MicroMod - a compact interface to connect a microcontroller to various peripherals via the M.2 Connector!

Adding a Function Board to the Main Board

We'll assume that you have inserted a Processor Board into the Main Board already. The process is the same for adding a Function Board. The only difference is that you will be adding two screws to hold the Function board down.

Align the Function Board's key into its M.2 connector's socket. Insert the board at an angle (~25°), push down, and tighten one of the screw to hold the board down. Attach the second screw on the other side of the board. Once the board is aligned, tighten both screws fully to secure the board. In this case, we had the WiFi Function Board secured in the M.2 connector socket. Depending on your application, you may have a different Function Board.

Main - Double, Processor, and Function Board

If you decide to have two function boards attached to the Main Board - Double, we recommend tightening the screw between the two Function Boards first to hold them down before attaching the remaining screws on either side of the Function Boards. In this case, we had the WiFi Function Board and the Environmental Function Board secured in the M.2 connector socket. Depending on your application, you may have different function boards.

Main - Double, Processor, and Function Boards

ESP32 Firmware Update

To update the firmware you will need to connect the USB C cable to the MicroMod WiFi Function Board (ESP32) to a computer's COM port. An additional Main Board with a second USB C cable is also needed to power the Main Board and MicroMod WiFi Function Board.

ESP32 Firmware Update

Software Installation

Note: This example assumes you are using the latest version of the Arduino IDE on your desktop. If this is your first time using Arduino, please review the following tutorials.

Arduino Board Definitions

We'll assume that you installed the necessary board files for your Processor Board. In this case, we used the MicroMod Artemis Processor Board.

MicroMod Artemis Processor Board Hookup Guide

October 21, 2020

Get started with the Artemis MicroMod Processor Board in this tutorial!

CP2102 Drivers

For users looking to update the AT Command Firmware, you will need to install the Silicon Labs CP210X Driver for the WiFi Function Board - ESP32. The latest can be found from Silicon Labs: USB to UART Bridge VCP Driver.

Note: If applicable, make sure you are using the proper driver files for your CPU architecture. This is usually indicated by a folder or file name with "x86" for 32-bit processors or "x64" for 64-bit processors.

Arduino Example

Example 1: Connecting to WiFi

This example shows you how to send AT commands from your Processor Board to scan and connect to a WiFi Router. Note that this example runs once in the setup() function.

If you have not already, select your Board (in this case the MicroMod Artemis), and associated COM port. Copy and paste the code below in your Arduino IDE. Make sure to modify the SSID (YOUR_NETWORK_HERE) and password (YOUR_PASSWORD_HERE) for your wireless router. Hit the upload button and set the serial monitor to 115200 baud.

language:c
const char* newLineCarriageReturn = "\r\n";                                                     // Used at beginning of code to clear out anything in buffer
const char* toSend = "AT+GMR\r\n";                                                              // Check version information.
const char* enableSys = "AT+SYSLOG=1\r\n";                                                      // Enable AT error code prompt
const char* wifiMode = "AT+CWMODE=3\r\n";                                                       // Set the WiFi mode of ESP devices
const char* whatWifi = "AT+CWLAP\r\n";                                                          // List available APs
const char* connectTo = "AT+CWJAP=\"YOUR_NETWORK_HERE\",\"YOUR_PASSWORD_HERE\"\r\n";            // Connect an ESP station to a targeted AP, where YOUR_NETWORK_HERE is your network SSID, and YOUR_PASSWORD_HERE.
const char* wifiInfo = "AT+CWSTATE?\r\n";                                                       // Query the Wi-Fi state and Wi-Fi information
const char* atReset = "AT+RST\r\n";                                                             // Restart module
const char* whatStandard = "AT+CWAPPROTO?\r\n";                                                 // Sets the 802.11 b/g/n protocol standard of SoftAP mode
//const char* sendLight = "AT+HTTPCLIENT=1,3,192.168.1.116/TEMP86";                             // Send HTTP Client Request

//String composedMess = "";
//uint8_t powerEnableZero = A1;
//uint8_t powerEnableOne = 34;

void setup() {

  //  pinMode(powerEnableOne, OUTPUT);
  // pinMode(powerEnableZero, OUTPUT);

  Serial.begin(115200);  //Arduino Serial Monitor
  Serial1.begin(115200); //Hardware Serial Port connected to ESP32


  //Let user know that we are ready to begin sending AT commands
  Serial.println("We up.");

  Serial1.write(newLineCarriageReturn);
  delay(1000);//wait for ESP32

  Serial1.write(toSend);
  delay(1000);//wait for ESP32

  //check on ESP32 response
  while (Serial1.available()) {
    Serial.print(char(Serial1.read()));
  }

  Serial1.write(enableSys);
  delay(1000);//wait for ESP32

  //check on ESP32 response
  while (Serial1.available()) {
    Serial.print(char(Serial1.read()));
  }

  Serial1.write(wifiMode);
  delay(2000);//wait for ESP32

  //check on ESP32 response
  while (Serial1.available()) {
    Serial.print(char(Serial1.read()));
  }

  Serial1.write(whatWifi);
  delay(5000);//wait for ESP32

  //check on ESP32 response
  while (Serial1.available()) {
    Serial.print(char(Serial1.read()));
  }

  Serial1.write(connectTo);
  delay(5000);//wait for ESP32

  //check on ESP32 response
  while (Serial1.available()) {
    Serial.print(char(Serial1.read()));
  }

  Serial1.write(wifiInfo);
  delay(5000);//wait for ESP32

  //check on ESP32 response
  while (Serial1.available()) {
    Serial.print(char(Serial1.read()));
  }

  Serial.println("Done.");
  while (1);
  delay(2000);
}

void loop()
{
  //  digitalWrite(powerEnableZero, LOW);
  //  digitalWrite(powerEnableOne, LOW);
  while (1);

}

If all goes well, your ESP32 be configured for each AT command. At one point, the ESP32 will see what other wireless routers (if there are any) are in range before connecting to your WiFi router and providing a status on the connection to your network.

Example 2: Serial Passthrough

This example allows you to use your Processor Board as a serial passthrough to send characters to and from the ESP32 and the USB-to-serial converter. This is useful for testing different AT commands from the Arduino Serial Monitor or terminal window.

If you have not already, select your Board (in this case the MicroMod Artemis), and associated COM port. Copy and paste the code below in your Arduino IDE. Hit the upload button and set the serial monitor to 115200 baud.

language:c
char val; //init global var for serial characters being sent from ESP32

void setup()
{

  Serial.begin(115200); //Set up Serial Monitor
  Serial1.begin(115200); //Set up hardware UART to pipe data from the ESP32

}

void loop()
{

  if (Serial.available())
  {
    //If data comes in from Serial Monitor:
    //1.) echo the character back to the Serial Monitor
    //2.) send it to Hardware UART.

    val  = Serial.read(); //save character from Arduino's buffer to a variable

    //Serial.print(val); //display serial data back on the Arduino's Serial Monitor, disabled this line if using a Terminal Window
    Serial1.write(val); //send serial data to Processor Board's Hardware UART
  }

  if (Serial1.available())
  { // If data comes in from ESP32 connected to hardware UART,
    //display it on the Serial Monitor or Terminal Window
    Serial.write(Serial1.read());//display serial data received from 
  }

}

Firmware Update

If you decide to update the firmware, make sure to have the ESP32 connected to the Main Board. Then insert a USB cable to the Main Board and the WiFi Function Board.

ESP32 Firmware Update

When updating firmware for the ESP32, you will need to make sure you select the port that the WiFi Function Board is connected to. It should be the port that is connected to the CP2102. In this case, it was COM11.

CP2101 in the Device Manager

Head over to Espressif's user guide for instructions, tools, and the latest firmware to update the ESP32.

Troubleshooting

Resources and Going Further

Now that you've successfully got your MicroMod ESP Function Board up and running, it's time to incorporate it into your own project! For more information, check out the resources below:

Looking for more inspiration? Check out these other tutorials related to MicroMod.

MicroMod Weather Carrier Board Hookup Guide

A quick guide to help to create your own MicroMod weather station using the MicroMod Weather Carrier Board and Processor of your choice.

MicroMod ESP32 Processor Board Hookup Guide

A short hookup guide to get started with the SparkFun MicroMod ESP32 Processor Board.

SparkFun MicroMod Input and Display Carrier Board Hookup Guide

A short Hookup Guide to get started with the SparkFun MicroMod Input and Display Carrier Board

MicroMod nRF52840 Processor Hookup Guide

Get started with the MicroMod nRF52840 Processor following this guide.

learn.sparkfun.com | CC BY-SA 3.0 | SparkFun Electronics | Niwot, Colorado


Viewing all articles
Browse latest Browse all 1123

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>