-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wiring wirocs #1
Comments
This code is superseded by the wio code in rocrail. |
Ahh. Sorry , that linked page has been deleted as the wirocs project is no longer active and the rocrai WIO is the replacement. |
can this code still be used with the current rocrail program sir? |
Sorry, I think it can but I have not tried. I presume you want to use the sound effects parts? |
yes sir, I want to try controller sound effects and sync with engine speed without using dcc on the model train. |
Im very sorry, it was a very long time ago that iwrote the code. |
I have this but it misses the pictures. I hope it is sufficient to assist. it says use d1 d2 d3 d4 to drive the tb 6612. For the motor. One small mobile sound decoder configuration is to use the WEMOS Mini with a RC servo dc motor controller and the Adafruit DAC. In this configuration, the Battery eliminator in the RC servo DC motor controller powers the WEMOS Mini and the DAC. The WiRocS can also be used to drive a PWM motor control directly, in which case the RC DC motor controller is replaced by a motor shield with the 293 chip or (much better!) a TB6612FNG Dual DC Stepper Motor Drive Controller Board Module. The TB6612 has MOS drivers so does not have the losses of the bipolar 293, and I found it runs cool driving my loco motors, where the 293 gets hot. BUT! NOTE that the WEMOS Mini input voltage is limited to 6.5V, so must not be connected directly to a 2S LIPO. A small 5V regulator must therefore be added for this purpose. - Also, to complicate matters, the NodeMCU motor shield has some additional and not well documented circuitry. This makes pins D3 and D4 "direction pins" and Pins D1 and D2 the PWM for the two Motor channels. This makes motor direction code for the Motor Shield very simple, but incompatible with use with other hardware. Because most users will use the "stationary" version of WiRocS I have defaulted the drives to use the "motor shiled" type driving. There are some directives in the code to select other drive options, but I would recommend contacting me if you plan to use the WiRocS to drive a loco using PWM mode. There is another advantage to the 6612, - you can use one set of drivers to replace the single transistor AudioNODAC drive. Connect RX to one of the PWM inputs, and the loudspeaker (via a 10uf electrolytic) to the output. I also connected a 100k resistor from 3V3 to the Standby pin, with 10uf from standby to Gnd. This provides a very short delay before the drivers are turned on. Without this, the wheels do a powerful spin on turn on that can be disconcerting or damaging. The illustration shows a 6612 board with the PWM Channel A driving to the motor, and one half of Channel B to drive the loudspeaker via the electrolytic, (but note that the standby pin did not yet have the Resistor-Capacitor delay added at the time of the photo). |
And this about sound. The simplest is to use the definition _AudioNODAC. This is the Default and all the available binary files have been compiled with this option. This creates a Class D amplifier output stage that uses "I2SDAC_DIN" {D9/RX (esp8266) or 22 on ESP32}, to drive a transistor base that then drives the loudspeaker. I2SDAC_DIN drives the transistor base. I recommend placing resistor {1k to 10k} between I2SDAC_DIN and the NPN transistor base. The resistor in the transistor base ensures that the serial programming is still possible!. THe speaker will make squeaks whilst being programmed, but I find this useful to show something is happening. The transistor collector is connected to the loudspeaker and the emitter to ground. The Loudspeaker is connected to the collector and V+. An electrolytic across V+ to Gnd is recommended to support the high pulse currents. The "NODAC" output system uses oversampling, so to try and prevent timing issues, I limited my sound samples to 11K sample rate, rather than the 44k possible. I have not done tests to find the limits, but I find the sounds very acceptable. There is a "high quality" option that uses the _AudioDAC definition set, which uses the AdaFruit MAX98357 which provides high quality stereo sound and on-board amplifier. I2SDAC_DIN 9 D9(/rx) Data |
And lastly, this page may give more help to understand what i did. Back to WiRocs Description Full printable documentation for the original ESPMQTTWIFOROCNET code setup, with illustrations is in Node Setup.pdf This should remain largely valid for the updated 'WiRocS' code. This includes full details on: Programming the NodeMCU/ESP8266 Selecting Pins as Inputs or Outputs If Pi02 Is set as "INPUT" then the pin is an input (and automatically has the weak pull-up switched on) In PWM and Servo modes, the Pio3 Delay*10ms and Left and Right Steps will determine how fast the servo moves to the new position. Set Delay = 0 and steps to 0 for the fastest movement. See this guide for how to use RocView to set up a WiRocS node "FIXED" Functionality If you are using the code as a mobile decoder, then some pins will have "fixed" functionality. In this case, changing their functions or characteristics using the rocrail tabs will have no effect. You can confirm that their functionality is fixed by observing the Arduino serial terminal as the device initialises. As the device initialises, it checks its port definitions and sends a summary that looks like this: From it you can see if I/O is "fixed", and why.
(As a very simplistic overview, NodePortType Determines if the port is Input or Output, Pi03_Setting_options determines if the output will be digital, PWM or a servo drive.) See also this guide for how to use RocView to set up a WiRocS node and ESP32 Setup Mobile Decoder When set as a Loco, the code expects LEDS connected to 3v3 and the Back or Frontlight pins (D2 and D5). Currently the "fixed" nodes cannot have their phase altered using the Rocrail Rocnet Programming PI02 tab. CV settings Clicking on “Programming” will open the Rocrail CV Programming interface. To make this work, you need to select “POM” and the loco to be programmed in the top left box, and Rocrail will interrogate the set loco address and get the main CV settings: Changing the Loco address can be done with this interface, but care needs to be taken to ensure the programming interface loco address and the loco address stay in synch. To change from a Short Loco address to a Long loco address, First set the Loco "long" address to the Current Short address. Then change the Loco so it reads the Long address, and then change the Loco address to the desired Long address. Sound System Click here for more details on the Sound System Speed settings: WiRocS tries to be NMRA compliant.
Set CV 66 and CV 95 if needed to trim for equal speed forward and reverse. Set the kick start CV65 to a value so that the motor reliably starts without a visible kick. If it kicks noticeably then lower the value. If it does not start, increase the value. Set the loco to desired speed and adjust CV5 and CV6 so the loco travels at the speed you want. |
OK sir, I will try your instructions. |
Can you share this wiring for your this project, Sir?
The text was updated successfully, but these errors were encountered: