fiduciary

Author Topic: TeensySaber Software Discussion  (Read 67097 times)

0 Members and 2 Guests are viewing this topic.

Offline spearson

  • No Force
  • *
  • Posts: 20
  • Um...Hello?
Re: TeensySaber Software Discussion
« Reply #300 on: February 10, 2018, 02:24:22 PM »
If I wanted to make a battery indicator blade style, say a gradient from red to yellow to green, but the blade only lights up the percentage of voltage between 4.2 and 2.7, is the gradient class a good starting point?

I'm not using charging through the blade and am just looking for an easy way of seeing the voltage left.

Offline profezzorn

  • Mining Colony Members
  • Master Force User
  • *
  • Posts: 901
  • May the source be with you.
    • Hubbe's Corner
Re: TeensySaber Software Discussion
« Reply #301 on: February 10, 2018, 02:52:03 PM »
If I wanted to make a battery indicator blade style, say a gradient from red to yellow to green, but the blade only lights up the percentage of voltage between 4.2 and 2.7, is the gradient class a good starting point?

I'm not using charging through the blade and am just looking for an easy way of seeing the voltage left.

I would suggest starting with the StyleCharging. (Which kind of does what you want already...)

Offline miib123

  • No Force
  • *
  • Posts: 20
  • Um...Hello?
Re: TeensySaber Software Discussion
« Reply #302 on: February 11, 2018, 09:06:33 AM »
Voltage after booster is exactly 5V, and the battery is around 3.7V (checked by multimeter). Battery voltage, measured with multimeter is not changing like in serial monitor.

Battery is protected, cause it contains protecting pcb under the tab. The next thing i should do is to buy a new high current unprotected one.

Is this one suitable for this project?

100% Genuine Efest IMR 18650 BATTERY HIGH DRAIN 3.7v 3000mAh 35A Li-Mn Flat top

How much does current this lihtsaber drain?

Offline profezzorn

  • Mining Colony Members
  • Master Force User
  • *
  • Posts: 901
  • May the source be with you.
    • Hubbe's Corner
Re: TeensySaber Software Discussion
« Reply #303 on: February 11, 2018, 09:43:48 AM »
Voltage after booster is exactly 5V, and the battery is around 3.7V (checked by multimeter). Battery voltage, measured with multimeter is not changing like in serial monitor.

Battery is protected, cause it contains protecting pcb under the tab. The next thing i should do is to buy a new high current unprotected one.

Is this one suitable for this project?

100% Genuine Efest IMR 18650 BATTERY HIGH DRAIN 3.7v 3000mAh 35A Li-Mn Flat top

How much does current this lihtsaber drain?

10A should be enough, and if you measured it, I doubt the battery is the problem.
I don't know about this battery in particular, but IMR is generally a good thing for unprotected batteries.

Offline profezzorn

  • Mining Colony Members
  • Master Force User
  • *
  • Posts: 901
  • May the source be with you.
    • Hubbe's Corner
Re: Error notifications
« Reply #304 on: February 11, 2018, 10:41:10 AM »
profezzorn, I've been thinking and playing around a bit with error notifications.

Currently there are 3-4 errors that have talkie voice notifications. While it's cool to have voice messages with a pretty low memory footprint, they don't sound very good (and are often hard to make out) and the message itself is not exactly what the error is (ie Bank Open means a file was not found).

I wondered about putting recorded audio messages in program memory.  Paul Stoffgren (Mr. Teensy) has done some work on this. Paul estimated that you could put 20 seconds of audio in program memory of a Teensy 3.2. I made 4 error messages using a test-to-speech website and came up with 4 seconds of total audio, so that would take 1/5 of program memory. Is this a direction you think is worth pursuing? The plus side is the audio error messages would sound better and be exactly what you want, but is it worth 1/5 of the program space? Let me know what you think.

