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.
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?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
Well done!
That is very cool! very noisy!
what speaker is being used?
for now I'm trying with proteus
I used Real Simulator.
I also tried with simulide and I have the same problem
I don't get the issue on Real Simulator.
I am attaching a video
Real Sim sounds great, so, I think it could be a simulation issue.
ok thanks, where can i find the real simulator?
https://web.archive.org/web/20190516175305/https://digitalelectrosoft.com/download-pic-simulator
Last edit: Anobium 2023-10-06
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?
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.
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
;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
What is the exact circuit on the output?
circuit
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/
Last edit: Chris Roper 2023-10-10
I am puzzled... see https://www.plcforum.it/f/topic/313526-sirena-con-pic16f84-disturbo-audio/
Veneziano Salvatore = twister1970 ?