w. PIC32 and Internet of Things (IoT)

PIC32 has two powerful universal asynchronous communication modules (UARTs, universal asynchronous receiver transmitters) that support baud rates from 38 bps to 12.5 Mbps. This is more than enough to communicate with ESP8266 IoT module. However, there are a great variety of ESP8266 modules, which are less home user friendly with every new version. I managed to buy six Ai-Thinker ESP8266 v13 modules (ESP-13, VROOM-02) for less than 3 USD a piece on eBay, but it was quite a challenge to make the modules work with PIC32MX270F256B microcontroller.

There were some important steps to get ESP8266 working with PIC32:

1. ESP8266-13 needs at least a 500 mA power supply at 3.3 V. A standard USB 2.0 port cannot provide this much power so I opted for an external 2000 mA, 5 V power supply and a 3.3 V regulator that also provided power for PIC32MX270F256B.

SV TTL RS-232 meter based on PIC32MX270F256B microcontroller

Click on the picture to enlarge it.

3. PB8 and PB9 I/Os were used as UART2's RX and TX signals with TTL voltage levels. Direct connections between PIC32MX270F256B and ESP8266 are preferable, because they both operate on 3.3 V and this is also the way to achieve the highest data transfer speeds.

2. I built yet another PIC32MX270F256B basic circuit with an 8 MHz XT crystal and added a few resistors and two micro switches, one for ESP8266 reset and the other for ESP8266 boot mode selection. There were also enough free I/O pins for to connect the reset and boot mode signals to the microcontroller. PIC32MX270F256B and ESP8266 module were both connected to the external power supply through LM317T voltage regulator circuit, set to 3.3 V.

ESP8266-13 (VROOOM-02) connected to PIC32MX270R256B

Click on the photo to enlarge it.

6. 5. A new MS Windows DLL library LIB_PCUSBProjects v7.3.NET4 that supports the new firmware functionalities is also available from Downloads section.

5. The firmware supports two TTL RS-232 modes: software mode where a PIC32 input capture unit is used to measure the lengths of digital signals on RX line and automatically determine the line speed and decode the data bytes. The firmware bases all calculations on 40 MHz internal clock that runs a timers 2 and 3 that are used in pair by the input capture unit. It is therefore important to use 8 MHz external crystal resonator to provide time source for PIC32 frequency circuit that provide time bases for USB and UART2.

4. Next, PIC32MX270F256B needed a new firmware version 2.9.D that would have included UART2 support. The new firmware is now available in PIC32MX270F256B firmware v2.9.D IoT (8 MHz XT).hex file from Downloads section.

7. The final part of the PIC32 IoT support is SV_TTL-RS232-Meter application (SV_TTL-RS232-Meter.zip) with source code available from Downloads section. Enter an ESP8266 AT command and hit AT command button to execute the command. In case of a ESP8266-13 slow response, you have to use UART2 read text button to reload the content of the internal PIC32 character buffer.

IC3 Read ASCII button enables detection of ESP8266 baud rates. Press it and the reset the ESP8266 and hit ok button. The whole content and the baud rates will be displayed.

HOW TO MAKE A CONNECTION THROUGH A COM PORT EMULATION?

One might thing that he could simply reconfigure a CDC_SERIAL_EMULATOR example from Harmony v1.07, but it didn't work at least for me! Go to Downloads section and get a new firmware: PIC32MX270F256B - 8 MHz - CDC firmware.hex. Now, it works with terminal emulators like Putty or Tera Term...

READ ABOUT A NEW ESP8266 PROJECT: Programming ESP8266-13 with MCP2200 USB to TTL RS-232 communication bridge

PC USB Projects basic IoT circuit: ESP8266-13 and PIC32MX270F256B or PIC32MX250F128B

Click on the schematic to enlarge it.

READ ABOUT A NEW ESP8266 PROJECT: Programming ESP8266-13 with MCP2200 USB to TTL RS-232 communication bridge