Rtttl with T88 Tiny

I have not found a form or a library that has addressed or solved this issue for the board. Any rtttl code I use for the T88 Tiny doesn't work. The buzzer is completely silent, so I have hooked up an Arduino to check the buzzer, and it works with every code I have tried. I have even probed each pin on the tiny to see if the pins are just labeled differently, and still nothing. I tried the TinyRTTTL, NonBlockingRtttl, PlayRtttl, anyrtttl, and a few other libraries and couldn't get any to work with the T88 Tiny; the buzzer makes zero sound every time. I have gotten lights to blink and buttons to work, even with Rtttl music in the code on the T88, but the music will act like it is playing, and no sound will be coming out.

Am I just going down a path with the T88 Tiny that can't happen, or is there a library or code I am missing that can allow RTTTL to be played on this board?

With all of the information you did not provide I can only suggest you swap the yellow and purple wires.

If this does not work and I do not expect it to post an annotated schematic showing exactly how you wired the project along with links to technical information on the parts you used. Since this could also be a software problem post the code using code tags.

I am not sure what other information I could provide to help you understand, @gilshultz since you have no relevant follow-up questions to my question in your response. There is no purple and yellow wire not sure what you are talking about there, unless you are just making fun of me.

I used Arduino IDE software, which has worked to upload blinking light code to the T88 Tiny. The code and setup work on my Arduino Uno board, and music plays through the speaker. However, with the same setup and pins hooked up to the T88 Tiny board and buzzer, it produces no sound through the buzzer after the same code is uploaded. I am simply wondering if anyone knows or has seen a video showing a T88 Tiny working with a buzzer to produce RTTTL music/is it even possible. I am 99% sure the problem is not code (unless there is a library I should use) or setup, which is why I didn't provide that. I just used many different variations of code to account for different libraries (TinyRTTTL, NonBlockingRtttl, PlayRtttl, anyrttt) to try and get the T88 tiny to play music through a buzzer, and nothing worked.

Here is one variation of code I tried; however, this is not what I am worried about. Pretend the schematic has a T88 tiny instead of an Arduino Micro.

#include <TinyRTTTL.h>
#define SPEAKER 9
#define OCTIVE 0

TinyRTTTL rtttl(SPEAKER, OCTIVE);
char simpsons[] = "Simpsons:d=4,o=5,b=160:c.6,e6,f#6,a6,g6,e6,c6,a,f#,f#,f#,g,p,8p,c.6,e6,f#6,a6,g6,e6,c6,a,f#,f#,f#,g,p,8p,p,2c7";

void setup() {
pinMode(SPEAKER, OUTPUT);
}

void loop() {
rtttl.play(simpsons);  
delay(500);          
}

Active or passive buzzer?

OCTAVE?

Just checking if you saw a "good" upload... to upload a sketch to ATtiny88...

  1. Disconnect the USB
  2. Compile the sketch to start the upload
  3. Wait for "insert USB within six seconds" (or something meaning that)
  4. Wait for "finished" (or something meaning that)

** I see the library spells "octave" as "octive"...

I got a few squeaks out of the simpsons song... nothing out of their own example songs, even with their example sketch... TinyRTTTL/examples/sample/sample.ino at master · jasonacox/TinyRTTTL · GitHub

Great questions. Although my main question is not for help with writing/uploading code or hooking up the buzzer, it is whether anyone knows or has seen a buzzer work with a T88 Tiny or has used a library that works with it. However, to answer your questions, if it helps, I believe it is an active buzzer. I got it from an old Arduino Uno kit, and it works perfectly when connected to an Arduino Uno, so I am assuming the problem is the T88 tiny. I have gone back and forth from the Uno to the Tiny to make sure I didn't break it, and it worked on the Uno every time.

In my initial question, I did point out that I was able to upload code to the ATtiny88 ( I used the unplug, upload wait, then insert plug method and got 100% complete prompt) to blink RGB LEDs and even control them with a button, which worked on the T88. I also had code that used blinking RGB LEDs, a button to switch between light colors, and Rtttl that uploaded successfully. With that code, if I had RTTTL playing in a case, it wouldn't let me switch to the next case till the Rtttl song was finished by design, so when uploaded to the Uno, even if I pressed the button, the next case would not activate until the music was finished playing. When put on the T88, I could switch between cases, but for about as long as the music usually lasted on the Uno I could not switch to the next case when pressing the button with the T88, even though nothing was playing through the buzzer. That told me the T88 is trying to read through rtttl code, but no sound happens. It also tells me the code is working as it should, and the pins I was connected to were right. Although with that code having variables of LED signals or libraries interfering with each other, I switched to the simpler code I posted to keep troubleshooting different libraries, and still no sound. I also tried probing other pins with the input pin that led to the buzzer and heard nothing, just in case the pins were mapped wrong.

