Led display stopped

Good day to all, who read this, im new in this site so, sorry for any problems.

I need help, im making a proyect of a sound meter usind a sound sensor(ky-038) while also using a sd card adapter to play a wav music and a isd1820 to record and play voice, the problem i got was while trying to put the normal 16x2 to show the db levels it ended up broken, so im trying to use a lc2 display but i cant understand its layout. could anyone please help me adapting the l2c? this is the code for the sound meter (i dont know if all the code including the sd card reader and the isd is needed since the l2c doesnt use the digital outlet, but i post the whole code) while looking i found the address of the l2c 0x27. Im using and arduino uno (if someone find any other problem please help)

#include <LiquidCrystal.h>

LiquidCrystal lcd(7,8,10,11,12,13);
 
int num_Measure = 128 ; // Set the number of measurements   
int pinSignal = A0; // pin connected to pin O module sound sensor  
int redLed = 5; 
long Sound_signal;    // Store the value read Sound Sensor   
long sum = 0 ; // Store the total value of n measurements   
long level = 0 ; // Store the average value   
int soundlow = 40;
int soundmedium = 500;
 
void setup ()  
{   
  pinMode (pinSignal, INPUT); // Set the signal pin as input   
  Serial.begin (9600); 
  lcd.begin(16,2); 
}  
   
void loop ()  
{  
  // Performs 128 signal readings   
  for ( int i = 0 ; i <num_Measure; i ++)  
  {  
   Sound_signal = analogRead (pinSignal);  
    sum =sum + Sound_signal;  
  }  
 
  level = sum / num_Measure; // Calculate the average value   
  Serial.print("Sound Level: ");
  lcd.print("Sound Level= ");
  Serial.println (level-33);  
  lcd.print(level-33);
  if(level-33<soundlow)
  {
    lcd.setCursor(0,2);
    lcd.print("Intensity= Low");
     digitalWrite(redLed,LOW);
  }
  if(level-33>soundlow && level-33<soundmedium)
  {
    lcd.setCursor(0,2);
    lcd.print("Intensity=Medium"); 
     digitalWrite(redLed,LOW); 
  }
  if(level-33>soundmedium)
  {
    lcd.setCursor(0,2);
    lcd.print("Intensity= High");   
    digitalWrite(redLed,HIGH); 
  }
  sum = 0 ; // Reset the sum of the measurement values  
  delay(1000);
  lcd.clear();
}

Please post a schematic, not a frizzy thing, of your circuit as you have built it. Did you connect all of the grounds? Did you use the proper pull up resistors on the I2C interface. Are you supplying the proper voltages to each section.

I dont know how to use l2c, in the program im using the l2c is not available so im posting the original 16x2 lcd display

i dont know if this is use full, only to clarify i only want to replace the lcd display with the l2c to show the sound db on that screen,

That's a decent 1st shot at a schematic. What program did you use?
If you add a Symbol for Gnd and add that near all the pins, that will reduce a lot of the Gnd wire clutter.
Same for 5V and VCC.

Doesn't the sound card module need CS connected for SPI to work with it?

Uno direct to a speaker is also not good, that is usually too low of a resistance (impedance actually) and can damage the IO pin. Best to have a 120 resistor in series so the pin is not putting out too much current.

I dont know how to use l2c, in the program im using the l2c is not available so im posting the original 16x2 lcd display

So what good is that then?

The I2C pronounced “eye squared C” is a bus designed for connecting many devices to the Arduino using only two pins. There are many I2C displays we need to know what one you have, so a link to where you bought it from would be good.

There are many many tutorials about this topic, I suggest you read a few and then come back here with specific questions. Here is one.

CrossRoads:
That's a decent 1st shot at a schematic. What program did you use?
If you add a Symbol for Gnd and add that near all the pins, that will reduce a lot of the Gnd wire clutter.
Same for 5V and VCC.

Doesn't the sound card module need CS connected for SPI to work with it?

Uno direct to a speaker is also not good, that is usually too low of a resistance (impedance actually) and can damage the IO pin. Best to have a 120 resistor in series so the pin is not putting out too much current.

