Skip to content

Commit bbe17bc

Browse files
authored
Merge pull request DCC-EX#231 from DCC-EX/230-api-reference-refinements
230 api reference refinements
2 parents 8d7864e + 37c14dc commit bbe17bc

File tree

2 files changed

+136
-78
lines changed

2 files changed

+136
-78
lines changed

docs/advanced-setup/wifi-config.rst

Lines changed: 37 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
WiFi Configuration
33
*******************
44

5-
.. image:: ../_static/images/conductor.png
6-
:alt: Conductor Icon
7-
:scale: 50%
8-
:align: left
5+
.. sidebar:: On this page
96

10-
Conductor Level (Tinkerer if wiring an ESP instead of using a shield)
7+
.. contents::
8+
:depth: 1
9+
:local:
1110

12-
|
11+
.. image:: ../_static/images/conductor-level.png
12+
:alt: Conductor Icon
13+
:scale: 50%
1314

1415
This page describes the software configuration options for using WiFi to connect your Command Station (CS) wirelessly to JMRI or a wireless throttle like Engine Driver. For information on how to connect your hardware, go to :doc:`WiFi Setup <../get-started/wifi-setup>`.
1516

@@ -26,6 +27,15 @@ For a video, click `Setting up WiFi <https://www.youtube.com/watch?v=N6TWR7fIl0A
2627

2728
<iframe width="336" height="189" src="https://www.youtube.com/embed/N6TWR7fIl0A" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
2829

30+
.. note::
31+
32+
.. image:: ../_static/images/tinkerer.png
33+
:alt: Tinkerer Icon
34+
:scale: 30%
35+
:align: left
36+
37+
If using a separate ESP instead of a shield, this becomes tinkerer level.
38+
2939
Wireless Connections
3040
=====================
3141

@@ -68,7 +78,7 @@ Access Point Mode vs. Station Mode
6878
There are two ways to configure the WiFi board connected to DCC++ EX: "Access Point Mode" (aka "AP MODE"), and "Station Mode". We often abbreviate the latter to "STA". You will also see people refer to it as "Client Mode".
6979

7080
AP Mode
71-
--------
81+
________
7282

7383
In AP mode, the tiny ESP-WiFi chip acts as a very basic WiFi server and provides a small IP network for your throttle or for your computer running JMRI and WiThrottle. It acts much like your router does to let things connect directly to it (currently up to four connections). Using the CS in AP mode allows you to have a separate network so you can keep your layout network separate from your home network. This is the simplest way to enable a connection for a WiFi throttle.
7484

@@ -85,7 +95,7 @@ If you travel to shows, or take your setup to a friend's house, this allows for
8595
Access Point Mode - Things connect to the WiFi Board
8696

8797
Station Mode
88-
-------------
98+
_____________
8999

90100
Station mode allows you to connect the Command Station to your existing home network. The CS becomes a Station or Client rather than an AP. That means instead of being a host that manages the IP of the smartphone that runs your Throttle, it becomes a station that connects to your existing network just like any of the other computers or devices connected to your network. The Throttle then connects to the CS by finding its IP address on the network. You will have to find what IP address is assigned to the CS (see below). Alternately, you can define a static IP address in your router to assign to the CS.
91101

@@ -141,7 +151,7 @@ You will also see your SSID and Password in the log.
141151
Once you see an AP IP Address and see ``++ Wifi Setup OK ++`` at the bottom of the log (it may take a few seconds for the CS to complete the configuration), you can connect to it!
142152

143153
Connecting to the Access Point
144-
----------------------------------
154+
_______________________________
145155

146156
There are two steps to get you running trains with your WiFi throttle.
147157

@@ -227,46 +237,48 @@ The following defines are all the possible network settings found the config.h f
227237
| :ref:`advanced-setup/wifi-config:#define MAC_ADDRESS { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xEF }`
228238
229239
#define IP_PORT 2560
230-
--------------------
240+
_____________________
241+
231242
**Default: 2560** - This is the port used to communicate with the WiFi board or Ethernet Shield. We use the default value of 2560 because that is the port JMRI uses. You can change this value if you would prefer it to be something else. You will need to enter this in software like Engine Driver in order to connect to the CS via networking.
232243

233244
#define ENABLE_WIFI true
234-
------------------------
245+
_________________________
235246
**Default: true** - WiFi is supported only on a Mega. If you do not wish to use WiFi, and want to save boot time by not having the Mega check for a WiFi board each time, you may set this to "false".
236247

237248
#define DONT_TOUCH_WIFI_CONF
238-
----------------------------
249+
_____________________________
239250
**Default: commented out** If uncommented, this tells the CS to NOT process any WiFi commands in the CS. If other WiFi defines are enabled, the CS will ignore them. With this command, you can leave #define ENABLE_WIFI true so that networking is active, but send no configuration commands to ESP8266. This allows you to enter your own AT commands to set up your WiFi however you want. To do this, you would enter <+> commands in the serial monitor, or add code to send these commands automatically.
240251