I have tried a TinyRTTTL Library, but still no sound; maybe I can try the one you sent to see if some squeaks can get through. Here is my button and blink code with a schematic, but I am looking for the answer of if it is possible.

#include <PlayRtttl.hpp>
const int buttonPin = 2;    // Pin connected to the push button
int settingMode = 0;        // Counter for settings
int buttonState = HIGH;      // Current state of the button
int lastButtonState = HIGH;  // Previous state of the button
int redVal;
int blueVal;
int greenVal;
int LED2_redVal;
int LED2_blueVal;
int LED2_greenVal;
const int BUZZER_PIN = 5;

#define BLUE 6
#define GREEN 8
#define RED 9
#define LED2_BLUE 10
#define LED2_GREEN 11
#define LED2_RED 12
#define delayTime 20

bool played = false;

const char mission_imp[] PROGMEM = "MissionImp:d=16,o=4,b=95:32d,32z,32d,32z,32f,32z,32g,32z,32d,32z,32d,32z,32c,32z,32c#,32z";
const char Ama_Grace [] PROGMEM = "Amazing Grace:o=5,d=16,b=80,b=80:8c,2f,a,g,f,2a,8a,8g,2f,4d,2c,8c,2f,a,g,f,2a,8g,8a,2c6.";
const char Popeye [] PROGMEM = "Popeye:o=5,d=8,b=160,b=160:a5,c,c,c,4a#5,a5,4c,2p,c,d,a#5,d,4f,d,2c,p,c,d,a#5,d,f,e,d,c,d,c,a5,f5,a5,c,d,c,4a#5,g5,2f5";
const char WeAreThe [] PROGMEM = "WeAreThe:d=16,o=4,b=63:2d5,8c#5,8d5,4c#5,4a,8f#,4b,2f#,8a,2d5,8e5,8f#5,4a5,4f#5,b,2b,4b,4a,8b,4a,4g,4g5,4f#5,8g5,4f#5,4e5,4f#5,4d5,8g5,4f#5,4d5,8g5,4f5,4d5,8g5,4f5,2d5,8c5,8a,2d5";
const char WeAreThe1 [] PROGMEM = "WeAreThe1:d=4,o=5,b=100:2f,8e,8f,e,c,8p,8a4,d,a.4,2p,8c,2f,8g,8a,c6,a.,8d.,8e,2c,2p,d.,c,8d,c.,a#4,8p,a#.,a,8a#,a.,g,8p,a.,f,8a#,a.,8f,8p,8a#,g#.,f.,8a#,g#.,f.,2p";
const char WeAreThe2 [] PROGMEM = "WeAreThe2:d=4,o=5,b=80:2d,8c#,8d,c#,a4,8f#4,b4,2f#4,8a4,2d,8e,8f#,a,f#,8d,2b4,b4,a4,8b4,a4,g4,g4,f#,8g,f#,e,f#,d,8g,f#,d,8g,f,d,8g,f,2d";
const char Dead [] PROGMEM = "DeathMus:d=16,o=4,b=100:b,f5,p,f5,f5,f.5,e.5,d5,c5,g,p,e,c";
//America:d=16,o=5,b=200:4g,p,4e,4c,8p,p,4e,4p,4g,4p,4c6,2p,4p,4e6,p,4d6,4c6,4p,4e,4p,4f#,4p,2g,2p,4g,4p,2e6,4p,4d6,4c6,4p,2b,2p,4a,p,4b,4c6,4p,4e,4p,4f#,4p,4g,8p,p
//StarWars:d=4,o=5,b=112:8g,16p,8g,16p,8g,16p,16d#.,32p,32a#.,8g,16p,16d#.,32p,32a#.,g,8p,32p,8d6,16p,8d6,16p,8d6,16p,16d#.6,32p,32a#.,8f#,16p,16d#.,32p,32a#.,g,8p,32p,8g6,16p,16g.,32p,32g.,8g6,16p,16f#.6,32p,32f.6,32e.6,32d#.6,16e6,8p,16g#,32p,8c#6,16p,16c.6,32p,32b.,32a#.,32a.,16a#,8p,16d#,32p,8f#,16p,16d#.,32p,32g.,8a#,16p,16g.,32p,32a#.,d6,8p,32p,8g6,16p,16g.,32p,32g.,8g6,16p,16f#.6,32p,32f.6,32e.6,32d#.6,16e6,8p,16g#,32p,8c#6,16p,16c.6,32p,32b.,32a#.,32a.,16a#,8p,16d#,32p,8f#,16p,16d#.,32p,32g.,8g,16p,16d#.,32p,32a#.,g
//HarryPot:d=16,o=4,b=125:2p,8p,8b,8e.4,g4,8f#4,4e4,8b4,4a.4,4f#.4,8e.4,g4,8f#4,4d4,8f4,2e4,8p,8b,8e.4,g4,8f#4,4e4,8b4,4d5,8c#5,4c5,8g#4,8c.5,b4,8a#4,4f#4,8g4,2e4,8p,8g4,4b4,8g4,4b4,8g4,4c5,8b4,4a#4,8f#4,8g.4,b4,8a#4,4a#,8b,2b4,8p
void setup() {
// Use internal pull-up resistor (Button connects pin to GND)
pinMode(buttonPin, INPUT_PULLUP);
Serial.begin(9600);
pinMode(GREEN, OUTPUT);
pinMode(BLUE, OUTPUT);
pinMode(RED, OUTPUT);
pinMode(LED2_GREEN, OUTPUT);
pinMode(LED2_BLUE, OUTPUT);
pinMode(LED2_RED, OUTPUT);

digitalWrite(GREEN, LOW);
digitalWrite(BLUE, LOW);
digitalWrite(RED, LOW);
digitalWrite(LED2_GREEN, LOW);
digitalWrite(LED2_BLUE, LOW);
digitalWrite(LED2_RED, LOW);
}

