Esp32 Visual Studio



[Matti Airas] wanted to have a better electronics platform for making his boat smarter, more connected, and safer. He found traditional marine electronics expensive and not suited for hacking and tinkering. There was also the issue of lack of interoperability between device generations from the same supplier and between different brands. This led him to design the Sailor Hat with ESP32 — a marine specific, open source hardware development board.

Esp32 Visual Studio

Applications include all kinds of sensor and control interfaces for the boat, such as measurement of fuel or water level, engine RPM, anchoring chain length counter, or setting up smart lighting or smart refrigeration control. The board is designed to work with the traditional NMEA 2000 standard, as well as with Signal K. NMEA 2000 is standardized as IEC 61162-3, but isn’t open source or free. Signal K, on the other hand, is free and open source, and can co-exist alongside NMEA 2000.

The marine environment can be pretty harsh with extremes of temperature, rain, humidity, condensation and vibration. Boats, just like automobiles, have a notoriously noisy electrical environment and [Matti] has paid special attention to noise and surge suppression throughout the board. The board can work with either 12 V or 24 V bus systems since the on board DC-DC converter is rated up to 32 V input. Connections between the board and the outside world need to be very robust, so it is designed to accept various types of connectors depending on how robust you want it to be.

The Sailor Hat is based around a standard ESP32-WROOM-32 module. Interfaces include a CAN bus transceiver, opto-coupled input and output, I2C, 1-wire and QWIIC interfaces, USB Micro-B programming conector, plus a couple of buttons and LEDs. All of the ESP32 GPIO pins are terminated on a GPIO header, with jumper options to disable terminations to the standard interfaces and instead route them to the GPIO header as needed. Additionally, there’s a generous prototyping area to add additional hardware to the board. Hardware design files are hosted on the project repository on GitHub.

On the software side, there are several frameworks that can be used, with PlatformIO, SensESP, ESPHome and Visual Studio Code being the recommended choices. Or you could use any of the widely available SDK’s for the ESP32 platform — Espressif SDK, Arduino Core for ESP32, MicroPython, NodeMCU or Rust.

[Matti]’s NMEA 2000 USB gateway example is a good way to get a grip on hardware assembly and software installation required to build a practical project using the Sailor Hat. The board is designed to withstand a harsh electrical environment. But it’s mechanical installation obviously requires greater care if it has to survive marine applications. The Sailor Hat can be installed in commonly available, 100x68x50 mm or larger plastic waterproof enclosures, rated for IP65 or higher. The bulkhead connectors and cable glands also need to be appropriately rated, and the enclosure may possibly need a IP68 rated ventilation plug to take care of environmental cycling within the enclosure.

Arduino IDE for Visual Studio. Compile and Upload any Arduino project to any board, using the same Arduino platform and libraries. Debug your ESP32/8266/NINA WiFi project remotely so you can debug your project in its real environment, from the comfort of your PC.

-->

Get Started with ESP32 Devices

For first-time users of ESP32 devices, follow these quick steps to:

  • Prepare your development environment.
  • Send information from the device to the Azure IoT Hub
  • Listen to cloud to device message with ESP32

What you learn

  • How to install the development environment.
  • How to create an IoT Hub and register a ESP32 device.
  • How to send sample data to your IoT hub.

What you need

Click F1 to show Visual studio code actions, then type ESP-IDF to see possible actions. The Add Arduino-ESP32 as ESP-IDF Component command will add Arduino-ESP32 as a ESP-IDF component in your. Working with ESP32 targets Is the ESP32 Dev Kit C the ONLY board version that will work with nanoFramework. There are available several different versions including: ESP32-WROOM-32, ESP32-WROOM-32D, ESP32-WROOM-32U, ESP32-SOLO-1, ESP32-WROVER-B, ESP32-WROVER-IB, etc. Can I debug nanoCLR code on ESP32 using Visual Studio without any special.

  • A ESP32 device.

    [NOTE]We use M5Stack in this tutorial, but the steps below could also be applied to other ESP32 devices.

  • A computer running Windows 10 or macOS 10.10+.

  • An active Azure subscription. Activate a free 30-day trial Microsoft Azure account.

Esp32 visual studio free

Prepare your hardware

For M5Stack, please follow the guide to prepare the hardware.

Esp32 Visual Studio

Install development environment

Aktivasi microsoft office professional plus 2016. We recommend Azure IoT Device Workbench extension for Visual Studio Code to develop on the ESP32 devices.

Esp32 visual studio community

Azure IoT Device Workbench provides an integrated experience to develop IoT solutions. It helps both on device and cloud development using Azure IoT and other services. You can watch this Channel9 video to have an overview of what it does.

Follow these steps to prepare the development environment for ESP32 devices:

  1. Download and install Arduino IDE. It provides the necessary toolchain for compiling and uploading Arduino code.

    • Windows: Use Windows Installer version
    • macOS: Drag and drop the Arduino into /Applications
    • Ubuntu: Unzip it into $HOME/Downloads/arduino-1.8.5
  2. Install Visual Studio Code, a cross platform source code editor with powerful developer tooling, like IntelliSense code completion and debugging.

  3. Look for Azure IoT Device Workbench in the extension marketplace and install it.Together with the IoT Device Workbench, other dependent extensions will be installed.

  4. Open File > Preference > Settings and add following lines to configure Arduino.

    • Windows

    • macOS

    • Ubuntu

  5. Use F1 or Ctrl+Shift+P (macOS: Cmd+Shift+P) to open the command palette, type and select Arduino: Board Manager. Search for esp32 and install the latest version.

Build your first project

Now you are all set with preparing and configuring your development environment. Let us build a 'Hello World' sample for IoT: sending simulated telemetry data to Azure IoT Hub.Make sure your device is not connected to your computer. Start VS Code first, and then connect the ESP32 device to your computer.

Open the project folder

Open Azure IoT Device Workbench Examples

Use F1 or Ctrl+Shift+P (macOS: Cmd+Shift+P) to open the command palette, type Azure IoT Device Workbench, and then select Open Examples...

Select ESP32 Arduino.

Then the IoT Device Workbench Example window is shown up.

Find ESP32 Get Started and click Open Sample button. A new VS Code window with a project folder in it opens.

Esp32 Visual Studio

Provision Azure service

In the solution window, open the command palette and select Azure IoT Device Workbench: Cloud: Provision Azure Services...

Then VS Code guides you through provisioning the required Azure services.

The whole process includes:

  • Select an existing IoT Hub or create a new IoT Hub.
  • Select an existing IoT Hub device or create a new IoT Hub device.

Config Device Code

  1. Open the source file(.ino) for device code and update the following lines with your WiFi ssid and password:

  2. Open the command palette and select Azure IoT Device Workbench: Config Device Settings...

  3. Select Copy device connection string.

    This copies the connection string that is retrieved from the Provision Azure services step.

  4. Paste the device connection string into the following line in device code

Build and upload the device code

  1. Open the command palette and select Azure IoT Device Workbench: Upload Device Code.

  2. VS Code then starts verifying and uploading the code to your DevKit.

  3. The ESP32 device reboots and starts running the code.

Test the project

Esp32 Visual Studio Download

Visual

Send D2C message

Open serial monitor:

Esp32 Visual Studio Community

The sample application is running successfully when you see the following results:

  • The Serial Monitor displays the message sent to the IoT Hub.

Listen to C2D message

You can send message to your device with Azure Portal or other API. Please Make sure that serial monitor is open. Then you can see the message content from serial monitor.

Problems and feedback

Esp32 Visual Studio

If you encounter problems, you can reach out to us from: