Changing of plans!!!
In the previous page we looked over all my plans for my final project, but there is a big problem in it! I wanted my final project to be something that is easier to use and also a lot smaller than my previous design. For that I will have to completely change my design and way my project works!
I guess this will be my second spiral to completing my project. This time I will make sure that there are almost no flaws in my design with it also to make sure that it benefits all the people who might use it.
Schedule!!!/ work plan - 2 weeks and a half before presenstation!!
This is the schedule of how I went over the fabrication process of my final project.
I intentionally started at point of time from where I would have about another 4-5 days after I have finished creating my project to prepare for the presentation on June 7th. For me it was around 2 weeks and 4 days. Therefore I started officially started to devlop my project.(I started a long while a ago, but this is the real time when I actually started to create my project for real!) I will spend around 1 week for fabrication.
Sketch
This is the renewed sketch of my final project! I want to make it as compact as possible and then also make it a bit more cooler compared to the heavy cylinder it used to be. I also took out a lot of the sensors that I thought would be irrelevant to my project as they either took too much space or were just too expansive to get!
The components that I will now be using are:
Capacitive soil moisture sensor
DHT11 humidity and temperature sensor
Solar panel
3.7 volts lithium ion battery
Xiao esp32 c3
WOW... I have made a lot of changes for my final project and I also haver very good reason for it.
First of all like I said before I removed some sensors from my final project as I not only wanted to keep my final project compact but also I wanted to reduce the overall cost of my project. I wanted to make it so that anyone can recreate my project with minimal expenses.
Secondly I also added a solar panel with a rechargeable battery so that I would not have to constantly change the batteries when ever my project ran out of fuel.
Also I removed the LCD screen. Now to display the readings given by my project, I (with the help of my fab guru "Rico Sir") decided on hosting a web sever and when people enter in the ip address they will be able to get all the readings that is being displayed by my project.
Actualization
With all of that planning, now next move on to actually make it all really and really start fabricating it.
Firstly I have to start with the fabrication of my micro controller board! Now I am using the xiao esp32 c3, instead of the attiny3216 micro controller. I have some great memories with the attiny3216 as it is the micro controller that carried through all the week of the fab academy but it has its limitations and I must accept them. Such as the fact that it does not have a wifi protocol which is required for my project. Also I need to change my encloser for my final project a bit as my previous design was quite big and not really portable!
With the reasoning done lets start with designing our new encloser and board!
Encloser
Firstly we have to create our encloser. It is very important to note that my encloser has to have some key features that need to be implemented:
1. Firstly I have to make my encloser water prove so that it stay outdoors even if it rains.
2. Secondly we also have to make it as small as it can possibly be. So that it can be portable and easy to recreate.
3. It should also include a place for the solar panel to be placed in and generate electricity for my project.(Basically meaning my design will have two components, one to hold all the other components and the other to hold the solar cell then also I must have both of these components join in away that it is still water prove!!!)
4. Also most importantly it should be able to survive the shake test😀.
Designing!!!
Now lets start designing our encloser and then get thing started with and than also tested. To design my encloser I will be using fusion 360! So without any interference, lets goo!
Before anything we always need to have all our parameters in check to ensure that even if you mess up in the future you can just fix it!
Next we just have to create a cylinder. for me I created a 45mm circle and then I just added an offset of 10mm. After that I just extruded the sketch.
With that done next I made a chamfer at the bottom of the cylinder to act as a mount for the soil moisture sensor.
Now the hard part starts! we now have to make the mechanism that will be able to put together the two different components. To begin we must first create an extrusion on the top on the cylinder that we preciously created. What I want to create is a slide lock system on the top of the first component and then the other part of the lock will be placed on the component that holds the solar cell.(the socket will be on the main component while the header or pin of the lock will be on the component that holds the solar panel.)
Now to create a slide lock mechanism, I have to create it in two parts. Those two parts are the socket and the lock pins. I want to have the socket on the main body of the design while the lock pins will be on the component that holds the solar panel.
To create the socket I first created a this weird shape that had the height of the extrusion I created in the previous step. The width of the of the design has to be a bit more than the offset(for me it was +15mm). Then I had the design extrude to the side(the distance extruded is equivalent to the length of the lock pin.)
With the weird shape created we can simply just create a circular pattern with the shape as the object and the original circle as the axis it is going to move on! Remember to keep the operation as cut! if you don't want to end up with a really weird shape!!!
As we are now done with creating the pattern and then also cutting the main component according to the to lock pin, we are now done with the socket!!!
To create the socket I simply just extruded a sketch and then adjusted it to the pin in the socket(NOTE: I also added filets so that it would not have as much tolerance as it would have, if it was a square.)
After I created the key I then just used the pattern tool to create the same lock pin to all the sockets and then attached it to another platform(NOTE: this platform is going to be the platform that is going to contain the solar panel ).
I need to confirm if whether the slide lock actually works so, I for that I printed just the slide lock components of the encloser. This way I will be wasting 2 hours of my life instead of wasting like 12-16 hours of my life 3D printing if my slide lock fails!
I just started up my printer and then begun with the printing process. The print took around 2 hours and 10 minutes. This is how it looks after it was done printing!
When the printing finished, I just tested if the slide lock works or not and it did!!. Next I had to make sure if whether the lock was tight enough to not let water pass. To do that I covered the two ends and then poured water on the place on joint.
After the test was over, I was really surprised!!! I thought that for the joint to be water prove, I required some sort of rubber to go between the joints but apparently I didn't need then as the joints are water prove as it is now!
With that reassurance all I have to do is to create the platform for the solar panel on the lock pins. I just put in the dimensions of the solar panel and then had an offset of 5mm.
After that we just extruded the sketch. And also filled up the gaps with an offset with 5mm.
This is how it looks in Pursa Slicer.
and if you are wondering these are the print setting on which I printed.
After the printing finished this is how it looked! Also when the printing finished I was met with another surprise. The filament I used was semi transparent so when I shine a light through it, it looks mysticals!!! Maybe I could have LED indicators on my project as well.
MCU creation!!!
Firstly lets get over the schematic bit and finish it up as quickly as we can.
I have used the schematic editor before and am very comfortable with it! For this schematic, the components I added were the:
Xiao ESP32 c3 - This is very self explanatory as of why I have this. It is because it is the main micro controller that I will be using for my board.
01x03 pins (x2) - These pins are for the soil moisture and the DHT sensor. These pins require a VCC, GND and a Data pin. (for the moisture sensor, I need an analog pin where as for the DHT sensor both work.)
1 LED and 1 resistor - This just there to act as an programable LED.
Now I just have to update my pcb editor and then start with creating the pcb layout of my board!
NOTE: I had to used one 0 ohm resistor so that all the wires could comfortably fit!
After I finished the pcb layout, I next moved on to creating the RML file for my PCB so that I will be able to mill it out using the Roland SRM-20. I need to create the RML file first and do that I will be using the MOD-CE.
I first exported the PCB layout and imported it in inkscape.
After that I simply just put it in MOD-CE.
This is how the traces looks!
This is how the interior looks like.
Since I have created the rml file for both the interior and the traces, I will noe start the process of Milling my board.
First I have to stick the copper plate to the sacrificial layer!
To ensure that the copper plate has been securely stuck to the sacrificial layer, I also decided to add some pressure on it. I actually added WAY... more pressure than required. I just did it to be safe.
Next while the copper plate was begin stuck to the sacrificial layer, I went to collect the drill bits that were required for milling my circuit board!
The two drill bits that I used to mill my board were:
1/64 drill bit - This drill bit is essential to mill out the traces on the copper plate.(Remember!!! the 1/64 drill bit is REALLY fragile! It can break really easily. Even if you drop it from a few inches off ground, IT CAN BREAK!)
1/32 drill bit - This drill bit is used to mill the interior of my design. This drill bit is also more wider and longer than the 1/64 drill bit. It is also the reason why we use it to mill through the copper plate and then cut it out.(This is the cousin of the 1/64 drill bit. Its really tough and rarely breaks!)
Next lets start milling! First and foremost we have to mill out the traces and then we can move on to milling the interior!
After milling the traces I noticed that it didn't cut properly on the bottom left conner of the of the trace. But for some reason, poor old me wasn't able to notice such details and directly moved on to the next step.
After milling the traces, I just replaced the mill bit to the 1/32 mill bit and then and started with milling the interior.
Only after milling the circuit board out did I manage to see that the traces wasn't milled properly! I panicked a lot and then literally jumped towards to my multimeter to test continuity on my board. With that I figured that the the VCC and the GND lines were connected! To solve this I asked my instructor Anith Sir whether if I could just simply cut the copper that didn't cut properly with the use of some thing sharp like a blade.
Once I finished that very scary operation I next moved to checking the continuity. After testing, my boards passed with no other shorts.
I moved on to soldering part of the process. I gathered all the components I needed to solder on to my board and labeled them properly.
.
Testing!
I now need to test if whether my xiao board works or not. For that I will be having two tests:
1. Test one is going to be its capabilities to create a web server
2. Second its going to be the boards capability to communicate with other boards.
With these tests I will be able to clearly dictate whether my board is functional or not.
coding
The coding part of the test should be simple as I already coded the xiao esp32 c3 board for networking and communication where I had to both create a web server and then also had to make two xiao boards communicate between them selfs.
1. Web sever
For the web server test I simply used the libraries that came with the xiao board itself.
#include <WiFi.h>
#include <WiFiClient.h>
#include <WebServer.h>
With that I just wrote a simple code that displayed hello world on to a web server using a already existing wifi.
#include <WiFi.h>
#include <WiFiClient.h>
#include <WebServer.h>
const char* ssid = "your_SSID";
const char* password = "your_PASSWORD";
WebServer server(80);
void handleRoot() {
server.send(200, "text/plain", "Hello World!");
}
void setup() {
Serial.begin(115200);
// Connect to Wi-Fi
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi...");
}
Serial.println("Connected to WiFi");
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
// Start the web server
server.on("/", handleRoot);
server.begin();
Serial.println("Web server started");
}
void loop() {
server.handleClient();
}
This is how the result looks.
2. Communication (ESP NOW)
To communicate between two xiao boards I will use the esp now protocol. The esp now protocol allows for communication between 2 or more esp32 boards!!! The esp now is like a wifi that only esp32 boards can connect to. It work on 2.4GHz. I am still learning about it but I feel its somehow like a version of bluetooth but for the esp32!
For this test I will be using the board I printed to be connected to a soil moisture sensor and then relay its information to a receiver xiao board.
Before anything though I first need to find the mac address for both the my board and the receiver board.
For that I made both xiao boards print their mac address.
#include <WiFi.h>
void setup() {
Serial.begin(115200);
// Connect to Wi-Fi network
WiFi.begin();
// Wait for connection
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi...");
}
// Print MAC address
Serial.print("MAC Address: ");
Serial.println(WiFi.macAddress());
// Disconnect from Wi-Fi network
WiFi.disconnect(true);
}
void loop() {
Serial.println(WiFi.macAddress());
}
I simply used a program that reads the soil moisture and then also send it to the receiver.
Sender code
#include <esp_now.h>
#include <WiFi.h>
// MAC Address of the receiver XIAO ESP32-C3
uint8_t receiverAddress[] = {0xD4, 0xF9, 0x8D, 0x03, 0xEE, 0xAC};
#define MOISTURE_SENSOR_PIN 3 // Analog pin where the soil moisture sensor is connected
#define MAX_MOISTURE_VALUE 4095 // Maximum value of the sensor reading for full moisture
// Structure to send data
typedef struct {
float moisture;
} sensorData;
// Create an instance of the sensorData structure
sensorData dataToSend;
void setup() {
Serial.begin(115200);
// Set device as a Wi-Fi Station
WiFi.mode(WIFI_STA);
// Init ESP-NOW
if (esp_now_init() != ESP_OK) {
Serial.println("Error initializing ESP-NOW");
return;
}
// Register peer
esp_now_peer_info_t peerInfo;
memcpy(peerInfo.peer_addr, receiverAddress, 6);
peerInfo.channel = 0;
peerInfo.encrypt = false;
// Add peer
if (esp_now_add_peer(&peerInfo) != ESP_OK) {
Serial.println("Failed to add peer");
return;
}
}
void loop() {
// Read soil moisture sensor
float moisture = analogRead(MOISTURE_SENSOR_PIN);
moisture = (1 - (moisture / (float)MAX_MOISTURE_VALUE)) * 100;
// Store the moisture value in the data structure
dataToSend.moisture = moisture;
// Send data via ESP-NOW
esp_err_t result = esp_now_send(receiverAddress, (uint8_t*)&dataToSend, sizeof(dataToSend));
if (result == ESP_OK) {
Serial.println("Data sent successfully");
} else {
Serial.println("Error sending data");
}
delay(2000); // Adjust delay as needed
}
After the uploading finished( Remember to always boot while plugin if you want to upload just that the esp board can enter boot mode. If not it will not work!!! I had spent several minutes just figuring that out.) Anyways lets see the output on the serial moniter.
For the receiving board I simply just used made it print the values it got back.
receiver code
#include <esp_now.h>
#include <WiFi.h>
// MAC Address of the sender XIAO ESP32-C3
uint8_t senderAddress[] = {0xD4, 0xF9, 0x8D, 0x03, 0xF6, 0x5C};
// Structure to receive data
typedef struct {
float moisture;
} sensorData;
// Create an instance of the sensorData structure
sensorData receivedData;
// Callback when data is received
void OnDataRecv(const uint8_t* mac, const uint8_t* data, int len) {
// Copy received data to the sensorData structure
memcpy(&receivedData, data, sizeof(receivedData));
// Display the received moisture value
Serial.print("Received Moisture: ");
Serial.println(receivedData.moisture);
}
void setup() {
Serial.begin(115200);
// Set device as a Wi-Fi Station
WiFi.mode(WIFI_STA);
// Init ESP-NOW
if (esp_now_init() != ESP_OK) {
Serial.println("Error initializing ESP-NOW");
return;
}
// Register callback function for receiving data
esp_now_register_recv_cb((esp_now_recv_cb_t)OnDataRecv);
// Register peer
esp_now_peer_info_t peerInfo;
memcpy(peerInfo.peer_addr, senderAddress, 6);
peerInfo.channel = 0;
peerInfo.encrypt = false;
// Add peer
if (esp_now_add_peer(&peerInfo) != ESP_OK) {
Serial.println("Failed to add peer");
return;
}
}
void loop() {
// Do nothing in the loop
}
Now that the receiver code has been sent, Lets see the output on the serial moniter!!!
We have now fabricated a majourity of our final project requirements! Next we will be going into coding and making the data received by my board into charts and send it to a webserver. Lets get right into it
Reflection
this section is ment to answer what did you plan" vs “what did you actually do”
For fabrication I had setup an entire schedule for how I would be able to manage my time with maximum Efficiency! Also I was able to follow my schedule almost perfectly. But I had to make a lot of changes to actually finish my final project. You all probabily seen the top of this page where I talk about how I needed to make some changes to not only to my projects encloser and also make changes to the varity of sensor I am using! So generally speaking, I had to change alot of things and from what I though at first, my design changed heavily!
Speacial Thanks To
Anith Ghalley : my local instructor, his website helped a lot while creating this site!!
Rico Sir As our fab guru his experince and knowledge that he shared to us was very important, and also his website was a good reference
My friends: My friends are the people who helped most while creating this site!!
Thank you very much!!