fiduciary

Author Topic: TeensySaber Software Discussion  (Read 3245 times)

0 Members and 1 Guest are viewing this topic.

Online profezzorn

  • Master Force User
  • *****
  • Posts: 587
  • May the source be with you.
    • Hubbe's Corner
Re: TeensySaber Software Discussion
« Reply #105 on: September 12, 2017, 10:17:14 AM »
oh that sounds amazing:) So what is the main difference between the V2 and V3 board? Amp?

3W digital amplifier and slightly smaller (see here: Teensy Saber Electronics V3)

Quote
Yes, I dont want to share with anyone just myself and other sabers I build. I want to be able to remove some of the electronics to make it easier for programming and battery swapping. I took a note from your book and was going to use pogo pins and some perf board as a prototype. The button assembly and blade connector will be fixed in the hilt and the pommel will push the electronics into that assembly completing the circuit.

Pogo pins might be overkill. Might be better to just have an aviation connector at the top of the chassis mate with a connector inside the hilt. The problem is that both pogo pins and connectors take quite a lot of space.

I've seen something inside cell phones that might work though: It's kind of like a pogo pin, but it's small. flat and surface mounted. You could put some of those on a circuit board, and then have another circuit board with circular contact areas to connect to. The whole thing would be maybe 1/4" thick. Then it's just a matter of figuring out the mounting mechanics.

This part is probably too expensive, but it's an example of the kind of thing I was thinking:
815-22-001-30-001101 Mill-Max Manufacturing Corp. | Connectors, Interconnects |

Offline gmcivor

  • Force User
  • ***
  • Posts: 116
  • Do or do not. There is no try.
Re: TeensySaber Software Discussion
« Reply #106 on: September 15, 2017, 01:50:28 PM »
They might, but worth a try. I found some half inch long ones which make it pretty compact. and I have quite a bit of space inside my chassis design. Yes, you could use an aviation connector, but it would be hard to pull the bottom chassis out. You would need to 3d print a strong tab to pull on that didn't interfere with anything. Those look promising, but at almost 5 dollars a piece it would be expensive to make.

Yeah, mounting mechanics is what I am playing with right now. Hopefully, I can have a prototype soon and build some more V2 boards so i can buy some V3 :)

Regards,

GMcIvor

Offline arusiasotto

  • No Force
  • *
  • Posts: 11
  • Um...Hello?
Re: TeensySaber Software Discussion
« Reply #107 on: September 20, 2017, 07:57:58 AM »
So I've got the hardware built, and I am a out to embark on the software side. What does the file structure for sound fonts loom like? Just a folder on the root of the card?
Next question is setti g up my blade. I'm using a Cree XM-L. So I would need to change the my_saber1.h generated configuration such that is using the CreeXPE2White, red, blue, and green?

Online profezzorn

  • Master Force User
  • *****
  • Posts: 587
  • May the source be with you.
    • Hubbe's Corner
Re: TeensySaber Software Discussion
« Reply #108 on: September 20, 2017, 09:13:47 AM »
So I've got the hardware built, and I am a out to embark on the software side. What does the file structure for sound fonts loom like? Just a folder on the root of the card?
Yes, just make a directory, put the font in it, and then update the first entry in one of your presets to name that directory.
Just remember that teensysaber is currently limited to 8.3-character file and directory names.

Quote
Next question is setti g up my blade. I'm using a Cree XM-L. So I would need to change the my_saber1.h generated configuration such that is using the CreeXPE2White, red, blue, and green?

Sounds like you should make a new LED class. (Because I don't have one for XM-L yet) Find CreeXPE2White in lightsaber.ino, duplicated it, call it CreeXML and follow the instructions.
If you need help, I can create the class for you tonight.

Note that you'll also need to change the blade configuration (in the preset array) to use all white colors.



Offline arusiasotto

  • No Force
  • *
  • Posts: 11
  • Um...Hello?
Re: TeensySaber Software Discussion
« Reply #109 on: September 20, 2017, 04:41:02 PM »
So here is what I think I need to be doing?

Code: [Select]
struct CreeXMLWhite {
  static constexpr float MaxAmps = 1.0;
  static constexpr float MaxVolts = 3.7;
  static constexpr float P2Amps = 0.7;
  static constexpr float P2Volts = 3.1;
  static constexpr float R = 0.0;
  static const int Red = 255;
  static const int Green = 255;
  static const int Blue = 255;
};

struct CreeXMLRed {
  static constexpr float MaxAmps = 1.0;
  static constexpr float MaxVolts = 2.6;
  static constexpr float P2Amps = 0.7;
  static constexpr float P2Volts = 2.25;
  static constexpr float R = 0.0;
  static const int Red = 255;
  static const int Green = 0;
  static const int Blue = 0;
};

struct CreeXMLBlue {
  static constexpr float MaxAmps = 1.0;
  static constexpr float MaxVolts = 3.7;
  static constexpr float P2Amps = 0.7;
  static constexpr float P2Volts = 3.1;
  static constexpr float R = 0.0;
  static const int Red = 0;
  static const int Green = 0;
  static const int Blue = 255;
};

struct CreeXMLGreen {
  static constexpr float MaxAmps = 1.0;
  static constexpr float MaxVolts = 3.9;
  static constexpr float P2Amps = 0.7;
  static constexpr float P2Volts = 3.3;
  static constexpr float R = 0.0;
  static const int Red = 0;
  static const int Green = 255;
  static const int Blue = 0;
};
};

Would this be right, and then I have to make a preset that uses all 4 values, as this is an RGBW led?

Then the Blade config that has all 4 leds.
Code: [Select]
BladeConfig blades[] = {
 { 0, SimpleBladePtr<CreeXMLRed, CreeXMLGreen, CreeXMLBlue, CreeXMLWhite>(), CONFIGARRAY(presets) },
};
#endif

now the presets are going to difficult. Maybe it might be easier to set the White LED as a second blade and alster it with the presets?
I may have to define some led setups that are RGBW instead of RGB?

EDIT: So I found the color class. Debating if I should fuss with it, so that I can control the level of White light.
« Last Edit: September 20, 2017, 06:32:16 PM by arusiasotto »

Online profezzorn

  • Master Force User
  • *****
  • Posts: 587
  • May the source be with you.
    • Hubbe's Corner
Re: TeensySaber Software Discussion
« Reply #110 on: September 20, 2017, 06:51:56 PM »
So here is what I think I need to be doing?

Code: [Select]
struct CreeXMLWhite {
  static constexpr float MaxAmps = 1.0;
  static constexpr float MaxVolts = 3.7;
  static constexpr float P2Amps = 0.7;
  static constexpr float P2Volts = 3.1;
  static constexpr float R = 0.0;
  static const int Red = 255;
  static const int Green = 255;
  static const int Blue = 255;
};

struct CreeXMLRed {
  static constexpr float MaxAmps = 1.0;
  static constexpr float MaxVolts = 2.6;
  static constexpr float P2Amps = 0.7;
  static constexpr float P2Volts = 2.25;
  static constexpr float R = 0.0;
  static const int Red = 255;
  static const int Green = 0;
  static const int Blue = 0;
};

struct CreeXMLBlue {
  static constexpr float MaxAmps = 1.0;
  static constexpr float MaxVolts = 3.7;
  static constexpr float P2Amps = 0.7;
  static constexpr float P2Volts = 3.1;
  static constexpr float R = 0.0;
  static const int Red = 0;
  static const int Green = 0;
  static const int Blue = 255;
};

struct CreeXMLGreen {
  static constexpr float MaxAmps = 1.0;
  static constexpr float MaxVolts = 3.9;
  static constexpr float P2Amps = 0.7;
  static constexpr float P2Volts = 3.3;
  static constexpr float R = 0.0;
  static const int Red = 0;
  static const int Green = 255;
  static const int Blue = 0;
};
};

Would this be right, and then I have to make a preset that uses all 4 values, as this is an RGBW led?

Then the Blade config that has all 4 leds.
Code: [Select]
BladeConfig blades[] = {
 { 0, SimpleBladePtr<CreeXMLRed, CreeXMLGreen, CreeXMLBlue, CreeXMLWhite>(), CONFIGARRAY(presets) },
};
#endif

now the presets are going to difficult. Maybe it might be easier to set the White LED as a second blade and alster it with the presets?
I may have to define some led setups that are RGBW instead of RGB?

EDIT: So I found the color class. Debating if I should fuss with it, so that I can control the level of White light.


I'm confused. As far as I can tell, Cree XM-L only comes in various tones of white. Do you have a data sheet for these LEDs?
Also, assuming that the data you entered above is correct, I would recommend a 1-ohm resistor in series with the red channel. (Setting R=0 means no resistor.)
The presets shouldn't be difficult. You can just use RGB colors with your RGB star, the white channel will just be min(R, G, B), which should work pretty ok. Try it and let me know if it works for you or not.

Offline arusiasotto

  • No Force
  • *
  • Posts: 11
  • Um...Hello?
Re: TeensySaber Software Discussion
« Reply #111 on: September 20, 2017, 07:04:19 PM »
You are likely seeing the XM-L2 which is indeed a simple white LED. Here is the official data sheet.
http://www.cree.com/led-components/media/documents/XLampXML_Color.pdf
It is a 4 die chip.
And yes, I had already noticed I hadn't put in the R value on Red.
And by Min RGB, that means if any color is set to 0, the white won't turn on?
« Last Edit: September 20, 2017, 07:08:56 PM by arusiasotto »

