It’s time to make your device autonomous.
Here is the program from the previous chapter. The program has a tethering-inet
node that depends on PC and works only in the debug mode. To make a stand-alone device, replace it with another node that provides the internet using some hardware module, shield, or the native microcontroller features.
For such purposes XOD has a few standard libraries:
xod-dev/esp8266-mcu
— if you run the program on ESP8266,xod-dev/esp8266
— if you run the program on the microcontroller without onboard WiFi module, but using an ESP8266 as an AT command modem,xod-dev/w5500
— if you have an ethernet shield based on W5500 chipset.Each of the libraries has a set of some low-level networking nodes. But for the current case, you only need the internet provider node.
Here are these nodes:
xod-dev/esp8266-mcu/connect
xod-dev/esp8266/connect
xod-dev/w5500/ethernet-shield
tethering-inet
node with a suitable one from the list above.PORT
value to servo
node.Note that you need to log in and generate a XOD Cloud API key for the project if you haven’t done it before (hit Edit → Project Preferences).
The servo rotates to the angle that corresponds to the latest “moisture” value. Now you can open the chapter 015-xod-cloud
again, run the simulation and control your gauge from XOD IDE over the cloud. Or you can make another device, which updates this value automatically.
In some cases, you might need to make an advanced configuration of the connected module or ethernet-shield. Check out examples in the library or read an article about ethernet-shield advanced configuration.