Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 13 of 13

Thread: Eye candy for audio data on 320x240 display for halloween costume?

  1. #1
    Junior Member
    Join Date
    Oct 2019
    Posts
    14

    Eye candy for audio data on 320x240 display for halloween costume?

    Hi all,

    I fishing around for interesting things to attach to a teensy4+audio shield that will be doing a "robot/dalek" voice.

    One possibility is to plop a 320x240 display in the "robot's" chest and display eye candy. I can probably knock together an equalizer style frequency display, but it'd be fun if there were something fancier that I can glue into place.

    Suggestions?

    Thanks,

    g.

  2. #2
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,297

    Cool

    Well there is always uncanny eyes.

    This originally was an Adafruit sketch for the Teensy 3.2 using the 128x128 TFT/OLED displays. The author (Phil Burgess / Paint Your Dragon) used advanced display optimization techniques only on the Teensy 3.x of SPI FIFO/DMA support. Adafruit also ported the code to its M0 board the Hallowing M0 Express (ARM M0 processor with a single 128x128 display), using the DMA SPI support on the Adafruit ARM M0 chips:


    Then the author rewrote the code for Raspberry Pi:


    This year, he rewrote it again for the new Monster M4SK (two eyes) and Hallowing M4 Express (one eye) for the new 240x240 displays. He used the native DMA support on the Adafruit ARM M4 systems and the built-in flash memory to hold the eyes, so I'm not sure whether you could easily port the code over to Teensy:


    During the late T4 beta cycle, I asked whether we could run the original program on the T4, given the SPI stuff had changed under the covers, and whether there was hope for getting the 240x240 displays running. KurtE, Mjs513, and Defragster took it up and ran with it, and they tweaked the original program so it would run on the T4 and support the 240x240 displays, including the cheap displays with no CS pin.

    While the code for the ST7735_t3 library that they were working on is in the 1.48 release, unfortunately the uncanny eyes example program was not in the 1.48 release. You can grab it from:


    In terms of displays, I've been using the Adafruit 1.3" display, but you could also use the larger 1.54" Adafruit display, or the various 3rd party displays that use the ST7789 chipset and have through pin support:


    Particularly for the no-name displays, check out the ship time, since some of these ship from China, and it is 11 days to Halloween.
    I believe when you use this, you need to use the display bus exclusively for the display, particularly if you use the displays without a CS pin. This means you would not be able to use either the micro SD card or the optional flash memory on the audio shield. Alternatively, you could put the display on the 2nd or 3rd SPI bus. If you want two eyes, you will need to use two SPI buses. If you want to use the SPI bus for the audio shield, you will need to connect the displays to the 2nd and 3rd SPI buses.

    To get to the 2nd SPI bus, you will need to bring out pins 26 and 27 from underneath the Teensy. To get to the third SPI bus, you will need to bring out pins 35, and 37 from underneath the Teensy. Pins 35 and 37 are harder to do, because this solder pad is 1mm instead of the 2.54mm (0.1") and is made for bringing out the micro SD card. There are various breakout boards floating around, but again, it likely is too late to get anything fabbed from OSH park. Perhaps somebody has extra stock if you needed it ASAP.

  3. #3
    Junior Member
    Join Date
    Oct 2019
    Posts
    14
    Thanks for the detailed response!

    Quote Originally Posted by MichaelMeissner View Post
    Well there is always uncanny eyes.

    [...]

    To get to the 2nd SPI bus, you will need to bring out pins 26 and 27 from underneath the Teensy.
    I'm hoping (beggars/choosers, gift horses & mouths, etc...) for something that will reflect the audio from the mic/clips. I looked at the eyes a while back but apparently (says nephew) robots don't have extra eyes. Sigh....

    I've soldered the teensy on top of the audio board (photo here). Defragster suggested that I plan ahead, but since I didn't know where I was going, I ended up flipping a coin.

    I ended up ordering one of these 240x320 displays, I think they're very similar to the one PJRC sells and I can have it tomorrow (Halloween's on a schedule and I'll be traveling, so time is of the essence....).

    I've seen your (Michael) reply about using the audio board and an ILI9341 together and I'm hoping that I can get it working by sharing the SPI pins (see earlier lack of planning vis a vis the board bottom).

    Fallback plan is to forego the SD card for sound clips.

    FWIW, there'll also be some buttons and/or one of the adafruit matrix keypads (leftover from something else) that'll swallow some pins to trigger sound clips.

    Seems like this kind of project will be a great use for Dean's breakout board (Hi Dean!).

  4. #4
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,915
    Quote Originally Posted by hartzell View Post
    Hi all,

    I fishing around for interesting things to attach to a teensy4+audio shield that will be doing a "robot/dalek" voice.

    One possibility is to plop a 320x240 display in the "robot's" chest and display eye candy. I can probably knock together an equalizer style frequency display, but it'd be fun if there were something fancier that I can glue into place.

    Suggestions?

    Thanks,

    g.
    The Audio Tutorial has an FFT to ili9341 as part of it … starting there would get that much working asap … then if something fancier could evolve or swap in when the sound stops ...

  5. #5
    Junior Member
    Join Date
    Oct 2019
    Posts
    14
    Thanks defragster! I've seen the Part_2_03_TFT_Display tutorial which displays the output of a pair of peak filters [SIC?] on the display, that's what gave me hope that I could do a wider "Equalizer" style display using bins from an FFT.

    I'm not seeing an "FFT TO ili9341" tutorial. Is it staring me in the face?

  6. #6
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,297
    Quote Originally Posted by hartzell View Post
    I ended up ordering one of these 240x320 displays, I think they're very similar to the one PJRC sells and I can have it tomorrow (Halloween's on a schedule and I'll be traveling, so time is of the essence....).

    I've seen your (Michael) reply about using the audio board and an ILI9341 together and I'm hoping that I can get it working by sharing the SPI pins (see earlier lack of planning vis a vis the board bottom).
    Note if you use a normal sketch and not uncanny eyes (i.e. one that a proper SPI.beginTransaction and SPI.endTransaction, have devices that can share the SPI bus, not try to optimize to use an async. display, and have a proper CS pin), then you should be able to use both. You might get some choppiness in either the sound or the display if one side takes too long.

    The display you mentioned has a proper CS pin, so you should be able to share the SPI bus (knock on wood). If you have them lying around, you probably want to add pull-up resistors for each of the CS and DC pins used. Otherwise, you might have to tune the SPI bus speed down. I have used 2.2K resistors (a pull-up resister goes in parallel between the CS/DC data pin and 3.3v) in the past for the uncanny eyes sketch when I had trouble running faster than 11Mhz SPI bus.

    Quote Originally Posted by hartzell View Post
    Fallback plan is to forego the SD card for sound clips.
    For small clips, you could put them in const memory.

    There is a wav2sketch program that converts .WAV files to the C form in hardware/teensy/avr/libraries/Audio/extras/wav2sketch/.

  7. #7
    Junior Member
    Join Date
    Oct 2019
    Posts
    14
    Just for reference, what I've been calling an "Equalizer" display is something like this: https://stackoverflow.com/questions/...er-android-app

    If/once I have the bins from the FFT, it also seems like a small step ("Optimism!") to a display like the spectrogram here: https://learn.adafruit.com/assets/11422, scrolling a new line in periodically.

    But mostly what I'm looking/hoping for is something that I can remix/drop-in that will have a bit of an "oooo, shiny" factor.

  8. #8
    Junior Member
    Join Date
    Oct 2019
    Posts
    14
    Quote Originally Posted by MichaelMeissner View Post
    For small clips, you could put them in const memory.

    There is a wav2sketch program that converts .WAV files to the C form in hardware/teensy/avr/libraries/Audio/extras/wav2sketch/.
    Thanks, I'd stumbled across that from comments in the Tutorial code (it's a fun ecosystem to explore!), it's good to know that it'll do what I need.

  9. #9
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,915
    Quote Originally Posted by hartzell View Post
    Thanks defragster! I've seen the Part_2_03_TFT_Display tutorial which displays the output of a pair of peak filters [SIC?] on the display, that's what gave me hope that I could do a wider "Equalizer" style display using bins from an FFT.

    I'm not seeing an "FFT TO ili9341" tutorial. Is it staring me in the face?
    Indeed - PDF stops at Peak Meter as far as notes … but ends with 'Part 3-3: Add a TFT Display'

    Look at sketch :: "...\hardware\teensy\avr\libraries\Audio\examples\ Tutorial\Part_3_03_TFT_Display\Part_3_03_TFT_Displ ay.ino"

    I played with it some time back (2+yrs?) - improved the writing in conjunction with another display … not finding that code just now
    Last edited by defragster; 10-20-2019 at 11:40 PM.

  10. #10
    Junior Member
    Join Date
    Oct 2019
    Posts
    14
    Oops, "Part_2_03_TFT_Display" was a typo on my part, I meant Part_3_03_TFT_Display. That's the code that displays the output of a pair of peak meters that I mentioned above, they discus it here in the video.

    It's a great comfort that I'll be able to drive the display, the audio board, and the SD card. But I'm still not seeing the FFT bit that you mentioned above.

    That said, I can definitely see the foggy outlines of an FFT display off in the distance, waiting for me to make it real. I'm still hoping to get lucky though....

  11. #11
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,915
    Here is from 3+ years back … diff display :: youtube.com … ILI9341DualVu

    This thread : ILI9163C-128x128-TFT-driver

    This post a couple down has CODE used - it was for that display - it started on ili9341 then moved to that ili9163C to help sumotoy optimize/refine his WIP. There may be earlier or later versions - where both displays are supported with #ifdef ???

    <edit>: Downloaded my own code … indeed it has :
    Code:
    //#define ILI9341 // UNCOMMENT this line for ILI9341, COMMENT for ILI9163C
    
    #ifdef ILI9341
    #include <ILI9341_t3.h>
    #include <font_Arial.h> // from ILI9341_t3
    So it can do 9341 and changes to to 320x240 instead of the ili9163C' smaller 128x128.

    It will need T4 edits and changes for SPI with Rev D Audio - not sure what that shows when run … please post if you find it worth editing and get it working. The old code shows 57 downloads ...
    Last edited by defragster; 10-21-2019 at 12:58 AM.

  12. #12
    Junior Member
    Join Date
    Oct 2019
    Posts
    14
    defragster, thanks!

  13. #13
    Junior Member
    Join Date
    Oct 2019
    Posts
    14
    Just to bring a sense of closure to this.... Thanks again to defragster and MichaelMeissner!

    I ended up hacking together a little board that set up the resistors suggested by MichaelMeissner in his comment above. It's a hack, using what I had on hand, including a small proto board that linked holes in sets of three "vertically" (in the pictures below). I needed to grind off a bit of a corner so that I could slip it onto the display. I wire-wrapped the various teensy pins onto the display pins.

    I also ended up needing to cut (after taking this picture) the connection that tied the reset pin to Vcc, wire that pin to the Teensy, and specify it when creating the display object, otherwise I ended up with a solid white display.

    For eye-candy, I ended up pulling in the waterfall display from the Audio Examples and hacking out the knobs that it was using.

    Name:  IMG_7342 2.jpg
Views: 27
Size:  12.4 KB

    Name:  IMG_7347 2.jpg
Views: 28
Size:  50.4 KB

    Name:  IMG_7349.jpg
Views: 28
Size:  15.2 KB

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •