0

D20 Project
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

D20 Project

by tony_damato on Mon Mar 01, 2021 10:15 pm

This project uses the Pro Trinket.
Would it be possible to use ItsyBitsy with a few code changes?

Thank You
Tony

tony_damato
 
Posts: 7
Joined: Sun Feb 28, 2021 10:05 am

Re: D20 Project

by adafruit_support_mike on Tue Mar 02, 2021 10:35 pm

Yes, the code will work with an ItsyBitsy 32u4.

adafruit_support_mike
 
Posts: 63053
Joined: Thu Feb 11, 2010 2:51 pm

Re: D20 Project

by tony_damato on Wed Mar 17, 2021 2:42 pm

I sort of got it working with Itsy Bitsy. I loaded code via FTDI after disconnecting XMT/RCV wires , when done uploading put wires back. I get the greeting but can' get it to speak the faces. Is there a way I Can test it before I button it up.

Thank you,
Tony

tony_damato
 
Posts: 7
Joined: Sun Feb 28, 2021 10:05 am

Re: D20 Project

by adafruit_support_mike on Wed Mar 17, 2021 9:10 pm

Sure: use the play() function to test each track whose name is listed in the array, as shown here:

https://learn.adafruit.com/talking-d20- ... -1381894-6

adafruit_support_mike
 
Posts: 63053
Joined: Thu Feb 11, 2010 2:51 pm

Re: D20 Project

by tony_damato on Thu Mar 18, 2021 10:29 am

Thank you, that works fine. Is there a way while on the bench to test the interrupt.



Thank you,
Tony

tony_damato
 
Posts: 7
Joined: Sun Feb 28, 2021 10:05 am

Re: D20 Project

by adafruit_support_mike on Thu Mar 18, 2021 3:56 pm

Let’s see..

That looks like on of PhilB’s wakeup interrupts.. there isn’t any code in the ISR, but the microcontroller has to wake up and start executing code to find out.

The code says it’s looking for a falling edge on pin 1, so connect a button between pin 1 and GND to force a wakeup.

adafruit_support_mike
 
Posts: 63053
Joined: Thu Feb 11, 2010 2:51 pm

Re: D20 Project

by T7013tjr on Wed May 19, 2021 4:49 pm

I am working on this project and I did swap the trinket for the ItsyBitsy 32u4 but I am getting the slow blinking red light on the 32u4 indicating an issue with communication with the sound board. Soundboard has green light that goes on and off with the switch. I can also hear a very low click from the speaker when the soundboard turns on. I have double checked all wiring between the 32u4 and the soundboard and it all looks correct.

Are there any changes to the code or to wiring because of the 32u4? Thank you.

T7013tjr
 
Posts: 5
Joined: Wed May 19, 2021 4:46 pm

Re: D20 Project

by adafruit_support_mike on Sun May 23, 2021 6:27 pm

You shouldn't need to make any other changes to the wiring.

Post a photo showing your hardware and connections and we'll take a look. 800x600 images usually work best.

adafruit_support_mike
 
Posts: 63053
Joined: Thu Feb 11, 2010 2:51 pm

Re: D20 Project

by T7013tjr on Mon May 24, 2021 7:36 pm

Thanks for the reply. I actually did have to make some slight changes to the code. I was not getting communication with the sound board so I changed the references to Serial.begin and Adafruit_Soundboard sfx = Adafruit_Soundboard(&Serial1, NULL, AUDIO_RESET). It seems like I was getting some kind of communication conflict on the TX and RX lines. I also added some delays immediately following the Serial1.begin statements. I have been able to get it to the stage where the ItsyBitsy LED shuts off (indicating good initialization) and it now says the initial greeting.

Now I cannot seem to get it to recognize a "roll" to annouce the result. I am prototyping on a BB and simulating rolling by changing orientation of the board and a falling motion of a couple inches. I have even tried to simulate a sudden stop by lightly smacking my hand with the board. Nothing happens. Everything else still seems okay. FX audio is green light and Itsy is still LED off. I had to move the I2 pin on the accelerometer to Pin 7 on the Itsy because Pin 3 that was used on the Pro Trinket is the SCL line on the Itsy. I changed the corresponding code to reference Pin 7 and Interrupt 4 based on the Itsy documentation indicating that pin 7 is hardware interrupt 4.

