Shop OBEX P1 Docs P2 Docs Learn Events
Model Railroad Engine Controller (PropActivityBoardWX, DualMC33926, Smoke, 18vDCC, WebPageControl,) - Page 6 — Parallax Forums

Model Railroad Engine Controller (PropActivityBoardWX, DualMC33926, Smoke, 18vDCC, WebPageControl,)

12346»

Comments

  • I haven't been following this since it is about spin and I only do C. I did read through most of the discussion and see your having issues with the RFID tags. May be you could use a Sharp Detector 28938. I would use a Hall effect transistor and a magnet to detect an object passing by.

    I think using the WiFi and a cell phone you could build a app that controls the train speed and using the Accelerometer have it slow down on turns and when it comes into a station.

    Mike
  • Clock LoopClock Loop Posts: 2,069
    edited 2020-10-02 23:04
    That sharp detector's range isn't even 1/4 inch, parts on the train would smash that close, I need a range of around 3inch-5inch.

    The laser ping seems promising due to the fact that the hole for the lasers is small in width, and the range allows the 1-5i nch range to the surface of the track, and sleepers.

    I was able to send the caboose movement signal to the engine's web page,
    and trigger a beep if its not moving, and stop beeping if it is moving.
    It works ok, but the wx wifi module's prop to prop data transfer process is still too slow.
    Its due to the connect and close process being many seconds in length.
    At this point i wonder if anyone even cares about the little features like a beeping webpage when the caboose stops moving, lol.
    I will upload a copy of that also probably, its a fun lesson on making webpages do things.
    The wx module gets near its limits with this kind of web, telnet, prop programming, and prop to prop communication.


    I think a big issue with the wx module is it only has 4 listener connections, and 4 handle connections,
    if you try to connect after using all those up, and even use the telnet terminal connection,
    and then even try to reprogram the prop over wifi, you will find that your module's head is exploding.


    A new esp32 based module with more connection ability might be nice?
    But that is a whole new beast.
    I suppose two wifi modules could be used to increase the amount of communication channels.

    Like one WX module for a prop to prop.
    And the main WX module to accept webpage interface, prop programming, and telnet.?
  • I would like to see a high level drawing of the communication that you want to happen and see if there is a simple solution that could be used.

    Increasing the channels may not fix the issue. There is only one event at a time that you can react to without loosing the other event. I don't like the way that web pages are setup. You should just be able to define web request that you want to process without defining any channels. When a request is received the propeller code can decide what to do with the request and send a response. No channel is needed.

    Mike
  • Clock LoopClock Loop Posts: 2,069
    edited 2021-03-15 03:06
    Right now I get a slider value from a webpage using /motor listener. (1 connect, 1 listener)
    I also send the current pwm to the webpage using /Pwmvalue. (1 connect, 1 listener)
    I also send the current caboose state to the webpage using /CabooseWeb (1 connect, 1 listener)
    And then I get the button states from a webpage using /leds (1 connect, 1 listener)

    This uses all the available connections for the wx module.

    I also use telnet for debug, so that sucks up a connection i guess so I have overloaded the wx module.

    And lastly I connect to another prop's wx using the connect command.
    To even get this to work I have to shut down two listeners. This interrupts the webpage control, it kinda works tho.
    But very frustrating when the webpage loses control of the engine sometimes.




    SO, I just added another WX wifi module to the engine schematic and program.
    This second wx wifi module, is used to talk to the caboose, and any other cars, or even stationary things like railroad crossings etc.

    Now the caboose talks to the engine within 1 second to update the movement status, this means I can now have the engine stop when no movement in the caboose after 10 seconds or so.

    Both wifi devices work within 2 inches of eachother just fine in the same tender. This uses more power, make sure your voltage regulator and track power capacitor are both capable.

    I will post updated schematics and program when done.
    I added a timer switch to the webpage so a 5 minute timer will start and stop the engine.
    Fixed the estop so it turns the lights back to what they were before.
    Change the EOT light to blink fast(250ms) when no movement is detected, blink is 1 second when movement is sensed with the accelerator-meter.
    Thats not how to spell accelerometer, autocorrect AI.....
    (your AI stinks, even today, but you still let it cancel culture, aka, a blind seeing eye dog, for the blind?)


    With the added wx module I had to start another serial cog, and a loop for the communication, this means I have used up all 8cogs in the engine.
    Now I will need to look at code condensing and freeing up some cogs.
    I have also sped up the wx communcations so the webpage responds faster, and the engine-caboose communcations, no movement, to showing movement is about 2 seconds.

  • Clock LoopClock Loop Posts: 2,069
    edited 2021-03-21 00:49

    I actually think I might make an attempt to do this whole project with the P2 since objects are appearing in the p2 COMMUNITY obex. (the parallax official p2 obex is mysteriously empty tho)

    What has caught my eye are two objects, first the sound.

    https://github.com/parallaxinc/propeller/tree/master/libraries/community/p2/All/reSound

    Multichannel playback! 4 channels with 1 sd card, that will do nicely.

    And, more!

    I love the power of the P2, this performance was never possible on the P1. 
    The limiting factor REALLY is the SD card interface, so in reality we are talking 2 to 4 streams per physical SD interface. 
    You can also mix in samples over the audiostreams for sound effects as long as they fit in the remaining hub ram. 
    All this can be mixed in mono, stereo or up to 8 physical audio pins for surround sound.
    

    Then the pwm i need for the dual motor driver can possibly be had with
    https://github.com/parallaxinc/propeller/tree/master/libraries/community/p2/All/jm_pwm

    The rest is me learning the p2 language? I don't know anything about it, but most of my code is spin.. should be doable? ...
    If anyone can see any problems with me making an attempt to convert all the code over, let me know. I am flexible on what objects I use...

    I didn't see any sd card objects, is the sd interface built into the p2? I looked over the resound code and didn't really see anything about accessing files on the sd.card.

    The code to use two wx devices has revealed a bug in the latest wxfirmware so I am waiting for a firmware fix to upload the latest engine controller code and schematic, that now uses two wx modules in the engine.
    It is worth two of them because the webpage response time is very fast, seconds, and the communications with other cars, and even other stationary objects like rr crossings don't interrupt the webpage control.
    This means the feedback to the webpage as far as the caboose movement, and motor pwm rate are smooth and responsive. So are the engine throttle, estop and other switches.

    I may make the secondary wx device even faster by turning on command events in the wx module, and running a tight spin loop to catch the data fast, which would make the cycle even faster for communications between cars, caboose, and stationary objects.
    But I need to look at freeing up cogs to make that happen.
    I need to make a stationary object like a rr crossing with lights, a wx, a prop, and some weather protection for it all, (a sealed outdoor electrical box).
    My track is DC but all devices connected to it are capable of using AC or DCC power also. Full rectifiers.
    I figure i will just start with card board/cardstock/foamboard cutout rr crossings that are painted/marker and wired with Leds. Some nice bright, deep red, luxeon rebel, or luxeon z's

  • Moving from Spin to Spin2 will involve some relearning, but if you use FlexProp to compile your Spin code for the P2 then you should only need to learn the differences between the chip's capabilities.
    Your Spin code should run faster on the P2 than it did on the Propeller, so you might find that combining functions to share a cog is easier too.

    The P2 ROM contains routines to access SD cards on the default pins.
    Details can be found here

  • Clock LoopClock Loop Posts: 2,069
    edited 2021-03-24 21:49

    I have changed the schematic and spin program so much that I will call this version 2.0
    This is due to the code smoothing out the wireless communications.

    I have added 1 more wx esp8266 wireless module to the schematic.
    Now the engine has 2 wx modules, 1 is to communicate with the webpage all the time for total and uninterrupted control, and the other is to communicate with any other cars, crossings, caboose, etc.

    Right now the second wx module in the engine only talks to the caboose, I have not made any other devices, but I have another wx module waiting on my breadboard with a prop, and a few leds, a speaker, and an amp, for a rr crossing.
    The telnet connection using PUTTY is how you can see a status of all the engine settings, switches, values, and the caboose has the same telnet connection using putty.

    The html code for the engine is refreshed every 3 seconds, the pwm and the caboose movement are updated alternately, this is so the webpage isn't making multiple requests at the same time, (at least not repeating ones)

    The code waits 10 seconds before booting to help identify reboots, I don't save the running values to eeprom for power outs, I may do something like that using nvram of some sort.

    Running on brass rail powered at 18v dc, the rail gets dirty and pickups really can't do it. I need to think about some kind of battery setup that is charged from the rail also.
    It might help if I could do 18v AC, I would need to buy another dcc station, or make one.

    With more cars, the motor gear was not pushing hard enough against the drive gear and so it was skipping and grinding a bit, a small washer under one of the motor mounts made it possible to slightly angle the motor towards the gear, making a deep contact.
    I have added multiple cars to the consist due to this change. If I want more I may need to think about adapting all the circuitry to handle 22v DC and really push that motor.

    With 2 wx devices in the tender I had to decide to power one of them from the 5v line, the voltage regulators for the wx devices are getting near their limits, when they also need to drop such high voltages 16-18v. They heat up, so make sure you have a heat sink attached to them.

    I also put a lm1117 regulator in the schematic for the caboose with a wx, and that is not right, so I changed it to a 3A 3.3v regulator.

    Since this code and setup is working very well, I am going to look into making another engine with a prop2.

    BUT, since this engine doesn't have and sound, I think I will start out small, and put sound on the prop2 first.
    I will talk to it using a wx that is inside a boxcar with a speaker facing down, and have it make the engine sounds, since the prop is already doing alot, and multiple HQ sound file mixing gets hairy on the p1.

    I cannot fit a speaker and a small amp in the tender because i still have the prop wx board in there, I need to get it out and wire up a deadbug prop or something.
    (it just looks so nice and fits, i hate to rip it apart...)

    https://forums.parallax.com/uploads/editor/2w/yk5oh90scbkx.mp4

    Schematic, images, will be posted here, after a restart.

    960 x 540 - 174K
  • Clock LoopClock Loop Posts: 2,069
    edited 2021-03-28 03:55

    V2.0 uses another wx module and changes the voltage regulator in the caboose to a 3A one.

    980 x 1500 - 242K
    999 x 621 - 93K
    354 x 637 - 71K
    506 x 269 - 40K
    8448 x 6528 - 4M
  • Clock LoopClock Loop Posts: 2,069
    edited 2021-03-26 20:00

    I made a reverse bug in the code.
    To fix move reverse code from
    Pub SetSwitches
    to
    Pub MotorPwm
    The reverse code in the proper routine.

    Pub MotorPwm
        waitcnt(40_000_000 + cnt)   'wait 1/2 second before next update          
    
        If Reverse == 0 And EmergencyStop == 1 And CurrentDuty < 3       ' Going Forward
          outa[M1IN1] := 1     ' The logic input control of OUT1. PWM can be applied to this pin (typically done with both disable lines inactive)  Reversing the setings on Pins M1IN1 & M1IN2 will reverse motor direction
          outa[M1IN2] := 0     ' The logic input control of OUT2. PWM can be applied to this pin (typically done with both disable pins inactive)   Reversing the setings on Pins M1IN1 & M1IN2 will reverse motor direction  
    
        If Reverse == 1 And EmergencyStop == 1 And CurrentDuty < 3   ' Going Reverse
          outa[M1IN1] := 0     ' The logic input control of OUT1. PWM can be applied to this pin (typically done with both disable lines inactive)  Reversing the setings on Pins M1IN1 & M1IN2 will reverse motor direction
          outa[M1IN2] := 1     ' The logic input control of OUT2. PWM can be applied to this pin (typically done with both disable pins inactive)   Reversing the setings on Pins M1IN1 & M1IN2 will reverse motor direction
    

    Play this video back at slowest speed (right click the video once you start it). You can see the engine almost jump the track at the turn.
    If that was a real engine the engineer would have had a heart attack.
    https://forums.parallax.com/uploads/editor/gy/7ykdxxsqostg.mp4

  • Clock LoopClock Loop Posts: 2,069
    edited 2021-04-07 03:57

    I have added John's a2d code to read the a2d on the activity board. I followed the instructions from the dual motor driver datasheet and added a 270ohm resistor from the current sense output to ground along with a 1uf capacitor in parallel, the resistor is required to read the current source by a a2d, and the cap is required due to pwm being used for the motor.

    I have displayed the motor current data on the putty output (telnet putty connection)
    It shows the current feedback pretty well, you can watch the video to see it live, you can see the train going around curves drawing more motor current, and also when it goes down hills the current drops, and up hills it rises.

    I think I might include some basic sounds like a whistle and bell using the prop chip for now, since it can do some sound it just is limited in doing multi channel audio.

    I tried to improve the caboose movement code so it doesn't give false readings.
    I am going to look at the values to see if I can have it determine if the caboose is turning left/right, going straight/backwards..
    Not sure if it will be possible.

    The train is my full car load, I need to buy more cars, and if I do that I will need more fishing weights, the small kind so i can fit more in the engine. I will probably just get a baggie fill it with very small fishing weights so i can fit in as much as possible and shove that into the engine body to get more tractive effort!

    The motor can handle more and so can the drive, but the engine isn't heavy enough even with the weights I put in, it has alot of wheel slip going uphill at spots. The current draw at those points would be more if I had less wheel slip.

    Well that was fun getting the a2d working and seeing the motor draw.

    I increased the sizes of the throttle control and buttons to work better on phones/tablets with fingers.

    The A2D uses all 4 channels tied to the same signal, this is so i can alternate channels to capture data fast, not sure if this is a proper or good way to use the channels but it seems to work ok.
    The data is captured every 20mhz and the channel that captures it is rotated every 20mhz so all 4 channels capture every second in series. Those 4 measurements are then averaged and that value is what is plotted first in the 1s position.
    Data before 1s isn't shown due to that averaging.

    A history of 20 samples are recorded and shown in putty.
    The putty terminal window dimensions for the engine telnet debug feedback, are 96 columns by 62 rows.

    I have attached images of the current profile for various situations:

    Fast Startup:

    Down a hill:

    Slow stop:

    More to come!

  • Clock LoopClock Loop Posts: 2,069
    edited 2021-04-07 01:51

    Here is a link to the video which shows the train going around the track, the engine control webpage.
    It also shows the telnet putty outputs from the engine and the caboose.
    You can see the current sense feedback output fluctuate, lower on the straights/down hill, and higher on the curves/up hills.
    Direct video file link.
    https://srv-store6.gofile.io/download/JOx5HH/7ccd333c2ef2360a0c06187ebf48cc17/Northwoods%20Logger%202.0.mp4

    Link to web player for the file
    https://gofile.io/d/JOx5HH

    1724 x 1240 - 700K
  • Clock LoopClock Loop Posts: 2,069
    edited 2021-04-07 08:04

    I have changed the motor control.

    I now use IN1 with pwm driver, freeing up 1 cog.

    I changed this because if you use D1 D2 as a pwm, the status flag is in error.

    So D1 and D2 are only used to reset the motor drive (and it tri states the motor pins)

    I use INV for forward/reverse direction control, this also changes the direction of the second drive chip.

    I now also monitor the SF status for error and set pwm to 0 if in error.
    So don't forget you need a 10k pullup on the sf pin (p7 on the activity board in the schematic)

    I do not deal with resetting sf flag, that requires a power cycle on the engine. (this prevents you from missing the flag)
    The movement of the wheels seems to start earlier when using pwm on the IN1 pin.
    I used D1 and D2 not knowing that was a bad way to pwm the drive, since those will trigger the SF flag.

    Now that I use IN1 and IN2 properly, I can do freewheeling high and low.
    I don't want to switch my pwm pin to reverse direction so I will keep IN1 as my pwm and set INV to reverse motor.

                           'Device State        Input Conditions          Status    Outputs
                           '                    EN  D1  D2  IN1   IN2     SF        OUT1  OUT2
                           'Forward             H   L   H   H     L       H         H     L
                           'Reverse             H   L   H   L     H       H         L     H
                           'Free Wheeling Low   H   L   H   L     L       H         L     L
                           'Free Wheeling High  H   L   H   H     H       H         H     H
    

    Updated code attached again.

  • Clock LoopClock Loop Posts: 2,069
    edited 2021-04-08 19:25

    Kyes sound engine strikes again. Looks like I will be using a second prop with 4 sd cards attached to it.

    @Kye Is there any way I can play a wave file located in eeprom?
    Like a file reference in the Dat section.?

    His sound engine can seamlessly play wave loops, and do it while changing the sample rate to pitch/speed bend the sound

    I now have a train chuff.
    The chuff will probably need to be on the main activity board since that is where the motor drive and pwm info is and it can go there, since that only needs 1 cog and 1 sd card.
    But the pwm rate could be passed off to another prop via WX with a delay of 1 second or so, and the pwm rate could mathematically translate it to frequency for the wave player.

    The other prop will have MANY sd cards and use multiple cogs to get a whistle, bell, steam effects, stack talk, rail clack, blow off, etc...
    I am guessing I can play 7 waves at once with 7 sd cards with 1 propeller chip using all 7 cogs for wave, and 1 cog for main loop, unless kyes player uses another cog for sd, then i can only do 3 waves at once.
    I will have to test all this now.

    Here is some demo code on pitch bending sound on the prop chip.
    This code is working! The sound pitch bends perfectly.

    {
        By: Kwabena W. Agyeman - 9/27/2013     Modified by clock loop to demo progressive pitch bending.  And show debug output in putty.
    }
    
    CON
    
        _clkfreq = 80_000_000
        _clkmode = xtal1 + pll16x
    
        rx = 31
        tx = 30
    
        lPin = 26
        rPin = 27
    
        doPin = 22
        clkPin = 23
        diPin = 24
        csPin = 25
    
        wpPin = -1
        cdPin = -1
    
    OBJ
    
        ser: "FullDuplexSerial.spin"
    
        wav1: "V2-WAV_DACEngine.spin"
    
    
    VAR long spinPlayer1Stack[200]
    
    PUB main
    
        ser.Start(rx, tx, 0, 115200)
    
        waitcnt((clkfreq * 5) + cnt)
    
        ser.str(string(27))     'Set command mode ANSI command for putty terminal program.                                                    
        ser.str(string("[2J"))  'Clear telnet screen.
    
        ser.str(string(27))      'Set command mode 
        ser.str(string("[1;1f")) 'Set Position  
    
        if(wav1.begin(lPin, rPin, doPin, clkPin, diPin, csPin, wpPin, cdPin))
            ser.Str(string("Start: Success", 10, 13))
    
        else
            ser.Str(string("Start: Failure", 10, 13))
    
    
    wav1.setLeftVolume(2)
    wav1.setRightVolume(2)
    
    
    cognew(Chuff, @spinPlayer1Stack) ' Startup separate process.
    
    repeat   'keep main cog running
    
    
    
    PUB Chuff | SampleRate
      SampleRate := 4000
      repeat
            SampleRate := SampleRate + 200
            If SampleRate > 48000
              SampleRate := 4000
    
            ser.str(string(27))      'Set command mode 
            ser.str(string("[5;3f")) 'Set Position
            ser.Str(string("SampleRate: "))
            ser.dec(SampleRate)
            ser.Str(string("    "))
    
            ser.str(string(27))      'Set command mode 
            ser.str(string("[3;3f")) 'Set Position
            ser.Str(string("/ Chuff "))
            ser.str(string(27))      'Set command mode 
            ser.str(string("[1;1f")) 'Set Position
    
            result := \wav1.play(string("chuff1.wav"), SampleRate)
    
            ser.str(string(27))      'Set command mode 
            ser.str(string("[3;3f")) 'Set Position
            ser.Str(string("-  Chuff"))
            ser.str(string(27))      'Set command mode 
            ser.str(string("[1;1f")) 'Set Position
    
            result := \wav1.play(string("chuff2.wav"), SampleRate)
    
            ser.str(string(27))      'Set command mode 
            ser.str(string("[3;3f")) 'Set Position
            ser.Str(string("\ Chuff "))
            ser.str(string(27))      'Set command mode 
            ser.str(string("[1;1f")) 'Set Position
    
            result := \wav1.play(string("chuff3.wav"), SampleRate)
    
            ser.str(string(27))      'Set command mode 
            ser.str(string("[3;3f")) 'Set Position
            ser.Str(string("|  Chuff"))
            ser.str(string(27))      'Set command mode 
            ser.str(string("[1;1f")) 'Set Position
    
            result := \wav1.play(string("chuff4.wav"), SampleRate)        
    
            if(wav1.playErrorNum)
                ser.Str(string("WAV Error: "))
                ser.Str(result)
                ser.Tx(10)
                ser.Tx(13)
                repeat
    
    DAT
    {{
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //                                                  TERMS OF USE: MIT License
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
    // files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
    // modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
    // Software is furnished to do so, subject to the following conditions:
    //
    // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
    // Software.
    //
    // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
    // WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
    // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
    // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    }}
    
  • I have some Boards/thru hole kits having 4 sd cards and made to attach to the Parallax Quick-Start.

    Have still ~40 left, can send you a kit, they just get dusty here.

    PM me your address and I send you one or two.

    Enjoy!

    Mike

  • Clock LoopClock Loop Posts: 2,069
    edited 2021-04-09 05:51

    Hey thanks, but I am not sure what I am going to do, that wave player code takes up too much space with all my railroad engine stuff, so...

    Either I need to use another prop for the sounds, or find another way to play waves, looking into other wave players that may have seamless looping with frequency playback adjustment ability.

    I was also considering gettting a p2 and possibly doing all this with that, but I don't have enough money.
    Oddly enough I didn't get a penny from all the government money, talk about taxation without representation, its just a terd swirlin'.

    Anyway, I am stuck to using a p1, so thanks again for the parts offer, but I have what I need!

    Time to look at my code and reduce, reuse, recycle, and reject.... code.
    So far I may just be making a sound prop and putting it into a boxcar behind the engine.

    If I make this into a pcb, I may be able to get the sound prop into the tender also along with my generic speaker and amp.
    From my lack of code space, and the fact that I only have 1 cog left, pretty much says my sound must be on another prop.

    At first I think I will just send it serial data via wire, great there goes another serial object, that uses all my engine cogs.

  • Clock LoopClock Loop Posts: 2,069
    edited 2021-04-10 05:50

    Raymond Allen made some 8-bit wav player code that will allow me to do multichannel simultaneaous playback from eeprom.
    By using different pins for the outputs and then mixing them in hardware.
    Now i need to look into using multiple eeproms and I am not sure if the data can be loaded fast for on the fly wav playback.
    And/or using 64k eeproms....

    '  SPIN 8-bit WAV Player Ver. 1a  (Plays only mono 8-bit WAV at 8 or 16 ksps)
    '  Copyright 2007 Raymond Allen  See end of file for terms of use.
    '  Settings for Demo Board Audio Output:  Right Pin# = 10, Left Pin# = 11   , VGA base=Pin16, TV base=Pin12
    
    
    CON _clkmode = xtal1 + pll16x
        _xinfreq = 5_000_000       '80 MHz
    
    VAR
      long  SmokeStack1[50]
    
    PUB Main | loopcount
      'Play a WAV File
    Repeat
    
      loopcount++
    
      If loopcount == 10
        cognew(Player(@ShortWhisle,26,-1,10000), @SmokeStack1)   'Cog #2, 3
        loopcount := 0
    
      Player(@Chuff1,-1,27,10000)
      'waitcnt(40_000_000 + cnt)
    
      Player(@Chuff2,-1,27,10000)
      'waitcnt(40_000_000 + cnt)
    
      Player(@Chuff3,-1,27,10000) 
      'waitcnt(40_000_000 + cnt)
    
      Player(@Chuff4,-1,27,10000)
      'waitcnt(40_000_000 + cnt)
    
    PUB Player(pWav, PinR, PinL, rate1):bOK|n,i,nextCnt,rate,dcnt
      'Play the wav data using counter modules
      'although just mono, using both counters to play the same thing on both left and right pins
    
      'Set pins to output mode
      DIRA[PinR]~~                              'Set Right Pin to output
      DIRA[PinL]~~                              'Set Left Pin to output
    
      'Set up the counters
      CTRA:= %00110 << 26 + 0<<9 + PinR         'NCO/PWM Single-Ended APIN=Pin (BPIN=0 always 0)
      CTRB:= %00110 << 26 + 0<<9 + PinL         'NCO/PWM Single-Ended APIN=Pin (BPIN=0 always 0)
    
      'get length
      n:=long[pWav+40]
      'get rate
      rate:=long[pWav+24]
      case rate
        8000:
          dcnt:=10000
        16000:
          dcnt:=5000
          'dcnt:=2000
        other:
          return false
      'jump over header
      dcnt:=rate1
      pWav+=44   'ignore rest of header (so you better have the right file format!)
    
    
      'Get ready for fast loop
      n--
      i:=0
      NextCnt:=cnt+15000
    
      'Play loop
      repeat i from 0 to n
        NextCnt+=dcnt   ' need this to be 5000 for 16KSPS   @ 80 MHz
        waitcnt(NextCnt)
        FRQA:=(byte[pWav+i])<<24
        FRQB:=FRQA
    
    
          'Easy high-impedance output (e.g., to "line in" input of computer or sound system)
          '
          '              R=100
          ' Prop Pin ────┳──────── Audio Out
           '               C=0.1uF
           '                
           '               Vss
      return true
    
    
    DAT
    
    Chuff1 long
    File "8kc1.wav"           '   <---  put your 8-bit PCM mono 16000 or 8000 sample/second WAV filename here
    
    Chuff2 long
    File "8kc2.wav"           '   <---  put your 8-bit PCM mono 16000 or 8000 sample/second WAV filename here
    
    Chuff3 long
    File "8kc3.wav"           '   <---  put your 8-bit PCM mono 16000 or 8000 sample/second WAV filename here
    
    Chuff4 long
    File "8kc4.wav"           '   <---  put your 8-bit PCM mono 16000 or 8000 sample/second WAV filename here
    
    ShortWhisle long
    File "Wstl.wav"
    {{
                                TERMS OF USE: MIT License
    
     Permission is hereby granted, free of charge, to any person obtaining a copy
     of this software and associated documentation files (the "Software"), to deal
     in the Software without restriction, including without limitation the rights
     to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     copies of the Software, and to permit persons to whom the Software is
     furnished to do so, subject to the following conditions:
    
     The above copyright notice and this permission notice shall be included in
     all copies or substantial portions of the Software.
    
     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,ARISING FROM,
     OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     THE SOFTWARE.
    }}
    
  • Clock LoopClock Loop Posts: 2,069
    edited 2021-04-10 07:02

    Heres one that shows how to translate 0-100 pwm into frequency rate for audio playback.
    I will need to tweak it so it starts to chuff when the wheels start moving, each user would need to do this due to motor differences.
    At least until i get a hall effect sensor for the axle.

    '  SPIN 8-bit WAV Player Ver. 1a  (Plays only mono 8-bit WAV at 8 or 16 ksps)
    '  Copyright 2007 Raymond Allen  See end of file for terms of use.
    
    'modified by clock loop for chuff generator and putty diag output
    
    CON _clkmode = xtal1 + pll16x
        _xinfreq = 5_000_000       '80 MHz
    
      Rx        = 31     'serial in from wx device
      Tx        = 30     'serial out to wx device
    
    OBJ
      ser: "Parallax Serial Terminal.spin"
    
    
    VAR
      long  SmokeStack1[50]
    
    PUB Main | loopcount
      'Play a WAV File
    
        ser.StartRxTx(RX, TX, 0, 115200)   'Cog #3  Parallax Serial Terminal does NOT work at receiving data 230400 for some reason.
        waitcnt(10_000_000 + cnt)   'wait 1/8 second for serial to start.
    
        ser.str(string(27))     'Set command mode ANSI command for putty terminal program.                                                    
        ser.str(string("[2J"))  'Clear telnet screen.
    
        ser.str(string(27))      'Set command mode 
        ser.str(string("[1;1f")) 'Set Position  
    
      Chuff
    
    
    PUB Player(pWav, PinR, PinL, rate1):bOK|n,i,nextCnt,rate,dcnt
      'Play the wav data using counter modules
      'although just mono, using both counters to play the same thing on both left and right pins
    
      'Set pins to output mode
      DIRA[PinR]~~                              'Set Right Pin to output
      DIRA[PinL]~~                              'Set Left Pin to output
    
      'Set up the counters
      CTRA:= %00110 << 26 + 0<<9 + PinR         'NCO/PWM Single-Ended APIN=Pin (BPIN=0 always 0)
      CTRB:= %00110 << 26 + 0<<9 + PinL         'NCO/PWM Single-Ended APIN=Pin (BPIN=0 always 0)
    
      'get length
      n:=long[pWav+40]
      'get rate
      rate:=long[pWav+24]
      case rate
        8000:
          dcnt:=10000
        16000:
          dcnt:=5000
          'dcnt:=2000
        other:
          return false
      'jump over header
      dcnt:=rate1
      pWav+=44   'ignore rest of header (so you better have the right file format!)
    
    
      'Get ready for fast loop
      n--
      i:=0
      NextCnt:=cnt+15000
    
      'Play loop
      repeat i from 0 to n
        NextCnt+=dcnt   ' need this to be 5000 for 16KSPS   @ 80 MHz
        waitcnt(NextCnt)
        FRQA:=(byte[pWav+i])<<24
        FRQB:=FRQA
    
    
          'Easy high-impedance output (e.g., to "line in" input of computer or sound system)
          '
          '              R=100
          ' Prop Pin ────┳──────── Audio Out
           '               C=0.1uF
           '                
           '               Vss
      return true
    
    Pub ChuffCal
    
            SampleRate1 := 480 * Pwm
    
            If SampleRate1 > 48_000 
              SampleRate := 3_600 
            Elseif SampleRate1 < 5_000
              SampleRate := 40_000        
            Else
              SampleRate := 172_800_000 / SampleRate1     
    
    PUB Chuff | loopcount
    
      Pwm := 0
      Dir := 0                
      'SampleRate := 15_000
    
      Repeat
           { 'waitcnt(20_000_000 + cnt) 'Wait for 1/8 s     
            loopcount++
    
            If loopcount == 10
              cognew(Player(@ShortWhisle,26,-1,10000), @SmokeStack1)   'Cog #2, 3
              loopcount := 0
           }
    
            If Dir == 0                
                'Repeat 3
                Pwm++
                If Pwm > 99
                  dir := 1
                  Pwm := 100
            Else
                'Repeat 3
                Pwm--
                If Pwm < 1
                  dir := 0
                  Pwm := 0
    
            ChuffCal
    
            If Pwm < 11
              ser.str(string(27))      'Set command mode 
              ser.str(string("[3;3f")) 'Set Position  
              ser.Str(string("/ Idle  "))
              ser.str(string(27))      'Set command mode 
              ser.str(string("[1;1f")) 'Set Position
              'wav1.setLeftVolume(2)
              'wav1.setRightVolume(2)
              'wav1.overrideRate(16_000)
              'result := \wav1.play(string("idle.wav"), 16_000)
              ChuffCal
    
              Player(@Idle,-1,27,10000)
    
              ChuffCal
    
            Else        
    
              ser.str(string(27))      'Set command mode 
              ser.str(string("[3;3f")) 'Set Position
              ser.Str(string("/ Chuff "))
              ser.str(string(27))      'Set command mode 
              ser.str(string("[1;1f")) 'Set Position
    
              ChuffCal
    
              Player(@Chuff1,-1,27,SampleRate)
    
              ChuffCal            
    
              ser.str(string(27))      'Set command mode 
              ser.str(string("[3;3f")) 'Set Position
              ser.Str(string("-  Chuff"))
              ser.str(string(27))      'Set command mode 
              ser.str(string("[1;1f")) 'Set Position
                                       '
              ChuffCal
    
              Player(@Chuff2,-1,27,SampleRate) 
    
              ChuffCal
    
              ser.str(string(27))      'Set command mode 
              ser.str(string("[3;3f")) 'Set Position
              ser.Str(string("\ Chuff "))
              ser.str(string(27))      'Set command mode 
              ser.str(string("[1;1f")) 'Set Position
    
              ChuffCal                         '
    
              Player(@Chuff3,-1,27,SampleRate)
    
              ChuffCal
    
              ser.str(string(27))      'Set command mode 
              ser.str(string("[3;3f")) 'Set Position
              ser.Str(string("|  Chuff"))
              ser.str(string(27))      'Set command mode 
              ser.str(string("[1;1f")) 'Set Position
                                       '
              ChuffCal
              Player(@Chuff4,-1,27,SampleRate)
              ChuffCal
    
    
    
    
            ser.str(string(27))      'Set command mode 
            ser.str(string("[10;3f")) 'Set Position
            ser.Str(string("SampleRate: "))
            ser.dec(SampleRate)
            ser.Str(string("    "))
    
            ser.str(string(27))      'Set command mode 
            ser.str(string("[9;3f")) 'Set Position
            ser.Str(string("Pwm: "))
            ser.dec(Pwm)
            ser.Str(string("    "))            
    
    
    DAT
    
    
    
    SampleRate    long 0
    SampleRate1   long 0
    Pwm           byte 0
    Dir           byte 0
    
    
    Chuff1 long
    File "8kc1.wav"           '   <---  put your 8-bit PCM mono 16000 or 8000 sample/second WAV filename here
    
    Chuff2 long
    File "8kc2.wav"           '   <---  put your 8-bit PCM mono 16000 or 8000 sample/second WAV filename here
    
    Chuff3 long
    File "8kc3.wav"           '   <---  put your 8-bit PCM mono 16000 or 8000 sample/second WAV filename here
    
    Chuff4 long
    File "8kc4.wav"           '   <---  put your 8-bit PCM mono 16000 or 8000 sample/second WAV filename here
    
    Idle long
    File "8kIdle.wav"           '   <---  put your 8-bit PCM mono 16000 or 8000 sample/second WAV filename here
    
    {{
                                TERMS OF USE: MIT License
    
     Permission is hereby granted, free of charge, to any person obtaining a copy
     of this software and associated documentation files (the "Software"), to deal
     in the Software without restriction, including without limitation the rights
     to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     copies of the Software, and to permit persons to whom the Software is
     furnished to do so, subject to the following conditions:
    
     The above copyright notice and this permission notice shall be included in
     all copies or substantial portions of the Software.
    
     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,ARISING FROM,
     OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     THE SOFTWARE.
    }}
    

    If the eeprom method cannot do the wave files fast enough,
    i wonder if using the 8-bit player with an sd card would be the answer for simultaneous playback?

  • Clock LoopClock Loop Posts: 2,069
    edited 2021-04-10 10:22

    Wow this is cool, the 8-bit player can be manipulated so that it will forward and reverse the playback during the middle of a whistle wave.
    I also shortened it to a short whistle burst using similar skipping.

    I have a really nice whistle wave and I want its center to extend for as long as the user keeps the whistle on.
    But I do not want to have a LONG wave file.

    So i have made the center bits of a whistle wave repeat forward, and then backward before the sound ends, and then forward again before it begins, to make an infinitely extendable whistle depending on the user.

    Thats nice.
    I really gotta chunk all this into a sound chip.
    Its just too much fun to play with new sounds and see what I can do with all this code you guys do.
    :smile:

      repeat i from b to n
    
        If i > 25_000 And Sustain == 1
          RevSw := 1
          b := n
          n := 0
    
        If i < 16_000 And RevSw == 1
          RevSw := 0
          n := b
          b := 0
    
        NextCnt+=dcnt   ' need this to be 5000 for 16KSPS   @ 80 MHz
        waitcnt(NextCnt)
        FRQA:=(byte[pWav+i])<<24
        FRQB:=FRQA
    

    I wanted a better whistle in my wall train clock, and now i can not only make it better, but make it as long as I want with a prop and an eeprom.
    I could make the half hour, hour and 15 min be different lengths.

    Lol the wave file almost fills an entire eeprom.

  • Clock LoopClock Loop Posts: 2,069
    edited 2021-04-10 17:16

    Eeprom reads are too slow to play straight from eeprom.
    At least with John's spin versions of the eeprom reader.
    I guess i can look into a pasm version, but would it still be fast enough...
    Time to dig around the obex more...

    LOL spin eeprom read ---> FRQA:=(eeprom.rd_byte(i))<<24

        NextCnt+=dcnt   ' need this to be 5000 for 16KSPS   @ 80 MHz
        waitcnt(NextCnt)
        'FRQA:=(eeprom.rd_byte(i))<<24
        FRQA:=(byte[pWav+i])<<24
        FRQB:=FRQA
    

    Well... I COULD just use a prop and an eeprom for every 32k amount of files. (basically one prop and eeprom per sound file)

    At that point I am back to using multiple sd cards.

  • Cluso99Cluso99 Posts: 18,069

    Pasm is 25-50 times faster than spin. You need to invest some time here, just for the specialist section. Perhaps Eric’s FlexProp can help?

  • you could put multiple eeproms on the i2c bus,

    And my offer stands to send you some RAISD boards, you need to solder but its just resistors and leds, the 4 sd card sockets are already on the PCB. All thru hole, simple to solder.

    It is made to sit on top of a Parallax Quick-Start board, so no Propeller on the kit.

    PM me a address, I send you two kits, they are just collecting dust at my place, no need for them anymore here. They even have a RTC chip and battery.

    Enjoy!

    Mike

  • Clock LoopClock Loop Posts: 2,069
    edited 2021-04-11 04:45

    @Cluso99 said:
    Pasm is 25-50 times faster than spin. You need to invest some time here, just for the specialist section. Perhaps Eric’s FlexProp can help?

    Yea, I havent been able to get the pasm i2c version to work yet, still working on it.

    @msrobots said:
    you could put multiple eeproms on the i2c bus,

    My sound files need to be accessed at the same time so they would each need their own bus.
    Thanks for the 4sd pcb! But I really don't need it! Thanks again!

    So here is the latest engine controller code with SOUND.
    The sound playback is only chuffs tied to the pwm rate, my amp and speakers are from a pc speaker which I put into a box car behind the tender with a power power and a audio wire going to the tender. The speaker amp is powered with 5v from the pab in the tender, the sound comes from the headphone connector on the PAB, p26, p27.

    I am guessing that I will be able to fit everything in the tender if I make a pcb for it all (the speaker and amp will then fit because the tender becomes the speaker baffle.

    This eeprom is almost full, now I need to optimize and make non-debug versions to get even more space.

    I wonder if debug feature of the new propeller tool work for p1.

    Anyway, I'll get a video of it rollin soon.

  • Cluso99Cluso99 Posts: 18,069

    I’m sure I’ve used a pasm I2C object on P1 before, not that it’s difficult. Remind me in a few days if I haven’t had time to look for it.

  • Clock LoopClock Loop Posts: 2,069
    edited 2021-04-12 01:02

    I tried using
    PASM I2C Driver Version 1.0
    Copyright (c) 2010 Dave Hein
    June 6, 2010

    From the obex and it didnt work.
    Probabaly my code, or is my deviceid wrong?

     Repeat
    
      N := 0 
      Repeat N from 0 to Length
    
        eeprom.WriteByte(SCL0, 0, N, Whistle[N])
    
        ser.str(string(27))      'Set command mode 
        ser.str(string("[4;3f")) 'Set Position
        ser.Str(string("Value: "))
        ser.dec(Whistle[n])
        ser.Str(string("            ")) 
    
        ser.str(string(27))      'Set command mode 
        ser.str(string("[5;3f")) 'Set Position
        ser.Str(string("Eeprom: "))
        ser.dec(eeprom.ReadByte(SCL0, 0, N))
        ser.Str(string("            ")) 
    
    DAT
      Whistle long
      File "Lwstl.wav"
    
  • Clock LoopClock Loop Posts: 2,069
    edited 2021-04-12 06:28

    My problem was I used writebyte when i wanted writelong for my variable long.
    I also device addressed the chip completely wrong with these I2c devices, and the data address was wrong also.

    CON 
        _clkmode = xtal1 + pll16x
        _xinfreq = 5_000_000       '80 MHz
    
      Rx        = 31     'serial in from wx device
      Tx        = 30     'serial out to wx device
    
      SCL0      = 28
      SDA0      = 29
    
      SCL1      = 0
      SDA1      = 1
    
      SCL2      = 2
      SDA2      = 3
    
      SCL3      = 4
      SDA3      = 5
    
      eepromAddress = $7000
    
      EepromDevAdd   = $A0                      ' I2C EEPROM Device Addres
    
    
    OBJ
      ser: "Parallax Serial Terminal.spin"
      eeprom: "pasm_i2c_driver"
    
    
    Pub Main | StartTime, N, Length, Addy
    
      ser.StartRxTx(RX, TX, 0, 115200)   'Cog #3  Parallax Serial Terminal does NOT work at receiving data 230400 for some reason.
      waitcnt(10_000_000 + cnt)   'wait 1/8 second for serial to start.
    
      ser.str(string(27))     'Set command mode ANSI command for putty terminal program.                                                    
      ser.str(string("[2J"))  'Clear telnet screen.
    
      eeprom.Initialize(SCL0)
      Length := @Stop - @Whistle
    
      N := 0 
      Repeat N from 0 to Length
    
        waitcnt(80_000_000 + cnt)   'wait 1 second.
        Addy := $7000 + N
        If eeprom.WriteLong(SCL0, $A0, Addy, Whistle[N]) == -1
    
          ser.str(string(27))      'Set command mode 
          ser.str(string("[2;3f")) 'Set Position
          ser.Str(string("Eeprom: Bad write."))
          Repeat
    
        Else
          startTime := cnt ' prepare to check for a timeout   
          repeat while eeprom.WriteWait(SCL0, $A0, Addy)
            if cnt - startTime > clkfreq / 10
              abort ' waited more than a 1/10 second for the write to finish
    
          ser.str(string(27))      'Set command mode 
          ser.str(string("[3;3f")) 'Set Position
          ser.Str(string("Eeprom: Good write. ")) 
    
    
        'waitcnt(80_000_000 + cnt)   'wait 1 second.
        ser.str(string(27))      'Set command mode 
        ser.str(string("[4;3f")) 'Set Position
        ser.Str(string("Value : "))
        ser.dec(Whistle[N])
        ser.Str(string("            ")) 
    
        ser.str(string(27))      'Set command mode 
        ser.str(string("[5;3f")) 'Set Position
        ser.Str(string("Eeprom: "))
    
        ser.dec(eeprom.ReadLong(SCL0, $A0, Addy))
    
        ser.Str(string("            ")) 
    
    Repeat
      ser.str(string(27))      'Set command mode 
      ser.str(string("[6;3f")) 'Set Position
      ser.Str(string("Copy Done."))
      waitcnt(80_000_000 + cnt)   'wait 1 second.
    
    
    Dat
    
      Whistle long
      File "Lwstl.wav"
      Stop  Long 0
    {{
                                TERMS OF USE: MIT License
    
     Permission is hereby granted, free of charge, to any person obtaining a copy
     of this software and associated documentation files (the "Software"), to deal
     in the Software without restriction, including without limitation the rights
     to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     copies of the Software, and to permit persons to whom the Software is
     furnished to do so, subject to the following conditions:
    
     The above copyright notice and this permission notice shall be included in
     all copies or substantial portions of the Software.
    
     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,ARISING FROM,
     OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     THE SOFTWARE.
    }}
    

    She's FULL

    31896 bytes sent                  
    

    Still didn't work, I think its just too slow, or it probably needs to be buffered into ram or something.

      repeat i from 0 to n    
        NextCnt+=dcnt   ' need this to be 5000 for 16KSPS   @ 80 MHz
        waitcnt(NextCnt)
        Addy := $7000 + N
        FRQA:=(eeprom.Readbyte(SCL0, $A0, Addy))<<24
    
        'FRQA:=(byte[pWav+i])<<24
        FRQB:=FRQA
    

    I have one of these 23k256's, i should try it.
    This means to do multichannel sound I need to use a few 23k256's? or other size.
    https://www.microchip.com/wwwproducts/en/23K256

    I suspect I am just reading the eeprom data wrong, but i can't tell if its simply too slow for that audio loop, i don't know enough to know.

    Getting a Whistle to work on my train shouldn't be this hard,...

    I just wanna annoy the hell out of my neighbor with train whistles all night long, and this damn eeprom is too slow.

    I installed a studio monitor in one of my boxcars and turned the volume all the way up, the chuffing is really loud.
    I was considering installing a subwoofer speaker WALL, with a 10,000watts of amps so the entire neighborhood can enjoy the rumbling of the chuff.

    Oh wait, I can just use another prop and eeprom for every 256k of sound I want and trigger on a pin, no need for serial.
    That activity board is getting short on pins but I think i have 3 left.
    1 for the whisle,
    1 for a bell
    1 for stack talk.

    At least adding 3 props will get me sound, definetly not ideal, but it will get me my sounds.
    Since the data is in ram i can do multichannels if I can fit multiple waves in a single eeprom.

    I may try using multiple sram chips and loading it with multiple eeproms at boot instead of doing multiple props with one eeprom each.

    Since my engine prop uses tons of code and cogs, it seems best to do all sounds on another prop, no matter what data storage method I use.

    Until I give the sram a try, i am stuck with one prop one eeprom per 256kb of audio data.
    ...
    ....
    I must have my annoying whistle, so I will just install another prop and eeprom, and wire it to the audio out line on the activity board,
    the activity boards audio hardware is better than a prop, but oh well, i will use one of the generic audio circuits posted in the forums.
    If I used multiple sram chips, I would imagine the overhead to access that data would be much less than a sd card.

    Perhaps the best would be to load the sounds into SRAM from a sd card!!!!

    Or if someone else has a solution!

  • Clock LoopClock Loop Posts: 2,069
    edited 2021-04-12 12:34

    I had my tender to engine wire connector wear out and one of the motor leads started to short with the other,
    this caused my motor drive to go into a fault condition which I was able to see on the telnet putty output.

    When this happened, my code will not let the engine do anything but 0 pwm, and the status for the drive stays error until the prop is reprogrammed, or the power is cycled.

    So make sure you wire up the drive status pin! It could save you some time!

    This drive is pretty robust, I would recommend it to anyone who wants to drive a motor!
    https://www.parallax.com/product/dual-motor-driver-mc33926/

    edit: it seems that even an intermittent motor connection will error the drive, that must mean it has some kinda back emf detection?

  • Clock LoopClock Loop Posts: 2,069
    edited 2021-04-13 23:28

    I was able to initially fit 22 or so ounces of led weights into the engine.
    I switchted to 1/2 ounce led weights and was able to fit more in, so I now have 32.5 ounces extra added to the original bachmann engine.

    The extra weight did use more current on the motor, but not by that much at all, before I was doing alot of wheel slip and now I see none.

    So tractive effort is a real world thing! You can add weight to your engine and it won't necessarily need much more power to get less wheel slip.
    You gain way more pulling ability than you use in actual amperage. This would translate to loss of boiler pressure for steamers.
    They can add more weight and not really need that much more pressure.
    Its BIG.

    Time to add more cars.

    I don't think I can get any more weight on that engine unless I start filling up under the boiler, and not much. But the weights look like cylinders so painting them black and placing them along the underside of the boiler might just look like a pipe, or they could go inside a black paper tube.

  • Hey, do I see a diesel electric a few cars down. We have one of those in are museum here in Green Bay.

    Mike

  • Clock LoopClock Loop Posts: 2,069
    edited 2021-04-14 13:09

    @iseries said:
    Hey, do I see a diesel electric a few cars down. We have one of those in are museum here in Green Bay.

    Mike

    Yea those UP bums treat their bigboy and challenger like super mint, so they push them almost all the time and just make smoke for the 'kidz.

    I want to hear the big boy on an incline, alone with 3/4 its max load.
    And I do mean HEAR.

    Stack talk. @2:25 and @ 2:40 You will never hear their shiny new precious up 4014 talk like that. It would probably break, lol.

    Once I get stack talk going somehow, I will have more than the new 4014, lol, with a sd card and a 23k256 or something.
    I haven't tested the 23k256 yet, I have it working, but I think the 8-bit player i use has limits on what you can cram into its fast loop.
    This stuff is beyond my experience, I am treading water.

Sign In or Register to comment.