Showing posts with label ESP32. Show all posts
Showing posts with label ESP32. Show all posts

Thursday, February 23, 2023

Building a Dynamic ESP32 Wireless Network using the ESP-Now Protocol

In this three part series we will design a dynamic wireless network using ESP32 modules and leveraging EXPRESSIF's ESP-NOW communication protocol.

In part 1 we provide an overview of the ESP-NOW communication protocol and talk about how our dynamic wireless network will work.


In part 2 we look at a simple implementation of ESP-Now that will serve as a foundation for the dynamic network we will design and cover in part 3.



Patreon page link: https://www.patreon.com/forcetronics

ESP-NOW documentation: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/network/esp_now.html


**************Part 3 coming soon*******************************



Sunday, December 4, 2022

How to Design a Programming Circuit for the ESP32

In the video we look at how to design a circuit for programming an ESP32 module. We also explain the Strapping Pins on the ESP32 and how they work.



Oscilloscope Capture of EN pin and GPIO0 setting ESP32 in Download Boot Mode



Wednesday, September 14, 2022

How to Control Water Flow with Arduino IoT Cloud and a Solenoid Parts 1 and 2

In this two part series we look at how to control a Solenoid using an ESP32 board and the Arduino IoT Cloud. In part one we focus on what a solenoid is and the hardware needed to drive a solenoid open or closed. In part 2 we focus on setting up the Arduino IoT Cloud control.

\



Link to tutorial on setting up device on Arduino IoT Cloud: https://docs.arduino.cc/arduino-cloud/getting-started/esp-32-cloud


//**************Arduino Code from Tutorial*********************
#include "thingProperties.h"

#define SOLENOID_PIN 21

void setup() {
  pinMode(SOLENOID_PIN,OUTPUT);
  digitalWrite(SOLENOID_PIN,LOW);

  // Defined in thingProperties.h
  initProperties();

  // Connect to Arduino IoT Cloud
  ArduinoCloud.begin(ArduinoIoTPreferredConnection);
  
  /*
     The following function allows you to obtain more information
     related to the state of network and IoT Cloud connection and errors
     the higher number the more granular information you’ll get.
     The default is 0 (only errors).
     Maximum is 4
 */
  setDebugMessageLevel(2);
  ArduinoCloud.printDebugInfo();
}

void loop() {
  ArduinoCloud.update();
  
  if(water_Scheduler.isActive() || solenoidState) {
    digitalWrite(SOLENOID_PIN, HIGH);
  }
  else {
    digitalWrite(SOLENOID_PIN, LOW);
  } 
}



/*
  Since SolenoidState is READ_WRITE variable, onSolenoidStateChange() is
  executed every time a new value is received from IoT Cloud.
*/
void onSolenoidStateChange()  {
  // Add your code here to act upon SolenoidState change
  /*
  if (solenoidState) {
    digitalWrite(SOLENOID_PIN, HIGH);
  }
  else {
    digitalWrite(SOLENOID_PIN, LOW);
  } 
  */
}

/*
  Since WaterScheduler is READ_WRITE variable, onWaterSchedulerChange() is
  executed every time a new value is received from IoT Cloud.
*/
void onWaterSchedulerChange()  {
  // Add your code here to act upon WaterScheduler change
}