User Tools

Site Tools


users:dagnall53:hardware

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:hardware [2019/02/14 12:45]
dagnall53
users:dagnall53:hardware [2019/03/20 12:48] (current)
dagnall53 [Different NodeMCU Modules]
Line 1: Line 1:
- 
- ​\\ ​ 
-**ESP8266 Rocnet Nodes** ​ 
   * [[:​users:​Dagnall53:​Description|WiRocS Description]] ​   * [[:​users:​Dagnall53:​Description|WiRocS Description]] ​
-  * [[https://​github.com/​dagnall53/​ESPMQTTRocnetSound|ESP8266 Code]] + ​====== WiRocs HARDWARE ======
-  * [[:​users:​Dagnall53:​Node_Setup|Node_Setup]]  +
-  * [[:​users:​Dagnall53:​Hardware|Hardware]]  +
-  * [[:​users:​Dagnall53:​Troubleshooting|Troubleshooting]]  +
- \\ +
-** RocClient Experiments ** \\ +
-Rocrail Client experiments using the Wemos Oled Battery board. +
-  * [[:​users:​Dagnall53:​RocClientTool|RocClientTool]]  +
-  * [[:​users:​Dagnall53:​RocClientThrottle|RocClientThrottle]]  +
- +
----- +
-====== WiRocs HARDWARE ======+
  
  
-The [[https://​github.com/​dagnall53/​ESPMQTTRocnetSound|ESP8266 ​Code]] can be run on any ESP8266 ESP-12 modules.  +{{:​users:​dagnall53:​img_2087.jpg?​300 |}}The [[https://​github.com/​dagnall53/​WiRocS|Source ​Code]] can be run on any ESP8266 ESP-12 ​or ESP32 modules.  
-This includes the NodeMCU and WeMOS mini modules: +This includes the NodeMCU and WeMOS mini modules:\\
- +
-{{:​users:​dagnall53:​img_2087s.jpg?​600}} +
 The NodeMCU module is on the left, and is fitted in a "​NodeMCU Motor Shield"​ The NodeMCU module is on the left, and is fitted in a "​NodeMCU Motor Shield"​
 The Wemos Mini is a smaller equivalent to the NODEMCU, and is shown right, Note both have the same "​ESP8266 ESP-12 module on board. The Wemos Mini is a smaller equivalent to the NODEMCU, and is shown right, Note both have the same "​ESP8266 ESP-12 module on board.
-The smaller board by the WEMOS Mini is an ADAfruit MAX 98357 board that is one option for the audio output.+Also shown are some options for the Audio. ​The smaller board by the WEMOS Mini is an ADAfruit MAX 98357 board that is one option for "High Quality" ​audio.
 Below the NodeMCU is a 3D printed housing for the Hall effect switch that is used for sensing trains. Below the NodeMCU is a 3D printed housing for the Hall effect switch that is used for sensing trains.
 The 3d file for this is included in my thingyverse item: [[https://​www.thingiverse.com/​thing:​1867599|Sensor]] The 3d file for this is included in my thingyverse item: [[https://​www.thingiverse.com/​thing:​1867599|Sensor]]
  
-===== Stationary Decoder =====+ 
 +---- 
 + 
 +====== Stationary Decoder =====
 + 
 +{{:​users:​dagnall53:​img_2776.jpg?​400 |A WiRocS node using NodeMCU }}When used with an ESP8266 NodeMCU and NodeMCU Motor Shield, WiRocS is very easy to use: WiRocS provides 8 general purpose I/O on an ESP8266, the Illustrated example has Sound, An OLED display, a Servo, two PWM Leds and still has three general purpose I/O unconnected.\\  
 +On an ESP32, there are 16 General purpose I/O. 
 + 
 +Deciding what functionality each General Purpose I/O has is set up in RocView using the PI02 and PIO3 programming interfaces. 
 + 
 +There is an inbuilt memory drive ("​SPIFFS"​) that holds up "​Wav"​ sound files. These are primarily for the Loco version of the code, but can also be accessed by the Stationary Node. For example, a WiRocS node can say "​Please Stand Clear of the Platform"​ (this is switched by a standard Rocrail Switch interface, "​Bus"​ set to the WIRocS Node number, and Address "​109"​). Sound Files can be uploaded using a standard FTP protocol. 
 + 
 +WiRocS can also interface with inexpensive OLEDs to display messages, and the illustration shows a typical timetable example. ​   
 + 
 +---- 
 + 
 +====== Using a ESP8266 NodeMCU Motor Shield ====== 
 + 
 The NodeMCU Motor Shield is very useful as the basis of a stationary decoder because it provides a Servo like three pin connection for each "​D"​ output. The NodeMCU Motor Shield is very useful as the basis of a stationary decoder because it provides a Servo like three pin connection for each "​D"​ output.
-This allows simple connection of hall effect switches or servos. However, the Central V+ rail of these pinouts is connected as standard to the NodeMCU 3.3V supply, which is not suitable for driving most servos.  +This allows simple connection of hall effect switches or servos.\\  
-To overcome this I would recommend ​connecting ​a 5V regulator with input to the V Motor input, and the regulated 5V out to the "​Vin"​ input.  +However, the Central ​"V+" ​rail of these pinouts is connected as standard to the NodeMCU 3.3V supply, which is not suitable for driving most servos.\\ 
-Then disconnect the 3.3v drive to the connection rail by cutting the single track on the rear of the board. You can then connect the 5V power (on Vin) to the (cut) 3v3 rail on the line oof pins by adding a link jumper to the "​Vin/​3v3"​ pins.+  
 +To overcome this I would recommend ​some modifications. 
 +  - Disconnect the NodeMCU 3v3 drive from Motor Shield. This can be done by cutting the track on the back of the board (see photo), OR by cutting the 3V3 pin on the NodeCU board situated between "​D4"​ and "​G"​. 
 +  - Then connect ​a 5V regulator with input to the V Motor input, and the regulated 5V out to the "​Vin"​ input. 
 +  - Lastly ​connect the 5V power (on Vin) to the (cut) Middle ​3v3 rail on the line of pins by adding a link jumper to the "​Vin/​3v3"​ pins. 
 + 
 +{{:​users:​dagnall53:​5v_mod.jpg?​400 |}}Note that all the Motor shields I have had only connected a single 3v3 from the NodeMCU to the shield, but you should check that your shields do not use the other two 3v3 outputs to avoid problems!  
 + 
  
-{{:​users:​dagnall53:​5v_mod.jpg?700}}+{{:​users:​dagnall53:​motorshield.jpg?400 |}}This shows the 3V3 trace cut (uncut on left, the knife points to the cut track on the right) ​
  
 The motor shield is designed to allow you to use the inbuilt "​293"​ motor driver IC to power high powered items like motors or lights. ​ The motor shield is designed to allow you to use the inbuilt "​293"​ motor driver IC to power high powered items like motors or lights. ​
  
-These are connected to the D1-D3 and D2-D4 pins, which will need to be set up as outputs on the ESP module (and as PWM if you like). +These are connected to the D1-D3 and D2-D4 pins, which will need to be set up as outputs on the ESP module (and as PWM if you like).\\ 
- +\\ 
 +\\
 However please note that the 293 on the shield is NOT connected as four independent half bridges, but as a "​direction"​ and PWM inputs. ​ The direction input includes an inverter to one of the half bridges. ​ However please note that the 293 on the shield is NOT connected as four independent half bridges, but as a "​direction"​ and PWM inputs. ​ The direction input includes an inverter to one of the half bridges. ​
  
-This means that the board can drive **only** two motors or two lights, and not four lights that would be possible if it did not include these inverters. ​+This means that the board can drive **only** two motors or two lights, and not four lights that would be possible if it did not include these inverters.
  
-===== Mobile Decoder and Sound =====+===== Different NodeMCU Modules ​===== 
 +Most NodeMCU modules are 26mm wide and fit the Motor Shield perfectly. However, the "​V3"​ version is 31mm wide, so it cannot fit directly into the two rows of pins on the shield. **But all is not lost**!. The Side with the "​important"​ "​D"​ pins has the same pinout as the other boards and so you can connect a V3 module in the shield using just this set of pins. Then connect a wire from the 5V rail to the V3's VV pin (on the side that did not fit in the Motor Shield'​s sockets) to power it. 
  
-There are two options to get sound. ​ 
  
-The first uses the AdaFruit MAX98357 which provides high quality sound and onboard amplifier+---- 
 +===== ESP32 Motor Shield ===== 
 +Unfortunately there is no standard ESP32 motor shield equivalent to the ESP8266 version. Different ESP32 boards seem to have different pin-outs, making it difficult to suggest a "​good"​ off the shelf solution. There appears to be an interesting possible ​ [[https://​www.pcbway.com/​project/​shareproject/​NodeMCU_ESP_32_MotorShield_FULL__IO_Extension_Board_.html|PCB here]] but I have not explored this option
  
-This board needs the _AudioDAC definition set, and then uses these connections :+---- 
 +====== WiRocS Sound ======
  
-  * I2SDAC_DIN 9    D9(/rx) Data   +There are two options to get sound. You can hear how it works on the Mobile variant here [[https://www.youtube.com/​watch?​v=Pg5r6MZDhww|Youtube:​ Loco running with sound]].  ​
-  * I2SDAC_LRC 4    D4 used as Left Right Control ​  +
-  * I2SDAC_CLK 8    D8 used by DAC as clock.+
  
-The alternative ​is to use the definition _AudioNODAC.+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 D9/RX to drive a transistor base that then drives the loudspeaker.  +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 ​ D9/rx (data) used to drive transistor base  +  * I2SDAC_DIN ​drives the transistor base. I recommend placing ​ resistor {1k to 10k}  between I2SDAC_DIN and the NPN transistor base.\\  
-  * I2SDAC_LRC ​4 D4 used as LRC or i2s clock (?)  +  * I2SDAC_LRC ​is '​LRC'​ This is set during Audio setup, but released for use as an input later. ​(?)
-In this configuration ​D4 is initially set as a clock output, but it can be resused ​once the DAC has been setup although my code currently does not do this. +  
-I recommend placing ​ 1k resistor between D9 and the NPN transistor base. This ensues that the serial programming is still possible.  +In this configuration ​I2SDAC_LRC ​is initially set as a clock output, but it can be re-used ​once the DAC has been setup.\\ 
-The transistor collector is connected to the loudspeaker and the emitter to ground. The Loudpseaker 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.+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.
  
-===== MOBILE DECODER -WEMOS MINI ===== 
-One mobile sound decoder configuration is to use the WEMOS mini with a RC servo dc motor controller and the Adafruit DAC. 
  
-{{:users:​dagnall53:​img_2072_1_.jpg?​600}} ​+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.\\  
 +If this option is used, the board needs these connections ​:
  
-In this configuration,​ the Battery eliminator in the RC servo DC motor controller powers the WEMOS Mini and the DAC. +  * I2SDAC_DIN 9    D9(/rx) Data   
 +  * I2SDAC_LRC 4    D4 used as Left Right Control ​  
 +  * I2SDAC_CLK 8    D8 used by DAC as clock.
  
-The Code 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+This mode is not compatible ​with the OLED display.
  
-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. ​ 
  
-(The NodeMCU module ​can take slightly higher unregulated voltages ​as it uses different 3.3v regulator)+====== MOBILE DECODER ​ ===== 
 +WiRocS ​can be used as a complete "​mobile"​ Loco controllerIt includes the ability to get RocNet protocol loco messages and will respond to speed, direction, lights and sounds commands
  
-If you use 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. ​+{{:​users:​dagnall53:​img_2072_1_.jpg?​200 |}}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.    
 + 
 +{{:​users:​dagnall53:​img_2121.jpg?​200 |}}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. 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).
  
-The illustration below 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). +There are examples ​of the (3D printedloco running on [[https://​www.youtube.com/​watch?​v=Pg5r6MZDhww|Youtube:​ Loco running with sound]]
    
-{{:​users:​dagnall53:​img_2121.jpg?​600}} 
  
    
users/dagnall53/hardware.1550144712.txt.gz · Last modified: 2019/02/14 12:45 by dagnall53