I use Fritzing(and older version thats why to complete schematic is not show) do i need another 5v and gnd (i was using a protoboard to separate the pins, yes the cs was connected to pin 10(i forgot to link in the program), do i need to use an electric capacitor alongside the resistor to get a better quallity on th audio??

Grumpy_Mike:
So what good is that then?

The I2C pronounced “eye squared C” is a bus designed for connecting many devices to the Arduino using only two pins. There are many I2C displays we need to know what one you have, so a link to where you bought it from would be good.

There are many many tutorials about this topic, I suggest you read a few and then come back here with specific questions. Here is one.

How to Connect I2C LCD Display to Arduino - Electronics Projects Hub

sorry if that was confusing, i cant post a link since the shop when i bought it doesnt have a web page, (i live in ecuador so many places like that doesnt have a page to go and shop)
what i want is to change the part of the code i post that i was using for the normal led into a code using the l2c instead

again, sorry for the troubles and the late response, and thanks for the help

i post a link to the pictures i took of the l2c

That is not the way to post pictures on this forum. It looks like you ignored the page you got when you attempted to make your first post. Have an other look at it.

All you can do is to try some librarys to see if they work, it is likely that the people who made your board just copied some other.
There are many ways to do this and you need to track down what you have.

Grumpy_Mike:
That is not the way to post pictures on this forum. It looks like you ignored the page you got when you attempted to make your first post. Have an other look at it.
https://forum.arduino.cc/index.php?topic=712204.0

All you can do is to try some librarys to see if they work, it is likely that the people who made your board just copied some other.
There are many ways to do this and you need to track down what you have.

im sorry for posting the link, i do read the post on how to make a post but you asked for a link on where i bought the l2c, so i though it was ok since it was a link to a google drive with the picture but again sorry.

Hi, i need help if possible fast, working in the proyect of my previous post i was able to put together a sound meter with a sd card wav player, but i got a problem, when the code begins the led stay without showing anything but if i push the button and only when is pressed that the sound levels shows up in the led, could anyone please help me how to let the sound meter to be always show on the display

#include <SD.h> // need to include the SD library
#include <TMRpcm.h> //Arduino library for asynchronous playback of PCM/WAV files
#include <SPI.h> //  need to include the SPI library
#include <LiquidCrystal.h>

#define SD_ChipSelectPin 10 //connect pin 10 of arduino to cs pin of sd card


LiquidCrystal lcd(3,4,5,6,7,8);
TMRpcm tmrpcm; // create an object for use in this sketch

int temp=1;
int pp=2;

int num_Measure = 128 ; // Set the number of measurements   
int pinSignal = A0; // pin connected to pin O module sound sensor  
int redLed = 5; 
long Sound_signal;    // Store the value read Sound Sensor   
long sum = 0 ; // Store the total value of n measurements   
long level = 0 ; // Store the average value   
int soundlow = 40;
int soundmedium = 500;


void setup()
{  
  pinMode (pinSignal, INPUT); // Set the signal pin as input   
  Serial.begin (9600); 
  lcd.begin(16,2); 

 pinMode(pp,INPUT_PULLUP);
 tmrpcm.speakerPin = 9; //5,6,11 or 46 on Mega, 9 on Uno, Nano, etc
 if (!SD.begin(SD_ChipSelectPin)) // returns 1 if the card is present
 {
 // Serial.println("SD fail");
  return;
 }

 tmrpcm.setVolume(5); //
 tmrpcm.play("1.wav"); //the sound file "song" will play each time the arduino powers up, or is reset
                          //try to provide the file name with extension
                     
}


void loop()
{  

 // Performs 128 signal readings   
  for ( int i = 0 ; i <num_Measure; i ++)  
  {  
   Sound_signal = analogRead (pinSignal);  
    sum =sum + Sound_signal;  
  }  
 
  level = sum / num_Measure; // Calculate the average value   
  Serial.print("Sound Level: ");
  lcd.print("Sound Level= ");
  Serial.println (level-33);  
  lcd.print(level-33);
  if(level-33<soundlow)
  {
    lcd.setCursor(0,2);
    lcd.print("Intensity= Low");
     digitalWrite(redLed,LOW);
  }
  if(level-33>soundlow && level-33<soundmedium)
  {
    lcd.setCursor(0,2);
    lcd.print("Intensity=Medium"); 
     digitalWrite(redLed,LOW); 
  }
  if(level-33>soundmedium)
  {
    lcd.setCursor(0,2);
    lcd.print("Intensity= High");   
    digitalWrite(redLed,HIGH); 
  }
  sum = 0 ; // Reset the sum of the measurement values  
  
  lcd.clear();


      tmrpcm.pause();
      while(digitalRead(pp)==0);
      delay(200);
}


void song (void)
{
  if(temp==1)
  {
    tmrpcm.play("1.wav");  
  }

}

Topics merged

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.