The preparations for use Squama Ethernet with the Arduino IDE

Squama is a series of products. This series of products has a standard appearance, with a general size of 62x30mm. The series integrates an MCU and peripherals with communication function, which is suitable for IoT-related applications.
ORIGINAL POST
By Longan_labs
components
Hardware Components
ATSAMD21G18 chip
X 1
Software Apps and online services
Arduino IDE
details

ide.jpg

ARDUINO IDE SETUP


First download the Arduino IDE from https://www.arduino.cc/en/Main/Software. Arduino IDE can be installed and run on Windows, Linux, and Mac OS X operating systems. Download the installer or zip file (Windows only) and install (if you have the zip file, extract it to your Windows computer’s hard drive) it on your operating system.

Once finished, start the Arduino IDE.

Copy and paste the link below into the Additional Boards Manager URLs option in the Arduino IDE preferences (File > Preferences).

https://raw.githubusercontent.com/Longan-Labs/Longan-SAMD-Boards/master/package_longan_m0_boards_index.json

Enter longan to install the latest Longan SAMD board

Then you can select the Squama Ethernet board,

USAGE


Install Ethernet Library

The Arduino Ethernet library work well with Squama Ethernet dev board.

Lets start by installing the library, open your Arduino IDE, Sketch > Include Library > Manage Libraries…

Input ethernet, you will find the library, make sure you are running at V2.0.0 or higher.

Connect Cable

Here you need a network cable and a TypeC cable. Connect the Squama Ethernet Dev Board to the router through the network cable and to the computer through the TypeC cable.

Run Example Code (WebServer)

We take WebServer as an example. First open the code of WebServer.

Some parts of the code may need to be modified. If your router limits the mac to the Internet, then you need to modify the mac address. And the IPAddress on line 28 of the code needs to be modified to the same segment as your gateway address. My gateway address is 192.168.31.1, so I changed my IPAddress to 192.168.31.177. If you use a Windows operating system computer, You can get your gateway address through win+R > cmd > ipconfig.

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = {
    0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
};
IPAddress ip(192, 168, 31, 177);

After the code is uploaded successfully, open the Serial Monitor.

Open the web browser and enter the address displayed on the Serial Monitor, you can get the data sent by Squama Ethernet.

The library also contains a lot of practical examples, including the following, not to introduce them here.

  • AdvancedChatServer
  • BarometricPressureWebServer
  • ChatServer
  • DhcpAddressPrinter
  • DhcpChatServer
  • LinkStatus
  • TelnetClient
  • UdpNtpClient
  • UDPSendReceiveString
  • WebClient
  • WebClientRepeating
  • WebServer

Use the WS2812B on the board

We already add the library to the examples.

Open Arduino IDE, File > Examples > Adafruit DMA neopixel library > strandtest.

Use the USR button on the board

const int pinBtn = 11;
const int pinLed = 13;

void setup()
{
    pinMode(pinBtn, INPUT_PULLUP);
    pinMode(pinLed, OUTPUT);
}

void loop()
{
    int ledst = 1-digitalRead(pinBtn);
    digitalWrite(pinLed, ledst);
    delay(100);
}

ide.jpg

ARDUINO IDE SETUP


First download the Arduino IDE from https://www.arduino.cc/en/Main/Software. Arduino IDE can be installed and run on Windows, Linux, and Mac OS X operating systems. Download the installer or zip file (Windows only) and install (if you have the zip file, extract it to your Windows computer’s hard drive) it on your operating system.

Once finished, start the Arduino IDE.

Copy and paste the link below into the Additional Boards Manager URLs option in the Arduino IDE preferences (File > Preferences).

https://raw.githubusercontent.com/Longan-Labs/Longan-SAMD-Boards/master/package_longan_m0_boards_index.json

Enter longan to install the latest Longan SAMD board

Then you can select the Squama Ethernet board,

USAGE


Install Ethernet Library

The Arduino Ethernet library work well with Squama Ethernet dev board.

Lets start by installing the library, open your Arduino IDE, Sketch > Include Library > Manage Libraries…

Input ethernet, you will find the library, make sure you are running at V2.0.0 or higher.

Connect Cable

Here you need a network cable and a TypeC cable. Connect the Squama Ethernet Dev Board to the router through the network cable and to the computer through the TypeC cable.

Run Example Code (WebServer)

We take WebServer as an example. First open the code of WebServer.

Some parts of the code may need to be modified. If your router limits the mac to the Internet, then you need to modify the mac address. And the IPAddress on line 28 of the code needs to be modified to the same segment as your gateway address. My gateway address is 192.168.31.1, so I changed my IPAddress to 192.168.31.177. If you use a Windows operating system computer, You can get your gateway address through win+R > cmd > ipconfig.

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = {
    0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
};
IPAddress ip(192, 168, 31, 177);

After the code is uploaded successfully, open the Serial Monitor.

Open the web browser and enter the address displayed on the Serial Monitor, you can get the data sent by Squama Ethernet.

The library also contains a lot of practical examples, including the following, not to introduce them here.

  • AdvancedChatServer
  • BarometricPressureWebServer
  • ChatServer
  • DhcpAddressPrinter
  • DhcpChatServer
  • LinkStatus
  • TelnetClient
  • UdpNtpClient
  • UDPSendReceiveString
  • WebClient
  • WebClientRepeating
  • WebServer

Use the WS2812B on the board

We already add the library to the examples.

Open Arduino IDE, File > Examples > Adafruit DMA neopixel library > strandtest.

Use the USR button on the board

const int pinBtn = 11;
const int pinLed = 13;

void setup()
{
    pinMode(pinBtn, INPUT_PULLUP);
    pinMode(pinLed, OUTPUT);
}

void loop()
{
    int ledst = 1-digitalRead(pinBtn);
    digitalWrite(pinLed, ledst);
    delay(100);
}

COMMENTS

Please Login to comment
  Subscribe  
Notify of
POSTED BY
TAGS