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 revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
users:dagnall53:hardware [2019/02/14 12:45] dagnall53users:dagnall53:hardware [2019/02/17 13:05] – [MOBILE DECODER -WEMOS MINI] dagnall53
Line 17: Line 17:
  
  
-The [[https://github.com/dagnall53/ESPMQTTRocnetSound|ESP8266 Code]] can be run on any ESP8266 ESP-12 modules.  +{{:users:dagnall53:img_2087.jpg?400 |}}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 optins 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]]
Line 30: Line 27:
 ===== Stationary Decoder ===== ===== Stationary Decoder =====
 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
 + 
 +---- 
 +A note on 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 the sockets) to power it
  
 ===== Mobile Decoder and Sound ===== ===== Mobile Decoder and Sound =====
Line 48: Line 57:
 There are two options to get sound.  There are two options to get sound. 
  
-The first uses the AdaFruit MAX98357 which provides high quality sound and onboard amplifier+The simplest is to use the definition **_AudioNODAC**. 
 +  
 +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  
 +  * I2SDAC_LRC is LRC or i2s clock (?). 
 +  
 +In this configuration I2SDAC_LRC is initially set as a clock output, but it can be re-used once the DAC has been setup.\\   
 +I recommend placing  resistor {1k to 10k}  between I2SDAC_DIN and the NPN transistor base.\\  
 +This ensues that the serial programming is still possible.  
 +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.
  
-This board needs the _AudioDAC definition set, and then uses these connections :+The "high quality" option is to use the **_AudioDAC** definition set,which uses the AdaFruit MAX98357 which provides high quality sound and on-board amplifier.\\  
 +This board needs  and then uses these connections :
  
   * I2SDAC_DIN 9    D9(/rx) Data     * I2SDAC_DIN 9    D9(/rx) Data  
Line 56: Line 75:
   * I2SDAC_CLK 8    D8 used by DAC as clock.   * I2SDAC_CLK 8    D8 used by DAC as clock.
  
-The alternative is to use the definition _AudioNODAC. 
-  
-This creates a Class D amplifier output stage that uses D9/RX to drive a transistor base that then drives the loudspeaker.  
-  * I2SDAC_DIN 9  D9/rx (data) used to drive transistor base  
-  * I2SDAC_LRC 4 D4 used as LRC or i2s clock (?)  
-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.  
-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. 
  
 ===== MOBILE DECODER -WEMOS MINI ===== ===== 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?400 |}}One 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
- +
-{{:users:dagnall53:img_2072_1_.jpg?600}} +
  
-In this configuration, the Battery eliminator in the RC servo DC motor controller powers the WEMOS Mini and the DAC. +----
  
-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. +{{:users:dagnall53:img_2121.jpg?400 |}}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. 
  
 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!.  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!. 
Line 87: Line 95:
    
  
-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).+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).
  
    
-{{:users:dagnall53:img_2121.jpg?600}}