fiduciary

Author Topic: Announcing the Teensy Saber open source sound board  (Read 91551 times)

0 Members and 1 Guest are viewing this topic.

Offline profezzorn

  • Mining Colony Members
  • Master Force User
  • *
  • Posts: 901
  • May the source be with you.
    • Hubbe's Corner
Re: Announcing the Teensy Saber open source sound board
« Reply #75 on: January 27, 2017, 11:55:44 AM »
I want to be absolutely crysstal clear about what I implemented.

It uses a linear model to estimate the current over the LED, and reduces the duty cycle in proportion to how much over the max amps that estimate is.

Will this cause the FET to heat up? Technically, yes, but not really.
During PWM, we'll be transitioning from on to off 2000 times per second. Reading the datasheet from the FET I use on the V2 board, that transition takes about 20ns. If we assume that the FET were to absorb ALL the 3.7 watts that the LED might generate for during those 20ns, we get: 3.7 * 2E-9 * 2000 = 0.000148. Which means that for a 1-amp led the FET would have to dissippate an extra 150 microwatts, which is almost nothing.

However, I think you still need resistors in most cases, because LEDs are not linear, and the amps go up very quickly as the voltage goes up.
Take an white Cree XP-E2 as an example:

At 2.9 volts you get 350mA. At 3.05 volts you get 700mA. At 3.15 volts you get 1000mA.
This is roughly 300mA per 0.1 volts. So if we extrapolate, at 3.8 volts we would get about 3A.
I'm almost certain that the LED will not be 3 times brighter, but my math will assume that it is and set the PWM duty cycle to about 30%.
I have no idea what will happen if you do that. It may work perfectly, or it may not.
I think what I will do in the future is that I will use a smaller nominal voltage (say 3.5 volts) when I calculate my resistors, and let the PWM code make up for the rest. Futher experimentation is needed to decide if resitors can be done away with completely or not.

Offline profezzorn

  • Mining Colony Members
  • Master Force User
  • *
  • Posts: 901
  • May the source be with you.
    • Hubbe's Corner
Re: Announcing the Teensy Saber open source sound board
« Reply #76 on: January 27, 2017, 01:49:31 PM »
Apparently CREE has studied the effects of driving your LED like this:

http://www.cree.com/~/media/Files/Cree/LED%20Components%20and%20Modules/XLamp/XLamp%20Application%20Notes/XLampPulsedCurrent.pdf

TL;DR; it works, but reduces efficiency and may reduce the lifetime of the LED.
For practical purposes, it seems like it's ok to do this for currents up to ~1.5x the rated current. And it's better than not doing it (meaning that you drive the LED at 1.5 the current all the time.)

Note that the datasheets will not say what voltage you can handle to get 1.5x the rated current, so you either have to measure or extrapolate to figure that out.

Once I/we have tested this some more, I will write up some instructions/recommendations and put on my site.

Offline G3DI

  • No Force
  • *
  • Posts: 2
  • Um...Hello?
Re: Announcing the Teensy Saber open source sound board
« Reply #77 on: January 29, 2017, 10:29:20 PM »
Thanks for sharing your design. It's making my job of building a light saber for my daughter much easier. I'm using the Teensy 3.5 with your code, and it's working with just a few minor changes.

I am experiencing an issue when using polyphonic fonts. The background hum goes away if I swing the saber for more than a few seconds. Clashes don't seem to cause the hum to stop, and it will hum forever if the saber remains still. When the hum does disappear, the other sounds (swing / clash) still continue to work. Do you have any idea as to what might cause this? Also, when using polyphonic fonts do I need to remove the monophonic fonts?

Regarding the discussion on PWMing the LED, have you considered putting an inductor in series with the LED? (A parallel diode would also be required to allow the current to recirculate when the FET turns off.) With the inductor sized properly, the LED would see a lower continuous current with a bit of ripple on top of it rather than alternating between zero current and peak current. As a bonus, per the Cree paper you linked to earlier, the LED efficiency should increase. Note that the switching frequency would need to be increased at least into the tens of kHz range to keep the inductor a reasonable size. I might try this with my daughter's saber.


