Rachele Didero's site Welcome to Rocky 96's HTMAA world

Welcome to Rocky96's
HTMAA world

A free, fully responsive (?) font of inspiration (?) designed by Rachele Didero for How to Make (Almost) Anything Course @ MIT Media Lab
and released for free .

November 22, 2023

Week 10

Networking and Communications

- PCB Board with ESP32, communicates with my phone -

1984

Design, build, and connect wired or wireless node(s) with network or bus addresses

This week's task involved creating, constructing, and linking wired or wireless nodes. Until now, my previous projects have exclusively utilized XIAO RP2040-based boards. However, for the communication-focused week, I opted to employ the ESP32, a versatile, cost-effective, and power-efficient system-on-a-chip microcontroller featuring integrated Wi-Fi and dual-mode Bluetooth capabilities. During my search, I came across Wedyan's work from last year who followed Barduino project crafted by Eduardo Chamorro Martin at FabLab Barcelona. This project entails an ESP32 development board compatible with the FabLab environment, facilitating student work development. After confirming the availability of the required components in our inventory, I chose to proceed with Barduino 2.0, which is an FTDI version. The board incorporates several components, all of which are readily accessible in our inventory: 1 x WIFI MODULE 32MBITS SPI FLASH 1 x RES 10.0K OHM 1/4W 1% 1206 SMD 1x SWITCH TACT SMD W-GND 160GF 2 x CAP CER 10UF 35V Y5V 1206 1 x IC REG LDO 3.3V 1A SOT223-3 2 x LED RED CLEAR 1206 SMD 2 x RES 100 OHM 1/4W 1% 1206 SMD 1 x SWITCH SLIDE SPDT 12V 100MA GW 1 x CAP CERAMIC .1UF 250V X7R 1206

I then first milled the PCB board. Having lots of troubles with precisions.


I finally got to mill the board but I didn't solder it and used an already made board provided by Wedyan. To begin incorporating the ESP32 into the Arduino IDE, I employed a USB to TTL Serial Adapter featuring the FTDI (FT232RL) chip. Additionally, I downloaded and installed the Espressif ESP32 library from this source. Ensuring the proper connection, I verified that the FTDI pins on the adapter were appropriately linked to the FTDI pins on the ESP32 board. During the code upload process, the tactile switch played a crucial role for performing a RESET, while the slide switch was utilized to transition between program and execution modes. To verify the proper functionality of my board, I initially programmed it with a fundamental blink code. I attached a jumper wire to set the board to "Program" mode and executed the code. During the uploading process, when Arduino displayed "Connecting....," I pressed the tactile button labeled "Reset." Once the programming was successful, I removed the jumper wire to transition the ESP32 to "Run" mode and pressed the tactile reset button. As anticipated, the connected LED began blinking, confirming the expected behavior.


Code to make ESP32 Blink

i = 0;

c/*
Blink

Turns an LED on for one second, then off for one second, repeatedly.

Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to
the correct LED pin independent of which board is used.
If you want to know what pin the on-board LED is connected to on your Arduino
model, check the Technical Specs of your board at:
https://www.arduino.cc/en/Main/Products

modified 8 May 2014
by Scott Fitzgerald
modified 2 Sep 2016
by Arturo Guadalupi
modified 8 Sep 2016
by Colby Newman

This example code is in the public domain.

https://www.arduino.cc/en/Tutorial/BuiltInExamples/Blink
*/

// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(13, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
digitalWrite(13, HIGH);  // turn the LED on (HIGH is the voltage level)
delay(1000);                      // wait for a second
digitalWrite(13, LOW);   // turn the LED off by making the voltage LOW
delay(1000);                      // wait for a second
}


print 'It took ' + i + ' iterations to sort the deck.';

To remotely manage the board, I chose to employ the Blynk app from Blynk IoT. This application is compatible with both iOS and Android smartphones, providing internet-based control for Arduino, Raspberry Pi, and NodeMCU. To initiate the integration of the Blynk App with my board, I downloaded and installed the Blynk Library within the Arduino IDE.

Code to control the board with Blynk using WIFI conncetion

i = 0;

	#define BLYNK_PRINT Serial
	#define BLYNK_AUTH_TOKEN "Your Auth Token"
	#define BLYNK_TEMPLATE_ID "TMPL2DW5ZQyIL"
	#define BLYNK_TEMPLATE_NAME "led test"
	
	
	#include 
	#include 
	#include 
	
	// You should get Auth Token in the Blynk App.
	// Go to the Project Settings (nut icon).
	char auth[] = "Quickstart Device";
	
	// Your WiFi credentials.
	// Set password to "" for open networks.
	char ssid[] = "MIT SECURE";
	char pass[] = "xxxxxx";
	
	void setup()
	{
	  // Debug console
	  Serial.begin(9600);
	
	  Blynk.begin(auth, ssid, pass);
	}


print 'It took ' + i + ' iterations to sort the deck.';

I then insert in my project a new botton that I connect to a Digital Pin, number 15, the same I have on my PCB that is connected to the LED.

It's been a nightmare. I couln't use Blynk, I don't know why. So I downloaded REMOTE XS, but I also had a lot of problems with that.

With REMOTE XS I tried both with Bluetooth connection and with WIFI connection.


I tried again with Blynk, this time I change the WIFI network and I use my mobile hotspot. I run the code on Arduino, it doensn't give me any error but still the botton doesn't make my board blink.

I will try again, maybe with another app for remote controlling.