Another option would be to put error audio files on the SD card. Of course this doesn't work for SD card or file errors. Perhaps beeps could be used if the SD card can't be read (ie 1 beep means low battery, 2 beeps means no SD card, 3 beeps means file not found, 4 beeps means bad blade). Or maybe just use beeps and no voice messages. Again, your thoughts?

Almost forgot to reply to this...
Let le's do some Math (tm).

We have 256kB of ROM. For error messages, phone quality would be sufficient, which is 8-bit 8kHz audio, or 8 kb / s,  256 / 8 = 32 seconds of audio.
I'd feel silly if I didn't apply some sort of compression to that though. A simple linear-predictive-encoding can double the amount of audio with relatively little loss in quality, which means 64 seconds of audio, or 4kb / s.
We probably only need 10 seconds of audio though, which would take up ~40kb.  40kb is not that much, but I can pretty much guarantee that it'll be the first thing to go if we start running low on space.

Another alternative would be to simply generate new error messages using the current speech synthesizer. The original talkie script comes with a matlab script that is supposed to be able to generate talkie data. Maybe it's possible to tweak that a little to make it generate higher quality. (Like, maybe by upping the sampling rate to 11kHz)

Offline miib123

  • No Force
  • *
  • Posts: 20
  • Um...Hello?
Re: TeensySaber Software Discussion
« Reply #305 on: February 11, 2018, 12:04:25 PM »
If i change the resistor identify value from default 7800 (WS2811 string blade) to my actually 56 (ohm), it fails to turn on the LEDs and serial monitor gives me this:

Welcome to TeensySaber, type 'help' for more info.
Accel setup ... Failed.Gyro setup ... Failed.
Accel setup ... Failed.Accel setup ... Failed.Accel setup ... Failed.Accel setup ... Failed.

I choosed this resistor based on your cketch (50ohm +/-5%). I'm using only one blade.


Offline profezzorn

  • Mining Colony Members
  • Master Force User
  • *
  • Posts: 901
  • May the source be with you.
    • Hubbe's Corner
Re: TeensySaber Software Discussion
« Reply #306 on: February 11, 2018, 12:12:37 PM »
If i change the resistor identify value from default 7800 (WS2811 string blade) to my actually 56 (ohm), it fails to turn on the LEDs and serial monitor gives me this:

Welcome to TeensySaber, type 'help' for more info.
Accel setup ... Failed.Gyro setup ... Failed.
Accel setup ... Failed.Accel setup ... Failed.Accel setup ... Failed.Accel setup ... Failed.

I choosed this resistor based on your cketch (50ohm +/-5%). I'm using only one blade.

Wait, changing the blade ID resistor makes i2c communication fail??? (or does that happen either way?)
56 is far to low to use for a WS2811 blade identifier. It might be useful as a current limiter on the data line though.
Normal recommendations is 100-300 ohm for the current limiter and 2k to 100k for the blade ID.
On a non-neopixel blade, lower blade IDs are ok.

Where did I recommend 50 ohms? If that's what I did, I should fix that....

Offline miib123

  • No Force
  • *
  • Posts: 20
  • Um...Hello?
Re: TeensySaber Software Discussion
« Reply #307 on: February 11, 2018, 12:23:00 PM »
If i change the resistor identify value from default 7800 (WS2811 string blade) to my actually 56 (ohm), it fails to turn on the LEDs and serial monitor gives me this:

Welcome to TeensySaber, type 'help' for more info.
Accel setup ... Failed.Gyro setup ... Failed.
Accel setup ... Failed.Accel setup ... Failed.Accel setup ... Failed.Accel setup ... Failed.

I choosed this resistor based on your cketch (50ohm +/-5%). I'm using only one blade.

Wait, changing the blade ID resistor makes i2c communication fail??? (or does that happen either way?)
56 is far to low to use for a WS2811 blade identifier. It might be useful as a current limiter on the data line though.
Normal recommendations is 100-300 ohm for the current limiter and 2k to 100k for the blade ID.
On a non-neopixel blade, lower blade IDs are ok.

Where did I recommend 50 ohms? If that's what I did, I should fix that....