Online profezzorn

  • Master Force User
  • *****
  • Posts: 587
  • May the source be with you.
    • Hubbe's Corner
Re: TeensySaber Software Discussion
« Reply #112 on: September 20, 2017, 08:34:49 PM »
You are likely seeing the XM-L2 which is indeed a simple white LED. Here is the official data sheet.
http://www.cree.com/led-components/media/documents/XLampXML_Color.pdf
It is a 4 die chip.
And yes, I had already noticed I hadn't put in the R value on Red.
And by Min RGB, that means if any color is set to 0, the white won't turn on?

Yes, that's what it means.
If you want a little white, you can use a color like 30,30,255
This also turns on the red and green colors a little though, which is nice for brightness, but less nice for battery life.

I think you should set P2Amps to 0.35 for all the LEDs and fill in the typical forward voltage for P2Volts (2.25, 3.3, 3.1)
The MaxAmps is correctly set to 1.0 for all the dies. I think you should get the MaxVolts from the graph on page 4, which means ~2.7 volts for red, ~3.35 volts for white and blue and ~3.8 volts for green.
It would be even better to measure these things of course.

The white and blue LEDs should probably also have resistors at about 0.35 ohms, but it will probably work fine without.


Offline arusiasotto

  • No Force
  • *
  • Posts: 11
  • Um...Hello?
Re: TeensySaber Software Discussion
« Reply #113 on: September 21, 2017, 03:24:40 PM »
Alas, I can't seem to keep the Teensy powered long enough. I probably just melted 80$ of electronics together...

Online profezzorn

  • Master Force User
  • *****
  • Posts: 587
  • May the source be with you.
    • Hubbe's Corner
Re: TeensySaber Software Discussion
« Reply #114 on: September 21, 2017, 03:36:28 PM »
Ouch, that sucks, what happened?

Online profezzorn

  • Master Force User
  • *****
  • Posts: 587
  • May the source be with you.
    • Hubbe's Corner
Re: TeensySaber Software Discussion
« Reply #115 on: September 21, 2017, 09:18:10 PM »
You are likely seeing the XM-L2 which is indeed a simple white LED. Here is the official data sheet.
http://www.cree.com/led-components/media/documents/XLampXML_Color.pdf
It is a 4 die chip.
And yes, I had already noticed I hadn't put in the R value on Red.
And by Min RGB, that means if any color is set to 0, the white won't turn on?

Yes, that's what it means.
If you want a little white, you can use a color like 30,30,255
This also turns on the red and green colors a little though, which is nice for brightness, but less nice for battery life.

I think you should set P2Amps to 0.35 for all the LEDs and fill in the typical forward voltage for P2Volts (2.25, 3.3, 3.1)
The MaxAmps is correctly set to 1.0 for all the dies. I think you should get the MaxVolts from the graph on page 4, which means ~2.7 volts for red, ~3.35 volts for white and blue and ~3.8 volts for green.
It would be even better to measure these things of course.

The white and blue LEDs should probably also have resistors at about 0.35 ohms, but it will probably work fine without.

After re-reading the data sheet (and measuring the diagram on page 4 with a ruler), here is what I came up with:

Code: [Select]
struct CreeXMLRed {
  static constexpr float MaxAmps = 1.0;
  static constexpr float MaxVolts = 2.68;
  static constexpr float P2Amps = 0.35;
  static constexpr float P2Volts = 2.25;
  static constexpr float R = 1.0;
  static const int Red = 255;
  static const int Green = 0;
  static const int Blue = 0;
};

struct CreeXMLGreen {
  static constexpr float MaxAmps = 1.0;
  static constexpr float MaxVolts = 3.79;
  static constexpr float P2Amps = 0.35;
  static constexpr float P2Volts = 3.3;
  static constexpr float R = 0.0;
  static const int Red = 0;
  static const int Green = 255;
  static const int Blue = 0;
};

struct CreeXMLBlue {
  static constexpr float MaxAmps = 1.0;
  static constexpr float MaxVolts = 3.38;
  static constexpr float P2Amps = 0.35;
  static constexpr float P2Volts = 3.1;
  static constexpr float R = 0.32;
  static const int Red = 0;
  static const int Green = 0;
  static const int Blue = 255;
};

struct CreeXMLWhite {
  static constexpr float MaxAmps = 1.0;
  static constexpr float MaxVolts = 3.38;
  static constexpr float P2Amps = 0.35;
  static constexpr float P2Volts = 3.1;
  static constexpr float R = 0.32;
  static const int Red = 255;
  static const int Green = 255;
  static const int Blue = 255;
};


I'll add this to the next version of teensysaber.
Note that "maxvolts" should be the typical voltage at the maximum amps, not the absolute maximum possible voltage.

« Last Edit: September 21, 2017, 09:22:53 PM by profezzorn »