241252
#define WIFI_SSID "Your network name"
242-
--------------------------------------
253+
______________________________________
243254
**Default: "Your network name"** - To connect to your CS as an AP (Access Point), do not change this setting. If you wish to connect to your home network instead, enter the SSID (network name) for that network. If you do NOT set the WIFI_SSID, the WiFi chip will first try to connect to the previously configured network, and if that fails, fall back to Access Point mode. The SSID of the AP will be automatically set to DCCEX_xxxxxx, where xxxxxx is the last 6 digits of the MAC address for the WiFi chip.
244255
Your SSID may not contain ``"`` (double quote, ASCII 0x22).
245256

246257
#define WIFI_PASSWORD "Your network passwd"
247-
--------------------------------------------
258+
____________________________________________
248259
**Default: "Your network passwd"** - WIFI_PASSWORD is the network password for your home network, or if you want to change the password from default AP mode password to the AP password you want. Your password may not contain ``"`` (double quote, ASCII 0x22).
249260
If you don't change this setting and start up in AP mode instead, the default password is PASS_xxxxxx where xxxxxx is the last 6 digits of the MAX address for your ESP board.
250261

251-
252262
#define WIFI_HOSTNAME "dccex"
253-
-----------------------------
263+
______________________________
254264
**Default: "dccex"** You would normally not want to change this, as it is the host name that will appear in the list of available networks displayed for devices connecting to DCC-EX. It helps you know which WiFi device is your Command Station.
255265

256266
#define WIFI_CONNECT_TIMEOUT 14000
257-
-----------------------------------
267+
___________________________________
258268
**Default: 14000 milliseconds (14 seconds)** - You only need to set this if you have an extremely slow WiFi router, and the response to the connection request takes longer than normal.
259269

260270
#define ENABLE_ETHERNET true
261-
-----------------------------
271+
_____________________________
262272
**Default: commented out** - Uncomment this line if you wish to use an Ethernet Shield & cable (not WiFi, see above for that). You will also need to install the Arduino Ethernet Library on whichever IDE you use to compile and upload your sketch.
263273

264274
#define IP_ADDRESS { 192, 168, 1, 200 }
265-
----------------------------------------
275+
________________________________________
266276
**Default: commented out** - Uncomment this line if you wish to use a static IP address, otherwise the CS will use DHCP to automatically assign an IP address from your router. If you use a static IP, you will also have to configure this IP in your router.
267277

278+
**Note** - this is only valid when using Ethernet, and does not apply to WiFi.
279+
268280
#define MAC_ADDRESS { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xEF }
269-
------------------------------------------------------------
281+
____________________________________________________________
270282
**Default: commented out** - This is for Ethernet only! Ethernet shields do not normally come with a defined MAC address. We give you two, and you can uncomment the one you prefer. You can also choose any other validly formatted MAC address that will not conflict with any devices already on your network.
271283

272284

@@ -276,14 +288,14 @@ Resetting Network Settings
276288
Once you enter a network SSID and password, the CS will always try to connect to it, even after removing the power and restarting. If you want to connect in AP mode, or your network credentials change, or you need to connect to a different network, you simply need to tell your WiFi board to clear the settings.
277289

278290
Clearing the ESP-WiFi SSID Settings
279-
------------------------------------
291+
____________________________________
280292

281293
Open your serial monitor and wait until the CS has gone through the startup sequence. Then in the command textbox enter ``<+RESTORE>`` and press "SEND".
282294

283295
You will then see an "Ok" message. The WiFi Settings are forgotten. However, if the last config.h used when you uploaded it to the CS had WiFi credentials in it, then as soon as your CS restarts, it will load and save those settings again. So...
284296

285297
If you want to run in AP mode
286-
------------------------------
298+
______________________________
287299

288300
Edit the config.h, change your SSID and password lines back to default. It MUST look like the following. If it is anything else it will try to login with whatever you type there as credentials!
289301

@@ -295,7 +307,7 @@ Edit the config.h, change your SSID and password lines back to default. It MUST
295307
Then upload the project into the CS.
296308

297309
If you want to change your network login
298-
------------------------------------------
310+
_________________________________________
299311

300312
Edit the config.h file, change your SSID and password to your new credentials, and then upload the project into the CS.
301313

@@ -327,13 +339,13 @@ There are circumstances where you may want to make temporary changes to your net
327339
- Press "send" after each command.
328340

329341
Temporarily Log Into A Different Network
330-
-----------------------------------------
342+
_________________________________________
331343

332344
1. Forget your network settings by entering ``<+CWQAP>`` in the serial monitor.
333345
2. Login to the new network by entering either a new local SSID & password, or using the CS in AP Mode.
334346

335347
Create a Static IP for your CS in AP Mode
336-
------------------------------------------
348+
__________________________________________
337349

338350
You are still going to have to go into your router, find the MAC address for your WiFi board (or find it in the serial monitor log) and then assign a static IP address (sometimes called "reserved" IP address) to that MAC. That should be all you need, as the DHCP server on your network will assign that IP to your CS when the CS asks for one.
339351

0 commit comments

Comments
 (0)