void loop() {
// Read the current state of the button
buttonState = digitalRead(buttonPin);

// Check if button state changed from HIGH to LOW (a press)
if (buttonState != lastButtonState) {
if (buttonState == LOW) {
settingMode++; // Move to next setting

  // Reset to setting 0 after reaching the limit (e.g., 5 settings)
  if (settingMode > 4) {
    settingMode = 0;
  }
  
  Serial.print("Current Mode: ");
  Serial.println(settingMode);
}
// Small delay to debounce the mechanical button
delay(50); 

}

// Save current state for next loop iteration
lastButtonState = buttonState;

// Execute different code for each setting
switch (settingMode) {
case 0:
played = false;
// Code for Setting 1 (e.g., All white with music)
int redVal = 255;
int blueVal = 255;
int greenVal = 255;
int LED2_redVal = 255;
int LED2_blueVal = 255;
int LED2_greenVal = 255;
analogWrite( GREEN, greenVal );
analogWrite( RED, redVal );
analogWrite( BLUE, blueVal );
analogWrite( LED2_GREEN, LED2_greenVal );
analogWrite( LED2_RED, LED2_redVal );
analogWrite( LED2_BLUE, LED2_blueVal );

  playRtttlBlockingPGM(BUZZER_PIN, mission_imp);
  delay(500);
  playRtttlBlockingPGM(BUZZER_PIN, Ama_Grace);
  delay(500);
  playRtttlBlockingPGM(BUZZER_PIN, Popeye);
  delay(500);
  playRtttlBlockingPGM(BUZZER_PIN, WeAreThe);
  delay(500);
  playRtttlBlockingPGM(BUZZER_PIN, WeAreThe1);
  delay(500);
  playRtttlBlockingPGM(BUZZER_PIN, WeAreThe2);
  delay(500);
  break;
case 1:
  // Code for Setting 1 (e.g., All Fade)
  redVal = 255;
  blueVal = 0;
  greenVal = 255;
  LED2_redVal = 255;
  LED2_blueVal = 0;
  LED2_greenVal = 255;

  analogWrite( GREEN, greenVal );
  analogWrite( RED, redVal );
  analogWrite( BLUE, blueVal );
  analogWrite( LED2_GREEN, LED2_greenVal );
  analogWrite( LED2_RED, LED2_redVal );
  analogWrite( LED2_BLUE, LED2_blueVal );
  break;
case 2:
  // Code for Setting 2 (e.g., LED Fade)
  redVal = 255;
  blueVal = 0;
  greenVal = 0;
  LED2_redVal = 255;
  LED2_blueVal = 0;
  LED2_greenVal = 0;
  for( int i = 0 ; i < 255 ; i += 1 ){
    greenVal += 1;
    redVal -= 1;
    LED2_greenVal += 1;
    LED2_redVal -= 1;
    analogWrite( GREEN, greenVal );
    analogWrite( RED, redVal );
    analogWrite( BLUE, blueVal );
    analogWrite( LED2_GREEN, LED2_greenVal );
    analogWrite( LED2_RED, LED2_redVal );
    analogWrite( LED2_BLUE, LED2_blueVal );
 

    delay( delayTime );
  }
 
  redVal = 0;
  blueVal = 0;
  greenVal = 255;
  LED2_redVal = 0;
  LED2_blueVal = 0;
  LED2_greenVal = 255;
  for( int i = 0 ; i < 255 ; i += 1 ){
    blueVal += 1;
    greenVal -= 1;
    LED2_greenVal -= 1;
    LED2_blueVal += 1;
    analogWrite( BLUE, blueVal );
    analogWrite( GREEN, greenVal );
    analogWrite( RED, redVal );
    analogWrite( LED2_GREEN, LED2_greenVal );
    analogWrite( LED2_RED, LED2_redVal );
    analogWrite( LED2_BLUE, LED2_blueVal );

    delay( delayTime );
  }

    redVal = 0;
    blueVal = 255;
    greenVal = 0;
    LED2_redVal = 0;
    LED2_blueVal = 255;
    LED2_greenVal = 0;
    for( int i = 0 ; i < 255 ; i += 1 ){
      redVal += 1;
      blueVal -= 1;
      LED2_redVal += 1;
      LED2_blueVal -= 1;
      analogWrite( RED, redVal );
      analogWrite( BLUE, blueVal );
      analogWrite( GREEN, greenVal );
      analogWrite( LED2_GREEN, LED2_greenVal );
      analogWrite( LED2_RED, LED2_redVal );
      analogWrite( LED2_BLUE, LED2_blueVal );
  
      delay( delayTime );
    }
  break;
case 3:
    redVal = 0;
    blueVal = 0;
    greenVal = 0;
    LED2_redVal = 0;
    LED2_blueVal = 0;
    LED2_greenVal = 0;
    for( int i = 0 ; i < 255 ; i += 1 ){
      redVal += 1;
      blueVal += 1;
      greenVal += 1;
      LED2_greenVal += 1;
      LED2_blueVal += 1;      
      LED2_redVal += 1;   
      analogWrite( RED, redVal );
      analogWrite( BLUE, blueVal );
      analogWrite( GREEN, greenVal );
      analogWrite( LED2_GREEN, LED2_greenVal );
      analogWrite( LED2_RED, LED2_redVal );
      analogWrite( LED2_BLUE, LED2_blueVal );
  
      delay( delayTime );
    }
    redVal = 255;
    blueVal = 255;
    greenVal = 255;
    LED2_redVal = 255;
    LED2_blueVal = 255;
    LED2_greenVal = 255;
    for( int i = 0 ; i < 255 ; i += 1 ){
      redVal -= 1;
      blueVal -= 1;
      greenVal -= 1;
      LED2_greenVal -= 1;
      LED2_blueVal -= 1;      
      LED2_redVal -= 1;
      analogWrite( RED, redVal );
      analogWrite( BLUE, blueVal );
      analogWrite( GREEN, greenVal );
      analogWrite( LED2_GREEN, LED2_greenVal );
      analogWrite( LED2_RED, LED2_redVal );
      analogWrite( LED2_BLUE, LED2_blueVal );
  
      delay( delayTime );
    }
  break;
case 4:
  // Code for Setting 3 (e.g., LED Solid blue)
    redVal = 0;
    blueVal = 255;
    greenVal = 0;
    LED2_redVal = 0;
    LED2_blueVal = 255;
    LED2_greenVal = 0;        
    analogWrite( GREEN, greenVal );
    analogWrite( RED, redVal );
    analogWrite( BLUE, blueVal );
    analogWrite( LED2_GREEN, LED2_greenVal );
    analogWrite( LED2_RED, LED2_redVal );
    analogWrite( LED2_BLUE, LED2_blueVal );
  break;
  
case 5:
  // Code for Setting 3 (e.g., LED Solid red)
    redVal = 255;
    blueVal = 0;
    greenVal = 0;
    LED2_redVal = 255;
    LED2_blueVal = 0;
    LED2_greenVal = 0;
    analogWrite( GREEN, greenVal );
    analogWrite( RED, redVal );
    analogWrite( BLUE, blueVal );
    analogWrite( LED2_GREEN, LED2_greenVal );
    analogWrite( LED2_RED, LED2_redVal );
    analogWrite( LED2_BLUE, LED2_blueVal );
  break;
 case 6:
  // Code for Setting 3 (e.g., LED Solid red)
    redVal = 0;
    blueVal = 0;
    greenVal = 0;
    LED2_redVal = 0;
    LED2_blueVal = 0;
    LED2_greenVal = 0;
    analogWrite( GREEN, greenVal );
    analogWrite( RED, redVal );
    analogWrite( BLUE, blueVal );
    analogWrite( LED2_GREEN, LED2_greenVal );
    analogWrite( LED2_RED, LED2_redVal );
    analogWrite( LED2_BLUE, LED2_blueVal );
    if(!played){
      playRtttlBlockingPGM(BUZZER_PIN, Dead);
      played = true;
    }
  break;

}
}

