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!
USB device using host network adapter
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- mikeysklar
- Posts: 13936
- Joined: Mon Aug 01, 2016 8:10 pm
Re: USB device using host network adapter
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
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
- kudrow
- Posts: 35
- Joined: Fri Dec 19, 2014 12:54 pm
Re: USB device using host network adapter
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!
Thanks!
- mikeysklar
- Posts: 13936
- Joined: Mon Aug 01, 2016 8:10 pm
Re: USB device using host network adapter
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.
- kudrow
- Posts: 35
- Joined: Fri Dec 19, 2014 12:54 pm
Re: USB device using host network adapter
Does the Trinkey have a unique ID that can be queried and can’t be changed? Similar to a MAC address?
- mikeysklar
- Posts: 13936
- Joined: Mon Aug 01, 2016 8:10 pm
Re: USB device using host network adapter
The SAMD21 processor (M0) used on the Trinkey has a unique 128-bit address. See section 9.3.3:
http://academy.cba.mit.edu/classes/embe ... asheet.pdf9.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.
- kudrow
- Posts: 35
- Joined: Fri Dec 19, 2014 12:54 pm
Re: USB device using host network adapter
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.mikeysklar wrote:The SAMD21 processor (M0) used on the Trinkey has a unique 128-bit address. See section 9.3.3:
http://academy.cba.mit.edu/classes/embe ... asheet.pdf9.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.
Thanks!
- mikeysklar
- Posts: 13936
- Joined: Mon Aug 01, 2016 8:10 pm
Re: USB device using host network adapter
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
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);
}
Please be positive and constructive with your questions and comments.