USB device using host network adapter

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
kudrow
 
Posts: 35
Joined: Fri Dec 19, 2014 12:54 pm

USB device using host network adapter

Post by kudrow »

I am looking for a USB device that I can program to communicate to the internet via the host machine. So basically write an application in Arduino that sends data to the internet using the ethernet or wifi connection of the host machine. Does this make sense?

Thanks!

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: USB device using host network adapter

Post by mikeysklar »

You can use almost any of the Adafruit microcontrollers options to achieve the goal:

Arduino --> USB --> PC --> Internet

Write the Arduino code output the serial data and have a python script or other code on the PC side follow the serial data and push the content over the internet. At least that would be the traditional way of taking advantage of the PCs network connection. Would this work for you?

The Trinkey might be a nice option for a minimal USB sized board to avoid additional cords if you do not need GPIO access.

https://www.adafruit.com/product/4870

User avatar
kudrow
 
Posts: 35
Joined: Fri Dec 19, 2014 12:54 pm

Re: USB device using host network adapter

Post by kudrow »

This is absolutely perfect! Thank you! I will order it and start tinkering with it. Last question though; is it possible for someone to pull my Arduino program off the Trinkey and use it for themselves?

Thanks!

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: USB device using host network adapter

Post by mikeysklar »

They can pull the hex file and copy that to the same model of processor. They would not see the source code, but this is enough to reproduce copies.

User avatar
kudrow
 
Posts: 35
Joined: Fri Dec 19, 2014 12:54 pm

Re: USB device using host network adapter

Post by kudrow »

Does the Trinkey have a unique ID that can be queried and can’t be changed? Similar to a MAC address?

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: USB device using host network adapter

Post by mikeysklar »

The SAMD21 processor (M0) used on the Trinkey has a unique 128-bit address. See section 9.3.3:
9.3.3 Serial Number
Each device has a unique 128-bit serial number which is a concatenation of four 32-bit words contained at the following addresses:
Word 0: 0x0080A00C
Word 1: 0x0080A040
Word 2: 0x0080A044
Word 3: 0x0080A048
The uniqueness of the serial number is guaranteed only when using all 128 bits.
http://academy.cba.mit.edu/classes/embe ... asheet.pdf

User avatar
kudrow
 
Posts: 35
Joined: Fri Dec 19, 2014 12:54 pm

Re: USB device using host network adapter

Post by kudrow »

mikeysklar wrote:The SAMD21 processor (M0) used on the Trinkey has a unique 128-bit address. See section 9.3.3:
9.3.3 Serial Number
Each device has a unique 128-bit serial number which is a concatenation of four 32-bit words contained at the following addresses:
Word 0: 0x0080A00C
Word 1: 0x0080A040
Word 2: 0x0080A044
Word 3: 0x0080A048
The uniqueness of the serial number is guaranteed only when using all 128 bits.
http://academy.cba.mit.edu/classes/embe ... asheet.pdf
OK it looks like I need some direction on this. I am guessing I need to write something to load on the device that listens for communication over the com port? I have a python app that runs on the computer and it opens a serial connection to the device but I have not written anything for the device itsself. What command would I write to get the serial number? Are there any documents on the command lists it will accept? I see the data sheet you linked but did not find anything specific.

Thanks!

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: USB device using host network adapter

Post by mikeysklar »

You can start with this library which offers a way to read the serial number off the SAMD21 boards. Then compare the value with your python catcher script via USB serial to verify the boards identity is valid.

https://github.com/mkretzschmar/SAMD21Serialnumber

Code: Select all

#include <SAMD21DeviceID.h>
SAMD21 samd = SAMD21();
char serialnumber[33];
void setup() {
  Serial.begin(9600);
  samd.getSerialNumber(serialnumber);
  Serial.print("[SETUP] chip serial#: 0x");
  Serial.println(serialnumber);
}

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”