Offline profezzorn

  • Mining Colony Members
  • Master Force User
  • *
  • Posts: 901
  • May the source be with you.
    • Hubbe's Corner
Re: Announcing the Teensy Saber open source sound board
« Reply #78 on: January 29, 2017, 11:57:18 PM »
I am experiencing an issue when using polyphonic fonts. The background hum goes away if I swing the saber for more than a few seconds. Clashes don't seem to cause the hum to stop, and it will hum forever if the saber remains still. When the hum does disappear, the other sounds (swing / clash) still continue to work. Do you have any idea as to what might cause this? Also, when using polyphonic fonts do I need to remove the monophonic fonts?

I shall have to investigate this.
It might be helpful to know more about the font you're using.
Normally, each font should live it's own directory on the sdcard, and it's fine to have both polyphonic and monophonic fonts. (Just not in the *same* directory...)

Quote
Regarding the discussion on PWMing the LED, have you considered putting an inductor in series with the LED? (A parallel diode would also be required to allow the current to recirculate when the FET turns off.) With the inductor sized properly, the LED would see a lower continuous current with a bit of ripple on top of it rather than alternating between zero current and peak current. As a bonus, per the Cree paper you linked to earlier, the LED efficiency should increase. Note that the switching frequency would need to be increased at least into the tens of kHz range to keep the inductor a reasonable size. I might try this with my daughter's saber.

Hmm, it's an interesting idea. I'm trying to figure out how to code for it, because we would want to adjust the PWM rate to adjust the voltage and the PWM duty cycle to control the brightness. (Not sure if there are enough timers in the teensy to have per-pin PWM frequencies...)

Also, there are options for as to where the inductors would go. They could either go in the hilt, or they could go in the blade adapter. (In a TeensySaber V2, they could potentially go on the board) However, if they go in the hilt, they would also be in-line when I hook up a neopixel blade, which can eat as much as 17 amps, so the inductors would have to be pretty beefy.  Putting them in the blade adapter might be a better option, as they would not need to handle as much current.

Another option might be to use parallel capacitors instead of serial inductors. The result should be the same, but since the current doesn't go through the capacitors, they don't have to be sized to handle 17A, and perhaps that could be in the hilt and/or on the TeensySaberV2 board.

Of course, if you just add a resistor and a feedback loop, it's a proper constant-current drive system, which would be nice....

Offline G3DI

  • No Force
  • *
  • Posts: 2
  • Um...Hello?
Re: Announcing the Teensy Saber open source sound board
« Reply #79 on: January 30, 2017, 11:29:26 PM »
It might be helpful to know more about the font you're using.
Normally, each font should live it's own directory on the sdcard, and it's fine to have both polyphonic and monophonic fonts. (Just not in the *same* directory...)
I am using the Star Wars Pack by joe93barlow at freesound.org. On the SD card I put the following folders and files:
  -- font01
      -- blst
         -- blst01.wav
         -- blst02.wav
         -- blst03.wav
         -- blst04.wav
         -- blst05.wav
      -- clsh
         -- clsh01.wav
         -- clsh02.wav
         -- clsh03.wav
      -- hum
         -- hum01.wav
      -- in
         -- in.wav
      -- out
         -- out.wav
      -- swng
         -- swng01.wav
         -- swng02.wav
         -- swng03.wav
         -- swng04.wav
         -- swng05.wav
         -- swng06.wav
         -- swng07.wav
         -- swng08.wav
         -- swng09.wav

Also, after losing the background hum, when I turn the saber off the 'hum' clip plays once instead of the 'blade off' clip.

Do you have any recommendations for fonts?

Quote
Hmm, it's an interesting idea. I'm trying to figure out how to code for it, because we would want to adjust the PWM rate to adjust the voltage and the PWM duty cycle to control the brightness. (Not sure if there are enough timers in the teensy to have per-pin PWM frequencies...)
I think the PWM rate could remain constant. The duty cycle will vary the current in the LED, and as long as the duty cycle is not 100% the LED will not see the full battery voltage.