To answer this:

I couldn't tell you.

BUT regarding this:

I did a google search for T88 tiny. I kept coming up with ATTiny88. In post #3 you have the buzzer connected to D9 on the micro, which is PB5. According to the datasheet, PB5 on the ATTiny88 is physical pin #17. Your code in post #3 show #define SPEAKER 9, so I believe the ATTiny88 should be wired to physical pin 17.

Similarly, in post #5, you wrote const int BUZZER_PIN = 5, which corresponds to PC6, which is physical pin 29 on the ATTiny88, which also happens to be the reset pin. (You might consider changing this.)

That is how I learned to map the Arduino IDE pin numbers to the pins on an ATTiny85 and it works. I had to learn to "reverse map it" to get to the correct physical pin on the ATTiny85.

Hope this helps.

EDITED--The info I found above was not for a PDIP MCU. It was for TQFP and 32 MLF FOUND HERE AT MICROCHIP. And I double checked with AI (copilot) and was told that the ports didn't matter, it was all about the functionality of the pin. PWM, etc... So maybe some RI (REAL intelligence) will come along and correct me.

EDITED AGAIN--I reread post #5 and now see you said it is an ATTiny88 and your LEDs and button worked on it, so I don't know. Maybe RI will have an answer.

And there was no schematic to show what you had. T88 has many members which you failed to show. Also posting a link to the technical information on the buzzer will help us help you. The fact that it works on a UNO indicates that it functions but it does NOT indicate it will work on your T88. There are several types of them, some active some passibe.