Sorry, maybe i understand it the wrong wrong way. This is the resistor, i took it in consideration:


« Last Edit: February 11, 2018, 12:29:57 PM by profezzorn »

Offline profezzorn

  • Mining Colony Members
  • Master Force User
  • *
  • Posts: 901
  • May the source be with you.
    • Hubbe's Corner
Re: TeensySaber Software Discussion
« Reply #308 on: February 11, 2018, 12:30:14 PM »
If i change the resistor identify value from default 7800 (WS2811 string blade) to my actually 56 (ohm), it fails to turn on the LEDs and serial monitor gives me this:

Welcome to TeensySaber, type 'help' for more info.
Accel setup ... Failed.Gyro setup ... Failed.
Accel setup ... Failed.Accel setup ... Failed.Accel setup ... Failed.Accel setup ... Failed.

I choosed this resistor based on your cketch (50ohm +/-5%). I'm using only one blade.

Wait, changing the blade ID resistor makes i2c communication fail??? (or does that happen either way?)
56 is far to low to use for a WS2811 blade identifier. It might be useful as a current limiter on the data line though.
Normal recommendations is 100-300 ohm for the current limiter and 2k to 100k for the blade ID.
On a non-neopixel blade, lower blade IDs are ok.

Where did I recommend 50 ohms? If that's what I did, I should fix that....

Sorry, maybe i understand it the wrong wrong way. This is the resistor, i took it in consideration:





First of all, that's not the blade ID, it's the current limiter. (The one below it is the blade ID.)
Secondly, I'm not sure if I used correct values for the illustration, so please ignore the color bands.
So, current limiter: 100-300 ohm
Blade ID: 2k to 100k   (and update your config file to match.)

Also; this is probably the wrong thread for this, since this has nothing to do with the software.
Might be better to just create a new thread in the "Profezzorn's lab" subforum.

Offline profezzorn

  • Mining Colony Members
  • Master Force User
  • *
  • Posts: 901
  • May the source be with you.
    • Hubbe's Corner
Re: TeensySaber Software Discussion
« Reply #309 on: February 11, 2018, 08:20:34 PM »
So I commented out the battery charge preset and the button work to turn it on and off but the clash does not work.... but clashh will trigger from the serial monitor but not the button... We are getting somewhere.
When you power up your saber boards, what does the Serial Monitor show? Specifically, does it say "Accel setup ... Done." or "Accell setup ... Failed."?
If it failed, try powering it again because sometimes it fails on power up randomly. If you power up 3 times and it fails every time, you probably have a hardware problem. We built our boards and 2-3 of them had these failures but reflowing the IMU IC fixed it.

It's possible I broke something too. Or maybe gmcivor made some changes in the earlier version but forgot to make them in this version?
I will update my v1 saber when   I get a chance to make sure.

Finally got a chance to update my V1 saber, which works fine with the new code, so I don't think the code is broken.

Offline miib123

  • No Force
  • *
  • Posts: 20
  • Um...Hello?
Re: TeensySaber Software Discussion
« Reply #310 on: February 12, 2018, 06:39:04 AM »
If i change the resistor identify value from default 7800 (WS2811 string blade) to my actually 56 (ohm), it fails to turn on the LEDs and serial monitor gives me this:

Welcome to TeensySaber, type 'help' for more info.
Accel setup ... Failed.Gyro setup ... Failed.
Accel setup ... Failed.Accel setup ... Failed.Accel setup ... Failed.Accel setup ... Failed.

I choosed this resistor based on your cketch (50ohm +/-5%). I'm using only one blade.

Wait, changing the blade ID resistor makes i2c communication fail??? (or does that happen either way?)
56 is far to low to use for a WS2811 blade identifier. It might be useful as a current limiter on the data line though.
Normal recommendations is 100-300 ohm for the current limiter and 2k to 100k for the blade ID.
On a non-neopixel blade, lower blade IDs are ok.

Where did I recommend 50 ohms? If that's what I did, I should fix that....

