fiduciary

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

0 Members and 1 Guest are viewing this topic.

Offline McFarticus

  • No Force
  • *
  • Posts: 11
  • Um...Hello?
Re: Announcing the Teensy Saber open source sound board
« Reply #15 on: December 03, 2016, 05:26:05 PM »
I've searched far and wide about this, so I'll ask here.  I came across the teensy 3.6 at the local microcenter (it has the MicroSD already on it, plus a faster processor).  I have the prop on order from sparkfun, but I imagine there are changes in regards to the SDcard script.   I'm mostly new to programming. 

It comes down to two things here:

What changes will I have to make in the code for the SD, and where can I figure out how to make this thing work with a single 3.2-3.5V 1A XP-E cree LED? (I have a white LED I can squeeze in for the clash effect if needed, same voltage with 0.7A)

Short answer: I don't know.

Much longer answer: I don't think you have to change much, as the SD card interface is very simple. Teensy 3.6 has some new features that lets you access the SD card faster, but I don't know what you would need to do to use those features. I have a Teensy 3.6 sitting on my desk at home, but I have not tried to use it yet.

One thing to watch out for though: The Teensy 3.6 has the Audio Out (A14) in a different position than the Teensy 3.2, so you'll need to make that connection with a wire instead of a pin. Shouldn't be a big deal, but could be very confusing if you didn't know about it.  (The rest of the pins near the short side of the prop shield are not required, so I don't think you have to worry about those.)

A FET and a resstor per LED is all you need for the LEDs.

For the 1A LED, the resistor should eat 0.2 volts, which at 1A means you need 0.2 ohms. The means the resistor will emit 0.2 watts of heat.

For the 0.7A led, you'd want a 0.14 ohm resistor, which will emit 0.1 watts of heat.

I assume you've looked at the circuit diagram: Teensy Saber Electronics

PS: This the intended place to ask questions, feel free to ask more!


Ok a few more questions for you.

1) I've searched far and wide for the right FET.  I've been using LM317s for constant current on some other LED projects.  Will that suffice? 

2) After studying the pins on the 3.2, I found no A14.  Is it A13?

3) I've had a little bit of trouble understanding which pin connects to which pin based on your schematics, given that I'm using the 3.6, not the 3.2. Do I blindly treat it as the 3.2 and ignore the extra pins?

4) You said it's safe to leave the coding AS-IS, but since the SD reader is built in, what change would have to be made in the code for that one?

Offline McFarticus

  • No Force
  • *
  • Posts: 11
  • Um...Hello?
Re: Announcing the Teensy Saber open source sound board
« Reply #16 on: December 03, 2016, 07:49:28 PM »
Also, I attempted to verify the code and got this error:

Arduino: 1.6.13 (Windows 10), TD: 1.32-beta1, Board: "Teensy 3.6, Serial, 180 MHz, US English"

Build options changed, rebuilding all
C:\Users\CptnYellowStain\Downloads\lightsaber-1.14\lightsaber-1.14.ino: In member function 'void TouchButton::BeginRead()':

C:\Users\CptnYellowStain\Downloads\lightsaber-1.14\lightsaber-1.14.ino:3536:5: error: 'TSI0_PEN' was not declared in this scope

     TSI0_PEN = (1 << ch);

     ^

C:\Users\CptnYellowStain\Downloads\lightsaber-1.14\lightsaber-1.14.ino:3537:5: error: 'TSI0_SCANC' was not declared in this scope

     TSI0_SCANC = TSI_SCANC_REFCHRG(3) | TSI_SCANC_EXTCHRG(CURRENT);

     ^

C:\Users\CptnYellowStain\Downloads\lightsaber-1.14\lightsaber-1.14.ino:3537:37: error: 'TSI_SCANC_REFCHRG' was not declared in this scope

     TSI0_SCANC = TSI_SCANC_REFCHRG(3) | TSI_SCANC_EXTCHRG(CURRENT);

                                     ^

C:\Users\CptnYellowStain\Downloads\lightsaber-1.14\lightsaber-1.14.ino:3537:66: error: 'TSI_SCANC_EXTCHRG' was not declared in this scope

     TSI0_SCANC = TSI_SCANC_REFCHRG(3) | TSI_SCANC_EXTCHRG(CURRENT);

                                                                  ^

