DS18B20 Temperature Alarmed monitoring system


I have set up a temperature alarmed monitoring system using 2 DS18B20 temperature sensors, with the output of the buzzer/LED configured to the digital 8 output pin. Initially this operated fine, however the buzzer output was not sufficient.

Therefore I have configured it using a MOSFET (2N7000) to try and amplify the signal. My connections have been the following:

  • Vin from Arduino goes to (+) of Piezo speaker
  • (-) of Piezo speaker goes to the Drain of the MOSFET
  • A 2.2 K ohm resistor connected in parallel to the Piezo speaker
    -Digital 8 Pin has a 2.2 K ohm resistor in series and then connected to the Gate of the MOSFET
  • Source of MOSFET connected to ground.

I have tried numerous different configurations however this seems the most logical and makes it the closest to getting the correct operation with an amplified output.

However it is still not functioning accordingly. The threshold is set for 25 degrees so when this is exceeded the alarm should go off. The following output is happening:

-On switch on of the Arduino the Alarm is constantly while going through the Void Setup ON (Wrong but not too bothered if remains)
-If the temperature is below 25 degrees the alarm remains ON constantly (Wrong)
-When the temperature goes above 25 degrees the Alarm starts pulsing: On/Off (Correct)
-Now when the temperature goes below 25 degrees the alarm goes OFF (correct)

An help would be much appreciated,


MOSFET Circuit diagram I am currently using…

Maybe i am dumb but how exactly does the MOSFET amplify the signal to the buzzer? Does the amplification work ? (if it buzzes does it do so at the desired level)

Also your photo is nice, but to us it looks like spaghetti. Could you maybe make a wiring diagram of all the relevant parts for this bit? Like the one you drew for the MOSFET (which was very clear and pretty).

Finally could you post your code in code tags (or upload it if it is very large), it migth be a coding error.

I could recommend using a multimeter and having a bit of a look around if all the components do what you expect them to.

Thanks for your response.

The reason I decided to us a MOSFET to amplify the buzzer was because of the guidance I found on the following website:


The amplification works in the concept that it creates a larger output however does not operate as it did previously. Before the design I used can be seen on the attachment - ‘Initial buzzer configuration’ where I just used a pull up resistor going from the digital pin and the output of the buzzer going to earth. This configuration worked correctly however the output of the buzzer was not loud enough.

I will upload my full code however I do not believe this to be the issue as it has been working correct in the configuration before. Sorry about the amount of attachments it would not allow me to send as 1 attachment.

Thanks again for your help and any additional help would be much appreciated.

Good morning,

I have created a project where the digital pin 8 operates a Piezo buzzer when the temperature goes above a certain threshold. Initially this worked fine as expected using the configuration seen in the link:

‘Initial buzzer configuration’

This configuration worked fine as expected going off when the temperature exceeds 25 degrees and stopping when it goes below. The only issue I had was the loudness of the buzzer so I look at methods to amplify the output.

I have so far attempted 2 methods.

Firstly I used a DC to DC step up convertor using guidance from the link:


This did not work as it required a minimum input of 3.7 V and the digital output voltage was maximum 2.5V.

The next method I used was to use a MOSFET from the guidance


This amplified the signal however didn’t make the system operate as expected. The full circuit diagram I used for this configuration can be seen in the attachment: ’ Full Circuit Diagram’

Any guidance of how to amplify the signal to increase the loudness of the output would be much appreciated. Like I previously said I don’t think it’s the code as previously it has been operating correct.

Many thanks,


The higher the voltage, the louder the piezo. And remember that a piezo is a capacitive load, that must be charged and discharged, e.g. by a H bridge.

The Fritzing picture shows a passive piezo speaker, and the diagram assumes an active buzzer. So what is it. Leo..


I believe it is an active Piezo speaker as it generates a tone using an internal oscillator, so all that is needed is a DC voltage.

The following speaker was ordered:



Active piezo buzzer. DC only. Try with two 9volt batteries in series (18volt). Might have to mount it on some soundboard, to make it louder.

If you power it with 18volt, then you must switch it on/off with an external transistor. Leo..