In this tutorial we will show how to give your SBC a fixed IP and how to connect it to a PC.
This is an ideal setup for developing network applications for your SBC since it allows you to write code on your PC and test it directly.
Since most PCs use WiFi to get Internet, we will also cover how to share your WiFi Internet connection with your SBC via Ethernet.
Note that if you connect your SBC to a router with Internet access, the process is straightforward.
- simpleRTK2B-SBC with Ethernet cable
- PC (with WiFi connected to Internet in case you want to share it with your SBC)
Step 1: check (or set) your PC network adapter configuration
- Open Network Connections via Run or Command Prompt. Press the Windows key and the R key at the same time to open the Run box. Type ncpa.cpl and hit Enter and you can access Network Connections immediately.
- Double click on the Ethernet icon, select Internet Protocol Version 4 (TCP/IPv4) and click Properties
- You need to set your adapter fixed IP address and subnet mask. You can write any value, but for this tutorial we will use the values on the image below. Leave the rest of the fields empty and click OK.
Step 2: power your SBC and connect it to your pc via USB and Ethernet
- After everything is connected, open your preferred IDE/code editor and paste this code:
- As you can see from the code, we are assigning the SBC the fixed IP 10.0.0.1.
If you run the code on step 2.1, you can verify that it works by opening a command window on your PC (press the Windows key and the R key at the same time, type cmd.exe and hit Enter) by doing a ping at the SBC IP address.
- If the ping succeeds, congratulations, your SBC has now a fixed IP that can be recognized by your PC.
Step 3: share Internet from your PC with the SBC
- Open Network Connections (see step 1.1)
- Right click on your Wi-Fi adapter and select Properties, go to the Sharing tab and select Allow other network users to connect through this computer’s Internet connection, click OK
- After clicking OK, sometimes the Ethernet configuration is automatically changed by Windows.
Just to be sure, repeat all steps described in Step 1 to verify that your Ethernet adapter IPv4 configuration is ok, if Windows has changed it, please set it back as defined in step 1.3
- You should now have Internet available on your SBC!
You can run the following code to verify:
- If everything is ok, you should see printed on your microPython terminal the GET response of Google’s website.