C:\Users\CptnYellowStain\Downloads\lightsaber-1.14\lightsaber-1.14.ino:3538:85: error: 'TSI_GENCS_SWTS' was not declared in this scope

     TSI0_GENCS = TSI_GENCS_NSCN(NSCAN) | TSI_GENCS_PS(PRESCALE) | TSI_GENCS_TSIEN | TSI_GENCS_SWTS;

                                                                                     ^

C:\Users\CptnYellowStain\Downloads\lightsaber-1.14\lightsaber-1.14.ino: In member function 'virtual void TouchButton::Loop()':

C:\Users\CptnYellowStain\Downloads\lightsaber-1.14\lightsaber-1.14.ino:3592:37: error: 'TSI0_CNTR1' was not declared in this scope

     Update(*((volatile uint16_t *)(&TSI0_CNTR1) + ch));

                                     ^

Multiple libraries were found for "SD.h"
 Used: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SD
 Not used: C:\Program Files (x86)\Arduino\libraries\SD
Error compiling for board Teensy 3.6.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

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 #17 on: December 04, 2016, 11:44:08 AM »
I've searched far and wide about this, so I'll ask here.  I came across the teensy 3.6 at the local microcenter (it has the MicroSD already on it, plus a faster processor).  I have the prop on order from sparkfun, but I imagine there are changes in regards to the SDcard script.   I'm mostly new to programming. 

It comes down to two things here:

What changes will I have to make in the code for the SD, and where can I figure out how to make this thing work with a single 3.2-3.5V 1A XP-E cree LED? (I have a white LED I can squeeze in for the clash effect if needed, same voltage with 0.7A)

Short answer: I don't know.

Much longer answer: I don't think you have to change much, as the SD card interface is very simple. Teensy 3.6 has some new features that lets you access the SD card faster, but I don't know what you would need to do to use those features. I have a Teensy 3.6 sitting on my desk at home, but I have not tried to use it yet.

One thing to watch out for though: The Teensy 3.6 has the Audio Out (A14) in a different position than the Teensy 3.2, so you'll need to make that connection with a wire instead of a pin. Shouldn't be a big deal, but could be very confusing if you didn't know about it.  (The rest of the pins near the short side of the prop shield are not required, so I don't think you have to worry about those.)

A FET and a resstor per LED is all you need for the LEDs.

For the 1A LED, the resistor should eat 0.2 volts, which at 1A means you need 0.2 ohms. The means the resistor will emit 0.2 watts of heat.

For the 0.7A led, you'd want a 0.14 ohm resistor, which will emit 0.1 watts of heat.

I assume you've looked at the circuit diagram: Teensy Saber Electronics

PS: This the intended place to ask questions, feel free to ask more!


Ok a few more questions for you.

1) I've searched far and wide for the right FET.  I've been using LM317s for constant current on some other LED projects.  Will that suffice? 

2) After studying the pins on the 3.2, I found no A14.  Is it A13?

3) I've had a little bit of trouble understanding which pin connects to which pin based on your schematics, given that I'm using the 3.6, not the 3.2. Do I blindly treat it as the 3.2 and ignore the extra pins?

4) You said it's safe to leave the coding AS-IS, but since the SD reader is built in, what change would have to be made in the code for that one?

(1) I'm no expert on LM317, but it seems like a good choice to me. A linear regulator will make the LED brightness consistent as the power runs down, which is great.

