Thursday, January 28, 2016

New version 7 of the sound module based in Arduino for Loconet

I made some improvements to the existing version 6 of the sound and outputs module for Arduino, releasing last version 7. For those who didn't read old posts, this is a Loconet module (like any other from Digitrax, Uhlenbrock or any other brand) where you can upload sounds and assign an output number to each one. It has also 16 output pins that you can set up individually as puse output, continuous or with fading. Use of this pins is intended for illumination, putting Mosfets in between if you plan to connect more than 1 or 2 led in each output.

Configuration is done via LNCV programming. It's the same idea like CV in mobile decoders, but this is an invention from Uhlenbrock. In future versions I plan to change all the configuration system to SV variables, a mechanism more standard of Loconet and supported not only by one builder.

Arduino sketch of the Sound and Outputs Module can be downloaded here.
You can also download an Excel file with the definition of all LNCV variables to setup properly the module from here.

If you want to read a more extensive review of the old version 6, click here to read the old post.


New functionality in v.7


There is a restriction added, is that in this version you can only manage 30 sounds máximum and not as many as you want like in the previous version. The explanation to this is that now you can configure the volume of each of the individual sounds so I needed to put a limitation in the number of files to manage. You can also specify for each of the sounds the preference or type (normal or ambient sound), and if it has to be reproduced in loop until a new sound is played or stop output activated.

The sound type (normal or ambient sound) is used in the following way: if a sound is being played in the exact moment a new sound request arrives, and the requested new sound is ambient, petition is ignored. If the new sound is normal, the file being played is interrupted to start the new one. Let's imagine we have a train announcement (configured as normal) and a birds background sound (configured as ambient). If the birds sound is playing, the train announcement will interrupt the birds sound to be played. But it will not happen the same in the other way. No announcement will be interrupted to play a background sound.

There is also the possibility to set up an output number to play all music uploaded in random and loop mode, non stop.



I hope you like it and use it, and if you need any assistance do not hesitate to get in touch with me making a comment to this post or sending me an email.

4 comments:

  1. Hi Dani

    I would expect that if you choose one sound playing endles (512 ++) that sound would play further if it is broken by a non ambient sound but that does not work, do i do something wrong ?

    BR

    Jan va n de Borden
    Holland

    ReplyDelete
  2. Hi Dani

    I would expect that if you choose one sound playing endles (512 ++) that sound would play further if it is broken by a non ambient sound but that does not work, do i do something wrong ?

    BR

    Jan va n de Borden
    Holland

    ReplyDelete
    Replies
    1. Hello,

      When a sound is broken by a non ambient sound, it doesn't continue after the non ambient sound has finished. The MP3 shield used is not able to do that, so it's a hardware limitation. :(

      How it should work (I didn't tested all possible combinations) is:

      1) If MP3 is playing a file and you want to reproduce an ambient sound (volume[0-30]+256), the command is ignored
      2) If you play a normal sound (0-30), any sound being played is finished and the new sound is played

      A loop sound (volume[0-30]+512) is like a normal sound.

      Delete
  3. I didn't publish it yet, but you can try version 8. You can download it from github: https://github.com/ClubNCaldes/LNCVSoundOutput

    It has some improvements like individual intensity setting for each of the PWM outputs, sound plays automatically when you set it up to know exactly which one are you adjusting, and there is also an output number that can be assigned to play any of the ambient sounds randomly.

    You will have to setup LNCV again if you upload it in a previous version 7 as LNCV positions have changed.

    ReplyDelete