ESP8266 MQTT Client

Special solutions for outdoor model railroading.
Post Reply
casperdeboer
Posts: 35
Joined: 12.02.2017, 21:46

Re: ESP8266 MQTT Client

Post by casperdeboer » 20.11.2018, 06:51

Hi

Thanx is this also the same for the rocnet auto connect? because i would like to us this without an mqtt server.

Casper

Dagnall
Posts: 205
Joined: 15.05.2015, 14:41

Re: ESP8266 MQTT Client

Post by Dagnall » 20.11.2018, 20:13

Casper, I'm sorry but i do not know anything about "rocnet auto connect", i only wrote my code to work with mqtt.
Perhaps Rob might be able to help?

casperdeboer
Posts: 35
Joined: 12.02.2017, 21:46

Re: ESP8266 MQTT Client

Post by casperdeboer » 20.11.2018, 21:48

RocNetNodeAutoConnect i mean this one

casperdeboer
Posts: 35
Joined: 12.02.2017, 21:46

Re: ESP8266 MQTT Client

Post by casperdeboer » 20.11.2018, 21:53

Hi Dagnall

Thanx for your support, So know i have one esp that is all inputs , is it also possible that the other node is all output?. I am using the mqtt version, also made an test track with hall sensors as input and one servo. Whith the espwifirocnet master v4 i found that it resets after 30 second do you know how this is possilble.

Casper

Dagnall
Posts: 205
Joined: 15.05.2015, 14:41

Re: ESP8266 MQTT Client

Post by Dagnall » 21.11.2018, 18:34

Casper.
OK, so now I understand "Rocnetautoconnect".. it was an old version of my code stored in Github.. I have deleted it to save confusing others and myself! :oops:

My current code is https://github.com/dagnall53/ESPMQTTRocnetSound but I have just put a "static" test version
here: https://github.com/dagnall53/ESPWIFIRocnet

This SHOULD be the same as the rocnetsound code, but with the defaults set for a Static node.

Whilst I was writing this my node reset, so I have the same issue s you and will find out why..

More to come later hopefully... :coding:

casperdeboer
Posts: 35
Joined: 12.02.2017, 21:46

Re: ESP8266 MQTT Client

Post by casperdeboer » 21.11.2018, 18:36

Thnx going to try this version

Casper

Dagnall
Posts: 205
Joined: 15.05.2015, 14:41

Re: ESP8266 MQTT Client

Post by Dagnall » 21.11.2018, 20:30

I have just now uploaded an updated working version of the static node code to a new branch in
https://github.com/dagnall53/ESPMQTTRoc ... -Node-test
(and, because I do not really work well with github I also uploaded it here first https://github.com/dagnall53/ESPWIFIRocnet :oops: !!)
I could not remember the cause of the crash,but I had solved it (apparently) with my ESPMQTTRocnetSound code. BUT the version on the github did not compile nicely if you switched off the audio. (It now does...)

I need to check "universal code" in ESPMQTTRocnetSound is still working fully and that I have not added any problems into my "Loco" version with these changes, but when I do I will probably delete the ESPWIFIRocnet github

Please let me know if this works with your combinations of inputs and outputs. (it should, but you never know!)

thanks
Dagnall


casperdeboer
Posts: 35
Joined: 12.02.2017, 21:46

Re: ESP8266 MQTT Client

Post by casperdeboer » 22.11.2018, 16:58

Hy sensors work fine only it misses the servo commands somtimes.

Dagnall
Posts: 205
Joined: 15.05.2015, 14:41

Re: ESP8266 MQTT Client

Post by Dagnall » 22.11.2018, 17:16

Make sure you have the Rocrail Switch interface (for the servo) set to "single gate" .
You can adjust the servo transition speed by setting the number of steps (Left Steps) and (Right Steps) (per increment) and the increment delay (delay*10ms) in the Pi03 Channel Setup.
I find that having "1" Steps increment and "1" Delay*10ms works to give a nice servo movement speed.
Having "zero" steps and "zero" delay makes the code try to do the change instantaneously which works, but just might be a problem for slow servos.

Dagnall
Posts: 205
Joined: 15.05.2015, 14:41

Re: ESP8266 MQTT Client

Post by Dagnall » 29.11.2018, 17:00

casperdeboer wrote:
22.11.2018, 16:58
Hy sensors work fine only it misses the servo commands somtimes.
Casper, a thought occured to me. Are you using one node with LOTS (8) of servos?
I have only ever tested the software with up to three servos, as the static code is intended for a remote station, where i need sensors and servos running from a single piece of hardware. The code allows for any and all io to be set to servo, but each servo output needs to have an internal esp8266 timer used for the servo pulse width. The esp8266 complier hides the exact details, but it is possible that the hardware runs out of internal timers to assign to each drive, and this may do something to reuse them and give timing issues or something like that.

If you reduce the number of servos on your node, does the "misses the commands" issue go away.? If so i will add a note that the code can only support a maximum of xx servos..
Many thanks
Dagnall

casperdeboer
Posts: 35
Joined: 12.02.2017, 21:46

Re: ESP8266 MQTT Client

Post by casperdeboer » 29.11.2018, 17:25

Hi i only use one Servo but it doesn't miss commando's IT is a cheap Servo and sometimes IT bounces back.

Casper

Waiting for more nodemcu for bigger test track. Running more trainster at one.

Post Reply

Return to “Garden Railroads”