User Tools

Site Tools


users:dagnall53:troubleshooting

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
users:dagnall53:troubleshooting [2019/02/14 12:45]
dagnall53 [Check that the Node is actually connected]
users:dagnall53:troubleshooting [2019/02/17 12:26] (current)
dagnall53 [Arduino Compile errors]
Line 1: Line 1:
 Index  ​ Index  ​
   * [[:​users:​Dagnall53:​Description|WiRocs Description]] ​   * [[:​users:​Dagnall53:​Description|WiRocs Description]] ​
-  * [[https://​github.com/​dagnall53/​ESPMQTTRocnetSound|ESP8266 Code]]+  * [[https://​github.com/​dagnall53/​WiRocS|ESP8266 Code]]
   * [[:​users:​Dagnall53:​Node_Setup|Node_Setup]] ​   * [[:​users:​Dagnall53:​Node_Setup|Node_Setup]] ​
   * [[:​users:​Dagnall53:​Hardware|Hardware]] ​   * [[:​users:​Dagnall53:​Hardware|Hardware]] ​
Line 10: Line 10:
 ====== Check that the Node is actually connected ====== ====== Check that the Node is actually connected ======
  
-If you have Rocrail setup, and one of my WiRocS nodes working, then when you select {rocrail}Programming/​Rocnet/​Setup ​ and press "​Query",​ you should see the esp ID and some data for the working ​ESP rocnet ​node...+If you have Rocrail setup, and one of my WiRocS nodes working, then when you select {rocrail}Programming/​Rocnet/​Setup ​ and press "​Query",​ you should see the esp ID and some data for the working ​WiRocS ​node...
 (getting this far sometimes takes a few restarts of Rocrail if you are changing things like the MQTT IP addresses...) (getting this far sometimes takes a few restarts of Rocrail if you are changing things like the MQTT IP addresses...)
  
-''​ID  Location Vendor ​                    Class Revision i/o Sub IP   UID name''​ +    ​ID  Location Vendor ​                    Class Revision i/o Sub IP   UID name 
- +    28  0  Public Domain and DIY Decoders ​  ​Al ​    ​13 ​      ​8 ​   0.22     ​WoodSt
- +
-''​28  0  Public Domain and DIY Decoders ​  ​Al ​    ​13 ​      ​8 ​   0.22     ​WoodSt''​+
  
    
-Here the ESP is at real IP address xxx.xxx.xxx.22 but has a Rocrail ID of 28, and a UID name of "Wood St". This module is using revision 13 of my code. +Here the Node is at real IP address xxx.xxx.0.22 but has a Rocrail ID of 28, and a UID name of "Wood St". This module is using revision 13 of my code. 
  
-IF this is not working it may be that your ESP is not connected properly to your wifi. Please start it using the arduino interface and it should help you identify the problem using the arduino terminal. ​+IF this is not working it may be that your node is not connected properly to your wifi. Please start it using the arduino interface and it should help you identify the problem using the arduino terminal. ​
  
 ====== Check that the ports on the node are set correctly ====== ====== Check that the ports on the node are set correctly ======
Line 30: Line 28:
  
 Set Type to "​Input",​ and then, because of the hall effect switch pulling "​down"​ on detecting the magnet, I set "​Invert"​ ON.  Set Type to "​Input",​ and then, because of the hall effect switch pulling "​down"​ on detecting the magnet, I set "​Invert"​ ON. 
-I do not set Toggle. { I do not think my ES code even recognizes toggle, but I could be wrong+I do not set Toggle. { I do not think my code even recognizes toggle, but I could add it later
  
-{**IMPORTANT NOTE** The PORT 4   Pi03 "​channel"​ PORT settings should be ignored because this Port is an "​Input"​ as set by the Pi02 Settings **__BUT I think that at the moment__** ​ the Pi03 “Channel” Setup options to make a pin a PWM Output or SERVO Output (“Blink” or “Servo”) actually take priority over the Pi02 “Port” Type/​direction settings (“Input” /​“Output”) and make the port an Output. (This may change in later updates).)+{**IMPORTANT NOTE** The Pi03 “Channel” Setup options to make a pin a PWM Output or SERVO Output (“Blink” or “Servo”) actually take priority over the Pi02 “Port” Type/​direction settings (“Input” /​“Output”) and make the port an Output.)
  
-Test this with a magnet and you should see the sensor icon (with the interface set to address 28,Address 4,type sensor) ​ on Rocrail go RED when you place a magnet near the sensor, and the blue light on the NodeMcu ​module should change to blue.+Having set up a port as an input, test this with a magnet and you should see the sensor icon (with the interface set to address 28,Address 4,type sensor) ​ on Rocrail go RED when you place a magnet near the sensor, and the blue light on the WiRocS ​module should change to blue. (Because Port 4 on the NodeMCU is connected to the Blue LED. But this LED may not be present, or connected to another pin on other boards).
  
 In the rocrail controller viewport, rocrail should report something like this:  In the rocrail controller viewport, rocrail should report something like this: 
  
-''​10:58:19 sensor report 28:4 off code= load=0''​+    ​10:58:19 sensor report 28:4 off code= load=0 
 +    10:58:18 sensor report 28:4 on code= load=0
  
- +The code does include a degree of debounce logic, but its best to try it to explore how it works with your sensors.
-''​10:​58:​18 sensor report 28:4 on code= load=0''​+
  
 ====== Use the DEBUG MQTT messages ====== ====== Use the DEBUG MQTT messages ======
Line 49: Line 47:
 (assuming your mosquitto is at 192.168.0.11 ​ !!)  (assuming your mosquitto is at 192.168.0.11 ​ !!) 
 and you should see something like this... ​ and you should see something like this... ​
-C:\Users\Richard>​cd C:\mosquitto+{{:users:dagnall53:​debug.jpg?​400 |}}
  
-C:​\mosquitto>​mosquitto_sub ​-h 192.168.0.11 -i "CMD_Prompt" ​-t debug -q 0 +For this example, I started the Debug Monitor and then re-started two nodesThey login to the "SHED" ​SSID, and find the MQTT Broker, and send a debug message.\\ 
- +Every time they get the RocNet ​Time synchronization message, they send a simple ​debug messageallowing confirmation that they are connected.\\ 
- +This is a very useful way of checking all your Esp devices are actually connected. For this reason I usually run the debug all the time in the background so I can check if something has lost connection. ​In comparison to the old code, at V3 I added a signal strength monitor, showing how strong(or weak) the WiFi signal isIn this example its exceptionally low, at below -90 dB. The two nodes were in my study, yet managed to connect to the SHED, which is in the garden, about 30m away.  ​
-<​11:​04:​20s> ​ Node:28 (Wood St) Msg: IPaddr ​.22  Time Synchronised. Power is OFF +
- +
- +
-<​11:​04:​70s> ​ Node:28 (Wood St) Msg:*Sensor Seen&​Sent ​ Address:4 state:1 +
- +
- +
-<​11:​04:​70s> ​ Node:28 (Wood St) Msg:*Sensor Confirmed Address:4 state:1 +
- +
- +
-<​11:​06:​20s> ​ Node:28 (Wood St) Msg: IPaddr .22  Time Synchronised. Power is OFF +
- +
- +
-Note that the Time Synchronisation is sent to the debug portso this is a very useful way of checking all your Esp devices are actually connected. For this reason I usually run the debug all the time in the background so I can check if something has lost connection..+
  
 ====== Set the sensors so they work with momentary inputs from the hall sensors ====== ====== Set the sensors so they work with momentary inputs from the hall sensors ======
Line 84: Line 69:
 ====== Make sure you have Input/​Output settings correct ====== ====== Make sure you have Input/​Output settings correct ======
  
-Note that the Pi03 "​Channel"​ Setup options to make a pin a PWM Output or SERVO Output ("​Blink"​ or "​Servo"​) take priority over the Pi02 "​Port"​ Type/​direction settings ("​Input"​ /"​Output"​).+As noted earlier, ​the Pi03 "​Channel"​ Setup options to make a pin a PWM Output or SERVO Output ("​Blink"​ or "​Servo"​) take priority over the Pi02 "​Port"​ Type/​direction settings ("​Input"​ /"​Output"​).
  
 So, If you have any of the "​Channel"​ pins set to Blink or Servo, then the Pi02 Port Type/​direction will always be set(forced) to "​Output"​. ​ So, If you have any of the "​Channel"​ pins set to Blink or Servo, then the Pi02 Port Type/​direction will always be set(forced) to "​Output"​. ​
-(Note: But it will report "​Output"​ when you "​get"​ the settings, to show that it is an Output)+(Note: But it will report "​Output"​ when you "​get"​ the settings, to show that it is an Output).\\
  
  
-====== Make sure the servo settings are correct ​for the points ​======+====== Make sure the Rocrail ​settings are correct ======
  
-For the Switch for the points ​its very similar except that the settings for a port (example here is PORT 7) to be a servo output are as follows:  +Setting ​the Switch ​Interface ​for the points ​is very similar ​to setting the inputs, ​except that the settings for a port (example here is PORT 7) to be a servo output are as follows:\\ 
-Pi02 Port setup for PORT 7 set to OUTPUT +  ​* ​Pi02 Port setup for PORT 7 set to OUTPUT 
-Pi03Channel Setup  for PORT 7:  Left and right set the servo positions. I would set left and right steps to "​1"​ to start withSet the "​Servo"​ tick box, but leave the Blink box unchecked. Set Delay*10ms to "​1"​.+  ​* ​Pi03Channel Setup  for PORT 7:  Left and right set the servo positions. ​ 
 +  * (I would set left and right steps to "​1"​ to start with
 +  * Set the "​Servo"​ tick box, but leave the Blink box unchecked. 
 +  * Set Delay*10ms to "​1"​.
  
-Providing you have placed a point/​switch on your layout, and set the propertiies: {General: Type: Switch} ​[Interface InterfaceD {whatever you called your MQTT controller} Bus : {28 in this example} Address {7 in this exmple for PORT 7 with a servo connected} {and Check Single Gate}. ​+Providing you have placed a point/​switch on your layout, and set the properties 
 +  * Unordered List Item{General: Type: Switch} ​ 
 +  * Interface InterfaceD {whatever you called your MQTT controller} ​ 
 +  * Bus : {28 in this example} ​ 
 +  * Address {7 in this exmple for PORT 7 with a servo connected} ​ 
 +  * And Checked ​{Single Gate}. ​
  
-With these settings ​rocrail ​should be able to change the switch/​point/​servo position. ​+With these settings ​Rocrail ​should be able to change the switch/​point/​servo position. ​
  
-The debug monitoor ​should show something like this+The debug monitor ​should show something like this
  
-<​11:​23:​24s> ​ Node:28 (Wood St) Msg:Setting Output 7 (SERVO) to State(1) = Position:​180 +    ​<​11:​23:​24s> ​ Node:28 (Wood St) Msg:Setting Output 7 (SERVO) to State(1) = Position:​180 
-<​11:​23:​26s> ​ Node:28 (Wood St) Msg:Setting Output 7 (SERVO) to State(0) = Position:4[/code]+    <​11:​23:​26s> ​ Node:28 (Wood St) Msg:Setting Output 7 (SERVO) to State(0) = Position:4
  
 I think if you can get all this working, you should be able to make what you want work, and experiment with the other settings, to get things like the PWM controls and blinking working for lights on the track... I think if you can get all this working, you should be able to make what you want work, and experiment with the other settings, to get things like the PWM controls and blinking working for lights on the track...
 +
 +===== Arduino Compile errors=====
 +I have seen arduino compile erors such as \\
 +    "​C:​\Users\dagna\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2/​bin/​xtensa-lx106-elf-ar:​ unable to rename ​
 +    '​C:​\Users\dagna\AppData\Local\Temp\arduino_build_445866/​arduino.ar';​ reason: File exists\\
 +
 +    Multiple libraries were found for "​Servo.h"​
 +    Used: C:​\Users\dagna\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.2\libraries\Servo
 +    Not used: C:​\Arduino\libraries\Servo
 +    Multiple libraries were found for "​SD.h"​
 +    Used: C:​\Users\dagna\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.2\libraries\SD
 +    Not used: C:​\Arduino\libraries\SD
 +    exit status 1
 +    Error compiling for board NodeMCU 1.0 (ESP-12E Module).
 +    Archiving built core (caching) in: 
 +    C:​\Users\dagna\AppData\Local\Temp\arduino_cache_939480\core\core_esp8266_esp8266_nodemcuv2_CpuFrequency_80,​
 +    VTable_flash,​FlashSize_4M3M,​LwIPVariant_v2mss536,​Debug_Disabled,​DebugLevel_None____,​FlashErase_none,​
 +    UploadSpeed_115200_3f447b7f4ff4321d67996d55e2879ce0.a"​..
 +
 +But usually (!) although it complains, the code eventually compiles and uploads\\
 +Usually it compiles fine the second time (!) around\\
 +Sometimes the com port gets "​stuck",​ and it needs a second try. 
 +
  
  
 good luck good luck
users/dagnall53/troubleshooting.1550144740.txt.gz · Last modified: 2019/02/14 12:45 by dagnall53