Networking and Communication¶
Task | progress |
---|---|
Linked to the group assignment page | done |
Documented your project and what you have learned from implementing networking and/or communication protocols. | done |
Explained the programming process(es) you used. | done |
Outlined problems and how you fixed them. | done |
Included design files (or linked to where they are located if you are using a board you have designed and fabricated earlier) and original source code. | done |
Included a ‘hero shot’ of your network and/or communications setup | done |
HERO SHOT¶
Group Assignment¶
Here is the link to this weeks assignment Link
Key takeways for this week:
- Serial Communication protocols
Image source: From internet but was shared in chat during class
-
We explored all the communication protocols and learned more on I2C communication for Xiao Rp2040 and Arduino Uno.
-
Also learned about the different pinouts of the each protocols.
Individul Assignment¶
Wireless communication¶
I tried exploring using bluetooth function of the ESP32 as I was thinking of using this for my final project for my 2nd spiral development.
ESP32 Bluetooth Provision¶
I used the board I made in my electronics design week here for wifi communication assignment.
I took reference and got the code for the communication from this Link which has several tutorial on ESP-32.
The picture below, explains what I am trying to acheive. I wanted to connect my board to wifi without having to hard code the wifi AP (Access Point) and password, which would be inefficient for real live application.
** image source: https://randomnerdtutorials.com/esp32-web-bluetooth/**
Here are the steps taken:
-
Firsly, programed my board with the code attached below through an FTDI cable using AdruinoIDE which enable bluetooth connection of ESP-32 and waits for a connection with a bluetooth device to provide wifi AP name and password. This is the message that comes up in serial monitor after uploading and also a QR code as seen below in the picture.
-
The APPs source code is also open for any modification.
Begin Provisioning using BLE
Provisioning started
Give Credentials of your access point using smartphone app
- Next, I downloaded the ESP SoftAP provisioning app developed by Espressif in my phone which is also avaliable for andriod users. With this app, we can either scan the QR code or search for a device. I searched for a device as the QR code was not working. Took a screenshot of my phone.
- After pairing with the my board, I wrote the wifi AP name and password in the Application, which got sent to my board and can be seen in serial monitor.
- Using the wifi credentials my board can now connect to wifi and do any wifi related task.
ESP32 WEB-Bluetooth¶
Next, I wanted to try controlling my board using an APP and in my case I used a web application which used Bluetooth communication. Here is where I got the code. This page has detail explaination on the code and about Web-bluetooth.
image source: https://randomnerdtutorials.com/esp32-web-bluetooth/
-
For this I again programmed the same board with another code which is attched below which enables the Bluetooth function and also starts advertising its existence. In serial monitor, you can see that the the board is waiting for bluetooth connection successfully setting my board as a BLE Client.
-
After successfully uploading the code, I opened the web app for interating with my ESP32 board via bluetooth. For this we need to use computer and brower that allows Web-Bluetooth. This is the link to the web application
-
Using the app, I paired my ESP board with the web app successfully.
- I connected a LED to GPIO2 and as seen below, I was able to control the LED by changing the value to the GPIO pin to 1 or 0 the web app (ON or OFF) in the web app and ESP32 checks the value of the characteristic change and it will change the state of the GPIO accordingly turing the LED On or off.
- Also, ESP32 change the value of the sensor charcteristic periodically which is received by the web app and displays the new value as seen below.
ESP-32 and RFID programming¶
For this weeks assignment, I made a new board which I am also aiming to use it for my final project. I designed the board after testing my program in a ESP32 dev module in my previous assignment. I used the RFID Card that I programmmed in previous weeks assignment with letters to pop corresponding solenoids when placed on card reader this week.
I used KiCAD to desing my board as shown below.
(This is the corrected ckt)
Failure
I had to mill two boards as in the first one I had inverted the SVG image of drill files in MODs, which made the drill holes bigger.
Here are the BOM:
-
Also the the board below, the orrientation of the power jack was wrong in my design because of which I had power issue in my board. I had also connected, 3 volts output of the regulator to 5 volts input of FTDI cable.
-
With few tweaks I was able to use the board by giving the power supply from board external powersupply and not using the input powersupply from ftdi cable.(I corrected the ckt and attached above)
-
Here is the setup for my this weeks assignment. I gave an input power supply of 12V from a power source with 1.8A current.
-
The pin connections for RFID card reader are as follows: SDA-22, CLK-19, MOSI-23, MISO-25, GND-GND, RST-22, 3.3V-3.3V. For solenoid, I connected the solenoids to GPIO27, GPIO25 and GPIO14.
-
The had already programmed the cards in week 11 for the input week and this week I want the card reader to read the card
-
I wrote the program with help from online tools and Claude AI chat bot which was much more helpful then ChatGPT.
-
I am attaching the full code below but here is the logic to the code which triggered the respective solenoids when the card reads the last data on the RFID card. I wanted to trigger particular solenoids as they will be my braille cells for my final project.
void displayBraillePattern( char letter)
{
switch (letter)
{
case 'A':
Serial.println("Case A");
digitalWrite(SOLENOID1_PIN, HIGH);
digitalWrite(SOLENOID2_PIN, LOW);
digitalWrite(SOLENOID3_PIN, LOW);
break;
case 'B':
Serial.println("Case B");
digitalWrite(SOLENOID1_PIN, HIGH);
digitalWrite(SOLENOID2_PIN, LOW);
digitalWrite(SOLENOID3_PIN, HIGH);
break;
case 'C':
Serial.println("Case C");
digitalWrite(SOLENOID1_PIN, HIGH);
digitalWrite(SOLENOID2_PIN, HIGH);
digitalWrite(SOLENOID3_PIN, LOW);
break;
// Add more cases for other letters here
default:
Serial.println("Default");
digitalWrite(SOLENOID1_PIN, LOW);
digitalWrite(SOLENOID2_PIN, LOW);
digitalWrite(SOLENOID3_PIN, LOW);
break;
}
delay(1000); // Adjust the delay as needed
digitalWrite(SOLENOID1_PIN, LOW);
digitalWrite(SOLENOID2_PIN, LOW);
digitalWrite(SOLENOID3_PIN, LOW);
}
The code worked and you can see in the video below:
!!! Failure : Brownout detector was triggered
I got this error with the new board I made for this week and I could not figure out the error. I said it was because of the bad connection(soldering issue) and power issue but even when measuring the the input voltage it was 3 volts. So, I used my other board I made in previous week which worked. I need to still check remake the board and maybe that time it wll work.