Generate NMRA DCC Wave Form Using ESP32

densha
Posts: 5
Joined: Sun Feb 11, 2018 6:54 am

Generate NMRA DCC Wave Form Using ESP32

Postby densha » Thu Feb 22, 2018 8:14 pm

Hi Forum

I am learning how to program on the ESP32. I would like to implement the NMRA DCC Protocol https://en.wikipedia.org/wiki/Digital_Command_Control using the ESP32. Basically the DCC protocol can be used to control the model train speed and direction by varying the period of the voltage is applied to the railway track. This voltage is a variations is used to encode a data signal that is decoded by a decoder in the model train. To represent a binary one a nominally 58 µs half cycle, while a zero is represented by a nominally at least 100 µs half cycle.

I have used PWM signal to control power to motors previously, however the NRMA signalis very different.

Could someone suggest approaches I should review to implement a NRMA signal generator on ESP32/

Thanks

Densha

ESP_Sprite
Posts: 8921
Joined: Thu Nov 26, 2015 4:08 am

Re: Generate NMRA DCC Wave Form Using ESP32

Postby ESP_Sprite » Sat Feb 24, 2018 3:39 am

I would use the RMT peripheral; it is very well-suited to generating these types of signals.

densha
Posts: 5
Joined: Sun Feb 11, 2018 6:54 am

Re: Generate NMRA DCC Wave Form Using ESP32

Postby densha » Sat Feb 24, 2018 8:41 am

Thanks - I'll have a look at RMT. I have not come across that yet.

Could you suggest any examples generating a PWM or motor control signal I can learn from?

Thanks

Densha

ESP_Sprite
Posts: 8921
Joined: Thu Nov 26, 2015 4:08 am

Re: Generate NMRA DCC Wave Form Using ESP32

Postby ESP_Sprite » Mon Feb 26, 2018 5:39 am

Not sure - if you haven't done it, please at least have a look in the examples directory of esp-idf, if any it shows you how you can use the peripheral drivers.

Who is online

Users browsing this forum: Bing [Bot], Majestic-12 [Bot] and 109 guests