Getting a Mega to allow data to pass through it from a transceiver to a USB

Hello,

I'm relatively new to Arduino and dont have much experience with programming.

Anyway, I am trying to assemble and code an arduino mega to take data in from 1 port and transfer it to another with a connected USB drive. The ultimate goal is to have the board act as a switch/storage system to collect data autonomously and then transfer it via an attached cell modem. For now, however, I'm just trying to do a proof of concept that the board can simply take data in from one port, and send it to another.

I've noticed that the mega only has 1 USB port to connect so I assume I'll have to use other parts included in the kit to add a second USB port.

Its a rather vague ask, but I'm not really sure where to start.

Sure, connect an FDTI Basic to Serial1, Serial2, or Serial3 and open a 2nd instance of the IDE for it to talk to.
Then:

void loop(){
  if (Serial.available() >0){ // did a byte come in from the PC?
  Serial1.print (Serial.read() ); // read it and send it out on Serial1
  }
}

Most Arduinos do not host USB, they are clients.

Look into wiring an SD module to Arduino SPI bus for local storage.

Okay, so I take it this'll be simple enough.

However, I am rather new to this. Does the FDTI come with the kit?

I have an additional piece that came with it that has a USB port, is there a schematic for hooking it up to communicate, then running the code?

What kit?

Most USB devices are USB slaves only. Slaves can not talk to each other, they need a master (such as a PC) to talk with.

You need a USB Host shield if you want the Mega to talk to a USB stick at some point.

I suspect a RaspberryPi would be better suited to this job.

...R

Yes, we intend on using a raspberry-pi for this when it is set up, I just dont have one on hand so decided to use the arduino I had sitting around. I have an odroid brain though....

Get the forum to recommend good but still Cheap (< $5) SD modules. On a PC, you plug the SD card (usually a micro-SD) into a media reader and it is a standard drive. Heck, you can even Make One Yourself from a microSD to full size SD adapter and 6 resistors or 3 resistors and 3 diodes to level voltages between the 5V Arduino and 3.3V SD.

These are great for Arduino! For not much money you get Gigabytes of storage. The smaller cards, 16G or less like 4G are fine and multi-packs of those are always on discount somewhere.

They have Very Low Energy Requirements compared to spinny-drives. When a data collector/logger including batteries is packed into an Altoids tin (it was a thing here once) and runs 1+ months at a time, it uses SD for data storage.

jaswan:
Yes, we intend on using a raspberry-pi for this when it is set up, I just dont have one on hand so decided to use the arduino I had sitting around.

Complete waste of time IMHO - a Mega and an RPi are very different beasts.

...R