Welcome back to my project. This is Eric. The WiFi connection in the MCU has allowed us
to do many projects that we couldn't do before. Connecting directly to the server and
transferring data is now a piece of cake. You agree with me, don't you?
I hope we are on the same page. Now, the way I see it, I can do various projects even in an environment without WiFi
by using a cellular modem beyond WiFi. The device I will use in this project is based on ESP32-S3 and includes a Mini-PCIe 4G LTE
modem as well as a camera module OV2640. This is very interesting. As you know, ESP32-S3
already includes WiFi and Bluetooth. By combining this with a PCIe-type LTE modem, this can
be connected to a server anytime, anywhere. Unfortunately, WiFi isn't
there when we really need it. LTE also doesn't cover all of the US, but we believe that excluding satellite service,
guarantees the maximum connectivity we can use. In today's project, I'm going to start a project that captures images
and uploads them to the server. Personally, what I'm most excited about is
how quickly the images can be sent to the server. The SIM7600H series I will be using is an
LTE Cat 4 module and supports up to 150Mbps downlink rate and 50Mbps uplink rate.
It means you can upload files at 6.25 Megabytes per second.
That's awesome. However, these are just the
specifications of the LTE module. Here is the problem.
The MCU and LTE module are connected via UART, and data is transferred through it. This is likely
to be significantly slower than the USB interface. The second problem is the packet
size that can be sent at a time. Ethernet's MTU is usually 1500 bytes.
This is the size of packets that can be transferred at a time.
TinyGSM, which we will use, does not seem to break into the chunk when
the size of the data to be transferred is larger than the MTU. That's why we need to
create and transmit packets in the chunk unit. For example, let's say your
photo image is 300 kilobytes. It cannot be uploaded to the server
at once through the Post API. This is because it exceeds the MTU size. So, this is divided into chunk units with a
maximum packet size of 1500 bytes and transferred. Unfortunately, this slows down the transfer rate. If your project is sending
short strings to the server, there is no problem at all.
What I'm trying to do is to upload the highest-quality images that
can be taken from OV2640 to the server. Now that the hardware is ready, let's
prepare the required SIM card next. I'm using Google Fi so I was able to easily apply
for an additional data-only SIM card and use it. The cost is $10 per gigabyte. That's a
pretty high rate. However, since it is Pay as you go, if you do not use it, it is $0.
I think it can be used much cheaper than a prepaid data SIM card that is only used for a few days.
There are many variables depending on what kind of project you are doing, so please find the
cheapest carrier that is perfect for your case. My Google Fi Data SIM card has arrived.
It took about 5 days to be delivered. There is a secret code to activate
the SIM card in this paper case. You can use it after activating the
SIM card through the Google Fi webpage. Now let's get down to the first project
by inserting the SIM card into the slot. First, there is the source code provided by the
company that made this board. This is very useful to check if your device is working normally.
You can test not only the camera but also the built-in microphone, so please refer to it if
you need a basic understanding of this device. What I'm going to do is test whether I can actually communicate with the
server using the TinyGSM library. This is the most important part of this project, so we must confirm it and
move on to the next step. Alright. Let me open my Arduino IDE. If you have installed the TinyGSM
library, you can find an example called All functions from your Arduino IDE.
The version I am currently using is 0.11.5. This example contains many
tests on your SIM module. If you look here, you can test not only
GPRS, but also WiFi, Call, and GPS. I will modify some parts of this
code so that my device can work. I use the SIM7000 series, so select SIM7600 here. Connect to Hardware Serial, not software Serial. Define GPIO to which PCIe is connected.
This was brought from the T-SIMCAM Test Code. I will only test the TCP
connection after connecting GPRS, so I change all the rest of the test to False. Google FI's APN is h2g2. You need to set it to the
APN of the SIM card you use. Lastly, it is to create a
serial connection for the modem. This part is also brought from
the example source of T-SIMCam. I believe we are ready for
the cellular connection test. Let's see what the results come out. Almost forgot it.
You have to enable USB CDC on Boot. if not, you cannot
see any log from the device. Modem SIM7600G-H
connecting to h2g2 GPRS status connected
CCID, IMEI, Operator Google Fi HTTP SERVER Connected I got 568 characters from the connected server. Yes. If you see this TinyGSM on the
console, your modem works properly. You must check the cellular connection. Otherwise, you will not be able to
proceed with the following steps. In projects using WiFi, it was easy to transfer
data to a PC connected to the same local network. However, in an environment using cellular,
on the contrary, it is difficult to access the local network or local server. Of course,
it's possible but requires extra routing work. This is the system I am
trying to create this time. It's to make it possible to transfer the pictures
taken on T-SIMCAM directly to the server. I will install a server that has a static IP so that we can upload photos
directly through cellular. I will create a VM instance
through the Google Cloud Platform. Put your instance name here. Ubuntu server I'll make a tiny ubuntu server here. Choose a region that is cheap and close to you. Since this is a server where you
can simply upload and store images, I will choose the E2 Micro as
it has the lowest performance. As I said, I will make a ubuntu
server so let me choose the ubuntu os. The version I choose is 18.04 LTS. Allow all HTTP and HTTPS traffic. I think it's done. Okay. My ubuntu server is created on GCP. We can connect to the server through the console,
but I'll use the browser's SSH for convenience. I'm on the server. Let's change the font size to maximum. Hopfully, you can read these texts well. I'll make a node js server which is very
simple so let me download the node js. It's time to install node js. Installation is done. Let's check the version information
to make sure it's installed properly. Oops. it's not nodejs. just node. I confirmed it works for
not only npm but also node. Now we need to create a node js server. The role of this server is to act as an HTTP
server, and it must allow image data to be transferred in the POST method. And then, it's
to write image files in the specific folder. You know what.
I'm trying to make this server through ChatGPT. I won't go into detail about this
because it's very trendy these days. It's gonna be super exciting. Let's get started. write Node.js server code to
upload images via HTTP Post wow! It's generating code. Very cool. It allows me to upload an image using
the POST method with the express module. I feel like it's a very good tutor. Ok. He is good but I need something more.
This time, I will tell him to use a file stream. It's generating the code the way I want.
That's sick! I think it understands exactly what I want. Finally, let me add one more thing I need. Change the file name to
Unix timestamp in this code This is the code for the node js server I wanted.
Perfect. I will copy this as is and use it on my server. I'll go back to the server and
create a file called server.js and paste the server code
created by ChatGPT into it. That's it. I didn't touch anything. This server code uses the file system
module, so I'll install it through NPM. Let me run the node server.
Server listening on port 3000 Also, this server writes the image files in the
uploads folder. So we need to make it first. I believe the last part we have
to set is the firewall settings. This server uses port number 3000
so we need to set it to allow. In the firewall menu, Create firewall rule. Put the rule name, my server port. Set the targets,
All instances in the network. I have only one instance so it doesn't matter.
If not, you can choose the instance you want. Source IPv4 Ranges.
Allow all IPs. Finally we're here.
We need to add the port number we want here. That's it. My server is ready to go. I need to get a server IP address because
I'll put it in my source code for T-SIMCAM. This is the source code I prepared.
After TinyGSM cellular connection, take a picture and send it to the server. I share this source code
through my GitHub repository. Nothing special. After transferring the image file, do
nothing for 10 seconds and repeat again. In this part, the data is cut
into chunks and transferred. The size of the chunk is set to 1500 bytes. And the frame size is UXGA which is
the maximum resolution of OV2640. Let me build and flash it to my device. Now my server is running. The device takes a picture
after connecting to cellular and starts sending it right away. It seems it's currently being uploaded. Let's check if the file was
created in the Uploads folder. Image file has been sent. Great! The sender's byte and the
receiver's byte are the same. It took about 12 seconds to
transfer about 120 kilobytes. It shows a very slow transfer rate than expected. Let's stay like this for a few minutes. As you can see, the image is continuously uploaded to the server.
How about picture quality? Let's download one image
file stored on the server. You can download any files as
long as you know the image path. There is a typo. Let me type it again. Here you are. The image shows a lot of noise.
Actually, this is my problem. There is very little light as
only one light is on in the room. I think I would have gotten much better results
if I had tested it outdoors in the daytime. Let's sum up today's project. We were able to create a system that could
upload images taken via cellular to a server. The server was made with node.js
and charGPT made it instead of me. The actual upload speed was measured at about
80 kbps, but this part needs to be tested again. I will prepare an application using this.
That's it for today. Thank you for watching.
See you on the next project.