mongoose/examples/pico-sdk/pico-rndis-device
2024-11-08 14:34:33 -03:00
..
netif Move ARCH_RP2040 --> ARCH_PICOSDK 2024-11-08 14:34:33 -03:00
CMakeLists.txt Move ARCH_RP2040 --> ARCH_PICOSDK 2024-11-08 14:34:33 -03:00
hal.h Move ARCH_RP2040 --> ARCH_PICOSDK 2024-11-08 14:34:33 -03:00
main.c Move ARCH_RP2040 --> ARCH_PICOSDK 2024-11-08 14:34:33 -03:00
Makefile Move ARCH_RP2040 --> ARCH_PICOSDK 2024-11-08 14:34:33 -03:00
mongoose_config.h Move ARCH_RP2040 --> ARCH_PICOSDK 2024-11-08 14:34:33 -03:00
mongoose.c Move ARCH_RP2040 --> ARCH_PICOSDK 2024-11-08 14:34:33 -03:00
mongoose.h Move ARCH_RP2040 --> ARCH_PICOSDK 2024-11-08 14:34:33 -03:00
net.c Move ARCH_RP2040 --> ARCH_PICOSDK 2024-11-08 14:34:33 -03:00
net.h Move ARCH_RP2040 --> ARCH_PICOSDK 2024-11-08 14:34:33 -03:00
README.md Move ARCH_RP2040 --> ARCH_PICOSDK 2024-11-08 14:34:33 -03:00
tusb_config.h Move ARCH_RP2040 --> ARCH_PICOSDK 2024-11-08 14:34:33 -03:00
usb_descriptors.c Move ARCH_RP2040 --> ARCH_PICOSDK 2024-11-08 14:34:33 -03:00

Remote MQTT Device on an RP2040

Your headless Raspberry Pi Pico-based hardware can also be a remote gadget when you connect it to your computer via USB

For the USB specifics, see this related tutorial at https://mongoose.ws/tutorials/rp2040/pico-rndis-dashboard/

See this tutorial to control your device: https://mongoose.ws/tutorials/mqtt-dashboard/

For this to work, you need your computer to act as a router (gateway) and NAT for your device.

Linux setup

Enable "masquerading"; the quick and simple options are:

sudo iptables --flush
sudo iptables --table nat --flush
sudo iptables --delete-chain
sudo iptables --table nat --delete-chain

# Do masquerading
sudo iptables -t nat -A POSTROUTING -o yourifc -j MASQUERADE
# enable routing
sudo echo 1 > /proc/sys/net/ipv4/ip_forward

Where yourifc is the interface that is connected to your network

MacOS setup