Any help would be appreciated.
Attachments
IMG_0522.JPG
IMG_0522.JPG (174.13 KiB) Viewed 351 times
IMG_0523.JPG
IMG_0523.JPG (201.43 KiB) Viewed 351 times

T7013tjr
 
Posts: 5
Joined: Wed May 19, 2021 4:46 pm

Re: D20 Project

by T7013tjr on Mon May 24, 2021 10:47 pm

Ok. Further edit of my above post. I have been able to verify with a fluke meter that pin 7 that I have chosen to tie my I2 interrupt to from the accelerometer is sitting at 3.3V after the greeting. A reasonably sound smack of the BB on my palm results in Pin 7 falling to 0V. However, the SD pin on the amplifier is sitting at 0V after initialization (as it is supposed to be to save power) and it does not pullup despite Pin 7 falling to 0V (as should happen according to the audioOn() function). This leads me to believe the audioOn() function is not working for some reason. If I comment out the audioOff call at the end of intialization, SD stays at 4.7V. Still nothing happens when Pin 7 falls even though the amp has been forced to remain on.

Even having ferreted out this much information, I am still at a loss as to why the soundboard is not playing the sounds associated with a "roll" when Pin 7 falls. Again, any help would be appreciated. Thank you.

T7013tjr
 
Posts: 5
Joined: Wed May 19, 2021 4:46 pm

Re: D20 Project

by T7013tjr on Tue May 25, 2021 2:48 pm

Further edit.

I commented out the wait() function and the entire things works flawlessly. The wait() function puts the entire thing into a deep sleep mode to conserve battery power. When I say it works flawlessly it has the annoying downside of never shutting up but otherwise it does work. It announces the roll, "CONTIUOUSLY", and will alter the annoucement based on the orientation of the BB simulating other die faces coming up. Without the wait() function it just keeps going. When I restore the wait(), it will not wake up. The amplifier SD pin drops from 4.7V to 0V after the greeting, and then the I2 pin drops from 3.3V to 0 when I simulate a drop, but then the SD pin voltage does not turn back on, no sound, and nothing else seems to happen. I even put some Serial.println at the beginning of the resume code and that does not print. It appears that even though the accelerometer is conducting the interrupt on I2 by transitioning from high to low, the itsybitsy 32u4 is not getting the idea to bring everything out of deep sleep.

Help will be thoroughly appreciated as I believe I have exhausted the extent of my very limited arduino coding experience. Thank you.

T7013tjr
 
Posts: 5
Joined: Wed May 19, 2021 4:46 pm

Re: D20 Project

by adafruit_support_mike on Wed May 26, 2021 3:30 pm

Put the wait() function back in the code and try to trigger a wakeup manually: connect a wire from the trigger pin to GND after the microcontroller has gone to sleep.

If that doesn’t wake up the microcontroller, try connecting the GND wire to other pins and see if you can get a response from any of them.

adafruit_support_mike
 
Posts: 63053
Joined: Thu Feb 11, 2010 2:51 pm

Re: D20 Project

by T7013tjr on Wed May 26, 2021 6:23 pm

Hello Mike,

Thank you for your response. I did as instructed and manually connected to GND on every pin on the ItsyBitsy except obviously the voltage pins and the reset pin. There was no identifiable activity.

Have you reviewed the code for the project. I have been over it pretty thoroughly including looking at the registers for the MMA8451 on the chip datasheet. I have relatively moderate experience in several other programming languages including C, C++ and python. I am just very new to tinkering with arduinos. I don't know the libraries at all. I am at a loss and all I have been able to identify as indicated in my previous posts is that the I2 pin on the MMA8451 is indeed FALLING and the amp is shutting down as they are supposed to in the power saving function wait(). I just cannot get everything to wake back up when the I2 to Pin 7 voltage FALLS.

Thanks again for any further help.

T7013tjr
 
Posts: 5
Joined: Wed May 19, 2021 4:46 pm

Please be positive and constructive with your questions and comments.