The LED dimmer circuit 'f' on newbielink:http://www.opensourcepartners.nl/~costar/leddimmer/ [nonactive] is what I'm thinking about, but I would put the transistor between ground and the LED so it can be driven directly from the teensy.

Quote
Of course, if you just add a resistor and a feedback loop, it's a proper constant-current drive system, which would be nice....
It looks like the teensy has 3 analog comparaters that can connect to the analog inputs. I have not looked into the details but maybe you could use them with a current sense resistor for cycle-by-cycle current limiting. That could be a simple constant-current drive on your TeensySaberV2...

Offline profezzorn

  • Mining Colony Members
  • Master Force User
  • *
  • Posts: 901
  • May the source be with you.
    • Hubbe's Corner
Re: Announcing the Teensy Saber open source sound board
« Reply #80 on: January 30, 2017, 11:58:15 PM »

Also, after losing the background hum, when I turn the saber off the 'hum' clip plays once instead of the 'blade off' clip.


That is a very good hint, I haven't had time to debug yet, but I think that will help a lot.

Quote
Do you have any recommendations for fonts?

Not really, fonts are very personal, and depends very much on what feels good for your saber.
I tend to go for sounds from the movies, but I really haven't decided what font(s) I like best.

Quote
I think the PWM rate could remain constant. The duty cycle will vary the current in the LED, and as long as the duty cycle is not 100% the LED will not see the full battery voltage.

The LED dimmer circuit 'f' on Highly Efficient 0-100% LED Dimmer is what I'm thinking about, but I would put the transistor between ground and the LED so it can be driven directly from the teensy.

It's definitely interesting. I think I'm going to keep it simple for now. The cree paper indicates that keeping it simple isn't as bad for the LEDs as I thought it would be, and using PWM to keep the leds from overheating should work fairly well.  As for efficiency, I think that you loose a few percent of efficiency when the LED is over-volted, but if you add an inductor/capacitor and up the PWM frequency, you loose a few percent that way too.

A constant-current setup would be really nice, but I'm not sure it's worth the extra complexity and components.

Quote
Quote
Of course, if you just add a resistor and a feedback loop, it's a proper constant-current drive system, which would be nice....
It looks like the teensy has 3 analog comparaters that can connect to the analog inputs. I have not looked into the details but maybe you could use them with a current sense resistor for cycle-by-cycle current limiting. That could be a simple constant-current drive on your TeensySaberV2...

Another good idea. Although probably overkill since the load isn't going to be varying wildly.
Probably easier to just average over time and just adjust the PWM accordingly.

Offline twing207

  • No Force
  • *
  • Posts: 6
  • Um...Hello?
Re: Announcing the Teensy Saber open source sound board
« Reply #81 on: February 01, 2017, 01:31:24 PM »
What is the purpose of the LiPower board? I can't see why it is *needed*.

Offline profezzorn

  • Mining Colony Members
  • Master Force User
  • *
  • Posts: 901
  • May the source be with you.
    • Hubbe's Corner
Re: Announcing the Teensy Saber open source sound board
« Reply #82 on: February 01, 2017, 01:42:01 PM »
When I built my V1 setup, I just followed the guidelines for the prop shield, which says to provide 5V.
Now that I know hwo everything works better, I agree: It's not required, but there are a few caveats:
1. Once the battery goes low enough, the 3.3v power supply will start to drop. The teensy itself can handle this, but it's less clear if the other components that use 3.3 volts can: sd card and IMU.
2. The amplifier will keep working, but it will produce a lot less sound at lower voltages.

Right now I'm considering an upgrade for the TeensySaber V2 design which would replace the power booster with one that can also handle higher input voltages, (up to 12 volts) which would make two-battery setups very easy.

Offline Zephisto

  • No Force
  • *
  • Posts: 10
  • Um...Hello?
Re: Announcing the Teensy Saber open source sound board
« Reply #83 on: February 04, 2017, 05:56:42 AM »
ohh this will be fun

Offline theholyduck

  • No Force
  • *
  • Posts: 40
  • Um...Hello?
