Page 1 of 1

ESP8266 Locomotive Control with onboard RFID reader

Posted: 06.09.2016, 19:51
by Dagnall
This is a follow on from my ESP8266 for remote sensors and points. http://forum.rocrail.net/viewtopic.php? ... 11#p121852.
I have now got the "mobile" version of the code working.
https://github.com/dagnall53/WiFiMobile
Key features are:
  • The code acts as a single slot "Command Station".
    It responds with a Slot number equating to the Locomotive address, which is set in CV[1]
    CV's can be set and read using the RocRail programmer.
    CV's 5 and 2 set the upper and lower limts of the Servo for forwards speed.
    CV's 9 and 6 set the upper and lower limits of the Servo for backwards speed
    CV[29} bit 0 controls direction normal or reversed.
    Acceleration is controlled by CV[3]
    Lights on NodeMCU ports D0 and D3 are "forward and "backwards" lights, switched on by f0. (connect LED to 3.3V!!. )
    D8 is a servo output that controls the locomotive motor.
    I use the servo motor BECC interface as a 5V source powered by the LIPO used to power the motors.
    MFRC522 reader uses D1,D2 D5,D6 D7
I previously had issues with missing UDP messages, but switching off the RFID reads when the loco is stationary seems to have fixed this, so I am now "publishing" the code.

The RFID reader speed is the main issue I would like to improve. It takes 21ms to do a read, largely independent of the SPI clock speed. hopefully some collaborators will take up the challenge of finding where the time is spent..

Re: ESP8266 Locomotive Control with onboard RFID reader

Posted: 12.11.2016, 11:44
by gramels
wow! :-)

Didnt play with my quick deplayment rocrail project for a while ( http://forum.rocrail.net/viewtopic.php? ... 9&start=30 ) . This seem to bring me closer :)

I I do consider to use it to control the LEGO train to play with may kids. Cabeling as described here: http://www.internetoflego.com/lego-trai ... u-esp8266/

Now I just need to figure how to modd your code to talk to the lego motor instead of a servo interface. Any hints where to look?

Re: ESP8266 Locomotive Control with onboard RFID reader

Posted: 08.12.2016, 19:38
by Dagnall
I would suggest changing to the MQTT version.. https://github.com/dagnall53/ESPWIFIROCNET
There is a separate forum thread about this..