Sorry, maybe i understand it the wrong wrong way. This is the resistor, i took it in consideration:





First of all, that's not the blade ID, it's the current limiter. (The one below it is the blade ID.)
Secondly, I'm not sure if I used correct values for the illustration, so please ignore the color bands.
So, current limiter: 100-300 ohm
Blade ID: 2k to 100k   (and update your config file to match.)

Also; this is probably the wrong thread for this, since this has nothing to do with the software.
Might be better to just create a new thread in the "Profezzorn's lab" subforum.

Thank you! I will change the resistor value.

Offline gmcivor

  • Force User
  • ***
  • Posts: 140
  • Do or do not. There is no try.
Re: TeensySaber Software Discussion
« Reply #311 on: February 13, 2018, 12:26:11 PM »
*** Update: Doing some more bench testing I put it in the hilt and turned it on and I discovered it doesn't detect swings either. So the clash and swing does not work. I am using V1 electronics in this saber. So clash and swing sounds do not work in hilt. On the bench I can make it play the clash sounds and everything. I uploaded the new software from the website and it still has the same problem. No clash or swing with it in the hilt, but on the bench i can trigger a clash through the serial monitor.

This is my demo saber for students to see the project in the others I have built or I am building I am using V2 OR V3 electronics.

Regards,

GMcIvor

Offline profezzorn

  • Mining Colony Members
  • Master Force User
  • *
  • Posts: 901
  • May the source be with you.
    • Hubbe's Corner
Re: TeensySaber Software Discussion
« Reply #312 on: February 13, 2018, 12:30:18 PM »
*** Update: Doing some more bench testing I put it in the hilt and turned it on and I discovered it doesn't detect swings either. So the clash and swing does not work. I am using V1 electronics in this saber. So clash and swing sounds do not work in hilt. On the bench I can make it play the clash sounds and everything. I uploaded the new software from the website and it still has the same problem. No clash or swing with it in the hilt, but on the bench i can trigger a clash through the serial monitor.

This is my demo saber for students to see the project in the others I have built or I am building I am using V2 OR V3 electronics.

Regards,

GMcIvor

Did you make sure to use the right config file?
I recently updated my V1 saber, and at one point I picked the wrong config file which makes it behave all kind o weird, but when I picked the right config file, I had no trouble.
If you created a new config file or something, make sure it includes v1_config.h

Offline gmcivor

  • Force User
  • ***
  • Posts: 140
  • Do or do not. There is no try.
Re: TeensySaber Software Discussion
« Reply #313 on: February 13, 2018, 01:37:46 PM »
Quote
Did you make sure to use the right config file?
I recently updated my V1 saber, and at one point I picked the wrong config file which makes it behave all kind o weird, but when I picked the right config file, I had no trouble.
If you created a new config file or something, make sure it includes v1_config.h

That was the problem, I selected the new config files and it works.. But a new problem has arised..... When I turn it on in the serial monitor it will just clash randomly every few seconds or repeatedly. I leave it flat on my desk and it will just clash with no input.....

Regards,

GMcIvor

Offline profezzorn

  • Mining Colony Members
  • Master Force User
  • *
  • Posts: 901
  • May the source be with you.
    • Hubbe's Corner
Re: TeensySaber Software Discussion
« Reply #314 on: February 13, 2018, 01:53:57 PM »
Quote
Did you make sure to use the right config file?
I recently updated my V1 saber, and at one point I picked the wrong config file which makes it behave all kind o weird, but when I picked the right config file, I had no trouble.
If you created a new config file or something, make sure it includes v1_config.h

That was the problem, I selected the new config files and it works.. But a new problem has arised..... When I turn it on in the serial monitor it will just clash randomly every few seconds or repeatedly. I leave it flat on my desk and it will just clash with no input.....

Regards,

GMcIvor

That's weird. It only happens when you use the serial monitor?
What is your CLASH_THRESHOLD_G set to?
You can use "monitor clash" to have it print out acceleration debug messages.

 

retrousse