Re: Announcing the Teensy Saber open source sound board
« Reply #84 on: February 04, 2017, 02:09:30 PM »
I had a little bit of an issue with a wire shortingand accidentally sending the power of my unprotected 18650 directly through my teensy and letting out the magic smoke (whoopse) The teensysaber was a bit too bulky to really fit inside my application anyway so i went and ordered a DIYino. but i am still interested in your v2 board when its ready for sale. i really liked the tensy saber right until i fried it.

Offline profezzorn

  • Mining Colony Members
  • Master Force User
  • *
  • Posts: 901
  • May the source be with you.
    • Hubbe's Corner
Re: Announcing the Teensy Saber open source sound board
« Reply #85 on: February 04, 2017, 11:24:02 PM »
That's a darn shame. I managed to hook up my battery backwards a few times, which made both the teensy and the LiPower VERY hot, but did not seem to cause any permanent damage. The teency 3.2 is 5v tolerant, which makes it hard to fry it with a 3.7-volt battery, but it is possible.

If everything goes well, I will have a small amount of V2s to sell in a couple of weeks.

Offline theholyduck

  • No Force
  • *
  • Posts: 40
  • Um...Hello?
Re: Announcing the Teensy Saber open source sound board
« Reply #86 on: February 05, 2017, 04:54:21 PM »
Im pretty sure its dead. there i s a dead short between gnd/agnd/3.3v and i cant find any solder bridges or solder mask issues im pretty sure i killed the power regulator part of it.

Offline Lolwel21

  • No Force
  • *
  • Posts: 10
  • Bridging mechanical and organic
A proposal for swing synthesis
« Reply #87 on: February 17, 2017, 11:13:39 PM »
The following method can be implemented with only slight modifications to the already implemented audio system. As a proof of concept, I made a Processing sketch that demos the technique (from scratch) in less than 2 hours using only Minim's most basic features (volume control, looping, and file playback).

Disclaimer: The following technique will require serious modification of all sound-fonts used.
Namely, the swing sound needs to be turned into a (non-pulsating) looping sound, much like the idling hum sound. More details on that later.

Basically, the operating system will constantly loop both the humming and the swinging sounds. When the gyroscope (and/or accelerometer) detects blade motion, the program mixes the swinging sound in and ducks the hum.

As the blade reaches its max speed (determined by sensitivity), the swing sound is amplified to the point of clipping, resulting in that classic, clipped sound fast-moving lightsaber blades make. At this point, the idle hum is at 0 volume.

To enhance the sound when twirling the lightsaber, I suggest that as the blade approaches straight up, the 'sensitivity' is reduced, resulting in a desirable pulsating sound when you twirl the lightsaber (Vertical orientation sensed either using the magnetometer or the accelerometer).

What do you think? How easy would this technique be to implement? Would sound-font makers consider the additional difficulty worth it?

Offline profezzorn

  • Mining Colony Members
  • Master Force User
  • *
  • Posts: 901
  • May the source be with you.
    • Hubbe's Corner
Re: Announcing the Teensy Saber open source sound board
« Reply #88 on: February 17, 2017, 11:34:00 PM »
Interesting! This would be relatively easy to implement in the teensysaber code.
It would be enough to simply name the swings differently to tell the code that we need to play them differently.
We wouldn't have to modify all sound fonts, this would just be one more way to make sound fonts.

I can try putting it in the teensysaber code this weekend. Access to an appropriately looped font and the processing sketch you made would make it quicker and easier. :)

Offline Lolwel21

  • No Force
  • *
  • Posts: 10
  • Bridging mechanical and organic
Re: Announcing the Teensy Saber open source sound board
« Reply #89 on: February 18, 2017, 08:50:33 AM »
I'd love to! However, I'm a new member, and haven't figured out how to attach something yet. I'll just link to a Google Drive of the Zipped project I guess...
I've already packed the sound files into the Processing sketch, and have set it up so that you just move the mouse cursor around to see how the swing works! I haven't figured out how to do the whole clipping effect with Minim, but oh well. That would be much easier to do on the Teensy than it would in Minim.

Just a note, the sound-font I made is makeshift (compiled from online resources), and mostly the swing and maybe the hum will  be useful.

Here it is! Lightsaber_Motion_Test.zip - Google Drive

 

retrousse