From WiFi to Cellular 3/4G on ESP32 - esp32

I am building a project utilizing Wifi on the ESP32 module. Using RTOS, I am running a web server on 1 core and a web client on another core. This works very well and I can access the web server remotely via my browser and the WiFi provided IP address. The Web client reads some sensors and sends the data via WiFi to my database. All good and everything works as desired.
Now I need to do the next step and move beyond the reach of the WiFi and reproduce the same result via 3/4G cellular. I looked at the "easy" solution to use an industrial 3/4G WiFi router and simply keep what I have. Cost of these "industrial" type routers are on the high side, where as 3/4G module which also include a GPS chip are around half or less. Problem is that I cannot get my head around how I will "replace" my current WiFi functionality with one of these modules. The modules seems to expect you to connect via serial (rs232) and using modem AT commands establish a connection to the internet. Question is, after connecting to the internet, how do you continue to have "network functionality" same as with the built-in WiFi? Is there some library that will do ethernet over the serial port? Can I still have the WiFi and the "serial ethernet" running at the same time or switch between the two?
Thanks!

Related

Route websocket data through USB link to PC client (Android)

I have an issue where WiFi is not available on an Android device. We want to stream image data from the device using a websocket server (written using WebSocket++) through to the PC. However, I'm not sure if this is possible without operational WiFi. So, the position we are in is that we may only have the USB link available.
Someone today suggested we might be able to get Websockets working using adb port forwarding (see https://developer.android.com/studio/command-line/adb#forwardports), but I'm not sure if that's correct. Could this work, and what would that solution look like?
Are there any other reasonable options. I'm not certain if tethering is available on the device and if that could be another solution?

Developing a Mac OSX Network Driver for a Serial Port AT Command Based Modem

First allow me to say that I don't have any experience developing drivers for OSX, nor drivers for Windows. So, there are a lot of things that I don't understand about how drivers work; I'm sure it'll be evident in my question.
I have a modem that is able to open and close TCP/UDP sockets using AT commands. I would like to create some kind of program (kernel extension? driver?) that implements a network driver, converting the network interface calls into AT command serial messages.
That's the basic jist of it. I'm essentially asking if anybody can point me in the right direction / give me a high level overview of how they would approach it and what Apple guides to focus on.
The XNU networking stack -- like most network stacks -- expects network devices to send and receive IP packets directly. It isn't tooled to work with network devices that handle part of the network stack (like TCP or UDP) internally -- it won't be possible to implement a network driver which uses this device.
You might have more luck exposing this device as a SOCKS proxy. You will need to write a userspace daemon which listens on a TCP port on localhost (on the computer) and relays traffic to the serial device; once that's done, you can set the computer to use that device as a SOCKS proxy in the Networking control panel.
(As an aside: most devices that implement this type of interface have a very low limit on the number of open sockets -- often fewer than 10. They're unlikely to be able to handle the network load generated by a desktop OS.)

Is it possible to target a specific Arduino device with the CC3000 Wifi over the web?

I've got my CC3000 Wifi shield and Arduino Uno working as intended using the several libraries, including the aRest.h library. In order for me to control the Arduino from anywhere across the web, I configured the port-forwarding settings on the router to address the Arduino via the routers ip address.
My question is this: If I had a multiple Arduino modules/devices that relied on two way communication (client/server), how is the setup configuration automated for each device so that I could target a specific Arduino with regional data? I don't expect the end user to know how to access the router and configure port forwarding.
I hope this makes sense, I'm a newbie to the world of micro-controllers, but have had some success with progress as of late
You should be able to make a simple way to setup the Wifi, when this job is done you connect via socket so a socket server ( python,node,etc... ) and this will avoid any port-forwarding.
You will not need to care about all this messy tasks, you can have as many as you want arduino in the same network and access from the internet.

A confusion about chromecast discover

When I click google cast icon in my chrome browser, it will try to discover whether there is an available chromecast around my pc.
If yes, then it will recognize it (assume that chromecast has already been set and connect to the same router which my pc is connected to).
My first confusion is, during this course, does my pc ever connect to chromecast's own wifi signal? Or they ONLY talk via my router?
My second confusion comes from a test:
I set 2 routers: router_A on top;router_B connects to LAN port of router_A;
My pc also connects to router_A;
chromecast dongle connects to router_B;
multicast/upnp of router B is enabled, firewall on router_B is disabled.
My pc cannot find chromecast in this situation. I'm confused and I think it should work since router_B obtains ip/gateway from router_A.
The third confusion is when I swapped my pc and chromcast, to let my pc connect to router_B, and chromecast connect to router_A, my pc found the chormcast......
After Chormecast is set up with a wifi network, it is discovered through mDNS. For (2) and (3), since discovery is done through multicast/mDNS, you need to read on that topic and look at the configuration settings of your routers to see how you can set things up to get what you want.

Wifi and LAN at same time

As the question states, I have two ethernet devices I need to use. A wifi hotspot for general traffic as well as a LAN connection for local traffic (192.168.1.*). Right now the wifi receives all traffic and disregards the existence of my local LAN devices. I am trying to communicate with this device using python's urllib2 and basic http fetches. The program works partially when I turn one or the other off (turning wifi off makes the LAN code work, and turning LAN off makes wifi/general traffic code work). I believe this is more of an operating system issue than a programming question, but I might be mistaken. I have been messing with the Ethernet setting in system preferences, but nothing has been working so far.
Thanks for the help.
Depending on your needs and degrees of freedom, you can:
1) Easiest: If you can control one or both network ranges, you can put wifi and LAN on different subnets. For example, 192.168.2.* could be LAN traffic, and 192.168.1.* could be wifi. If only the WiFi side has a gateway, then all traffic except 2.* traffic should route through WiFi, and all 1.* traffic goes to the LAN. No change to your computer.
2) Medium: if you don't control the networks, you can define routing rules for the two ports. This lets you say certain IP addresses should be reached thru wifi, vs others thru LAN port. An example in Linux, which I think should work on OS X too: http://linux-ip.net/html/routing-tables.html The trickiest thing is to make sure you won't get in the way when you're in someone else's network. You can do this by creating narrow routing rules, or turning them off when you don't need them. It sounds like you're doing this from a python program, so maybe the program could turn this on and off at start and finish.
3) Slightly more exotic: I wasn't totally sure from your question, but if you're trying to do load balancing (not separate networks), you could create rules to bond together two network ports and spread traffic across them. This isn't something I've done, but real network engineers know how to set this stuff up.
I could expand on one of these if you clarify what you're trying to do and what degrees of freedom you have.
For somebody don't want to do the study you can simply repeat my steps:
Open system preferences
click on Network
(ensure the precedence, first thunderbolt then wifi) click on thunderbolt
Configure IPv4 choose manually
delete router
done!
I have exactly the same user case. But I read this without any network knowledge.
I achieved this by simply following #Nils' 1) instructions. I only understand theses instructions after reading this link

Resources