I "burnt" out one DIO pin on an ATtiny88 and was able to use another DIO pin on the same ATtiny88.

I only really wanted to know if anyone had gotten a buzzer to play music with a T88 tiny. The other information about my troubleshooting was just to show some things I had tried, so I wouldn't get responses to what I had already tried. Here is a link to the exact Attiny88 board I have. Amazon.com: AITRIP 5pcs MH-Tiny ATTINY88 Micro Development Board 16Mhz /Digispark ATTINY85 Upgraded/Nano V3.0 ATmega328 Extended Compatible for Arduino : Electronics

How about a data sheet for the buzzer?

@EmilyJane, the Buzzer came in an old Uno kit, so I don't have the actual part number. Plus, they are a cheap manufactured in China, so it's hard to find good data sheets. This is my best guess as to what it is. Datasheet - LCSC Electronics . I was also able to get it to work great with the Uno, so I am not sure how this info helps.

Helpers like to test the exact parts that a visitor has if possible so as much information as you can supply is good.

That data sheet seems to describe an active buzzer so probably not what you have if yours produces a range of frequencies.

Reading around the internet, I saw an issue eight years ago with DrAzzy's core not resetting TIMER1... but saw no resolution to that particular issue (about the same "no sound"). A suggestion was TinyTone... Technoblogy - Simple Tones for ATtiny ... although, that does not solve the RTTTL translation to songs. Tiny steps.

https://codebender.cc/example/Tone/RTTTL#RTTTL.ino

Simple test, connect the buzzer to 5V, if it buzzes it is a buzzer, if it clicks it is a speaker. For tone you want a speaker.