Skip to content

FTP Image Transfer Tutorial

Timothy Woo edited this page Oct 26, 2018 · 14 revisions

NOTE: This tutorial is still in progress!

NOTE: Currently FTP has only been tested on SIM7000A (1351B03SIM7000A firmware) and SIM7000G (1529B01SIM7000G firmware). SIM7000E 1351B05SIM7000E should also work but has not been verified. Old versions of the SIM7000A will not support FTP commands. 1529B01SIM7000G on the SIM7000G seems to support everything except the FTPEXTPUT commands.

Introduction

In this tutorial we'll use a camera module to take pictures and send them to a custom server using FTP (File Transfer Protocol). Note that FTP can be used for any other file type, not just images, so feel free to adapt this to your particular use cases. If you want to experiment with this feature but don't want to buy a camera module, no worries, you can do this quite easily just by using a sample image.

NOTE: This tutorial assumes that you are already comfortable with the features of the Botletics shield and have everything set up. Please see the rest of this wiki if you haven't already.

Parts Needed

Below are all the parts you will need for this project:

  • Botletics SIM7000 shield kit
  • Hologram SIM card. Note: You may need a different SIM card depending on where you live.
  • 3.7V LiPo battery. Note: 1000mAH or greater capacity.
  • Arduino Mega (or compatible). Note: Arduino Uno will NOT work! The Mega is needed here because of hardware serial and memory.
  • ArduCAM camera module. Note: You can use pretty much any ArduCAM module and it will work as long as their library supports it. You could certainly also use other SPI or UART camera modules, but coding will be different from this tutorial.
  • SD card module for storing the images or files.
  • MicroSD card (choose your own storage capacity)
  • A breadboard, pushbutton switch, and jumper wires (for triggering the system)

Setting up FTP Server

First of all, we'll need an FTP server. Luckily this is quite easy to set up and Windows has these features conveniently built in for us. For Windows 10, please follow this really good tutorial on how to set up an FTP server.

Personally I found that I had to temporarily disable the Windows Defender Firewall for public networks before it would work, but then again I'm no networking expert.

Hardware Setup

The overall connection scheme we will be using is as follows:

  • The Botletics cellular shield will be plugged into the Arduino Mega
  • The shield will use software serial like usual (like all the other tutorials previously)
  • The camera module will be wired separately and will use a hardware serial port (Serial1) on the Mega

Shield Setup

Please follow this tutorial for how to set up the Botletics SIM7000 shield as well as the SIM card, LiPo battery and antenna. It's assumed that you probably already did all that, so we won't focus on it here.

SD Card Module Setup

To set up the SD card breakout, follow these Adafruit instructions and be sure to pay special attention to the SD card formatting tool that you need to download and run to format your SD card to FAT-16 or FAT-32.

Next, wire up the power and SPI connections to the SD card module as follows:

  • 5V --> 5V on the shield/Mega
  • GND --> GND on the shield/Mega
  • CLK --> pin 52
  • DO --> pin 50
  • DI --> pin 51
  • CS --> pin 53
  • Optional: You could use the CD pin to detect when the card is inserted

Camera Module Setup

For this tutorial we'll be using the ArduCAM OV2640 camera module since it's affordable and readily available, but you could choose other ArduCAM modules since they all have the same pinouts so it's mainly a matter of resolution (and price).

Make the following camera connections to the Mega:

[[]]

Next, wire up the button so that you can physically activate the system:

[[]]

Here's how your complete setup should look like:

[[]]

Now we're ready for the code!

Software and Testing

The general software scheme is as follows:

  • The button triggers the system
  • The camera module takes a picture and stores the file to the SD card.
  • The SIM7000 shield uploads the image file to your custom FTP server

Open the example FTP image transfer sketch and upload it to the Mega. Open the serial monitor so you can debug the current status. Press the button and the camera should take a picture, store the file to the SD card, and upload it to your FTP server!

Now you can check if it worked by opening the local FTP folder on your computer and you should see the image file there!

[[]]

Have fun integrating this knowledge in your own project!