(2) Look again, It's called "A14/DAC" on the pinout diagram, and it's on the short end of the Teensy 3.2. If you're using a Teensy 3.6, you'll want to connect that pin on the prop shield (called AudioIN on the prop shield diagram) to A21 (DAC0) or A22 (DAC1) on the Teensy 3.6.  (It's possible that using DAC0 will work with no modifications to the code, but the modifications would be minimal.)

(3) The teensy 3.6 is supposed to be pin-compatible with the teensy 3.2, (With A14 being an obvious exception...)  So hopefully you can just hook things up just like the circuit diagram shows.  (Skipping the SD card bits of course.)

(4) Did I? I didn't mean to say that. I have not tried running my code on a 3.6, and some bits were specifically written for the Teensy 3.2. Hopefully the changes needed are minimal though. (more about that in the next post.)

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 #18 on: December 04, 2016, 11:48:26 AM »
Also, I attempted to verify the code and got this error:

Arduino: 1.6.13 (Windows 10), TD: 1.32-beta1, Board: "Teensy 3.6, Serial, 180 MHz, US English"

Build options changed, rebuilding all
C:\Users\CptnYellowStain\Downloads\lightsaber-1.14\lightsaber-1.14.ino: In member function 'void TouchButton::BeginRead()':

C:\Users\CptnYellowStain\Downloads\lightsaber-1.14\lightsaber-1.14.ino:3536:5: error: 'TSI0_PEN' was not declared in this scope

     TSI0_PEN = (1 << ch);

     ^

C:\Users\CptnYellowStain\Downloads\lightsaber-1.14\lightsaber-1.14.ino:3537:5: error: 'TSI0_SCANC' was not declared in this scope

     TSI0_SCANC = TSI_SCANC_REFCHRG(3) | TSI_SCANC_EXTCHRG(CURRENT);

     ^

C:\Users\CptnYellowStain\Downloads\lightsaber-1.14\lightsaber-1.14.ino:3537:37: error: 'TSI_SCANC_REFCHRG' was not declared in this scope

     TSI0_SCANC = TSI_SCANC_REFCHRG(3) | TSI_SCANC_EXTCHRG(CURRENT);

                                     ^

C:\Users\CptnYellowStain\Downloads\lightsaber-1.14\lightsaber-1.14.ino:3537:66: error: 'TSI_SCANC_EXTCHRG' was not declared in this scope

     TSI0_SCANC = TSI_SCANC_REFCHRG(3) | TSI_SCANC_EXTCHRG(CURRENT);

                                                                  ^

C:\Users\CptnYellowStain\Downloads\lightsaber-1.14\lightsaber-1.14.ino:3538:85: error: 'TSI_GENCS_SWTS' was not declared in this scope

     TSI0_GENCS = TSI_GENCS_NSCN(NSCAN) | TSI_GENCS_PS(PRESCALE) | TSI_GENCS_TSIEN | TSI_GENCS_SWTS;

                                                                                     ^

C:\Users\CptnYellowStain\Downloads\lightsaber-1.14\lightsaber-1.14.ino: In member function 'virtual void TouchButton::Loop()':

C:\Users\CptnYellowStain\Downloads\lightsaber-1.14\lightsaber-1.14.ino:3592:37: error: 'TSI0_CNTR1' was not declared in this scope

     Update(*((volatile uint16_t *)(&TSI0_CNTR1) + ch));

                                     ^

Multiple libraries were found for "SD.h"
 Used: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SD
 Not used: C:\Program Files (x86)\Arduino\libraries\SD
Error compiling for board Teensy 3.6.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.


I will have a go at compiling the code for Teensy 3.6.
I won't have time to actually test it today, but I should be able to make it compile at least.

For the record, most of the problems listed above have to do with the touch-button code, which you may or may not need.
I didn't like that touchRead() can take several ms to run, so copied and modified the code, and the code apparently needs
to be different for the Teensy 3.2.



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 #19 on: December 04, 2016, 06:32:17 PM »
Ok, I have uploaded a new lightsaber.ino, which compiles cleanly with board set to Teensy 3.6.
I think the way to make the SD card work is to change the line:

  sdCardSelectPin = 0

to

  sdCardSelectPin = BUILTIN_SDCARD

(I have added a comment in the code about this.)

I have not tested it on a Teensy 3.6, but I'm optimistic that it will work.

The new code upload also has a bunch of code for the TeensySaber V2 board, but that should not affect anything.

Offline McFarticus

  • No Force
  • *
  • Posts: 11
  • Um...Hello?
Re: Announcing the Teensy Saber open source sound board
« Reply #20 on: December 05, 2016, 05:27:45 PM »
I'll thoroughly test this out.  I'll let you know how it works out.  I had to try this 3.6 since it's more low profile due to the SD reader, and I can't tell you how much of a nightmare it was trying to figure out how to flash the prop board.  I still haven't figured it out.....oh lawd.

Offline McFarticus

  • No Force
  • *
  • Posts: 11
  • Um...Hello?
Re: Announcing the Teensy Saber open source sound board
« Reply #21 on: December 05, 2016, 06:20:56 PM »
I'm checking other forums for this error:

C:\Users\CptnYellowStain\Documents\Arduino\lightsaber-1.18_for_3.6\lightsaber-1.18_for_3.6.ino:82:21: error: 'BUILTIN_SDCARD' was not declared in this scope


I tried copying the code, deleting the file and saving it as a new file (as suggested in another post), but I get the same error.  I'll keep looking

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 #22 on: December 05, 2016, 08:17:20 PM »
I'm checking other forums for this error:

C:\Users\CptnYellowStain\Documents\Arduino\lightsaber-1.18_for_3.6\lightsaber-1.18_for_3.6.ino:82:21: error: 'BUILTIN_SDCARD' was not declared in this scope


I tried copying the code, deleting the file and saving it as a new file (as suggested in another post), but I get the same error.  I'll keep looking

I am officially a dufus! (I didn't actually *try* setting  sdCardSelectPin to BUILTIN_SDCARD...)
The fix is simple, as I just needed to make sure to #include <SD.h> before trying to use BUILTIN_SDCARD.
I've uploaded a new version.

Offline McFarticus

  • No Force
  • *
  • Posts: 11
  • Um...Hello?
Re: Announcing the Teensy Saber open source sound board
« Reply #23 on: December 06, 2016, 07:45:58 PM »
I can't get it to power on, but I'm also using a crappy 5V boost.  I'll pick up a new one tomorrow and see if that remedies the problem.  This is my first attempt at this, so I wasn't expecting it to go smoothly. 

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 #24 on: December 06, 2016, 09:41:50 PM »
Have you tried the serial monitor to see if the card is doing something?

Offline McFarticus

  • No Force
  • *
  • Posts: 11
  • Um...Hello?
Re: Announcing the Teensy Saber open source sound board
« Reply #25 on: December 08, 2016, 03:50:10 PM »
Have you tried the serial monitor to see if the card is doing something?

The how-to must be old, because it looks NOTHING like the current interface, and I have the latest version.  I tried inserting the code, but I have no response. 

I have been playing with the 5V boost, and wiring it exactly as shown in the schematic you posted.  No luck yet. 

Offline McFarticus

  • No Force
  • *
  • Posts: 11
  • Um...Hello?
Re: Announcing the Teensy Saber open source sound board
« Reply #26 on: December 08, 2016, 05:31:15 PM »
Also, I have the DAC wire from the prop connected to the DAC1 on the 3.6.  I dug into the code and found the DAC marked as DAC0.  I switched them to DAC1.  Still no function that I can see.  I have both your original and my edit saved.  I'm not very skilled with Code, so I can't be relied upon for it.  hahahaha



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 #27 on: December 08, 2016, 08:49:54 PM »
I wonder if your Teensy 3.6 is toast? Have you managed to program it?
(Before you program it the first time, it blinks when you plug it in, once you've program it, it won't do that unless of course you program it with a blinky program...)

I hooked up my Teensy 3.6 to my computer, and uploaded lightsaber.ino with no modifications.
Then I opened the serial monitor (Ctrl-Shift-M), which said:

Code: [Select]
No sdcard found.

ID: 916 volts 2.95 resistance= 279888.97
blade= 0
WS2811 Blade with 97 leds
Normal Style
Scanning sound font: font01/

The "no sdcard found" is normal, since (a) I have no sdcard inserted and (b) I haven't configured the SD enable pin correctly.
Note that this is with nothing connected to the Teensy except for the USB cable. (no prop shield)
After printing this, it hangs because it tries to talk to the sd card even though it's not there.
If I comment out #define ENABLE_SD, it gets a little further, but then it fails to talk to the motion chip, since that's not there either. So I comment out #define ENABLE_MOTION too. After that, it it doesn't hang anymore I and the chip responds when I type "help" in the serial monitor.

As for DAC0 -> DAC1, you have the right idea: Replacing DAC0 with DAC1 should work, but you should see things printed through
the serial monitor either way.

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 #28 on: December 08, 2016, 08:56:26 PM »
I also got the builtin SD card reader to work by setting sdCardSelectPin = BUILTIN_SDCARD
(I was able to run "dir" in the serial monitor and see the contents of the memory card, obviously I can't play sounds without a prop shield...)

Offline McFarticus

  • No Force
  • *
  • Posts: 11
  • Um...Hello?
Re: Announcing the Teensy Saber open source sound board
« Reply #29 on: December 12, 2016, 06:54:28 PM »
I got no response from the 3.6, so i opened up the brand new 3.2 and tried a simple code. 
******
void setup() {
  // put your setup code here, to run once:
Serial.begin (9600);
}

void loop() {
  // put your main code here, to run repeatedly:
Serial.println("Teensy, you're giving me a migraine");
delay(290);
while(true);
}



I can't get it to do anything in serial monitor, not even on a barely touched 3.2 on COM1.  I switched between 3 and 4, but the monitor says offline.  I don't know what I'm missing.  I'm a dufus of all dufusry with programming. I did C++ for a year in high school.  That was it. 

I'm mostly a Smith and designer, not much of a programmer.  hahaha



 

retrousse