Menu

siren pic16f84 noise problem

2023-03-18
2023-10-12
  • Veneziano Salvatore

    I made code for a siren that starts at 1000Hz up to 1250Hz and then back to 1000Hz. On the output I have both the sound of the siren and a background noise. On the net I have seen other projects similar to mine that do not have background noise. I attach the file.

     
  • Anobium

    Anobium - 2023-03-18

    Well done!

    That is very cool! very noisy!

     
  • JANIS

    JANIS - 2023-03-18

    what speaker is being used?

     
  • Veneziano Salvatore

    for now I'm trying with proteus

     
    • Anobium

      Anobium - 2023-03-18

      I used Real Simulator.

       
  • Veneziano Salvatore

    I also tried with simulide and I have the same problem

     
    • Anobium

      Anobium - 2023-03-18

      I don't get the issue on Real Simulator.

       
  • Veneziano Salvatore

    I am attaching a video

     
  • Anobium

    Anobium - 2023-03-18

    Real Sim sounds great, so, I think it could be a simulation issue.

     
  • Veneziano Salvatore

    ok thanks, where can i find the real simulator?

     
  • Veneziano Salvatore

    ;Chip Settings
    #chip 16F84,4
    #config OSC=XT, WDTE=OFF
    
    ;Defines (Constants)
    #define SoundOut PORTA.0
    
    inizio:
    For prova = 1 To 250 step 30
        Tone 1000 + prova, 2
    Next
    For prova1 = 1 To 250 step 30
        Tone 1250- (prova1), 2
    Next
    Goto inizio
    
     

    Last edit: Anobium 2023-10-06
  • Veneziano Salvatore

    I tested the hex file generated by this code with proteus, simulide and built the circuit on bread board. The result is always to have at the output, in addition to the required audio signal, also another lower disturbing sound. Is it the meter that generates the disturbance?

     
  • Anobium

    Anobium - 2023-10-06

    umm... not sure what is going on here.

    The Tone command should work. But, you parameter of ,2 does means 20 ms - is that long enough ?

    Check the value of prova and prova1 by outputting to a serial terminal. The should show 1,31,61 .. up to 241. This will show that the FOR-NEXT loop is working as expected.

     
  • Veneziano Salvatore

    I have no problems with the loop functioning. The problem is that on the output in addition to the requested sound there is another low frequency sound. I'll give you another code where the disturbance is felt much more

     
  • Veneziano Salvatore

    ;Chip Settings

    chip 16F84,4

    config OSC=XT

    ;Defines (Constants)

    define SoundOut PORTA.0

    ;Variables
    Dim snd As word

    start:
    For snd = 700 To 1000 step 2
    Tone 700+snd, 1
    Next
    Goto start

     
    • Anobium

      Anobium - 2023-10-08

      What is the exact circuit on the output?

       
  • Veneziano Salvatore

    circuit

     
  • Anobium

    Anobium - 2023-10-10

    I thought you needed a capacitor before the output device.

     
    • Chris Roper

      Chris Roper - 2023-10-10

      I thought you needed a capacitor before the output device.

      Yes and that is at a minimum to block the Microcontroller switching frequency.
      Here is the full circuit:
      https://microcontrollerslab.com/active-passive-buzzer-interfacing-pic/

       
      👍
      1

      Last edit: Chris Roper 2023-10-10

Log in to post a comment.